zhihao-ui 1.3.27 → 1.3.28
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,5 +1,5 @@
|
|
|
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
|
|
2
|
-
import { S as zt, M as Ue, T as
|
|
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 Nt, reactive as St, onMounted as $t, onUnmounted as Vt } from "vue";
|
|
2
|
+
import { S as zt, M as Ue, T as he, 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 Se, H as Wt, I as be, J as Yt, K as Bt, N as st, Q as Ne, R as Ge, U as et, W as qt, Y as Ht, Z as Xt } from "./vendor-D2mv9LHk.js";
|
|
3
3
|
import { _ as He } from "./Button-CGndQwez.js";
|
|
4
4
|
import { w as jt } from "./utils-D2wHR1YB.js";
|
|
5
5
|
const Qt = { id: "scale-line-container" }, Jt = /* @__PURE__ */ Ae({
|
|
@@ -73,24 +73,24 @@ const Qt = { id: "scale-line-container" }, Jt = /* @__PURE__ */ Ae({
|
|
|
73
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
74
|
function to() {
|
|
75
75
|
const e = U(), l = () => e.value, r = () => l().getView(), s = () => {
|
|
76
|
-
var
|
|
77
|
-
return (
|
|
78
|
-
}, a = (
|
|
76
|
+
var h;
|
|
77
|
+
return (h = r()) == null ? void 0 : h.getZoom();
|
|
78
|
+
}, a = (h) => {
|
|
79
79
|
var P;
|
|
80
|
-
(P = r()) == null || P.setZoom(
|
|
81
|
-
}, o = (
|
|
82
|
-
var
|
|
83
|
-
(
|
|
80
|
+
(P = r()) == null || P.setZoom(h);
|
|
81
|
+
}, o = (h, P) => {
|
|
82
|
+
var S;
|
|
83
|
+
(S = r()) == null || S.setCenter(I([h, P]));
|
|
84
84
|
}, f = () => {
|
|
85
85
|
var P;
|
|
86
|
-
const
|
|
87
|
-
return Zt(
|
|
88
|
-
},
|
|
89
|
-
var
|
|
90
|
-
return (
|
|
91
|
-
}, t = new Ue(), n = (
|
|
86
|
+
const h = (P = r()) == null ? void 0 : P.getCenter();
|
|
87
|
+
return Zt(h);
|
|
88
|
+
}, x = () => {
|
|
89
|
+
var h;
|
|
90
|
+
return (h = l()) == null ? void 0 : h.getSize();
|
|
91
|
+
}, t = new Ue(), n = (h, P) => {
|
|
92
92
|
m(P);
|
|
93
|
-
const
|
|
93
|
+
const S = {
|
|
94
94
|
zoom: P.zoom,
|
|
95
95
|
center: I(P.center),
|
|
96
96
|
minZoom: ee.min,
|
|
@@ -98,8 +98,8 @@ function to() {
|
|
|
98
98
|
constrainResolution: !0,
|
|
99
99
|
enableRotation: !1,
|
|
100
100
|
multiWorld: !0
|
|
101
|
-
},
|
|
102
|
-
target:
|
|
101
|
+
}, y = new Ue({
|
|
102
|
+
target: h,
|
|
103
103
|
controls: Rt({
|
|
104
104
|
zoom: !1
|
|
105
105
|
}),
|
|
@@ -109,37 +109,37 @@ function to() {
|
|
|
109
109
|
t.get("satelliteImgTile"),
|
|
110
110
|
t.get("satelliteImgTileMark")
|
|
111
111
|
],
|
|
112
|
-
view: new Ot(
|
|
112
|
+
view: new Ot(S)
|
|
113
113
|
});
|
|
114
|
-
e.value =
|
|
115
|
-
}, m = (
|
|
116
|
-
t.set("vectorTile", new
|
|
114
|
+
e.value = y;
|
|
115
|
+
}, m = (h) => {
|
|
116
|
+
t.set("vectorTile", new he({
|
|
117
117
|
source: new me({ url: de.vectorTile }),
|
|
118
|
-
visible:
|
|
118
|
+
visible: h.layerType === "vector",
|
|
119
119
|
zIndex: 0,
|
|
120
120
|
preload: 1,
|
|
121
121
|
className: "vector"
|
|
122
|
-
})), t.set("vectorTileMark", new
|
|
122
|
+
})), t.set("vectorTileMark", new he({
|
|
123
123
|
source: new me({ url: de.vectorTileMark }),
|
|
124
|
-
visible:
|
|
124
|
+
visible: h.layerType === "vector",
|
|
125
125
|
zIndex: 1,
|
|
126
126
|
preload: 1,
|
|
127
127
|
className: "vector"
|
|
128
|
-
})), t.set("satelliteImgTile", new
|
|
128
|
+
})), t.set("satelliteImgTile", new he({
|
|
129
129
|
source: new me({ url: de.satelliteImgTile }),
|
|
130
|
-
visible:
|
|
130
|
+
visible: h.layerType === "satellite",
|
|
131
131
|
zIndex: 0,
|
|
132
132
|
preload: 1,
|
|
133
133
|
className: "satellite"
|
|
134
|
-
})), t.set("satelliteImgTileMark", new
|
|
134
|
+
})), t.set("satelliteImgTileMark", new he({
|
|
135
135
|
source: new me({ url: de.satelliteImgTileMark }),
|
|
136
|
-
visible:
|
|
136
|
+
visible: h.layerType === "satellite",
|
|
137
137
|
zIndex: 1,
|
|
138
138
|
preload: 1,
|
|
139
139
|
className: "satellite"
|
|
140
|
-
})), t.set("greenMark", new
|
|
140
|
+
})), t.set("greenMark", new he({
|
|
141
141
|
source: new me({ url: de.greenTile }),
|
|
142
|
-
visible:
|
|
142
|
+
visible: h.showGreenLayer,
|
|
143
143
|
zIndex: 2,
|
|
144
144
|
className: "greenTile"
|
|
145
145
|
}));
|
|
@@ -151,7 +151,7 @@ function to() {
|
|
|
151
151
|
setZoom: a,
|
|
152
152
|
setCenter: o,
|
|
153
153
|
getCenter: f,
|
|
154
|
-
getSize:
|
|
154
|
+
getSize: x,
|
|
155
155
|
initMap: n,
|
|
156
156
|
setBaseLayerMap: m
|
|
157
157
|
};
|
|
@@ -223,11 +223,11 @@ const tt = (e) => {
|
|
|
223
223
|
let r = null;
|
|
224
224
|
const s = async (m) => {
|
|
225
225
|
if (!e || (console.log("vehicleInfo", m), !(m != null && m.lon && (m != null && m.lat)))) return;
|
|
226
|
-
const
|
|
227
|
-
a(m, I(
|
|
228
|
-
const P = e == null ? void 0 : e.getView(),
|
|
229
|
-
P.setCenter(xe(
|
|
230
|
-
}, a = (m,
|
|
226
|
+
const h = Math.abs(Number(m.lon)) > 180 ? Xe(m.lon, m.lat) : [m.lon, m.lat];
|
|
227
|
+
a(m, I(h));
|
|
228
|
+
const P = e == null ? void 0 : e.getView(), S = new ne(h);
|
|
229
|
+
P.setCenter(xe(S.getCoordinates(), J.data, J.mercator));
|
|
230
|
+
}, a = (m, h) => {
|
|
231
231
|
const P = `${it}map/car-icon.gif`;
|
|
232
232
|
r || (r = new ie({
|
|
233
233
|
element: document.createElement("div"),
|
|
@@ -235,10 +235,10 @@ const tt = (e) => {
|
|
|
235
235
|
stopEvent: !1
|
|
236
236
|
// 允许交互事件穿透
|
|
237
237
|
}), e.addOverlay(r));
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
const
|
|
241
|
-
|
|
238
|
+
const S = r.getElement();
|
|
239
|
+
S.style.backgroundImage = `url(${P})`, S.style.width = "80px", S.style.height = "80px";
|
|
240
|
+
const y = (m == null ? void 0 : m.drc) || "";
|
|
241
|
+
S.style.transform = `rotate(${y}deg)`, S.style.backgroundSize = "cover", r == null || r.setPosition(h);
|
|
242
242
|
};
|
|
243
243
|
return {
|
|
244
244
|
location: s,
|
|
@@ -246,8 +246,8 @@ const tt = (e) => {
|
|
|
246
246
|
const m = r == null ? void 0 : r.getElement();
|
|
247
247
|
m && (m.innerHTML = "");
|
|
248
248
|
},
|
|
249
|
-
renderTrack: (m,
|
|
250
|
-
l.render(m,
|
|
249
|
+
renderTrack: (m, h, P) => {
|
|
250
|
+
l.render(m, h, P, "truck", 1e3);
|
|
251
251
|
},
|
|
252
252
|
setCenter: (m) => {
|
|
253
253
|
l.setCenter(m);
|
|
@@ -255,8 +255,8 @@ const tt = (e) => {
|
|
|
255
255
|
closeTrack: () => {
|
|
256
256
|
l.close();
|
|
257
257
|
},
|
|
258
|
-
playTrack: (m,
|
|
259
|
-
l.play(m,
|
|
258
|
+
playTrack: (m, h) => {
|
|
259
|
+
l.play(m, h);
|
|
260
260
|
}
|
|
261
261
|
};
|
|
262
262
|
};
|
|
@@ -266,13 +266,13 @@ const io = (e) => {
|
|
|
266
266
|
let s = null;
|
|
267
267
|
const a = "--";
|
|
268
268
|
let o = null;
|
|
269
|
-
const f = document.createElement("div"),
|
|
269
|
+
const f = document.createElement("div"), x = new ie({
|
|
270
270
|
element: f,
|
|
271
271
|
positioning: "top-left",
|
|
272
272
|
stopEvent: !1,
|
|
273
273
|
className: "track-label-popup"
|
|
274
274
|
});
|
|
275
|
-
let t, n, m,
|
|
275
|
+
let t, n, m, h, P, S = !1, y = Date.now(), w, L = 0, p = null, b = 20, G = !1;
|
|
276
276
|
const W = 5, B = [], X = (c) => {
|
|
277
277
|
var d;
|
|
278
278
|
for (B.unshift(c); B.length > W; ) {
|
|
@@ -289,20 +289,20 @@ const io = (e) => {
|
|
|
289
289
|
}
|
|
290
290
|
}, 300), u = (c, d) => {
|
|
291
291
|
let g = [];
|
|
292
|
-
const M = Math.max(1, Math.floor(d.length /
|
|
293
|
-
return g = d.filter((
|
|
294
|
-
if (Number(
|
|
295
|
-
const [$, A] = Xe(
|
|
296
|
-
|
|
292
|
+
const M = Math.max(1, Math.floor(d.length / b));
|
|
293
|
+
return g = d.filter((T, R) => R % M === 0).map((T, R) => {
|
|
294
|
+
if (Number(T.lon) > 180 || Number(T.lat) > 180) {
|
|
295
|
+
const [$, A] = Xe(T.lon, T.lat);
|
|
296
|
+
T.lon = $, T.lat = A;
|
|
297
297
|
}
|
|
298
|
-
return
|
|
298
|
+
return T.center = [T.lon, T.lat], T.centerPoint = no(T.center), T.time = lt(T.createdAt).format("YYYY-MM-DD HH:mm:ss"), T.id = c, T.index = R, T;
|
|
299
299
|
}), g;
|
|
300
|
-
},
|
|
301
|
-
if (console.log("renderTrackLine--------", c, d, g), !e || JSON.stringify(r[c]) === JSON.stringify(d) && s === c || (d = d == null ? void 0 : d.reverse(),
|
|
300
|
+
}, v = async (c, d, g, M = "ship", E = 200) => {
|
|
301
|
+
if (console.log("renderTrackLine--------", c, d, g), !e || JSON.stringify(r[c]) === JSON.stringify(d) && s === c || (d = d == null ? void 0 : d.reverse(), x && M === "ship" && (e != null && e.getOverlays().getArray().includes(x) || e.addOverlay(x)), (d == null ? void 0 : d.length) < 2))
|
|
302
302
|
return;
|
|
303
|
-
X(c), s = c, r[c] = d,
|
|
304
|
-
const
|
|
305
|
-
O = g || D[
|
|
303
|
+
X(c), s = c, r[c] = d, b = E;
|
|
304
|
+
const T = Object.keys(r).findIndex((R) => R === c) || 0;
|
|
305
|
+
O = g || D[T > 10 ? 10 : T], G = !0, await N(), await Je(s);
|
|
306
306
|
}, C = (c) => {
|
|
307
307
|
const d = new ae();
|
|
308
308
|
return new ve({
|
|
@@ -315,30 +315,30 @@ const io = (e) => {
|
|
|
315
315
|
});
|
|
316
316
|
}, k = (c) => {
|
|
317
317
|
l.forEach((d, g) => {
|
|
318
|
-
var
|
|
318
|
+
var E;
|
|
319
319
|
const M = g === c;
|
|
320
|
-
d.getVisible() !== M && (d.setVisible(M), e.getLayers().getArray().includes(d) || e.addLayer(d), M || (
|
|
320
|
+
d.getVisible() !== M && (d.setVisible(M), e.getLayers().getArray().includes(d) || e.addLayer(d), M || (E = d.getSource()) == null || E.clear());
|
|
321
321
|
}), s = c;
|
|
322
|
-
},
|
|
322
|
+
}, N = async () => {
|
|
323
323
|
const c = s;
|
|
324
324
|
if (!l.has(c)) {
|
|
325
|
-
const
|
|
326
|
-
l.set(c,
|
|
325
|
+
const T = C(c);
|
|
326
|
+
l.set(c, T);
|
|
327
327
|
}
|
|
328
328
|
await k(c);
|
|
329
329
|
const d = O || "", g = r[c] || [];
|
|
330
330
|
if (!(g && g.length > 1)) return [];
|
|
331
331
|
let M = [];
|
|
332
332
|
M = u(c, g);
|
|
333
|
-
const
|
|
334
|
-
M.length >= 2 && await z(c,
|
|
333
|
+
const E = M.map((T) => T.centerPoint);
|
|
334
|
+
M.length >= 2 && await z(c, E, d);
|
|
335
335
|
}, z = (c, d, g) => {
|
|
336
|
-
const M = new Pe(d),
|
|
337
|
-
if (
|
|
338
|
-
|
|
336
|
+
const M = new Pe(d), E = l.get(c).getSource(), T = E.getFeatureById(c);
|
|
337
|
+
if (T)
|
|
338
|
+
T.setGeometry(M), T.setId(c), T.setStyle(Z(g)), p = T;
|
|
339
339
|
else {
|
|
340
340
|
const R = new se({ geometry: M });
|
|
341
|
-
R.setId(c), R.set("type", "line"), R.setStyle(Z(g)),
|
|
341
|
+
R.setId(c), R.set("type", "line"), R.setStyle(Z(g)), E.addFeature(R), p = R;
|
|
342
342
|
}
|
|
343
343
|
return p;
|
|
344
344
|
}, Z = (c) => new H({
|
|
@@ -350,10 +350,10 @@ const io = (e) => {
|
|
|
350
350
|
const M = c == null ? void 0 : c.get("trackId");
|
|
351
351
|
if (c && M && d === "hover") {
|
|
352
352
|
e.getTargetElement().style.cursor = M ? "pointer" : "";
|
|
353
|
-
const
|
|
354
|
-
R && (f.querySelector(".popup-content"), f.innerHTML =
|
|
353
|
+
const E = c.get("data"), T = ce(E), R = g == null ? void 0 : g.coordinate;
|
|
354
|
+
R && (f.querySelector(".popup-content"), f.innerHTML = T, x == null || x.setPosition(R));
|
|
355
355
|
} else
|
|
356
|
-
|
|
356
|
+
x && x.setPosition(void 0);
|
|
357
357
|
}, ce = (c) => {
|
|
358
358
|
if (!(c != null && c.time)) return;
|
|
359
359
|
let d = "";
|
|
@@ -408,29 +408,29 @@ const io = (e) => {
|
|
|
408
408
|
let M = 0;
|
|
409
409
|
g[0].distance = 0;
|
|
410
410
|
for (let $ = 1; $ < g.length; $++) {
|
|
411
|
-
const A = g[$ - 1].pixel, q = g[$].pixel, K = q[0] - A[0],
|
|
412
|
-
M += Math.sqrt(K * K +
|
|
411
|
+
const A = g[$ - 1].pixel, q = g[$].pixel, K = q[0] - A[0], F = q[1] - A[1];
|
|
412
|
+
M += Math.sqrt(K * K + F * F), g[$].distance = M;
|
|
413
413
|
}
|
|
414
|
-
const
|
|
414
|
+
const E = g.filter(
|
|
415
415
|
($, A) => A === 0 || A === g.length - 1
|
|
416
|
-
),
|
|
417
|
-
for (let $ = 0; $ <
|
|
418
|
-
const A =
|
|
419
|
-
if (
|
|
420
|
-
const q =
|
|
421
|
-
for (let Y = 1; Y <=
|
|
416
|
+
), T = [];
|
|
417
|
+
for (let $ = 0; $ < E.length; $++) {
|
|
418
|
+
const A = E[$];
|
|
419
|
+
if (T.push(A), $ < E.length - 1) {
|
|
420
|
+
const q = E[$ + 1], K = q.distance - A.distance, F = Math.floor(K / 100);
|
|
421
|
+
for (let Y = 1; Y <= F; Y++) {
|
|
422
422
|
const j = A.distance + Y * 100;
|
|
423
423
|
if (j >= q.distance) break;
|
|
424
424
|
const _ = le(
|
|
425
425
|
g,
|
|
426
426
|
j
|
|
427
427
|
);
|
|
428
|
-
_ &&
|
|
428
|
+
_ && T.push(_);
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
432
|
return Array.from(
|
|
433
|
-
new Map(
|
|
433
|
+
new Map(T.map(($) => [$.distance.toFixed(2), $])).values()
|
|
434
434
|
).map(($) => ({
|
|
435
435
|
...$.original,
|
|
436
436
|
// 优先保留原始数据
|
|
@@ -444,9 +444,9 @@ const io = (e) => {
|
|
|
444
444
|
};
|
|
445
445
|
function le(c, d) {
|
|
446
446
|
for (let g = 1; g < c.length; g++) {
|
|
447
|
-
const M = c[g - 1],
|
|
448
|
-
if (d >= M.distance && d <=
|
|
449
|
-
const
|
|
447
|
+
const M = c[g - 1], E = c[g];
|
|
448
|
+
if (d >= M.distance && d <= E.distance) {
|
|
449
|
+
const T = (d - M.distance) / (E.distance - M.distance), R = M.pixel[0] + T * (E.pixel[0] - M.pixel[0]), $ = M.pixel[1] + T * (E.pixel[1] - M.pixel[1]), A = e == null ? void 0 : e.getCoordinateFromPixel([R, $]);
|
|
450
450
|
return {
|
|
451
451
|
...M,
|
|
452
452
|
// 继承前一个点的属性(可调整)
|
|
@@ -462,9 +462,9 @@ const io = (e) => {
|
|
|
462
462
|
}
|
|
463
463
|
const ze = async (c, d) => {
|
|
464
464
|
await Qe(), await ft(c);
|
|
465
|
-
const g = oe(d), M = g.map((
|
|
466
|
-
l.get(c).getSource().addFeatures(M),
|
|
467
|
-
const R = pe(c, O,
|
|
465
|
+
const g = oe(d), M = g.map((T) => ke(T));
|
|
466
|
+
l.get(c).getSource().addFeatures(M), ht(c, g, d, O), g.forEach((T) => {
|
|
467
|
+
const R = pe(c, O, T);
|
|
468
468
|
e.addOverlay(R);
|
|
469
469
|
});
|
|
470
470
|
}, ke = (c) => {
|
|
@@ -476,7 +476,7 @@ const io = (e) => {
|
|
|
476
476
|
let g = [
|
|
477
477
|
...vt(c, O)
|
|
478
478
|
];
|
|
479
|
-
return (c.index === 0 || c.index === r[c.id].length - 1) && (g = [...mt(c)], d.set("type", "track_begin")), c.state !== void 0 && c.state !== null && (g = [...
|
|
479
|
+
return (c.index === 0 || c.index === r[c.id].length - 1) && (g = [...mt(c)], d.set("type", "track_begin")), c.state !== void 0 && c.state !== null && (g = [...yt(c)], d.set("type", "track_icon")), d.setStyle(g), d;
|
|
480
480
|
}, pe = (c, d, g) => {
|
|
481
481
|
const M = document.createElement("div");
|
|
482
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 = `
|
|
@@ -492,7 +492,7 @@ const io = (e) => {
|
|
|
492
492
|
stroke="${d}"
|
|
493
493
|
stroke-width="1" />
|
|
494
494
|
`;
|
|
495
|
-
const
|
|
495
|
+
const E = new ie({
|
|
496
496
|
element: M,
|
|
497
497
|
position: I(g.center),
|
|
498
498
|
positioning: "top-right",
|
|
@@ -500,7 +500,7 @@ const io = (e) => {
|
|
|
500
500
|
stopEvent: !1,
|
|
501
501
|
className: "track-label-time-overlay"
|
|
502
502
|
});
|
|
503
|
-
return
|
|
503
|
+
return E.set("class", "track-label-overlay"), E.set("trackId", c), E;
|
|
504
504
|
}, Qe = () => {
|
|
505
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
506
|
d && d.length > 0 && d.forEach((g) => {
|
|
@@ -514,22 +514,22 @@ const io = (e) => {
|
|
|
514
514
|
}, vt = (c, d) => (`${c.time}`, [
|
|
515
515
|
new H({
|
|
516
516
|
// 扩大交互热区
|
|
517
|
-
image: new
|
|
517
|
+
image: new Se({
|
|
518
518
|
stroke: new fe({ color: "rgba(0, 0, 0, 0.01)", width: 20 }),
|
|
519
519
|
radius: 3
|
|
520
520
|
})
|
|
521
521
|
}),
|
|
522
522
|
// 轨迹点样式
|
|
523
523
|
new H({
|
|
524
|
-
image: new
|
|
524
|
+
image: new Se({
|
|
525
525
|
fill: new Q({ color: d }),
|
|
526
526
|
stroke: new fe({ color: "#fff", width: 2 }),
|
|
527
527
|
radius: 3
|
|
528
528
|
})
|
|
529
529
|
})
|
|
530
530
|
// textStyle,
|
|
531
|
-
]),
|
|
532
|
-
const d = "#E31818", g = "#1890FF", M = "",
|
|
531
|
+
]), yt = (c) => {
|
|
532
|
+
const d = "#E31818", g = "#1890FF", M = "", E = new H({
|
|
533
533
|
text: new ue({
|
|
534
534
|
font: "Normal 22px map-iconfont",
|
|
535
535
|
text: ge(M),
|
|
@@ -540,18 +540,18 @@ const io = (e) => {
|
|
|
540
540
|
}),
|
|
541
541
|
zIndex: 99
|
|
542
542
|
}), R = tt(""), A = tt(""), q = [];
|
|
543
|
-
return Number(c.state) === 0 ? q.push(R) : Number(c.state) === 1 && q.push(A), q.push(
|
|
544
|
-
},
|
|
545
|
-
const
|
|
546
|
-
|
|
543
|
+
return Number(c.state) === 0 ? q.push(R) : Number(c.state) === 1 && q.push(A), q.push(E), q;
|
|
544
|
+
}, ht = (c, d, g, M) => {
|
|
545
|
+
const E = d || [], T = d.length;
|
|
546
|
+
T || (E.push(g[0]), E.push(g[g.length - 1]));
|
|
547
547
|
const R = [];
|
|
548
|
-
for (let A = 0; A <
|
|
548
|
+
for (let A = 0; A < T - 1; A++) {
|
|
549
549
|
let q;
|
|
550
|
-
const K = d[A],
|
|
551
|
-
if (
|
|
552
|
-
q = g[
|
|
550
|
+
const K = d[A], F = (d[A + 1].index + K.index) / 2;
|
|
551
|
+
if (F % 2 === 0)
|
|
552
|
+
q = g[F].centerPoint;
|
|
553
553
|
else {
|
|
554
|
-
const Y = g[Math.floor(
|
|
554
|
+
const Y = g[Math.floor(F)], j = g[Math.ceil(F)];
|
|
555
555
|
if (Y && j) {
|
|
556
556
|
const [_, Ce] = Y.centerPoint, [Le, Ee] = j.centerPoint;
|
|
557
557
|
q = [(_ + Le) / 2, (Ce + Ee) / 2];
|
|
@@ -580,24 +580,24 @@ const io = (e) => {
|
|
|
580
580
|
const $ = l.get(c).getSource();
|
|
581
581
|
$ == null || $.addFeatures(R);
|
|
582
582
|
}, Je = (c) => {
|
|
583
|
-
var
|
|
584
|
-
const d = e.getView(), g = (
|
|
583
|
+
var T, R;
|
|
584
|
+
const d = e.getView(), g = (T = l == null ? void 0 : l.get(c)) == null ? void 0 : T.getSource(), M = p || (c ? g == null ? void 0 : g.getFeatureById(c) : null);
|
|
585
585
|
if (!M) return;
|
|
586
|
-
const
|
|
587
|
-
if (
|
|
586
|
+
const E = (R = M == null ? void 0 : M.getGeometry()) == null ? void 0 : R.getExtent();
|
|
587
|
+
if (E != null && E.length)
|
|
588
588
|
try {
|
|
589
|
-
const $ = Gt(
|
|
589
|
+
const $ = Gt(E, Math.max(E[2] - E[0], E[3] - E[1]) * 0.02);
|
|
590
590
|
d.fit($);
|
|
591
591
|
} catch ($) {
|
|
592
592
|
console.log($);
|
|
593
593
|
}
|
|
594
594
|
}, mt = (c) => {
|
|
595
|
-
const d = "",
|
|
595
|
+
const d = "", E = c.index === 0 ? "#fcdc3f" : "#ff0000";
|
|
596
596
|
return [new H({
|
|
597
597
|
text: new ue({
|
|
598
598
|
font: "Normal 14px map-iconfont",
|
|
599
599
|
text: ge(d),
|
|
600
|
-
fill: new Q({ color:
|
|
600
|
+
fill: new Q({ color: E })
|
|
601
601
|
}),
|
|
602
602
|
zIndex: 101
|
|
603
603
|
})];
|
|
@@ -613,22 +613,22 @@ const io = (e) => {
|
|
|
613
613
|
d == null || d.setVisible(!1);
|
|
614
614
|
const g = e.getOverlays().getArray();
|
|
615
615
|
for (let M = 0; M < g.length; ) {
|
|
616
|
-
const
|
|
617
|
-
|
|
616
|
+
const E = g[M];
|
|
617
|
+
E.get("class") === "track-label-overlay" ? (E.setPosition(void 0), e.removeOverlay(E)) : M++;
|
|
618
618
|
}
|
|
619
619
|
Me();
|
|
620
620
|
}, bt = (c, d = we.NM) => {
|
|
621
621
|
const g = {
|
|
622
622
|
id: c,
|
|
623
623
|
length: "--"
|
|
624
|
-
},
|
|
624
|
+
}, E = (r[c] || []).map(
|
|
625
625
|
(R) => xe([R.lon, R.lat], J.data, J.mercator)
|
|
626
|
-
),
|
|
627
|
-
return g.length = ro(
|
|
626
|
+
), T = new Pe(E);
|
|
627
|
+
return g.length = ro(T, d) || "--", g;
|
|
628
628
|
}, kt = (c, d) => {
|
|
629
629
|
pt(String(c), d);
|
|
630
630
|
}, pt = (c, d) => {
|
|
631
|
-
const g = r[String(c)], M = g == null ? void 0 : g.map((
|
|
631
|
+
const g = r[String(c)], M = g == null ? void 0 : g.map((E) => [E.lon, E.lat]);
|
|
632
632
|
M && Lt(M, d);
|
|
633
633
|
}, Oe = new H({
|
|
634
634
|
text: new ue({
|
|
@@ -639,32 +639,32 @@ const io = (e) => {
|
|
|
639
639
|
// 初始旋转角度
|
|
640
640
|
})
|
|
641
641
|
}), Mt = (c, d) => {
|
|
642
|
-
var
|
|
643
|
-
const g = Number(50 * d), M = ((
|
|
644
|
-
if (
|
|
642
|
+
var F, Y;
|
|
643
|
+
const g = Number(50 * d), M = ((F = c.frameState) == null ? void 0 : F.time) ?? Date.now(), E = M - y;
|
|
644
|
+
if (L = (L + g * E / 1e6) % 2, y = M, L >= 1) {
|
|
645
645
|
Me();
|
|
646
646
|
return;
|
|
647
647
|
}
|
|
648
|
-
const
|
|
649
|
-
|
|
648
|
+
const T = n.getCoordinateAt(
|
|
649
|
+
L > 1 ? 2 - L : L
|
|
650
650
|
), R = n.getCoordinateAt(
|
|
651
|
-
|
|
651
|
+
L > 1 ? L - 0.01 : L
|
|
652
652
|
), $ = n.getCoordinateAt(
|
|
653
|
-
|
|
653
|
+
L > 1 ? 2 - L : L + 0.01
|
|
654
654
|
), q = Ke(
|
|
655
655
|
ot(R, "array"),
|
|
656
656
|
ot($, "array")
|
|
657
657
|
) * Math.PI / 180;
|
|
658
|
-
(Y = Oe.getText()) == null || Y.setRotation(q),
|
|
658
|
+
(Y = Oe.getText()) == null || Y.setRotation(q), h.setCoordinates(T);
|
|
659
659
|
const K = Wt(c);
|
|
660
|
-
K.setStyle(Oe), K.drawGeometry(
|
|
660
|
+
K.setStyle(Oe), K.drawGeometry(h), e == null || e.render();
|
|
661
661
|
}, Ct = () => {
|
|
662
662
|
var c;
|
|
663
|
-
|
|
663
|
+
S = !0, y = Date.now(), L = 0, h = ((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
664
|
}, Me = () => {
|
|
665
|
-
|
|
665
|
+
S && (S = !1, P == null || P.setGeometry(void 0), o && w && w.un("postrender", o), w && (e == null || e.removeLayer(w)), w = null, P = null);
|
|
666
666
|
}, Lt = (c, d) => {
|
|
667
|
-
|
|
667
|
+
S && Me(), t = new Ie({
|
|
668
668
|
factor: 1e6
|
|
669
669
|
}).writeGeometry(new Pe(c)), n = new Ie({
|
|
670
670
|
factor: 1e6
|
|
@@ -676,51 +676,51 @@ const io = (e) => {
|
|
|
676
676
|
geometry: new ne(n.getFirstCoordinate())
|
|
677
677
|
});
|
|
678
678
|
const g = m.getGeometry();
|
|
679
|
-
|
|
679
|
+
h = g ? g.clone() : new ne([0, 0]), P = new se({
|
|
680
680
|
type: "geoMarker",
|
|
681
681
|
style: Oe,
|
|
682
|
-
geometry:
|
|
682
|
+
geometry: h
|
|
683
683
|
}), w = new ve({
|
|
684
684
|
source: new ae({
|
|
685
685
|
features: [P]
|
|
686
686
|
})
|
|
687
687
|
}), e == null || e.addLayer(w), o = (M) => Mt(M, d), Ct();
|
|
688
688
|
}, Ke = (c, d, g) => {
|
|
689
|
-
function M(
|
|
690
|
-
return 180 * (
|
|
689
|
+
function M(F) {
|
|
690
|
+
return 180 * (F % (2 * Math.PI)) / Math.PI;
|
|
691
691
|
}
|
|
692
|
-
function
|
|
693
|
-
return
|
|
692
|
+
function E(F) {
|
|
693
|
+
return F % 360 * Math.PI / 180;
|
|
694
694
|
}
|
|
695
|
-
function
|
|
695
|
+
function T(F) {
|
|
696
696
|
var Y;
|
|
697
|
-
if (!
|
|
698
|
-
if (!Array.isArray(
|
|
699
|
-
if ((
|
|
700
|
-
return
|
|
701
|
-
if (
|
|
697
|
+
if (!F) throw new Error("Coordinate is required");
|
|
698
|
+
if (!Array.isArray(F)) {
|
|
699
|
+
if ((F == null ? void 0 : F.type) === "Feature" && (F == null ? void 0 : F.geometry) !== null && ((Y = F == null ? void 0 : F.geometry) == null ? void 0 : Y.type) === "Point")
|
|
700
|
+
return F == null ? void 0 : F.geometry.coordinates;
|
|
701
|
+
if (F.type === "Point") return (F == null ? void 0 : F.coordinates) || [];
|
|
702
702
|
}
|
|
703
|
-
if (Array.isArray(
|
|
704
|
-
return
|
|
703
|
+
if (Array.isArray(F) && F.length >= 2 && !Array.isArray(F[0]) && !Array.isArray(F[1]))
|
|
704
|
+
return F;
|
|
705
705
|
throw new Error(
|
|
706
706
|
"Coordinate must be GeoJSON Point or an Array of numbers"
|
|
707
707
|
);
|
|
708
708
|
}
|
|
709
|
-
function R(
|
|
709
|
+
function R(F, Y, j = {}) {
|
|
710
710
|
if (j.final)
|
|
711
711
|
return function(Ft, Pt) {
|
|
712
712
|
return (R(Pt, Ft) + 180) % 360;
|
|
713
|
-
}(
|
|
714
|
-
const _ =
|
|
713
|
+
}(F, Y);
|
|
714
|
+
const _ = T(F), Ce = T(Y), Le = E(_[0]), Ee = E(Ce[0]), _e = E(_[1]), Re = E(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
715
|
return M(Math.atan2(Et, Tt));
|
|
716
716
|
}
|
|
717
|
-
function $(
|
|
718
|
-
return !isNaN(
|
|
717
|
+
function $(F) {
|
|
718
|
+
return !isNaN(F) && F !== null && !Array.isArray(F);
|
|
719
719
|
}
|
|
720
|
-
function A(
|
|
721
|
-
return
|
|
720
|
+
function A(F, Y = {}, j = {}) {
|
|
721
|
+
return F || console.log("Coordinates are required"), Array.isArray(F) || console.log("Coordinates must be an Array"), F.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (!$(F[0]) || !$(F[1])) && console.log("Coordinates must contain numbers"), q({ type: "Point", coordinates: F }, Y, j);
|
|
722
722
|
}
|
|
723
|
-
function q(
|
|
723
|
+
function q(F, Y = {}, j = {}) {
|
|
724
724
|
const _ = {
|
|
725
725
|
type: "Feature",
|
|
726
726
|
id: "",
|
|
@@ -728,13 +728,13 @@ const io = (e) => {
|
|
|
728
728
|
bbox: {},
|
|
729
729
|
geometry: {}
|
|
730
730
|
};
|
|
731
|
-
return j.id !== void 0 && (_.id = j.id), j.bbox && (_.bbox = j.bbox), _.properties = Y, _.geometry =
|
|
731
|
+
return j.id !== void 0 && (_.id = j.id), j.bbox && (_.bbox = j.bbox), _.properties = Y, _.geometry = F, _;
|
|
732
732
|
}
|
|
733
733
|
const K = R(A(c), A(d), g);
|
|
734
734
|
return K < 0 ? 360 + K : K;
|
|
735
735
|
};
|
|
736
736
|
return {
|
|
737
|
-
render:
|
|
737
|
+
render: v,
|
|
738
738
|
remove: wt,
|
|
739
739
|
play: kt,
|
|
740
740
|
setCenter: Je,
|
|
@@ -877,7 +877,7 @@ function ao(e, l, r, s) {
|
|
|
877
877
|
const uo = (e) => {
|
|
878
878
|
const { spd: l, hdg: r, cog: s } = e;
|
|
879
879
|
return l ? r !== null && +r != 511 && s !== null ? s - +r >= 3 ? te.right : s - +r <= -3 ? te.left : te.front : te.front : "";
|
|
880
|
-
},
|
|
880
|
+
}, ye = (e, l) => {
|
|
881
881
|
const { shipData: r } = l.getProperties(), s = at(e), a = je(e, r, s);
|
|
882
882
|
return go(l, a, s);
|
|
883
883
|
}, at = (e) => {
|
|
@@ -885,18 +885,18 @@ const uo = (e) => {
|
|
|
885
885
|
return l <= ee.shipModelMax && l >= ee.shipTriggleMin ? "ship" : "triangle";
|
|
886
886
|
}, je = (e, l, r) => {
|
|
887
887
|
if (r === "ship") {
|
|
888
|
-
const { len: s, wid: a } = l, o = 97, f = 20, t = 1 / (e == null ? void 0 : e.getView().getResolution()), n = s * t / o, m = a * t / f,
|
|
889
|
-
return
|
|
888
|
+
const { len: s, wid: a } = l, o = 97, f = 20, t = 1 / (e == null ? void 0 : e.getView().getResolution()), n = s * t / o, m = a * t / f, h = Math.min(n, m);
|
|
889
|
+
return h < 0.2 ? 0.2 : h > 2 ? 2 : h;
|
|
890
890
|
}
|
|
891
891
|
return ee.scaleNum;
|
|
892
892
|
}, go = (e, l, r) => {
|
|
893
|
-
const { color: s, direct: a, isHighlight: o, shipData: f } = e.getProperties(),
|
|
893
|
+
const { color: s, direct: a, isHighlight: o, shipData: f } = e.getProperties(), x = ((f == null ? void 0 : f.cog) - 90 + 360) % 360;
|
|
894
894
|
return new H({
|
|
895
895
|
image: new be({
|
|
896
896
|
src: t(),
|
|
897
897
|
scale: l || ee.scaleNum,
|
|
898
898
|
anchor: [0.5, 0.5],
|
|
899
|
-
rotation:
|
|
899
|
+
rotation: x * Math.PI / 180,
|
|
900
900
|
rotateWithView: !1
|
|
901
901
|
})
|
|
902
902
|
});
|
|
@@ -954,7 +954,7 @@ const uo = (e) => {
|
|
|
954
954
|
}, ut = (e) => {
|
|
955
955
|
const l = document.createElement("div");
|
|
956
956
|
l.className = "ship-overlay-box", l.style.position = "relative";
|
|
957
|
-
const { lon: r, lat: s, blinking: a, blinkingColors: o, name: f } = e,
|
|
957
|
+
const { lon: r, lat: s, blinking: a, blinkingColors: o, name: f } = e, x = De({
|
|
958
958
|
setup() {
|
|
959
959
|
return co({
|
|
960
960
|
position: [r + 2e-3, s + 2e-3],
|
|
@@ -967,12 +967,12 @@ const uo = (e) => {
|
|
|
967
967
|
});
|
|
968
968
|
}
|
|
969
969
|
});
|
|
970
|
-
return
|
|
970
|
+
return Nt(x, l), l;
|
|
971
971
|
}, rt = (e) => {
|
|
972
972
|
const l = [];
|
|
973
973
|
return e.existDevice && l.push(""), e.existMobile && l.push(""), e.existWaterGauge && l.push(""), l;
|
|
974
974
|
};
|
|
975
|
-
function
|
|
975
|
+
function yo() {
|
|
976
976
|
const e = [
|
|
977
977
|
"left-top",
|
|
978
978
|
"left-middle",
|
|
@@ -983,74 +983,74 @@ function ho() {
|
|
|
983
983
|
];
|
|
984
984
|
return e[Math.floor(Math.random() * e.length)];
|
|
985
985
|
}
|
|
986
|
-
const
|
|
986
|
+
const ho = window.devicePixelRatio || 1;
|
|
987
987
|
function mo(e, l, r = "left-bottom", s = 2) {
|
|
988
988
|
const a = document.createElement("canvas"), o = a.getContext("2d");
|
|
989
989
|
if (!o) return "";
|
|
990
|
-
const f = 2,
|
|
990
|
+
const f = 2, x = 8, t = 16, n = window.devicePixelRatio || 1, m = "500 12px Arial", h = "14px map-iconfont";
|
|
991
991
|
o.font = m;
|
|
992
|
-
const
|
|
993
|
-
o.font =
|
|
994
|
-
const
|
|
992
|
+
const S = o.measureText(e).width;
|
|
993
|
+
o.font = h;
|
|
994
|
+
const y = l.map((k) => ({ width: o.measureText(ge(k)).width, height: 14 })), w = y.reduce((k, N) => k + N.width, 0), L = (l.length - 1) * s, p = x + S + w + L + x, b = f + 14 + f * 2;
|
|
995
995
|
let G, W, B = 0, X = 0, O = 0, D = 0, i = 0, u = 0;
|
|
996
996
|
switch (G = t + p, r) {
|
|
997
997
|
case "right-top":
|
|
998
|
-
W = t +
|
|
998
|
+
W = t + b, B = 0, X = t + b, O = t, D = 0, i = t, u = 0;
|
|
999
999
|
break;
|
|
1000
1000
|
case "right-middle":
|
|
1001
|
-
W =
|
|
1001
|
+
W = b, B = 0, X = b / 2, O = t, D = b / 2, i = t, u = 0;
|
|
1002
1002
|
break;
|
|
1003
1003
|
case "right-bottom":
|
|
1004
|
-
W = t +
|
|
1004
|
+
W = t + b, B = 0, X = 0, O = t, D = t, i = t, u = t;
|
|
1005
1005
|
break;
|
|
1006
1006
|
case "left-top":
|
|
1007
|
-
W = t +
|
|
1007
|
+
W = t + b, B = p, X = t, O = p + t, D = b + t, i = 0, u = 0;
|
|
1008
1008
|
break;
|
|
1009
1009
|
case "left-middle":
|
|
1010
|
-
W =
|
|
1010
|
+
W = b, B = p, X = b / 2, O = p + t, D = b / 2, i = 0, u = 0;
|
|
1011
1011
|
break;
|
|
1012
1012
|
case "left-bottom":
|
|
1013
|
-
W = t +
|
|
1013
|
+
W = t + b, B = p, X = b, O = p + t, D = 0, i = 0, u = t;
|
|
1014
1014
|
break;
|
|
1015
1015
|
}
|
|
1016
|
-
a.width = Math.round(G * n), a.height = Math.round(W * n), o.scale(n, n), 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,
|
|
1017
|
-
const
|
|
1018
|
-
o.strokeStyle = "#ffffff", o.lineWidth = 1, o.strokeText(e, i +
|
|
1019
|
-
let C = i +
|
|
1020
|
-
return l.length > 0 && l.forEach((k,
|
|
1021
|
-
const z = u + f +
|
|
1022
|
-
o.fillText(ge(k), C, z), C +=
|
|
1016
|
+
a.width = Math.round(G * n), a.height = Math.round(W * n), o.scale(n, n), 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, b), o.font = m, o.textBaseline = "middle";
|
|
1017
|
+
const v = u + f + b / 2;
|
|
1018
|
+
o.strokeStyle = "#ffffff", o.lineWidth = 1, o.strokeText(e, i + x, v), o.fillStyle = "#000000", o.fillText(e, i + x, v), o.font = h, o.fillStyle = "#3370ff";
|
|
1019
|
+
let C = i + x + S + s;
|
|
1020
|
+
return l.length > 0 && l.forEach((k, N) => {
|
|
1021
|
+
const z = u + f + b / 2;
|
|
1022
|
+
o.fillText(ge(k), C, z), C += y[N].width + s;
|
|
1023
1023
|
}), a.toDataURL("image/png");
|
|
1024
1024
|
}
|
|
1025
1025
|
const nt = (e, l) => {
|
|
1026
|
-
const { name: r, rightIcons: s, selected: a } = e.getProperties(), o = l !== 1 ?
|
|
1027
|
-
let
|
|
1026
|
+
const { name: r, rightIcons: s, selected: a } = e.getProperties(), o = l !== 1 ? yo() : "right-top", f = mo(r, s, o);
|
|
1027
|
+
let x = [0, 0];
|
|
1028
1028
|
switch (o) {
|
|
1029
1029
|
case "right-top":
|
|
1030
|
-
|
|
1030
|
+
x = [0, 1];
|
|
1031
1031
|
break;
|
|
1032
1032
|
case "right-middle":
|
|
1033
|
-
|
|
1033
|
+
x = [0, 0.5];
|
|
1034
1034
|
break;
|
|
1035
1035
|
case "right-bottom":
|
|
1036
|
-
|
|
1036
|
+
x = [0, 0];
|
|
1037
1037
|
break;
|
|
1038
1038
|
case "left-top":
|
|
1039
|
-
|
|
1039
|
+
x = [1, 1];
|
|
1040
1040
|
break;
|
|
1041
1041
|
case "left-middle":
|
|
1042
|
-
|
|
1042
|
+
x = [1, 0.5];
|
|
1043
1043
|
break;
|
|
1044
1044
|
case "left-bottom":
|
|
1045
|
-
|
|
1045
|
+
x = [1, 0];
|
|
1046
1046
|
break;
|
|
1047
1047
|
}
|
|
1048
1048
|
return new H({
|
|
1049
1049
|
image: new be({
|
|
1050
1050
|
src: f,
|
|
1051
|
-
anchor:
|
|
1051
|
+
anchor: x,
|
|
1052
1052
|
displacement: [0, 0],
|
|
1053
|
-
scale: 1 /
|
|
1053
|
+
scale: 1 / ho,
|
|
1054
1054
|
anchorXUnits: "fraction",
|
|
1055
1055
|
anchorYUnits: "fraction"
|
|
1056
1056
|
}),
|
|
@@ -1072,19 +1072,19 @@ const nt = (e, l) => {
|
|
|
1072
1072
|
declutter: !0
|
|
1073
1073
|
});
|
|
1074
1074
|
e == null || e.addLayer(a), e == null || e.addLayer(f);
|
|
1075
|
-
let
|
|
1076
|
-
const
|
|
1075
|
+
let x = null, t = "", n = {}, m = {};
|
|
1076
|
+
const h = (i) => {
|
|
1077
1077
|
if (!i || !e) return;
|
|
1078
1078
|
const u = (r == null ? void 0 : r.id) || (l == null ? void 0 : l.get("id"));
|
|
1079
1079
|
if (r) {
|
|
1080
|
-
const
|
|
1081
|
-
|
|
1080
|
+
const v = i.filter((C) => C.id === u);
|
|
1081
|
+
v.length === 0 ? i.push(r) : r = v[0];
|
|
1082
1082
|
}
|
|
1083
|
-
w(),
|
|
1083
|
+
w(), L(!0), D(i), S();
|
|
1084
1084
|
}, P = (i) => {
|
|
1085
1085
|
var V;
|
|
1086
|
-
const u = (r == null ? void 0 : r.id) || (l == null ? void 0 : l.get("id")),
|
|
1087
|
-
geometry: new ne(
|
|
1086
|
+
const u = (r == null ? void 0 : r.id) || (l == null ? void 0 : l.get("id")), v = I([i == null ? void 0 : i.lon, i == null ? void 0 : i.lat]), C = ((V = m[i.id]) == null ? void 0 : V.blinkColors) || [], N = C[C.length - 1] || i.fill || "#04C900", z = uo(i), Z = new se({
|
|
1087
|
+
geometry: new ne(v),
|
|
1088
1088
|
// 船舶数据
|
|
1089
1089
|
shipData: i,
|
|
1090
1090
|
id: i.id,
|
|
@@ -1097,72 +1097,72 @@ const nt = (e, l) => {
|
|
|
1097
1097
|
// // 闪烁颜色
|
|
1098
1098
|
// blinkingColor: attentionShipsColor[ship.id].blinkColors || '',
|
|
1099
1099
|
// 船舶颜色
|
|
1100
|
-
color:
|
|
1100
|
+
color: N,
|
|
1101
1101
|
// 船艏向的方向
|
|
1102
1102
|
direct: z,
|
|
1103
1103
|
// 高亮
|
|
1104
1104
|
isHighlight: !1
|
|
1105
1105
|
});
|
|
1106
|
-
return Z.set("clickGeometry", new Bt(
|
|
1107
|
-
},
|
|
1106
|
+
return Z.set("clickGeometry", new Bt(v)), Z;
|
|
1107
|
+
}, S = async () => {
|
|
1108
1108
|
if (!r || !e) return;
|
|
1109
|
-
let u = e.getOverlays().getArray().find((
|
|
1109
|
+
let u = e.getOverlays().getArray().find((v) => v.get("class") == "ship-overlay-selected");
|
|
1110
1110
|
if (u) {
|
|
1111
|
-
const
|
|
1112
|
-
await u.setElement(
|
|
1111
|
+
const v = dt(e, r);
|
|
1112
|
+
await u.setElement(v), await u.setPosition(I([r.lon, r.lat]));
|
|
1113
1113
|
} else
|
|
1114
1114
|
u = fo(e, r), u && e.addOverlay(u);
|
|
1115
1115
|
setTimeout(() => {
|
|
1116
|
-
var
|
|
1117
|
-
u && ((
|
|
1116
|
+
var v;
|
|
1117
|
+
u && ((v = u.get("element")) != null && v.parentElement) && (u.get("element").parentElement.style.display = "block");
|
|
1118
1118
|
}, 20);
|
|
1119
|
-
},
|
|
1119
|
+
}, y = (i) => {
|
|
1120
1120
|
if (i === "start") {
|
|
1121
1121
|
const u = () => {
|
|
1122
1122
|
s.getFeatures().forEach((k) => {
|
|
1123
|
-
k.setStyle(
|
|
1123
|
+
k.setStyle(ye(e, k));
|
|
1124
1124
|
});
|
|
1125
1125
|
const C = (e == null ? void 0 : e.getOverlays().getArray()).find((k) => k.get("class") == "ship-overlay-selected");
|
|
1126
1126
|
if (C) {
|
|
1127
|
-
const k = C.getElement(),
|
|
1128
|
-
console.log("scaleFactor",
|
|
1127
|
+
const k = C.getElement(), N = je(e, r, "ship");
|
|
1128
|
+
console.log("scaleFactor", N), k.style.transform = `scale(${N})`;
|
|
1129
1129
|
}
|
|
1130
|
-
|
|
1130
|
+
x = requestAnimationFrame(u);
|
|
1131
1131
|
};
|
|
1132
1132
|
u();
|
|
1133
1133
|
} else
|
|
1134
|
-
|
|
1134
|
+
x && (cancelAnimationFrame(x), x = null);
|
|
1135
1135
|
}, w = () => {
|
|
1136
|
-
e && s && (s.clear(), o.clear(),
|
|
1137
|
-
},
|
|
1138
|
-
const u = e.getOverlays().getArray().filter((
|
|
1136
|
+
e && s && (s.clear(), o.clear(), L());
|
|
1137
|
+
}, L = (i) => {
|
|
1138
|
+
const u = e.getOverlays().getArray().filter((v) => v.get("class") == "zh-map-ship-overlay");
|
|
1139
1139
|
if (u && u.length > 0) {
|
|
1140
|
-
for (let
|
|
1141
|
-
if (!i && u[
|
|
1142
|
-
const C = u[
|
|
1140
|
+
for (let v = 0; v < u.length; v++)
|
|
1141
|
+
if (!i && u[v].get("class") !== "ship-overlay-selected") {
|
|
1142
|
+
const C = u[v];
|
|
1143
1143
|
C.setPosition(void 0), e.removeOverlay(C), C.dispose();
|
|
1144
1144
|
}
|
|
1145
1145
|
}
|
|
1146
1146
|
}, p = (i, u) => {
|
|
1147
1147
|
n = i, m = u, console.log("attentionShips", n, "attentionShipsColor", u);
|
|
1148
|
-
const
|
|
1148
|
+
const v = e.getOverlays().getArray(), C = s.getFeatures();
|
|
1149
1149
|
for (const k in n) {
|
|
1150
|
-
const
|
|
1150
|
+
const N = n[k], z = v.find((V) => V.getId() === "label-" + k), Z = C.find((V) => k === V.get("id"));
|
|
1151
1151
|
if (z && Z) {
|
|
1152
1152
|
const V = u[k].blinkColors || [], { shipData: ce, name: oe, color: le } = Z == null ? void 0 : Z.getProperties();
|
|
1153
|
-
Z.set("blinking",
|
|
1153
|
+
Z.set("blinking", N), 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(ye(e, Z)));
|
|
1154
1154
|
const ze = {
|
|
1155
1155
|
...ce,
|
|
1156
|
-
blinking:
|
|
1156
|
+
blinking: N,
|
|
1157
1157
|
blinkingColors: V || [],
|
|
1158
1158
|
name: oe + "(" + u[k].shipState + ")"
|
|
1159
1159
|
}, ke = z.getElement(), pe = ut(ze);
|
|
1160
1160
|
ke && ke !== pe && z.setElement(pe);
|
|
1161
1161
|
}
|
|
1162
1162
|
}
|
|
1163
|
-
},
|
|
1163
|
+
}, b = (i) => {
|
|
1164
1164
|
if (!e) return;
|
|
1165
|
-
const u = s.getFeatures(),
|
|
1165
|
+
const u = s.getFeatures(), v = o.getFeatures(), C = l ? l.get("id") : "", k = u.filter((V) => V.get("id") !== C), N = v == null ? void 0 : v.filter((V) => V.get("id") !== C), z = /* @__PURE__ */ new Map();
|
|
1166
1166
|
i.forEach((V) => {
|
|
1167
1167
|
z.set(V.id, !0);
|
|
1168
1168
|
});
|
|
@@ -1173,11 +1173,11 @@ const nt = (e, l) => {
|
|
|
1173
1173
|
V.setStyle([]);
|
|
1174
1174
|
else {
|
|
1175
1175
|
const le = V.getStyle();
|
|
1176
|
-
(le == null ? void 0 : le.length) == 0 && V.setStyle(
|
|
1176
|
+
(le == null ? void 0 : le.length) == 0 && V.setStyle(ye(e, V));
|
|
1177
1177
|
}
|
|
1178
1178
|
const oe = Z.find((le) => le.getId() === "label-" + ce);
|
|
1179
1179
|
oe && oe.setPosition(void 0);
|
|
1180
|
-
}), console.log(
|
|
1180
|
+
}), console.log(N), N.forEach((V) => {
|
|
1181
1181
|
const ce = V.get("id");
|
|
1182
1182
|
if (!z.has(ce))
|
|
1183
1183
|
V.setStyle([]);
|
|
@@ -1189,18 +1189,18 @@ const nt = (e, l) => {
|
|
|
1189
1189
|
}, G = (i) => {
|
|
1190
1190
|
if (i) {
|
|
1191
1191
|
console.log("选中", i);
|
|
1192
|
-
const u = s.getFeatures().find((C) => C.get("id") === i.id),
|
|
1193
|
-
u && (l = u),
|
|
1192
|
+
const u = s.getFeatures().find((C) => C.get("id") === i.id), v = o.getFeatures().find((C) => C.get("id") === i.id);
|
|
1193
|
+
u && (l = u), v && v.set("selected", !0), r = i, S();
|
|
1194
1194
|
} else
|
|
1195
1195
|
console.log("取消选中"), r = null, l = null, X();
|
|
1196
|
-
}, W = qe((i, u,
|
|
1196
|
+
}, W = qe((i, u, v) => {
|
|
1197
1197
|
try {
|
|
1198
1198
|
if (i) {
|
|
1199
1199
|
const C = i.get("shipData"), k = i.get("id");
|
|
1200
|
-
if (e.getTargetElement().style.cursor = k ? "pointer" : "", u === "click" && (G(C),
|
|
1200
|
+
if (e.getTargetElement().style.cursor = k ? "pointer" : "", u === "click" && (G(C), v && v(k)), u === "hover") {
|
|
1201
1201
|
t && t !== k && B(), t = k;
|
|
1202
|
-
const
|
|
1203
|
-
|
|
1202
|
+
const N = s.getFeatures().find((z) => z.get("id") === t);
|
|
1203
|
+
N == null || N.set("isHighlight", !0), N == null || N.setStyle(ye(e, N));
|
|
1204
1204
|
}
|
|
1205
1205
|
} else
|
|
1206
1206
|
e.getTargetElement().style.cursor = "", B();
|
|
@@ -1209,17 +1209,17 @@ const nt = (e, l) => {
|
|
|
1209
1209
|
}
|
|
1210
1210
|
}, 10), B = () => {
|
|
1211
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(
|
|
1212
|
+
t = null, i == null || i.set("isHighlight", !1), i == null || i.setStyle(ye(e, i));
|
|
1213
1213
|
}, X = () => {
|
|
1214
1214
|
try {
|
|
1215
|
-
const u = e.getOverlays().getArray().find((
|
|
1215
|
+
const u = e.getOverlays().getArray().find((v) => v.get("class") == "ship-overlay-selected");
|
|
1216
1216
|
u && u.setPosition(void 0);
|
|
1217
1217
|
} catch (i) {
|
|
1218
1218
|
console.log(i);
|
|
1219
1219
|
}
|
|
1220
1220
|
}, O = (i, u) => {
|
|
1221
|
-
const
|
|
1222
|
-
geometry: new ne(
|
|
1221
|
+
const v = I([i == null ? void 0 : i.lon, i == null ? void 0 : i.lat]), C = new se({
|
|
1222
|
+
geometry: new ne(v),
|
|
1223
1223
|
name: i.cnname || i.enname || i.name || i.id || "未命名船舶",
|
|
1224
1224
|
// 图标
|
|
1225
1225
|
rightIcons: rt(i),
|
|
@@ -1231,33 +1231,33 @@ const nt = (e, l) => {
|
|
|
1231
1231
|
return C.setStyle(k), C;
|
|
1232
1232
|
}, D = (i) => {
|
|
1233
1233
|
const u = e.getView().getZoom();
|
|
1234
|
-
i.forEach((
|
|
1235
|
-
const C = P(
|
|
1236
|
-
if (C.setStyle(
|
|
1237
|
-
if (n[
|
|
1238
|
-
if (
|
|
1239
|
-
const k = m[
|
|
1240
|
-
...
|
|
1234
|
+
i.forEach((v) => {
|
|
1235
|
+
const C = P(v);
|
|
1236
|
+
if (C.setStyle(ye(e, C)), s.addFeature(C), (r == null ? void 0 : r.id) == v.id || u >= ee.shipModelMin)
|
|
1237
|
+
if (n[v.id]) {
|
|
1238
|
+
if (v.id && m[v == null ? void 0 : v.id]) {
|
|
1239
|
+
const k = m[v == null ? void 0 : v.id] || {}, N = (k == null ? void 0 : k.blinkColors) || [], z = (k == null ? void 0 : k.shipState) || "", Z = (v.cnname || v.enname || v.name || v.id || "未命名船舶") + "(" + z + ")", V = {
|
|
1240
|
+
...v,
|
|
1241
1241
|
name: Z,
|
|
1242
|
-
blinking: n[
|
|
1243
|
-
blinkingColors:
|
|
1242
|
+
blinking: n[v.id],
|
|
1243
|
+
blinkingColors: N || []
|
|
1244
1244
|
};
|
|
1245
1245
|
vo(e, V);
|
|
1246
1246
|
}
|
|
1247
1247
|
} else {
|
|
1248
|
-
const k = O(
|
|
1248
|
+
const k = O(v, i.length);
|
|
1249
1249
|
o.addFeature(k);
|
|
1250
1250
|
}
|
|
1251
1251
|
});
|
|
1252
1252
|
};
|
|
1253
1253
|
return {
|
|
1254
|
-
render:
|
|
1254
|
+
render: h,
|
|
1255
1255
|
selected: G,
|
|
1256
|
-
filter:
|
|
1256
|
+
filter: b,
|
|
1257
1257
|
blinking: p,
|
|
1258
1258
|
clear: w,
|
|
1259
1259
|
handleShipMapEvent: W,
|
|
1260
|
-
changeShipScale:
|
|
1260
|
+
changeShipScale: y
|
|
1261
1261
|
};
|
|
1262
1262
|
}, xo = (e) => {
|
|
1263
1263
|
const l = () => e == null ? void 0 : e.getLayers(), r = U("vector"), s = () => r.value, a = (t) => {
|
|
@@ -1274,17 +1274,17 @@ const nt = (e, l) => {
|
|
|
1274
1274
|
if (t !== o.value) {
|
|
1275
1275
|
if (t) {
|
|
1276
1276
|
const n = l();
|
|
1277
|
-
if (!n.getArray().find((
|
|
1278
|
-
const
|
|
1277
|
+
if (!n.getArray().find((h) => h.className_ === "greenTile")) {
|
|
1278
|
+
const h = new he({
|
|
1279
1279
|
source: new me({ url: de.greenTile }),
|
|
1280
1280
|
visible: t,
|
|
1281
1281
|
zIndex: 2,
|
|
1282
1282
|
className: "greenTile"
|
|
1283
1283
|
});
|
|
1284
|
-
n.push(
|
|
1284
|
+
n.push(h);
|
|
1285
1285
|
}
|
|
1286
1286
|
} else {
|
|
1287
|
-
const n = l(), m = n.getArray().find((
|
|
1287
|
+
const n = l(), m = n.getArray().find((h) => h.className_ === "greenTile");
|
|
1288
1288
|
m && n.remove(m);
|
|
1289
1289
|
}
|
|
1290
1290
|
o.value = t;
|
|
@@ -1304,34 +1304,34 @@ const nt = (e, l) => {
|
|
|
1304
1304
|
}, ko = (e) => {
|
|
1305
1305
|
const l = "zh-map-location-layer";
|
|
1306
1306
|
let r, s, a = null, o = null;
|
|
1307
|
-
const f = (
|
|
1308
|
-
if (!(!
|
|
1307
|
+
const f = (y) => {
|
|
1308
|
+
if (!(!y || y.length === 0)) {
|
|
1309
1309
|
if (s || (s = new ae()), s.clear(), o) {
|
|
1310
|
-
const w =
|
|
1311
|
-
w ? o = w :
|
|
1310
|
+
const w = y.find((L) => L.id === o.id);
|
|
1311
|
+
w ? o = w : y.push(o);
|
|
1312
1312
|
}
|
|
1313
|
-
|
|
1314
|
-
|
|
1313
|
+
y.forEach((w) => {
|
|
1314
|
+
x(w);
|
|
1315
1315
|
}), r || (r = new ve({
|
|
1316
1316
|
className: l,
|
|
1317
1317
|
source: s,
|
|
1318
1318
|
zIndex: 100
|
|
1319
1319
|
}), e == null || e.addLayer(r));
|
|
1320
1320
|
}
|
|
1321
|
-
},
|
|
1322
|
-
const w = e == null ? void 0 : e.getView().getZoom(), [
|
|
1323
|
-
geometry: new ne(I([Number(
|
|
1321
|
+
}, x = (y) => {
|
|
1322
|
+
const w = e == null ? void 0 : e.getView().getZoom(), [L, p] = y.latLon.split(","), b = new se({
|
|
1323
|
+
geometry: new ne(I([Number(L), Number(p)]))
|
|
1324
1324
|
});
|
|
1325
|
-
|
|
1326
|
-
}, t = (
|
|
1325
|
+
b.setStyle(t(y, w, y.id === (o == null ? void 0 : o.id))), b.set("loactionData", y), s.addFeature(b);
|
|
1326
|
+
}, t = (y, w, L) => {
|
|
1327
1327
|
const p = {
|
|
1328
1328
|
image: new be({
|
|
1329
|
-
src:
|
|
1329
|
+
src: L && y.selectedPath || y.defaultPath,
|
|
1330
1330
|
scale: 0.5 * w / 10
|
|
1331
1331
|
})
|
|
1332
1332
|
};
|
|
1333
|
-
return
|
|
1334
|
-
text:
|
|
1333
|
+
return y.name && (p.text = new ue({
|
|
1334
|
+
text: y.name,
|
|
1335
1335
|
font: "12px sans-serif",
|
|
1336
1336
|
fill: new Q({
|
|
1337
1337
|
color: "#000000"
|
|
@@ -1343,33 +1343,33 @@ const nt = (e, l) => {
|
|
|
1343
1343
|
})), new H(p);
|
|
1344
1344
|
}, n = () => {
|
|
1345
1345
|
if (a) {
|
|
1346
|
-
const
|
|
1346
|
+
const y = a.get("loactionData").id;
|
|
1347
1347
|
s.getFeatures().forEach((w) => {
|
|
1348
|
-
w.get("loactionData").id !==
|
|
1348
|
+
w.get("loactionData").id !== y && s.removeFeature(w);
|
|
1349
1349
|
});
|
|
1350
1350
|
} else
|
|
1351
1351
|
s.clear();
|
|
1352
1352
|
}, m = () => {
|
|
1353
1353
|
var p;
|
|
1354
|
-
const
|
|
1355
|
-
s.getFeatures().forEach((
|
|
1356
|
-
|
|
1354
|
+
const y = a.get("loactionData"), w = (p = e == null ? void 0 : e.getView()) == null ? void 0 : p.getZoom();
|
|
1355
|
+
s.getFeatures().forEach((b) => {
|
|
1356
|
+
b.get("loactionData").id === y.id && (b == null || b.setStyle(t(y, w, !1)));
|
|
1357
1357
|
}), o = null, a = null;
|
|
1358
|
-
},
|
|
1359
|
-
|
|
1358
|
+
}, h = (y) => {
|
|
1359
|
+
y ? (P(), S(y)) : clearSelectedPort();
|
|
1360
1360
|
}, P = () => {
|
|
1361
|
-
var
|
|
1361
|
+
var y;
|
|
1362
1362
|
if (a) {
|
|
1363
|
-
const w = a.get("loactionData"),
|
|
1364
|
-
a.setStyle(t(w,
|
|
1363
|
+
const w = a.get("loactionData"), L = (y = e == null ? void 0 : e.getView()) == null ? void 0 : y.getZoom();
|
|
1364
|
+
a.setStyle(t(w, L, !1));
|
|
1365
1365
|
}
|
|
1366
|
-
},
|
|
1366
|
+
}, S = (y) => {
|
|
1367
1367
|
const w = s.getFeatures();
|
|
1368
|
-
o =
|
|
1368
|
+
o = y, a = w.find((L) => L.get("loactionData").id === y.id);
|
|
1369
1369
|
};
|
|
1370
1370
|
return {
|
|
1371
1371
|
render: f,
|
|
1372
|
-
selected:
|
|
1372
|
+
selected: h,
|
|
1373
1373
|
clearSelected: m,
|
|
1374
1374
|
clear: n
|
|
1375
1375
|
};
|
|
@@ -1389,8 +1389,8 @@ const nt = (e, l) => {
|
|
|
1389
1389
|
s.value = i;
|
|
1390
1390
|
};
|
|
1391
1391
|
let o;
|
|
1392
|
-
const f = U(!1),
|
|
1393
|
-
Ve(e, "crosshair"), m(), po(e), e.on("pointermove",
|
|
1392
|
+
const f = U(!1), x = () => {
|
|
1393
|
+
Ve(e, "crosshair"), m(), po(e), e.on("pointermove", S), e.getViewport().addEventListener("mouseout", () => {
|
|
1394
1394
|
o && o.classList.add("hidden");
|
|
1395
1395
|
}), w(), f.value = !0;
|
|
1396
1396
|
};
|
|
@@ -1408,16 +1408,16 @@ const nt = (e, l) => {
|
|
|
1408
1408
|
}
|
|
1409
1409
|
}), e == null || e.addLayer(n);
|
|
1410
1410
|
};
|
|
1411
|
-
let
|
|
1412
|
-
const
|
|
1411
|
+
let h, P;
|
|
1412
|
+
const S = (i) => {
|
|
1413
1413
|
if (i.dragging)
|
|
1414
1414
|
return;
|
|
1415
1415
|
let u = "点击选择起点";
|
|
1416
|
-
|
|
1416
|
+
h && (u = "单击继续,双击结束"), o && (o.innerHTML = u, P.setPosition(i.coordinate), o.classList.remove("hidden"));
|
|
1417
1417
|
};
|
|
1418
|
-
let
|
|
1418
|
+
let y;
|
|
1419
1419
|
const w = () => {
|
|
1420
|
-
|
|
1420
|
+
y = new Ne({
|
|
1421
1421
|
source: t,
|
|
1422
1422
|
type: "LineString",
|
|
1423
1423
|
style: new H({
|
|
@@ -1429,7 +1429,7 @@ const nt = (e, l) => {
|
|
|
1429
1429
|
lineDash: [10, 10],
|
|
1430
1430
|
width: 2
|
|
1431
1431
|
}),
|
|
1432
|
-
image: new
|
|
1432
|
+
image: new Se({
|
|
1433
1433
|
radius: 5,
|
|
1434
1434
|
stroke: new fe({
|
|
1435
1435
|
color: "rgba(0, 0, 0, 0.7)"
|
|
@@ -1441,39 +1441,39 @@ const nt = (e, l) => {
|
|
|
1441
1441
|
}),
|
|
1442
1442
|
// 添加条件函数,判断是否应该出发点绘制
|
|
1443
1443
|
condition: (u) => u.originalEvent.target.tagName !== "DIV"
|
|
1444
|
-
}), e == null || e.addInteraction(
|
|
1444
|
+
}), e == null || e.addInteraction(y), G(), W();
|
|
1445
1445
|
let i;
|
|
1446
|
-
|
|
1446
|
+
y.on("drawstart", function(u) {
|
|
1447
1447
|
var C;
|
|
1448
|
-
|
|
1449
|
-
let
|
|
1450
|
-
i = (C =
|
|
1451
|
-
const
|
|
1452
|
-
|
|
1448
|
+
h = u.feature, h.set("randomId", L());
|
|
1449
|
+
let v;
|
|
1450
|
+
i = (C = h.getGeometry()) == null ? void 0 : C.on("change", function(k) {
|
|
1451
|
+
const N = k.target, z = gt(N, s.value);
|
|
1452
|
+
v = N.getLastCoordinate(), p && z && (p.innerHTML = z), b.setPosition(v);
|
|
1453
1453
|
});
|
|
1454
|
-
}),
|
|
1455
|
-
var u,
|
|
1454
|
+
}), y.on("drawend", function() {
|
|
1455
|
+
var u, v, C;
|
|
1456
1456
|
if (p && (p.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), p != null && p.innerHTML) {
|
|
1457
|
-
const k = (
|
|
1457
|
+
const k = (h == null ? void 0 : h.get("randomId")) || L();
|
|
1458
1458
|
r.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
1459
|
}
|
|
1460
1460
|
(u = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || u.addEventListener("click", (k) => {
|
|
1461
1461
|
var z;
|
|
1462
1462
|
k.preventDefault(), k.stopPropagation();
|
|
1463
|
-
const
|
|
1464
|
-
|
|
1465
|
-
}),
|
|
1463
|
+
const N = (z = k.target) == null ? void 0 : z.getAttribute("data-id");
|
|
1464
|
+
N && X(N);
|
|
1465
|
+
}), b.setOffset([0, -7]), h = null, p = null, G(), i && Ge(i), (C = (v = l.getProps()) == null ? void 0 : v.lineDrawEnd) == null || C.call(v, r.value);
|
|
1466
1466
|
});
|
|
1467
|
-
},
|
|
1468
|
-
let p,
|
|
1467
|
+
}, L = () => Math.random().toString(36).substring(2, 9);
|
|
1468
|
+
let p, b;
|
|
1469
1469
|
const G = () => {
|
|
1470
|
-
p != null && p.parentNode && p.parentNode.removeChild(p), p = document.createElement("div"), p.className = "ol-tooltip ol-tooltip-measure",
|
|
1470
|
+
p != null && p.parentNode && p.parentNode.removeChild(p), p = document.createElement("div"), p.className = "ol-tooltip ol-tooltip-measure", b = new ie({
|
|
1471
1471
|
element: p,
|
|
1472
1472
|
offset: [0, -15],
|
|
1473
1473
|
positioning: "bottom-center",
|
|
1474
1474
|
stopEvent: !1,
|
|
1475
1475
|
insertFirst: !1
|
|
1476
|
-
}), e == null || e.addOverlay(
|
|
1476
|
+
}), e == null || e.addOverlay(b);
|
|
1477
1477
|
}, W = () => {
|
|
1478
1478
|
o != null && o.parentNode && o.parentNode.removeChild(o), o = document.createElement("div"), o.className = "ol-tooltip hidden", P = new ie({
|
|
1479
1479
|
element: o,
|
|
@@ -1482,35 +1482,35 @@ const nt = (e, l) => {
|
|
|
1482
1482
|
}), e == null || e.addOverlay(P);
|
|
1483
1483
|
}, B = () => {
|
|
1484
1484
|
r.value.forEach((i, u) => {
|
|
1485
|
-
var k,
|
|
1486
|
-
const
|
|
1487
|
-
|
|
1485
|
+
var k, N;
|
|
1486
|
+
const v = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1487
|
+
v[u] && ((N = (k = v[u]) == null ? void 0 : k.parentNode) == null || N.removeChild(v[u]));
|
|
1488
1488
|
const C = t.getFeatures();
|
|
1489
1489
|
C[u] && t.removeFeature(C[u]);
|
|
1490
1490
|
}), O(), Mo(e), f.value = !1, Ve(e, "pointer");
|
|
1491
1491
|
}, X = (i) => {
|
|
1492
|
-
var
|
|
1492
|
+
var v, C, k, N;
|
|
1493
1493
|
const u = r.value.findIndex((z) => z.id === i);
|
|
1494
1494
|
if (u !== -1) {
|
|
1495
1495
|
r.value.splice(u, 1);
|
|
1496
1496
|
const z = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1497
|
-
z[u] && ((C = (
|
|
1497
|
+
z[u] && ((C = (v = z[u]) == null ? void 0 : v.parentNode) == null || C.removeChild(z[u]));
|
|
1498
1498
|
const Z = t.getFeatures();
|
|
1499
1499
|
Z[u] && t.removeFeature(Z[u]);
|
|
1500
1500
|
}
|
|
1501
|
-
(
|
|
1501
|
+
(N = (k = l.getProps()) == null ? void 0 : k.lineDrawEnd) == null || N.call(k, r.value);
|
|
1502
1502
|
}, O = () => {
|
|
1503
1503
|
if (r.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((i) => {
|
|
1504
1504
|
var u;
|
|
1505
1505
|
(u = i == null ? void 0 : i.parentNode) == null || u.removeChild(i);
|
|
1506
|
-
}), t.clear(),
|
|
1507
|
-
const i = e.getInteractions().getArray().find((u) => et(u) === et(
|
|
1506
|
+
}), t.clear(), y) {
|
|
1507
|
+
const i = e.getInteractions().getArray().find((u) => et(u) === et(y));
|
|
1508
1508
|
i && e.removeInteraction(i);
|
|
1509
1509
|
}
|
|
1510
1510
|
e.removeLayer(n), o != null && o.parentNode && o.parentNode.removeChild(o), p != null && p.parentNode && p.parentNode.removeChild(p);
|
|
1511
1511
|
};
|
|
1512
1512
|
return {
|
|
1513
|
-
open:
|
|
1513
|
+
open: x,
|
|
1514
1514
|
close: B,
|
|
1515
1515
|
deleteLine: X,
|
|
1516
1516
|
setUnit: a,
|
|
@@ -1536,11 +1536,11 @@ const nt = (e, l) => {
|
|
|
1536
1536
|
const a = () => {
|
|
1537
1537
|
o(), Ve(e, "crosshair");
|
|
1538
1538
|
}, o = () => {
|
|
1539
|
-
t(), p(), W(),
|
|
1539
|
+
t(), p(), W(), S();
|
|
1540
1540
|
};
|
|
1541
|
-
let f = null,
|
|
1541
|
+
let f = null, x = null;
|
|
1542
1542
|
const t = () => {
|
|
1543
|
-
if (f &&
|
|
1543
|
+
if (f && x) return;
|
|
1544
1544
|
const O = new ae(), D = new ve({
|
|
1545
1545
|
source: O,
|
|
1546
1546
|
style: new H({
|
|
@@ -1550,45 +1550,45 @@ const nt = (e, l) => {
|
|
|
1550
1550
|
})
|
|
1551
1551
|
})
|
|
1552
1552
|
});
|
|
1553
|
-
f = D,
|
|
1554
|
-
|
|
1553
|
+
f = D, x = O, e.on("pointermove", m), e.addLayer(D), e.on(["dblclick"], function(i) {
|
|
1554
|
+
h && (i.stopPropagation(), i.preventDefault());
|
|
1555
1555
|
});
|
|
1556
1556
|
};
|
|
1557
1557
|
let n;
|
|
1558
1558
|
const m = (O) => {
|
|
1559
1559
|
if (O.dragging) return;
|
|
1560
1560
|
const D = n ? "单击继续,双击结束" : "点击选择起点";
|
|
1561
|
-
|
|
1561
|
+
b && (b.innerHTML = D, G.setPosition(O.coordinate));
|
|
1562
1562
|
};
|
|
1563
|
-
let
|
|
1564
|
-
const
|
|
1563
|
+
let h, P = !1;
|
|
1564
|
+
const S = () => {
|
|
1565
1565
|
if (r) {
|
|
1566
|
-
|
|
1566
|
+
b != null && b.parentNode && b.parentNode.removeChild(b);
|
|
1567
1567
|
const O = r.getGeometry();
|
|
1568
1568
|
if (!O) return;
|
|
1569
|
-
const D =
|
|
1569
|
+
const D = y(O, "nm");
|
|
1570
1570
|
w && (w.innerHTML = `
|
|
1571
1571
|
<span class="text">面积:${D}${P ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1572
1572
|
`), w && (w.innerHTML += '<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');
|
|
1573
1573
|
const i = O.getCoordinates(), u = i[0][i[0].length - 2];
|
|
1574
|
-
if (
|
|
1574
|
+
if (L.setPosition(u), f) {
|
|
1575
1575
|
const C = f.getSource();
|
|
1576
1576
|
C && r && (C.clear(), C.addFeature(r));
|
|
1577
1577
|
}
|
|
1578
1578
|
setTimeout(() => {
|
|
1579
1579
|
var C;
|
|
1580
1580
|
(C = document.querySelector(".delete-icon")) == null || C.addEventListener("click", () => {
|
|
1581
|
-
var k,
|
|
1582
|
-
console.log("delete"), B(), (
|
|
1581
|
+
var k, N;
|
|
1582
|
+
console.log("delete"), B(), (N = (k = l.getProps()) == null ? void 0 : k.areaDrawEnd) == null || N.call(k, []);
|
|
1583
1583
|
});
|
|
1584
1584
|
}, 0);
|
|
1585
|
-
const
|
|
1586
|
-
e == null || e.getView().setCenter(
|
|
1585
|
+
const v = Ht(r.getGeometry().getExtent());
|
|
1586
|
+
e == null || e.getView().setCenter(v);
|
|
1587
1587
|
return;
|
|
1588
1588
|
}
|
|
1589
|
-
|
|
1589
|
+
h = new Ne({
|
|
1590
1590
|
type: "Polygon",
|
|
1591
|
-
source:
|
|
1591
|
+
source: x,
|
|
1592
1592
|
trace: !0,
|
|
1593
1593
|
style: [new H({
|
|
1594
1594
|
stroke: new fe({
|
|
@@ -1600,7 +1600,7 @@ const nt = (e, l) => {
|
|
|
1600
1600
|
color: "rgba(255, 255, 255, 0.25)"
|
|
1601
1601
|
})
|
|
1602
1602
|
}), new H({
|
|
1603
|
-
image: new
|
|
1603
|
+
image: new Se({
|
|
1604
1604
|
radius: 5,
|
|
1605
1605
|
fill: new Q({
|
|
1606
1606
|
color: "rgb(51,112,255, 1)"
|
|
@@ -1611,20 +1611,20 @@ const nt = (e, l) => {
|
|
|
1611
1611
|
return new Xt(D);
|
|
1612
1612
|
}
|
|
1613
1613
|
})]
|
|
1614
|
-
}), e == null || e.addInteraction(
|
|
1614
|
+
}), e == null || e.addInteraction(h), h.on("drawstart", (O) => {
|
|
1615
1615
|
var D;
|
|
1616
1616
|
n = O.feature, s = (D = n.getGeometry()) == null ? void 0 : D.on("change", (i) => {
|
|
1617
|
-
const u = i.target,
|
|
1618
|
-
if (P = Number(Be(
|
|
1617
|
+
const u = i.target, v = y(u, "nm"), k = u.getCoordinates()[0], N = new Pe([k[k.length - 2], k[k.length - 1]]), z = gt(N, "nm");
|
|
1618
|
+
if (P = Number(Be(N) / 1e3) > 150, !v) return;
|
|
1619
1619
|
const Z = '<span class="error pl-4">超出可以绘画的距离</span>';
|
|
1620
1620
|
w && (w.innerHTML = `
|
|
1621
1621
|
<div class="text">
|
|
1622
|
-
面积:${
|
|
1622
|
+
面积:${v}
|
|
1623
1623
|
${P ? Z : ""}
|
|
1624
1624
|
</div>
|
|
1625
|
-
`),
|
|
1625
|
+
`), b && (b.innerHTML = `
|
|
1626
1626
|
<div class="text">
|
|
1627
|
-
面积:${
|
|
1627
|
+
面积:${v}
|
|
1628
1628
|
</div>
|
|
1629
1629
|
<div class="text ${P ? "error" : ""}">
|
|
1630
1630
|
线段 ${k.length - 2}: ${z}
|
|
@@ -1636,23 +1636,23 @@ const nt = (e, l) => {
|
|
|
1636
1636
|
</div>
|
|
1637
1637
|
`);
|
|
1638
1638
|
});
|
|
1639
|
-
}),
|
|
1640
|
-
var
|
|
1639
|
+
}), h.on("drawend", (O) => {
|
|
1640
|
+
var v, C, k, N;
|
|
1641
1641
|
if (!O.feature.getGeometry()) return;
|
|
1642
|
-
r = O.feature, w && (w.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'),
|
|
1642
|
+
r = O.feature, w && (w.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), L.setOffset([10, 0]);
|
|
1643
1643
|
const i = O.feature.getGeometry().getCoordinates(), u = i[0][i[0].length - 2];
|
|
1644
|
-
if (
|
|
1644
|
+
if (L.setPosition(u), b != null && b.parentNode && b.parentNode.removeChild(b), (v = l.getProps()) != null && v.areaDrawEnd) {
|
|
1645
1645
|
const z = i[0].map((Z) => xe(Z, J.mercator, J.data));
|
|
1646
1646
|
(k = (C = l.getProps()) == null ? void 0 : C.areaDrawEnd) == null || k.call(C, z);
|
|
1647
1647
|
}
|
|
1648
|
-
|
|
1649
|
-
Z instanceof
|
|
1650
|
-
})), s && Ge(s), (
|
|
1648
|
+
h && (h.setActive(!1), e == null || e.removeInteraction(h), (e == null ? void 0 : e.getInteractions()).forEach((Z) => {
|
|
1649
|
+
Z instanceof Ne && (Z.setActive(!1), e == null || e.removeInteraction(Z));
|
|
1650
|
+
})), s && Ge(s), (N = document.querySelector(".delete-icon")) == null || N.addEventListener("click", () => {
|
|
1651
1651
|
var z, Z;
|
|
1652
1652
|
B(), (Z = (z = l.getProps()) == null ? void 0 : z.areaDrawEnd) == null || Z.call(z, []);
|
|
1653
1653
|
});
|
|
1654
1654
|
});
|
|
1655
|
-
},
|
|
1655
|
+
}, y = (O, D) => {
|
|
1656
1656
|
const i = qt(O);
|
|
1657
1657
|
switch (D) {
|
|
1658
1658
|
case "km":
|
|
@@ -1661,32 +1661,32 @@ const nt = (e, l) => {
|
|
|
1661
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
1662
|
}
|
|
1663
1663
|
};
|
|
1664
|
-
let w,
|
|
1664
|
+
let w, L;
|
|
1665
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",
|
|
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", L = new ie({
|
|
1667
1667
|
element: w,
|
|
1668
1668
|
offset: [0, -15],
|
|
1669
1669
|
positioning: "bottom-center",
|
|
1670
1670
|
stopEvent: !1,
|
|
1671
1671
|
insertFirst: !1
|
|
1672
|
-
}), e == null || e.addOverlay(
|
|
1672
|
+
}), e == null || e.addOverlay(L);
|
|
1673
1673
|
};
|
|
1674
|
-
let
|
|
1674
|
+
let b, G;
|
|
1675
1675
|
const W = () => {
|
|
1676
|
-
|
|
1677
|
-
element:
|
|
1676
|
+
b != null && b.parentNode && b.parentNode.removeChild(b), b = document.createElement("div"), b.className = "ol-tooltip ol-help-tooltip", G = new ie({
|
|
1677
|
+
element: b,
|
|
1678
1678
|
offset: [15, 0],
|
|
1679
1679
|
positioning: "center-left"
|
|
1680
1680
|
}), e == null || e.addOverlay(G);
|
|
1681
1681
|
}, B = () => {
|
|
1682
|
-
|
|
1682
|
+
x == null || x.clear(), r = null, p(), W(), S();
|
|
1683
1683
|
};
|
|
1684
1684
|
return {
|
|
1685
1685
|
open: a,
|
|
1686
1686
|
close: () => {
|
|
1687
|
-
|
|
1688
|
-
D instanceof
|
|
1689
|
-
}),
|
|
1687
|
+
x == null || x.clear(), x = null, f && (e.removeLayer(f), f = null), n = null, h && (h.setActive(!1), (e == null ? void 0 : e.getInteractions()).forEach((D) => {
|
|
1688
|
+
D instanceof Ne && (D.setActive(!1), e == null || e.removeInteraction(D));
|
|
1689
|
+
}), h = null), s && Ge(s), b != null && b.parentElement && b.parentElement.removeChild(b), w != null && w.parentElement && w.parentElement.removeChild(w), G && e.removeOverlay(G), L && e.removeOverlay(L), Ve(e, "pointer");
|
|
1690
1690
|
},
|
|
1691
1691
|
reset: B
|
|
1692
1692
|
};
|
|
@@ -1698,26 +1698,26 @@ const nt = (e, l) => {
|
|
|
1698
1698
|
});
|
|
1699
1699
|
l == null || l.addLayer(s);
|
|
1700
1700
|
let a = null, o = null;
|
|
1701
|
-
const f = (
|
|
1702
|
-
if (!(!
|
|
1701
|
+
const f = (y, w = !0) => {
|
|
1702
|
+
if (!(!y || y.length === 0)) {
|
|
1703
1703
|
if (r.clear(), o) {
|
|
1704
|
-
const
|
|
1705
|
-
|
|
1704
|
+
const L = y.find((p) => p.id === o.id);
|
|
1705
|
+
L ? o = L : y.push(o);
|
|
1706
1706
|
}
|
|
1707
|
-
|
|
1708
|
-
|
|
1707
|
+
y.forEach((L) => {
|
|
1708
|
+
x(L, w);
|
|
1709
1709
|
});
|
|
1710
1710
|
}
|
|
1711
|
-
},
|
|
1712
|
-
const
|
|
1713
|
-
geometry: new ne(I([Number(p), Number(
|
|
1714
|
-
portData:
|
|
1715
|
-
select:
|
|
1716
|
-
showTitle:
|
|
1717
|
-
});
|
|
1718
|
-
|
|
1719
|
-
}, t = (
|
|
1720
|
-
const
|
|
1711
|
+
}, x = (y, w = !0) => {
|
|
1712
|
+
const L = e.getZoom(), [p, b] = y.latLon.split(","), G = new se({
|
|
1713
|
+
geometry: new ne(I([Number(p), Number(b)])),
|
|
1714
|
+
portData: y,
|
|
1715
|
+
select: y.id === (o == null ? void 0 : o.id),
|
|
1716
|
+
showTitle: y.id === (o == null ? void 0 : o.id) || w
|
|
1717
|
+
}), W = t(G, L);
|
|
1718
|
+
console.log("point-styles--------", W), G.setStyle(W), r.addFeature(G);
|
|
1719
|
+
}, t = (y, w) => {
|
|
1720
|
+
const { select: L, showTitle: p } = y.getProperties(), b = (B) => `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1721
1721
|
<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}"/>
|
|
1722
1722
|
<g clip-path="url(#clip0_10059_122082)">
|
|
1723
1723
|
<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"/>
|
|
@@ -1728,131 +1728,130 @@ const nt = (e, l) => {
|
|
|
1728
1728
|
</clipPath>
|
|
1729
1729
|
</defs>
|
|
1730
1730
|
</svg>
|
|
1731
|
-
`,
|
|
1732
|
-
return !
|
|
1731
|
+
`, G = () => `data:image/svg+xml;utf8,${encodeURIComponent(b(L ? "#FF5733" : "#3370FF"))}`, W = y.get("portData");
|
|
1732
|
+
return !p && !L ? new H({
|
|
1733
1733
|
image: new be({
|
|
1734
|
-
src:
|
|
1734
|
+
src: G(),
|
|
1735
1735
|
scale: 0.5 * w / 10
|
|
1736
1736
|
}),
|
|
1737
|
-
zIndex:
|
|
1738
|
-
}) : (console.log("showTitle", W.shortName,
|
|
1737
|
+
zIndex: L ? 110 : 100
|
|
1738
|
+
}) : (console.log("showTitle", p, W.shortName, "选中", L), new H({
|
|
1739
1739
|
text: new ue({
|
|
1740
1740
|
text: W.shortName,
|
|
1741
1741
|
font: "12px sans-serif",
|
|
1742
1742
|
fill: new Q({
|
|
1743
|
-
color:
|
|
1743
|
+
color: L ? "#ffffff" : "#000000"
|
|
1744
1744
|
}),
|
|
1745
1745
|
backgroundFill: new Q({
|
|
1746
|
-
color:
|
|
1746
|
+
color: L ? "#FF5733" : "#FFFFFF"
|
|
1747
1747
|
}),
|
|
1748
1748
|
offsetY: 30
|
|
1749
1749
|
}),
|
|
1750
1750
|
image: new be({
|
|
1751
|
-
src:
|
|
1751
|
+
src: G(),
|
|
1752
1752
|
scale: 0.5 * w / 10
|
|
1753
1753
|
}),
|
|
1754
|
-
zIndex:
|
|
1754
|
+
zIndex: L ? 110 : 100
|
|
1755
1755
|
}));
|
|
1756
1756
|
}, n = () => {
|
|
1757
1757
|
if (r)
|
|
1758
1758
|
if (a) {
|
|
1759
1759
|
console.log("清除非选中的港口");
|
|
1760
|
-
const
|
|
1760
|
+
const y = a.get("portData").id;
|
|
1761
1761
|
r.getFeatures().forEach((w) => {
|
|
1762
|
-
w.get("portData").id !==
|
|
1762
|
+
w.get("portData").id !== y && r.removeFeature(w);
|
|
1763
1763
|
});
|
|
1764
1764
|
} else
|
|
1765
1765
|
console.log("清除所有港口", r), r == null || r.clear();
|
|
1766
|
-
}, m = (
|
|
1766
|
+
}, m = (y) => {
|
|
1767
1767
|
if (r) {
|
|
1768
|
-
if (!
|
|
1769
|
-
return
|
|
1770
|
-
(a == null ? void 0 : a.get("portData").id) !==
|
|
1768
|
+
if (!y)
|
|
1769
|
+
return h();
|
|
1770
|
+
(a == null ? void 0 : a.get("portData").id) !== y.id && (h(), P(y));
|
|
1771
1771
|
}
|
|
1772
|
-
},
|
|
1772
|
+
}, h = () => {
|
|
1773
1773
|
if (a) {
|
|
1774
|
-
const
|
|
1774
|
+
const y = a == null ? void 0 : a.get("portData"), w = e.getZoom();
|
|
1775
1775
|
r.getFeatures().forEach((p) => {
|
|
1776
|
-
p.get("portData").id ===
|
|
1776
|
+
p.get("portData").id === y.id && (p.setStyle(t(p, w)), p.set("select", !1), a = null);
|
|
1777
1777
|
});
|
|
1778
1778
|
}
|
|
1779
|
-
}, P = (
|
|
1779
|
+
}, P = (y) => {
|
|
1780
1780
|
if (!r) return;
|
|
1781
1781
|
const w = r.getFeatures();
|
|
1782
|
-
o =
|
|
1782
|
+
o = y, a = w.find((L) => L.get("portData").id === y.id), a && (a.set("select", !0), a.setStyle(t(a, e.getZoom())));
|
|
1783
1783
|
};
|
|
1784
1784
|
return {
|
|
1785
1785
|
render: f,
|
|
1786
1786
|
clear: n,
|
|
1787
1787
|
selected: m,
|
|
1788
|
-
handlePortHover: (
|
|
1788
|
+
handlePortHover: (y) => {
|
|
1789
1789
|
const w = l == null ? void 0 : l.getTargetElement();
|
|
1790
|
-
|
|
1790
|
+
y && y.get("portData") && w && (w.style.cursor = "pointer");
|
|
1791
1791
|
}
|
|
1792
1792
|
};
|
|
1793
1793
|
}, Fo = (e, l, r, s, a, o) => {
|
|
1794
1794
|
const f = e.getInstall();
|
|
1795
1795
|
f.on("moveend", () => {
|
|
1796
|
-
var
|
|
1796
|
+
var x, t;
|
|
1797
1797
|
try {
|
|
1798
1798
|
const n = e.getZoom();
|
|
1799
|
-
(t = (
|
|
1799
|
+
(t = (x = l.getProps()).mapMoveEnd) == null || t.call(x, n), r.reRenderTrackLine(), n <= ee.shipModelMax && n >= ee.shipTriggleMin && s.changeShipScale("end");
|
|
1800
1800
|
} catch (n) {
|
|
1801
1801
|
console.log("moveend---catch", n);
|
|
1802
1802
|
}
|
|
1803
|
-
}), f.on("pointermove", (
|
|
1803
|
+
}), f.on("pointermove", (x) => {
|
|
1804
1804
|
try {
|
|
1805
|
-
const t = f == null ? void 0 : f.getEventPixel(
|
|
1805
|
+
const t = f == null ? void 0 : f.getEventPixel(x.originalEvent);
|
|
1806
1806
|
if (!t || !f) return;
|
|
1807
1807
|
const n = f == null ? void 0 : f.forEachFeatureAtPixel(t, (m) => m, {
|
|
1808
1808
|
layerFilter: (m) => m.getVisible()
|
|
1809
1809
|
});
|
|
1810
|
-
s == null || s.handleShipMapEvent(n, "hover"), r == null || r.handleTrackMapEvent(n, "hover",
|
|
1810
|
+
s == null || s.handleShipMapEvent(n, "hover"), r == null || r.handleTrackMapEvent(n, "hover", x), n && (a == null || a.handlePortHover(n));
|
|
1811
1811
|
} catch (t) {
|
|
1812
1812
|
console.log("pointermove---catch", t);
|
|
1813
1813
|
}
|
|
1814
1814
|
}), f.on("movestart", () => {
|
|
1815
1815
|
try {
|
|
1816
|
-
const
|
|
1817
|
-
|
|
1818
|
-
} catch (
|
|
1819
|
-
console.log("movestart---catch",
|
|
1816
|
+
const x = f == null ? void 0 : f.getView().getZoom();
|
|
1817
|
+
x && x <= ee.shipModelMax && x >= ee.shipTriggleMin && s.changeShipScale("start");
|
|
1818
|
+
} catch (x) {
|
|
1819
|
+
console.log("movestart---catch", x);
|
|
1820
1820
|
}
|
|
1821
|
-
}), f.on("click", qe((
|
|
1821
|
+
}), f.on("click", qe((x) => {
|
|
1822
1822
|
var t, n, m;
|
|
1823
1823
|
try {
|
|
1824
1824
|
if (console.log("1", o.getState()), o.getState()) return;
|
|
1825
|
-
const
|
|
1826
|
-
|
|
1827
|
-
(
|
|
1828
|
-
if (
|
|
1829
|
-
return
|
|
1825
|
+
const h = f.getEventPixel(x.originalEvent), P = f.forEachFeatureAtPixel(
|
|
1826
|
+
h,
|
|
1827
|
+
(S) => {
|
|
1828
|
+
if (S != null && S.get("shipData") || S != null && S.get("portData"))
|
|
1829
|
+
return S;
|
|
1830
1830
|
}
|
|
1831
1831
|
);
|
|
1832
1832
|
if (console.log("2", P), !P) return;
|
|
1833
1833
|
if (P.get("shipData"))
|
|
1834
1834
|
s.handleShipMapEvent(P, "click", (t = l.getProps()) == null ? void 0 : t.selectShip);
|
|
1835
1835
|
else if (P.get("portData")) {
|
|
1836
|
-
const
|
|
1837
|
-
a.selected(
|
|
1836
|
+
const S = P.get("portData");
|
|
1837
|
+
a.selected(S), (m = (n = l.getProps()) == null ? void 0 : n.selectPort) == null || m.call(n, S);
|
|
1838
1838
|
}
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
console.log("click---catch", y);
|
|
1839
|
+
} catch (h) {
|
|
1840
|
+
console.log("click---catch", h);
|
|
1842
1841
|
}
|
|
1843
1842
|
}, 150));
|
|
1844
1843
|
}, Po = () => {
|
|
1845
|
-
const e =
|
|
1844
|
+
const e = St([]);
|
|
1846
1845
|
return {
|
|
1847
1846
|
createInstance: (s, a) => {
|
|
1848
1847
|
const o = to();
|
|
1849
1848
|
o.initMap(s, a);
|
|
1850
|
-
const f = o.getInstall(),
|
|
1851
|
-
t.setProps(a),
|
|
1852
|
-
const n = io(f), m = so(f, n),
|
|
1853
|
-
Fo(o, t, n,
|
|
1854
|
-
const
|
|
1855
|
-
const
|
|
1849
|
+
const f = o.getInstall(), x = xo(f), t = bo();
|
|
1850
|
+
t.setProps(a), x.setShowLayerType(a.layerType), x.setGreenTileVisible(a.showGreenLayer);
|
|
1851
|
+
const n = io(f), m = so(f, n), h = wo(f), P = ko(f), S = Co(f, t), y = Lo(f, t), w = To(o);
|
|
1852
|
+
Fo(o, t, n, h, w, S);
|
|
1853
|
+
const L = () => {
|
|
1854
|
+
const b = f.getView().calculateExtent(o.getSize()), G = xe([b[0], b[1]], J.mercator, J.data), W = xe([b[2], b[3]], J.mercator, J.data);
|
|
1856
1855
|
return [G[0], G[1], W[0], W[1]];
|
|
1857
1856
|
}, p = {
|
|
1858
1857
|
id: Symbol("map-instance"),
|
|
@@ -1863,8 +1862,8 @@ const nt = (e, l) => {
|
|
|
1863
1862
|
},
|
|
1864
1863
|
methods: {
|
|
1865
1864
|
...o,
|
|
1866
|
-
layer:
|
|
1867
|
-
ship:
|
|
1865
|
+
layer: x,
|
|
1866
|
+
ship: h,
|
|
1868
1867
|
track: n,
|
|
1869
1868
|
carTrack: m,
|
|
1870
1869
|
port: {
|
|
@@ -1873,11 +1872,11 @@ const nt = (e, l) => {
|
|
|
1873
1872
|
selected: w.selected
|
|
1874
1873
|
},
|
|
1875
1874
|
position: P,
|
|
1876
|
-
drawLine:
|
|
1877
|
-
drawPolygon:
|
|
1875
|
+
drawLine: S,
|
|
1876
|
+
drawPolygon: y,
|
|
1878
1877
|
// 子模块
|
|
1879
1878
|
utils: {
|
|
1880
|
-
getCalculateExtent:
|
|
1879
|
+
getCalculateExtent: L,
|
|
1881
1880
|
convertSixHundredThousandToLatLng: Xe,
|
|
1882
1881
|
calculateCirclePoints: oo
|
|
1883
1882
|
}
|
|
@@ -1894,7 +1893,7 @@ const nt = (e, l) => {
|
|
|
1894
1893
|
},
|
|
1895
1894
|
getAllInstances: () => [...e]
|
|
1896
1895
|
};
|
|
1897
|
-
},
|
|
1896
|
+
}, No = { class: "zh-map-box" }, So = /* @__PURE__ */ Ae({
|
|
1898
1897
|
__name: "Map",
|
|
1899
1898
|
props: {
|
|
1900
1899
|
zoom: { default: ee.default },
|
|
@@ -1914,13 +1913,13 @@ const nt = (e, l) => {
|
|
|
1914
1913
|
} }
|
|
1915
1914
|
},
|
|
1916
1915
|
setup(e, { expose: l }) {
|
|
1917
|
-
const r = U(), s = U(), a = Po(), o = U(), f = e,
|
|
1916
|
+
const r = U(), s = U(), a = Po(), o = U(), f = e, x = U({
|
|
1918
1917
|
getInstall() {
|
|
1919
1918
|
}
|
|
1920
1919
|
});
|
|
1921
1920
|
return $t(() => {
|
|
1922
1921
|
var t;
|
|
1923
|
-
o.value = a.createInstance(r.value, f),
|
|
1922
|
+
o.value = a.createInstance(r.value, f), x.value = o.value.methods, (t = s.value) == null || t.setScaleLine(o.value.map, f.scaleLineUnit);
|
|
1924
1923
|
}), Vt(() => {
|
|
1925
1924
|
var t, n;
|
|
1926
1925
|
a.destroyInstance((t = o == null ? void 0 : o.value) == null ? void 0 : t.id), (n = o.value) == null || n.destroy();
|
|
@@ -2128,7 +2127,7 @@ const nt = (e, l) => {
|
|
|
2128
2127
|
return (m = o.value) == null ? void 0 : m.methods.utils.calculateCirclePoints(t, n);
|
|
2129
2128
|
}
|
|
2130
2129
|
}
|
|
2131
|
-
}), (t, n) => (We(), Ye("div",
|
|
2130
|
+
}), (t, n) => (We(), Ye("div", No, [
|
|
2132
2131
|
Ze("div", {
|
|
2133
2132
|
id: "map",
|
|
2134
2133
|
ref_key: "zhMapRef",
|
|
@@ -2145,7 +2144,7 @@ const nt = (e, l) => {
|
|
|
2145
2144
|
}, null, 8, ["map-instance"])
|
|
2146
2145
|
]));
|
|
2147
2146
|
}
|
|
2148
|
-
}), $o = /* @__PURE__ */ He(
|
|
2147
|
+
}), $o = /* @__PURE__ */ He(So, [["__scopeId", "data-v-5724a05d"]]), Do = jt($o);
|
|
2149
2148
|
export {
|
|
2150
2149
|
Do as Z
|
|
2151
2150
|
};
|