zhihao-ui 1.3.42-alpha.3 → 1.3.42-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/{Map-nqeFFCPD.js → Map-ChjHXNSF.js} +232 -218
- package/dist/es/index.js +1 -1
- package/dist/umd/index.umd.cjs +27 -27
- package/package.json +1 -1
|
@@ -76,30 +76,30 @@ function ro() {
|
|
|
76
76
|
var x;
|
|
77
77
|
return (x = s()) == null ? void 0 : x.getZoom();
|
|
78
78
|
}, i = (x) => {
|
|
79
|
-
var
|
|
80
|
-
(
|
|
81
|
-
}, o = (x,
|
|
82
|
-
var
|
|
83
|
-
(
|
|
79
|
+
var M;
|
|
80
|
+
(M = s()) == null || M.setZoom(x);
|
|
81
|
+
}, o = (x, M) => {
|
|
82
|
+
var V;
|
|
83
|
+
(V = s()) == null || V.setCenter(ee([x, M]));
|
|
84
84
|
}, f = () => {
|
|
85
|
-
var
|
|
86
|
-
const x = (
|
|
85
|
+
var M;
|
|
86
|
+
const x = (M = s()) == null ? void 0 : M.getCenter();
|
|
87
87
|
return At(x);
|
|
88
88
|
}, v = () => {
|
|
89
89
|
var x;
|
|
90
90
|
return (x = n()) == null ? void 0 : x.getSize();
|
|
91
|
-
}, t = new rt(), r = (x,
|
|
92
|
-
g(
|
|
93
|
-
const
|
|
94
|
-
zoom:
|
|
95
|
-
center: ee(
|
|
91
|
+
}, t = new rt(), r = (x, M) => {
|
|
92
|
+
g(M);
|
|
93
|
+
const V = {
|
|
94
|
+
zoom: M.zoom,
|
|
95
|
+
center: ee(M.center),
|
|
96
96
|
minZoom: re.min,
|
|
97
97
|
maxZoom: re.max,
|
|
98
98
|
constrainResolution: !0,
|
|
99
99
|
enableRotation: !1,
|
|
100
100
|
multiWorld: !0
|
|
101
101
|
};
|
|
102
|
-
let
|
|
102
|
+
let C = {
|
|
103
103
|
target: x,
|
|
104
104
|
controls: Dt({
|
|
105
105
|
zoom: !1
|
|
@@ -110,9 +110,9 @@ function ro() {
|
|
|
110
110
|
t.get("satelliteImgTile"),
|
|
111
111
|
t.get("satelliteImgTileMark")
|
|
112
112
|
],
|
|
113
|
-
view: new Zt(
|
|
113
|
+
view: new Zt(V)
|
|
114
114
|
};
|
|
115
|
-
const b = new rt(
|
|
115
|
+
const b = new rt(C);
|
|
116
116
|
e.value = b;
|
|
117
117
|
}, g = (x) => {
|
|
118
118
|
t.set("vectorTile", new we({
|
|
@@ -227,20 +227,20 @@ const st = (e) => {
|
|
|
227
227
|
if (!e || (console.log("vehicleInfo", g), !(g != null && g.lon && (g != null && g.lat)))) return;
|
|
228
228
|
const x = Math.abs(Number(g.lon)) > 180 ? Ue(g.lon, g.lat) : [g.lon, g.lat];
|
|
229
229
|
i(g, ee(x));
|
|
230
|
-
const
|
|
231
|
-
|
|
230
|
+
const M = e == null ? void 0 : e.getView(), V = new ce(x);
|
|
231
|
+
M.setCenter(Me(V.getCoordinates(), _.data, _.mercator));
|
|
232
232
|
}, i = (g, x) => {
|
|
233
|
-
const
|
|
233
|
+
const M = `${gt}map/car-icon.gif`;
|
|
234
234
|
s || (s = new de({
|
|
235
235
|
element: document.createElement("div"),
|
|
236
236
|
positioning: "center-center",
|
|
237
237
|
stopEvent: !1
|
|
238
238
|
// 允许交互事件穿透
|
|
239
239
|
}), e.addOverlay(s));
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
const
|
|
243
|
-
|
|
240
|
+
const V = s.getElement();
|
|
241
|
+
V.style.backgroundImage = `url(${M})`, V.style.width = "80px", V.style.height = "80px";
|
|
242
|
+
const C = (g == null ? void 0 : g.drc) || "";
|
|
243
|
+
V.style.transform = `rotate(${C}deg)`, V.style.backgroundSize = "cover", s == null || s.setPosition(x);
|
|
244
244
|
};
|
|
245
245
|
return {
|
|
246
246
|
location: l,
|
|
@@ -248,8 +248,8 @@ const st = (e) => {
|
|
|
248
248
|
const g = s == null ? void 0 : s.getElement();
|
|
249
249
|
g && (g.innerHTML = "");
|
|
250
250
|
},
|
|
251
|
-
renderTrack: (g, x,
|
|
252
|
-
n.render(g, x,
|
|
251
|
+
renderTrack: (g, x, M) => {
|
|
252
|
+
n.render(g, x, M, "truck", 1e3);
|
|
253
253
|
},
|
|
254
254
|
setCenter: (g) => {
|
|
255
255
|
n.setCenter(g);
|
|
@@ -273,10 +273,10 @@ const ao = (e) => {
|
|
|
273
273
|
positioning: "top-left",
|
|
274
274
|
className: "track-label-popup"
|
|
275
275
|
});
|
|
276
|
-
let t, r, g, x,
|
|
277
|
-
const
|
|
276
|
+
let t, r, g, x, M, V = !1, C = Date.now(), b, m = 0, k = null, T = 20;
|
|
277
|
+
const E = 8, D = [], W = (c) => {
|
|
278
278
|
var d;
|
|
279
|
-
for (D.unshift(c); D.length >
|
|
279
|
+
for (D.unshift(c); D.length > E; ) {
|
|
280
280
|
const h = D.pop(), p = n.get(h);
|
|
281
281
|
p && ((d = p.getSource()) == null || d.clear(), e == null || e.removeLayer(p), n.delete(h), delete s[h]);
|
|
282
282
|
}
|
|
@@ -298,7 +298,7 @@ const ao = (e) => {
|
|
|
298
298
|
}
|
|
299
299
|
return S.center = [S.lon, S.lat], S.centerPoint = so(S.center), S.time = dt(S.createdAt).format("YYYY-MM-DD HH:mm:ss"), S.id = c, S.index = Z, S;
|
|
300
300
|
}), h;
|
|
301
|
-
},
|
|
301
|
+
}, L = async (c, d, h, p = "ship", P = 200) => {
|
|
302
302
|
if (!e || JSON.stringify(s[c]) === JSON.stringify(d) && l === c || (d = d == null ? void 0 : d.reverse(), v && p === "ship" && (e != null && e.getOverlays().getArray().includes(v) || e.addOverlay(v)), (d == null ? void 0 : d.length) < 2))
|
|
303
303
|
return;
|
|
304
304
|
W(c), l = c, s[c] = d, T = P;
|
|
@@ -347,7 +347,7 @@ const ao = (e) => {
|
|
|
347
347
|
color: c,
|
|
348
348
|
width: 2
|
|
349
349
|
})
|
|
350
|
-
}),
|
|
350
|
+
}), z = (c, d, h) => {
|
|
351
351
|
try {
|
|
352
352
|
const p = c == null ? void 0 : c.get("data");
|
|
353
353
|
if (console.log("trackId-data", p), c && p && d === "hover") {
|
|
@@ -645,8 +645,8 @@ const ao = (e) => {
|
|
|
645
645
|
})
|
|
646
646
|
}), Lt = (c, d) => {
|
|
647
647
|
var N, q;
|
|
648
|
-
const h = Number(50 * d), p = ((N = c.frameState) == null ? void 0 : N.time) ?? Date.now(), P = p -
|
|
649
|
-
if (m = (m + h * P / 1e6) % 2,
|
|
648
|
+
const h = Number(50 * d), p = ((N = c.frameState) == null ? void 0 : N.time) ?? Date.now(), P = p - C;
|
|
649
|
+
if (m = (m + h * P / 1e6) % 2, C = p, m >= 1) {
|
|
650
650
|
Fe();
|
|
651
651
|
return;
|
|
652
652
|
}
|
|
@@ -665,11 +665,11 @@ const ao = (e) => {
|
|
|
665
665
|
U.setStyle(Ge), U.drawGeometry(x), e == null || e.render();
|
|
666
666
|
}, Et = () => {
|
|
667
667
|
var c;
|
|
668
|
-
|
|
668
|
+
V = !0, C = Date.now(), m = 0, x = ((c = g.getGeometry()) == null ? void 0 : c.clone()) || new ce([0, 0]), o && (b == null || b.on("postrender", o)), M == null || M.setGeometry(void 0);
|
|
669
669
|
}, Fe = () => {
|
|
670
|
-
|
|
670
|
+
V && (V = !1, M == null || M.setGeometry(void 0), o && b && b.un("postrender", o), b && (e == null || e.removeLayer(b)), b = null, M = null);
|
|
671
671
|
}, Tt = (c, d) => {
|
|
672
|
-
|
|
672
|
+
V && Fe(), t = new nt({
|
|
673
673
|
factor: 1e6
|
|
674
674
|
}).writeGeometry(new ze(c)), r = new nt({
|
|
675
675
|
factor: 1e6
|
|
@@ -681,13 +681,13 @@ const ao = (e) => {
|
|
|
681
681
|
geometry: new ce(r.getFirstCoordinate())
|
|
682
682
|
});
|
|
683
683
|
const h = g.getGeometry();
|
|
684
|
-
x = h ? h.clone() : new ce([0, 0]),
|
|
684
|
+
x = h ? h.clone() : new ce([0, 0]), M = new ae({
|
|
685
685
|
type: "geoMarker",
|
|
686
686
|
style: Ge,
|
|
687
687
|
geometry: x
|
|
688
688
|
}), b = new ye({
|
|
689
689
|
source: new ge({
|
|
690
|
-
features: [
|
|
690
|
+
features: [M]
|
|
691
691
|
})
|
|
692
692
|
}), e == null || e.addLayer(b), o = (p) => Lt(p, d), Et();
|
|
693
693
|
}, tt = (c, d, h) => {
|
|
@@ -739,13 +739,13 @@ const ao = (e) => {
|
|
|
739
739
|
return U < 0 ? 360 + U : U;
|
|
740
740
|
};
|
|
741
741
|
return {
|
|
742
|
-
render:
|
|
742
|
+
render: L,
|
|
743
743
|
remove: bt,
|
|
744
744
|
play: Mt,
|
|
745
745
|
setCenter: et,
|
|
746
746
|
close: kt,
|
|
747
747
|
getLength: pt,
|
|
748
|
-
handleTrackMapEvent:
|
|
748
|
+
handleTrackMapEvent: z,
|
|
749
749
|
reRenderTrackLine: j
|
|
750
750
|
};
|
|
751
751
|
};
|
|
@@ -1007,39 +1007,39 @@ function xo(e, n, s = "left-bottom", l = 2) {
|
|
|
1007
1007
|
const o = pe, f = Be;
|
|
1008
1008
|
if (!f) return "";
|
|
1009
1009
|
o.width = 0, o.height = 0;
|
|
1010
|
-
const v = 2, t = 8, r = 16, g = window.devicePixelRatio || 1, x = "500 12px Arial",
|
|
1010
|
+
const v = 2, t = 8, r = 16, g = window.devicePixelRatio || 1, x = "500 12px Arial", M = "14px map-iconfont";
|
|
1011
1011
|
f.font = x;
|
|
1012
|
-
const
|
|
1013
|
-
f.font =
|
|
1014
|
-
const b = n.map((w) => ({ width: f.measureText(he(w)).width, height: 14 })), m = b.reduce((w,
|
|
1015
|
-
let D, W, A = 0, H = 0, j = 0, F = 0,
|
|
1012
|
+
const C = f.measureText(e).width;
|
|
1013
|
+
f.font = M;
|
|
1014
|
+
const b = n.map((w) => ({ width: f.measureText(he(w)).width, height: 14 })), m = b.reduce((w, z) => w + z.width, 0), k = (n.length - 1) * l, T = t + C + m + k + t, E = v + 14 + v;
|
|
1015
|
+
let D, W, A = 0, H = 0, j = 0, F = 0, L = 0, $ = 0;
|
|
1016
1016
|
switch (D = r + T, s) {
|
|
1017
1017
|
case "right-top":
|
|
1018
|
-
W = r +
|
|
1018
|
+
W = r + E, A = 0, H = r + E, j = r, F = 0, L = r, $ = 0;
|
|
1019
1019
|
break;
|
|
1020
1020
|
case "right-middle":
|
|
1021
|
-
W =
|
|
1021
|
+
W = E, A = 0, H = E / 2, j = r, F = E / 2, L = r, $ = 0;
|
|
1022
1022
|
break;
|
|
1023
1023
|
case "right-bottom":
|
|
1024
|
-
W = r +
|
|
1024
|
+
W = r + E, A = 0, H = 0, j = r, F = r, L = r, $ = r;
|
|
1025
1025
|
break;
|
|
1026
1026
|
case "left-top":
|
|
1027
|
-
W = r +
|
|
1027
|
+
W = r + E, A = T, H = r, j = T + r, F = E + r, L = 0, $ = 0;
|
|
1028
1028
|
break;
|
|
1029
1029
|
case "left-middle":
|
|
1030
|
-
W =
|
|
1030
|
+
W = E, A = T, H = E / 2, j = T + r, F = E / 2, L = 0, $ = 0;
|
|
1031
1031
|
break;
|
|
1032
1032
|
case "left-bottom":
|
|
1033
|
-
W = r +
|
|
1033
|
+
W = r + E, A = T, H = E, j = T + r, F = 0, L = 0, $ = r;
|
|
1034
1034
|
break;
|
|
1035
1035
|
}
|
|
1036
|
-
W = W + v, o.width = Math.round(D * g), o.height = Math.round(W * g), f.scale(g, g), f.clearRect(0, 0, D, W), f.beginPath(), f.moveTo(A, H), f.lineTo(j, F), f.strokeStyle = "#FFF", f.lineWidth = 1, f.stroke(), f.fillStyle = "#FFF", f.fillRect(
|
|
1037
|
-
const a = $ + v +
|
|
1038
|
-
f.strokeStyle = "#ffffff", f.lineWidth = 1, f.strokeText(e,
|
|
1039
|
-
let y =
|
|
1040
|
-
n.length > 0 && n.forEach((w,
|
|
1041
|
-
const G = $ + v +
|
|
1042
|
-
f.fillText(he(w), y, G), y += b[
|
|
1036
|
+
W = W + v, o.width = Math.round(D * g), o.height = Math.round(W * g), f.scale(g, g), f.clearRect(0, 0, D, W), f.beginPath(), f.moveTo(A, H), f.lineTo(j, F), f.strokeStyle = "#FFF", f.lineWidth = 1, f.stroke(), f.fillStyle = "#FFF", f.fillRect(L, $, T, E), f.font = x, f.textBaseline = "middle";
|
|
1037
|
+
const a = $ + v + E / 2;
|
|
1038
|
+
f.strokeStyle = "#ffffff", f.lineWidth = 1, f.strokeText(e, L + t, a), f.fillStyle = "#000000", f.fillText(e, L + t, a), f.font = M, f.fillStyle = "#3370ff";
|
|
1039
|
+
let y = L + t + C + l;
|
|
1040
|
+
n.length > 0 && n.forEach((w, z) => {
|
|
1041
|
+
const G = $ + v + E / 2;
|
|
1042
|
+
f.fillText(he(w), y, G), y += b[z].width + l;
|
|
1043
1043
|
});
|
|
1044
1044
|
const u = o.toDataURL("image/png");
|
|
1045
1045
|
return Ye.set(i, u), u;
|
|
@@ -1107,8 +1107,8 @@ const at = (e, n) => {
|
|
|
1107
1107
|
const u = a.filter((w) => w.id === y);
|
|
1108
1108
|
u.length === 0 ? a.push(s) : s = u[0];
|
|
1109
1109
|
}
|
|
1110
|
-
m(), $(a),
|
|
1111
|
-
},
|
|
1110
|
+
m(), $(a), V(), D();
|
|
1111
|
+
}, M = (a) => {
|
|
1112
1112
|
var R;
|
|
1113
1113
|
const y = (s == null ? void 0 : s.id) || (n == null ? void 0 : n.get("id")), u = ee([a == null ? void 0 : a.lon, a == null ? void 0 : a.lat]), w = ((R = g[a.id]) == null ? void 0 : R.blinkColors) || [], G = w[w.length - 1] || a.fill || "#04C900", B = go(a), J = new ae({
|
|
1114
1114
|
geometry: new ce(u),
|
|
@@ -1127,7 +1127,7 @@ const at = (e, n) => {
|
|
|
1127
1127
|
isHighlight: !1
|
|
1128
1128
|
});
|
|
1129
1129
|
return J.set("clickGeometry", new Ht(u)), J;
|
|
1130
|
-
},
|
|
1130
|
+
}, V = async () => {
|
|
1131
1131
|
if (!s || !e) return;
|
|
1132
1132
|
let y = e.getOverlays().getArray().find((u) => u.get("class") == "ship-overlay-selected");
|
|
1133
1133
|
if (y) {
|
|
@@ -1139,7 +1139,7 @@ const at = (e, n) => {
|
|
|
1139
1139
|
var u;
|
|
1140
1140
|
y && ((u = y.get("element")) != null && u.parentElement) && (y.get("element").parentElement.style.display = "block");
|
|
1141
1141
|
}, 20);
|
|
1142
|
-
},
|
|
1142
|
+
}, C = (a) => {
|
|
1143
1143
|
if (a === "start") {
|
|
1144
1144
|
const y = () => {
|
|
1145
1145
|
l.getFeatures().forEach((u) => {
|
|
@@ -1152,11 +1152,11 @@ const at = (e, n) => {
|
|
|
1152
1152
|
}, b = () => {
|
|
1153
1153
|
const y = (e == null ? void 0 : e.getOverlays().getArray()).find((u) => u.get("class") == "ship-overlay-selected");
|
|
1154
1154
|
if (y) {
|
|
1155
|
-
const u = y.getElement(), w = Ie(e, s, "ship"),
|
|
1156
|
-
console.log(
|
|
1155
|
+
const u = y.getElement(), w = Ie(e, s, "ship"), z = u.querySelector("svg");
|
|
1156
|
+
console.log(z), z && (z.style.transform = `scale(${w})`);
|
|
1157
1157
|
}
|
|
1158
1158
|
}, m = () => {
|
|
1159
|
-
e && l && (k(), l.clear(), o.clear(),
|
|
1159
|
+
e && l && (k(), l.clear(), o.clear(), C("end"));
|
|
1160
1160
|
}, k = (a) => {
|
|
1161
1161
|
const y = e.getOverlays().getArray().filter((u) => u.get("class") == "zh-map-ship-overlay");
|
|
1162
1162
|
if (y && y.length > 0) {
|
|
@@ -1169,21 +1169,21 @@ const at = (e, n) => {
|
|
|
1169
1169
|
}, T = (a, y) => {
|
|
1170
1170
|
r = a, g = y;
|
|
1171
1171
|
const u = e.getOverlays().getArray(), w = l.getFeatures();
|
|
1172
|
-
for (const
|
|
1173
|
-
const G = r[
|
|
1172
|
+
for (const z in r) {
|
|
1173
|
+
const G = r[z], B = u.find((R) => R.getId() === "label-" + z), J = w.find((R) => z === R.get("id"));
|
|
1174
1174
|
if (B && J) {
|
|
1175
|
-
const R = y[
|
|
1175
|
+
const R = y[z].blinkColors || [], { shipData: ue, name: le, color: se } = J.getProperties();
|
|
1176
1176
|
J.set("blinking", G), R[(R == null ? void 0 : R.length) - 1] && se !== R[(R == null ? void 0 : R.length) - 1] && (J.set("color", R[(R == null ? void 0 : R.length) - 1] || ""), J.setStyle(me(e, J)));
|
|
1177
1177
|
const Ae = {
|
|
1178
1178
|
...ue,
|
|
1179
1179
|
blinking: G,
|
|
1180
1180
|
blinkingColors: R || [],
|
|
1181
|
-
name: le + "(" + y[
|
|
1181
|
+
name: le + "(" + y[z].shipState + ")"
|
|
1182
1182
|
}, Ee = B.getElement(), Te = yt(Ae);
|
|
1183
1183
|
Ee && Ee !== Te && B.setElement(Te);
|
|
1184
1184
|
}
|
|
1185
1185
|
}
|
|
1186
|
-
},
|
|
1186
|
+
}, E = () => {
|
|
1187
1187
|
const a = e.getOverlays().getArray();
|
|
1188
1188
|
if (r)
|
|
1189
1189
|
for (const y in r) {
|
|
@@ -1205,12 +1205,12 @@ const at = (e, n) => {
|
|
|
1205
1205
|
}
|
|
1206
1206
|
}, W = (a) => {
|
|
1207
1207
|
if (!e) return;
|
|
1208
|
-
const y = l.getFeatures(), u = o.getFeatures(), w = n ? n.get("id") : "",
|
|
1208
|
+
const y = l.getFeatures(), u = o.getFeatures(), w = n ? n.get("id") : "", z = y.filter((R) => R.get("id") !== w), G = u == null ? void 0 : u.filter((R) => R.get("id") !== w), B = /* @__PURE__ */ new Map();
|
|
1209
1209
|
a.forEach((R) => {
|
|
1210
1210
|
B.set(R.id, !0);
|
|
1211
1211
|
});
|
|
1212
1212
|
const J = e.getOverlays().getArray();
|
|
1213
|
-
|
|
1213
|
+
z.forEach((R) => {
|
|
1214
1214
|
const ue = R.get("id");
|
|
1215
1215
|
if (!B.has(ue))
|
|
1216
1216
|
R.setStyle([]);
|
|
@@ -1233,15 +1233,15 @@ const at = (e, n) => {
|
|
|
1233
1233
|
if (a) {
|
|
1234
1234
|
console.log("选中", a);
|
|
1235
1235
|
const y = l.getFeatures().find((w) => w.get("id") === a.id), u = o.getFeatures().find((w) => w.get("id") === a.id);
|
|
1236
|
-
y && (n = y), u && u.set("selected", !0), s = a,
|
|
1236
|
+
y && (n = y), u && u.set("selected", !0), s = a, V();
|
|
1237
1237
|
} else
|
|
1238
1238
|
console.log("取消选中"), s = null, n = null, F();
|
|
1239
1239
|
}, H = Re((a, y, u) => {
|
|
1240
1240
|
try {
|
|
1241
1241
|
if (a) {
|
|
1242
|
-
const w = a.get("shipData"),
|
|
1243
|
-
if (e.getTargetElement().style.cursor =
|
|
1244
|
-
t && t !==
|
|
1242
|
+
const w = a.get("shipData"), z = a.get("id");
|
|
1243
|
+
if (e.getTargetElement().style.cursor = z ? "pointer" : "", y === "click" && (A(w), u && u(z)), y === "hover") {
|
|
1244
|
+
t && t !== z && j(), t = z;
|
|
1245
1245
|
const G = l.getFeatures().find((B) => B.get("id") === t);
|
|
1246
1246
|
G == null || G.set("isHighlight", !0), G == null || G.setStyle(me(e, G));
|
|
1247
1247
|
}
|
|
@@ -1260,7 +1260,7 @@ const at = (e, n) => {
|
|
|
1260
1260
|
} catch (a) {
|
|
1261
1261
|
console.log(a);
|
|
1262
1262
|
}
|
|
1263
|
-
},
|
|
1263
|
+
}, L = (a, y) => {
|
|
1264
1264
|
const u = ee([a == null ? void 0 : a.lon, a == null ? void 0 : a.lat]), w = new ae({
|
|
1265
1265
|
geometry: new ce(u),
|
|
1266
1266
|
name: a.cnname || a.enname || a.name || a.id || "未命名船舶",
|
|
@@ -1270,16 +1270,16 @@ const at = (e, n) => {
|
|
|
1270
1270
|
shipData: a
|
|
1271
1271
|
});
|
|
1272
1272
|
w.set("id", a.id);
|
|
1273
|
-
const
|
|
1274
|
-
return w.setStyle(
|
|
1273
|
+
const z = at(w, y);
|
|
1274
|
+
return w.setStyle(z), w;
|
|
1275
1275
|
}, $ = (a) => {
|
|
1276
1276
|
const y = e.getView().getZoom();
|
|
1277
1277
|
a.forEach((u) => {
|
|
1278
|
-
const w =
|
|
1278
|
+
const w = M(u);
|
|
1279
1279
|
if (w.setStyle(me(e, w)), l.addFeature(w), (s == null ? void 0 : s.id) == u.id || y >= re.shipModelMin)
|
|
1280
1280
|
if (r[u.id]) {
|
|
1281
1281
|
if (u.id && g[u == null ? void 0 : u.id]) {
|
|
1282
|
-
const
|
|
1282
|
+
const z = g[u == null ? void 0 : u.id] || {}, G = (z == null ? void 0 : z.blinkColors) || [], B = (z == null ? void 0 : z.shipState) || "", J = (u.cnname || u.enname || u.name || u.id || "未命名船舶") + "(" + B + ")", R = {
|
|
1283
1283
|
...u,
|
|
1284
1284
|
name: J,
|
|
1285
1285
|
blinking: r[u.id],
|
|
@@ -1288,8 +1288,8 @@ const at = (e, n) => {
|
|
|
1288
1288
|
yo(e, R);
|
|
1289
1289
|
}
|
|
1290
1290
|
} else {
|
|
1291
|
-
const
|
|
1292
|
-
o.addFeature(
|
|
1291
|
+
const z = L(u, a.length);
|
|
1292
|
+
o.addFeature(z);
|
|
1293
1293
|
}
|
|
1294
1294
|
});
|
|
1295
1295
|
};
|
|
@@ -1300,9 +1300,9 @@ const at = (e, n) => {
|
|
|
1300
1300
|
blinking: T,
|
|
1301
1301
|
clear: m,
|
|
1302
1302
|
handleShipMapEvent: H,
|
|
1303
|
-
changeShipScale:
|
|
1303
|
+
changeShipScale: C,
|
|
1304
1304
|
changeSelectedScale: b,
|
|
1305
|
-
hiddenShipBlink:
|
|
1305
|
+
hiddenShipBlink: E,
|
|
1306
1306
|
showShipBlink: D
|
|
1307
1307
|
};
|
|
1308
1308
|
}, ko = (e) => {
|
|
@@ -1350,13 +1350,13 @@ const at = (e, n) => {
|
|
|
1350
1350
|
}, Mo = (e) => {
|
|
1351
1351
|
const n = "zh-map-location-layer";
|
|
1352
1352
|
let s, l, i = null, o = null;
|
|
1353
|
-
const f = (
|
|
1354
|
-
if (!(!
|
|
1353
|
+
const f = (C) => {
|
|
1354
|
+
if (!(!C || C.length === 0)) {
|
|
1355
1355
|
if (l || (l = new ge()), l.clear(), o) {
|
|
1356
|
-
const b =
|
|
1357
|
-
b ? o = b :
|
|
1356
|
+
const b = C.find((m) => m.id === o.id);
|
|
1357
|
+
b ? o = b : C.push(o);
|
|
1358
1358
|
}
|
|
1359
|
-
|
|
1359
|
+
C.forEach((b) => {
|
|
1360
1360
|
v(b);
|
|
1361
1361
|
}), s || (s = new ye({
|
|
1362
1362
|
className: n,
|
|
@@ -1364,20 +1364,20 @@ const at = (e, n) => {
|
|
|
1364
1364
|
zIndex: 100
|
|
1365
1365
|
}), e == null || e.addLayer(s));
|
|
1366
1366
|
}
|
|
1367
|
-
}, v = (
|
|
1368
|
-
const b = e == null ? void 0 : e.getView().getZoom(), [m, k] =
|
|
1367
|
+
}, v = (C) => {
|
|
1368
|
+
const b = e == null ? void 0 : e.getView().getZoom(), [m, k] = C.latLon.split(","), T = new ae({
|
|
1369
1369
|
geometry: new ce(ee([Number(m), Number(k)]))
|
|
1370
1370
|
});
|
|
1371
|
-
T.setStyle(t(
|
|
1372
|
-
}, t = (
|
|
1371
|
+
T.setStyle(t(C, b, C.id === (o == null ? void 0 : o.id))), T.set("loactionData", C), l.addFeature(T);
|
|
1372
|
+
}, t = (C, b, m) => {
|
|
1373
1373
|
const k = {
|
|
1374
1374
|
image: new Ce({
|
|
1375
|
-
src: m &&
|
|
1375
|
+
src: m && C.selectedPath || C.defaultPath,
|
|
1376
1376
|
scale: 0.5 * b / 10
|
|
1377
1377
|
})
|
|
1378
1378
|
};
|
|
1379
|
-
return
|
|
1380
|
-
text:
|
|
1379
|
+
return C.name && (k.text = new be({
|
|
1380
|
+
text: C.name,
|
|
1381
1381
|
font: "12px sans-serif",
|
|
1382
1382
|
fill: new te({
|
|
1383
1383
|
color: "#000000"
|
|
@@ -1389,29 +1389,29 @@ const at = (e, n) => {
|
|
|
1389
1389
|
})), new Q(k);
|
|
1390
1390
|
}, r = () => {
|
|
1391
1391
|
if (i) {
|
|
1392
|
-
const
|
|
1392
|
+
const C = i.get("loactionData").id;
|
|
1393
1393
|
l.getFeatures().forEach((b) => {
|
|
1394
|
-
b.get("loactionData").id !==
|
|
1394
|
+
b.get("loactionData").id !== C && l.removeFeature(b);
|
|
1395
1395
|
});
|
|
1396
1396
|
} else
|
|
1397
1397
|
l.clear();
|
|
1398
1398
|
}, g = () => {
|
|
1399
1399
|
var k;
|
|
1400
|
-
const
|
|
1400
|
+
const C = i.get("loactionData"), b = (k = e == null ? void 0 : e.getView()) == null ? void 0 : k.getZoom();
|
|
1401
1401
|
l.getFeatures().forEach((T) => {
|
|
1402
|
-
T.get("loactionData").id ===
|
|
1402
|
+
T.get("loactionData").id === C.id && (T == null || T.setStyle(t(C, b, !1)));
|
|
1403
1403
|
}), o = null, i = null;
|
|
1404
|
-
}, x = (
|
|
1405
|
-
|
|
1406
|
-
},
|
|
1407
|
-
var
|
|
1404
|
+
}, x = (C) => {
|
|
1405
|
+
C ? (M(), V(C)) : clearSelectedPort();
|
|
1406
|
+
}, M = () => {
|
|
1407
|
+
var C;
|
|
1408
1408
|
if (i) {
|
|
1409
|
-
const b = i.get("loactionData"), m = (
|
|
1409
|
+
const b = i.get("loactionData"), m = (C = e == null ? void 0 : e.getView()) == null ? void 0 : C.getZoom();
|
|
1410
1410
|
i.setStyle(t(b, m, !1));
|
|
1411
1411
|
}
|
|
1412
|
-
},
|
|
1412
|
+
}, V = (C) => {
|
|
1413
1413
|
const b = l.getFeatures();
|
|
1414
|
-
o =
|
|
1414
|
+
o = C, i = b.find((m) => m.get("loactionData").id === C.id);
|
|
1415
1415
|
};
|
|
1416
1416
|
return {
|
|
1417
1417
|
render: f,
|
|
@@ -1436,7 +1436,7 @@ const at = (e, n) => {
|
|
|
1436
1436
|
};
|
|
1437
1437
|
let o;
|
|
1438
1438
|
const f = oe(!1), v = () => {
|
|
1439
|
-
Le(e, "crosshair"), g(), Co(e), e.on("pointermove",
|
|
1439
|
+
Le(e, "crosshair"), g(), Co(e), e.on("pointermove", V), e.getViewport().addEventListener("mouseout", () => {
|
|
1440
1440
|
o && o.classList.add("hidden");
|
|
1441
1441
|
}), b(), f.value = !0;
|
|
1442
1442
|
};
|
|
@@ -1454,16 +1454,16 @@ const at = (e, n) => {
|
|
|
1454
1454
|
}
|
|
1455
1455
|
}), e == null || e.addLayer(r);
|
|
1456
1456
|
};
|
|
1457
|
-
let x,
|
|
1458
|
-
const
|
|
1457
|
+
let x, M;
|
|
1458
|
+
const V = (F) => {
|
|
1459
1459
|
if (F.dragging)
|
|
1460
1460
|
return;
|
|
1461
|
-
let
|
|
1462
|
-
x && (
|
|
1461
|
+
let L = "点击选择起点";
|
|
1462
|
+
x && (L = "单击继续,双击结束"), o && (o.innerHTML = L, M.setPosition(F.coordinate), o.classList.remove("hidden"));
|
|
1463
1463
|
};
|
|
1464
|
-
let
|
|
1464
|
+
let C;
|
|
1465
1465
|
const b = () => {
|
|
1466
|
-
|
|
1466
|
+
C = new Oe({
|
|
1467
1467
|
source: t,
|
|
1468
1468
|
type: "LineString",
|
|
1469
1469
|
style: new Q({
|
|
@@ -1486,33 +1486,33 @@ const at = (e, n) => {
|
|
|
1486
1486
|
})
|
|
1487
1487
|
}),
|
|
1488
1488
|
// 添加条件函数,判断是否应该出发点绘制
|
|
1489
|
-
condition: (
|
|
1490
|
-
}), e == null || e.addInteraction(
|
|
1489
|
+
condition: (L) => L.originalEvent.target.tagName !== "DIV"
|
|
1490
|
+
}), e == null || e.addInteraction(C), E(), D();
|
|
1491
1491
|
let F;
|
|
1492
|
-
|
|
1492
|
+
C.on("drawstart", function(L) {
|
|
1493
1493
|
var a;
|
|
1494
|
-
x =
|
|
1494
|
+
x = L.feature, x.set("randomId", m());
|
|
1495
1495
|
let $;
|
|
1496
1496
|
F = (a = x.getGeometry()) == null ? void 0 : a.on("change", function(y) {
|
|
1497
1497
|
const u = y.target, w = mt(u, l.value);
|
|
1498
1498
|
$ = u.getLastCoordinate(), k && w && (k.innerHTML = w), T.setPosition($);
|
|
1499
1499
|
});
|
|
1500
|
-
}),
|
|
1501
|
-
var
|
|
1500
|
+
}), C.on("drawend", function() {
|
|
1501
|
+
var L, $, a;
|
|
1502
1502
|
if (k && (k.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), k != null && k.innerHTML) {
|
|
1503
1503
|
const y = (x == null ? void 0 : x.get("randomId")) || m();
|
|
1504
1504
|
s.value.push({ id: y, value: k == null ? void 0 : k.innerHTML }), k.innerHTML = `${k.innerHTML}<div class="ol-tooltip-delete-button" data-id="${y}"><i class="map-iconfont icon-delete"></i></div>`;
|
|
1505
1505
|
}
|
|
1506
|
-
(
|
|
1506
|
+
(L = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || L.addEventListener("click", (y) => {
|
|
1507
1507
|
var w;
|
|
1508
1508
|
y.preventDefault(), y.stopPropagation();
|
|
1509
1509
|
const u = (w = y.target) == null ? void 0 : w.getAttribute("data-id");
|
|
1510
1510
|
u && A(u);
|
|
1511
|
-
}), T.setOffset([0, -7]), x = null, k = null,
|
|
1511
|
+
}), T.setOffset([0, -7]), x = null, k = null, E(), F && Xe(F), (a = ($ = n.getProps()) == null ? void 0 : $.lineDrawEnd) == null || a.call($, s.value);
|
|
1512
1512
|
});
|
|
1513
1513
|
}, m = () => Math.random().toString(36).substring(2, 9);
|
|
1514
1514
|
let k, T;
|
|
1515
|
-
const
|
|
1515
|
+
const E = () => {
|
|
1516
1516
|
k != null && k.parentNode && k.parentNode.removeChild(k), k = document.createElement("div"), k.className = "ol-tooltip ol-tooltip-measure", T = new de({
|
|
1517
1517
|
element: k,
|
|
1518
1518
|
offset: [0, -15],
|
|
@@ -1521,36 +1521,36 @@ const at = (e, n) => {
|
|
|
1521
1521
|
insertFirst: !1
|
|
1522
1522
|
}), e == null || e.addOverlay(T);
|
|
1523
1523
|
}, D = () => {
|
|
1524
|
-
o != null && o.parentNode && o.parentNode.removeChild(o), o = document.createElement("div"), o.className = "ol-tooltip hidden",
|
|
1524
|
+
o != null && o.parentNode && o.parentNode.removeChild(o), o = document.createElement("div"), o.className = "ol-tooltip hidden", M = new de({
|
|
1525
1525
|
element: o,
|
|
1526
1526
|
offset: [15, 0],
|
|
1527
1527
|
positioning: "center-left"
|
|
1528
|
-
}), e == null || e.addOverlay(
|
|
1528
|
+
}), e == null || e.addOverlay(M);
|
|
1529
1529
|
}, W = () => {
|
|
1530
|
-
s.value.forEach((F,
|
|
1530
|
+
s.value.forEach((F, L) => {
|
|
1531
1531
|
var y, u;
|
|
1532
1532
|
const $ = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1533
|
-
$[
|
|
1533
|
+
$[L] && ((u = (y = $[L]) == null ? void 0 : y.parentNode) == null || u.removeChild($[L]));
|
|
1534
1534
|
const a = t.getFeatures();
|
|
1535
|
-
a[
|
|
1535
|
+
a[L] && t.removeFeature(a[L]);
|
|
1536
1536
|
}), H(), Lo(e), f.value = !1, Le(e, "pointer");
|
|
1537
1537
|
}, A = (F) => {
|
|
1538
1538
|
var $, a, y, u;
|
|
1539
|
-
const
|
|
1540
|
-
if (
|
|
1541
|
-
s.value.splice(
|
|
1539
|
+
const L = s.value.findIndex((w) => w.id === F);
|
|
1540
|
+
if (L !== -1) {
|
|
1541
|
+
s.value.splice(L, 1);
|
|
1542
1542
|
const w = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1543
|
-
w[
|
|
1544
|
-
const
|
|
1545
|
-
|
|
1543
|
+
w[L] && ((a = ($ = w[L]) == null ? void 0 : $.parentNode) == null || a.removeChild(w[L]));
|
|
1544
|
+
const z = t.getFeatures();
|
|
1545
|
+
z[L] && t.removeFeature(z[L]);
|
|
1546
1546
|
}
|
|
1547
1547
|
(u = (y = n.getProps()) == null ? void 0 : y.lineDrawEnd) == null || u.call(y, s.value);
|
|
1548
1548
|
}, H = () => {
|
|
1549
1549
|
if (s.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((F) => {
|
|
1550
|
-
var
|
|
1551
|
-
(
|
|
1552
|
-
}), t == null || t.clear(),
|
|
1553
|
-
const F = e.getInteractions().getArray().find((
|
|
1550
|
+
var L;
|
|
1551
|
+
(L = F == null ? void 0 : F.parentNode) == null || L.removeChild(F);
|
|
1552
|
+
}), t == null || t.clear(), C) {
|
|
1553
|
+
const F = e.getInteractions().getArray().find((L) => lt(L) === lt(C));
|
|
1554
1554
|
F && e.removeInteraction(F);
|
|
1555
1555
|
}
|
|
1556
1556
|
e.removeLayer(r), o != null && o.parentNode && o.parentNode.removeChild(o), k != null && k.parentNode && k.parentNode.removeChild(k);
|
|
@@ -1582,12 +1582,12 @@ const at = (e, n) => {
|
|
|
1582
1582
|
const o = () => {
|
|
1583
1583
|
H(), i = "open", f(), Le(e, "crosshair");
|
|
1584
1584
|
}, f = () => {
|
|
1585
|
-
r(), T(), W(),
|
|
1585
|
+
r(), T(), W(), C();
|
|
1586
1586
|
};
|
|
1587
1587
|
let v = null, t = null;
|
|
1588
1588
|
const r = () => {
|
|
1589
1589
|
if (v && t) return;
|
|
1590
|
-
const F = new ge(),
|
|
1590
|
+
const F = new ge(), L = new ye({
|
|
1591
1591
|
source: F,
|
|
1592
1592
|
style: new Q({
|
|
1593
1593
|
stroke: new ve({
|
|
@@ -1597,25 +1597,25 @@ const at = (e, n) => {
|
|
|
1597
1597
|
}),
|
|
1598
1598
|
zIndex: 1e3
|
|
1599
1599
|
});
|
|
1600
|
-
v =
|
|
1601
|
-
|
|
1600
|
+
v = L, t = F, e.on("pointermove", x), e.addLayer(L), e.on(["dblclick"], function($) {
|
|
1601
|
+
M && ($.stopPropagation(), $.preventDefault());
|
|
1602
1602
|
});
|
|
1603
1603
|
};
|
|
1604
1604
|
let g;
|
|
1605
1605
|
const x = (F) => {
|
|
1606
1606
|
if (F.dragging) return;
|
|
1607
|
-
const
|
|
1608
|
-
|
|
1607
|
+
const L = g ? "单击继续,双击结束" : "点击选择起点";
|
|
1608
|
+
E && (E.innerHTML = L, D.setPosition(F.coordinate));
|
|
1609
1609
|
};
|
|
1610
|
-
let
|
|
1611
|
-
const
|
|
1610
|
+
let M, V = !1;
|
|
1611
|
+
const C = () => {
|
|
1612
1612
|
if (s) {
|
|
1613
|
-
|
|
1613
|
+
E != null && E.parentNode && E.parentNode.removeChild(E);
|
|
1614
1614
|
const F = s.getGeometry();
|
|
1615
1615
|
if (!F) return;
|
|
1616
|
-
const
|
|
1616
|
+
const L = b(F, "nm");
|
|
1617
1617
|
m && (m.innerHTML = `
|
|
1618
|
-
<span class="text">面积:${
|
|
1618
|
+
<span class="text">面积:${L}${V ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1619
1619
|
`), m && (m.innerHTML += '<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');
|
|
1620
1620
|
const $ = F.getCoordinates(), a = $[0][$[0].length - 2];
|
|
1621
1621
|
if (k.setPosition(a), v) {
|
|
@@ -1625,15 +1625,15 @@ const at = (e, n) => {
|
|
|
1625
1625
|
setTimeout(() => {
|
|
1626
1626
|
var u;
|
|
1627
1627
|
(u = document.querySelector(".delete-icon")) == null || u.addEventListener("click", () => {
|
|
1628
|
-
var w,
|
|
1629
|
-
console.log("delete"), A(), (
|
|
1628
|
+
var w, z;
|
|
1629
|
+
console.log("delete"), A(), (z = (w = n.getProps()) == null ? void 0 : w.areaDrawEnd) == null || z.call(w, []);
|
|
1630
1630
|
});
|
|
1631
1631
|
}, 0);
|
|
1632
1632
|
const y = jt(s.getGeometry().getExtent());
|
|
1633
1633
|
e == null || e.getView().setCenter(y);
|
|
1634
1634
|
return;
|
|
1635
1635
|
}
|
|
1636
|
-
|
|
1636
|
+
M = new Oe({
|
|
1637
1637
|
type: "Polygon",
|
|
1638
1638
|
source: t,
|
|
1639
1639
|
trace: !0,
|
|
@@ -1654,28 +1654,28 @@ const at = (e, n) => {
|
|
|
1654
1654
|
})
|
|
1655
1655
|
}),
|
|
1656
1656
|
geometry: function(F) {
|
|
1657
|
-
const
|
|
1658
|
-
return new Qt(
|
|
1657
|
+
const L = F.getGeometry().getCoordinates();
|
|
1658
|
+
return new Qt(L);
|
|
1659
1659
|
}
|
|
1660
1660
|
})]
|
|
1661
|
-
}), e == null || e.addInteraction(
|
|
1662
|
-
var
|
|
1663
|
-
g = F.feature, l = (
|
|
1664
|
-
const a = $.target, y = b(a, "nm"), w = a.getCoordinates()[0],
|
|
1665
|
-
if (
|
|
1661
|
+
}), e == null || e.addInteraction(M), M.on("drawstart", (F) => {
|
|
1662
|
+
var L;
|
|
1663
|
+
g = F.feature, l = (L = g.getGeometry()) == null ? void 0 : L.on("change", ($) => {
|
|
1664
|
+
const a = $.target, y = b(a, "nm"), w = a.getCoordinates()[0], z = new ze([w[w.length - 2], w[w.length - 1]]), G = mt(z, "nm");
|
|
1665
|
+
if (V = Number(Ke(z) / 1e3) > 150, !y) return;
|
|
1666
1666
|
const B = '<span class="error pl-4">超出可以绘画的距离</span>';
|
|
1667
1667
|
m && (m.innerHTML = `
|
|
1668
1668
|
<div class="text">
|
|
1669
1669
|
面积:${y}
|
|
1670
|
-
${
|
|
1670
|
+
${V ? B : ""}
|
|
1671
1671
|
</div>
|
|
1672
|
-
`),
|
|
1672
|
+
`), E && (E.innerHTML = `
|
|
1673
1673
|
<div class="text">
|
|
1674
1674
|
面积:${y}
|
|
1675
1675
|
</div>
|
|
1676
|
-
<div class="text ${
|
|
1676
|
+
<div class="text ${V ? "error" : ""}">
|
|
1677
1677
|
线段 ${w.length - 2}: ${G}
|
|
1678
|
-
${
|
|
1678
|
+
${V ? B : ""}
|
|
1679
1679
|
|
|
1680
1680
|
</div>
|
|
1681
1681
|
<div>
|
|
@@ -1683,25 +1683,25 @@ const at = (e, n) => {
|
|
|
1683
1683
|
</div>
|
|
1684
1684
|
`);
|
|
1685
1685
|
});
|
|
1686
|
-
}),
|
|
1687
|
-
var y, u, w,
|
|
1686
|
+
}), M.on("drawend", (F) => {
|
|
1687
|
+
var y, u, w, z;
|
|
1688
1688
|
if (!F.feature.getGeometry()) return;
|
|
1689
1689
|
m && !s && (m.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), s = F.feature, k.setOffset([10, 0]);
|
|
1690
1690
|
const $ = F.feature.getGeometry().getCoordinates(), a = $[0][$[0].length - 2];
|
|
1691
|
-
if (k.setPosition(a),
|
|
1691
|
+
if (k.setPosition(a), E != null && E.parentNode && E.parentNode.removeChild(E), (y = n.getProps()) != null && y.areaDrawEnd) {
|
|
1692
1692
|
const G = $[0].map((B) => Me(B, _.mercator, _.data));
|
|
1693
1693
|
(w = (u = n.getProps()) == null ? void 0 : u.areaDrawEnd) == null || w.call(u, G);
|
|
1694
1694
|
}
|
|
1695
|
-
|
|
1695
|
+
M && (M.setActive(!1), e == null || e.removeInteraction(M), (e == null ? void 0 : e.getInteractions()).forEach((B) => {
|
|
1696
1696
|
B instanceof Oe && (B.setActive(!1), e == null || e.removeInteraction(B));
|
|
1697
|
-
})), l && Xe(l), (
|
|
1697
|
+
})), l && Xe(l), (z = document.querySelector(".delete-icon")) == null || z.addEventListener("click", () => {
|
|
1698
1698
|
var G, B;
|
|
1699
1699
|
A(), (B = (G = n.getProps()) == null ? void 0 : G.areaDrawEnd) == null || B.call(G, []);
|
|
1700
1700
|
});
|
|
1701
1701
|
});
|
|
1702
|
-
}, b = (F,
|
|
1702
|
+
}, b = (F, L) => {
|
|
1703
1703
|
const $ = Xt(F);
|
|
1704
|
-
switch (
|
|
1704
|
+
switch (L) {
|
|
1705
1705
|
case "km":
|
|
1706
1706
|
return $ > 1e4 ? Math.round($ / 1e6 * 100) / 100 + " km<sup>2</sup>" : Math.round($ * 100) / 100 + " m<sup>2</sup>";
|
|
1707
1707
|
case "nm":
|
|
@@ -1718,19 +1718,19 @@ const at = (e, n) => {
|
|
|
1718
1718
|
insertFirst: !1
|
|
1719
1719
|
}), e == null || e.addOverlay(k);
|
|
1720
1720
|
};
|
|
1721
|
-
let
|
|
1721
|
+
let E, D;
|
|
1722
1722
|
const W = () => {
|
|
1723
|
-
|
|
1724
|
-
element:
|
|
1723
|
+
E != null && E.parentNode && E.parentNode.removeChild(E), E = document.createElement("div"), E.className = "ol-tooltip ol-help-tooltip", D = new de({
|
|
1724
|
+
element: E,
|
|
1725
1725
|
offset: [15, 0],
|
|
1726
1726
|
positioning: "center-left"
|
|
1727
1727
|
}), e == null || e.addOverlay(D);
|
|
1728
1728
|
}, A = () => {
|
|
1729
1729
|
s = null, o();
|
|
1730
1730
|
}, H = () => {
|
|
1731
|
-
i = "close", e.un("pointermove", x), g = null,
|
|
1732
|
-
|
|
1733
|
-
}),
|
|
1731
|
+
i = "close", e.un("pointermove", x), g = null, M && (M.abortDrawing(), console.log("abortDrawing"), M.setActive(!1), (e == null ? void 0 : e.getInteractions()).forEach((L) => {
|
|
1732
|
+
L instanceof Oe && (L.setActive(!1), e == null || e.removeInteraction(L));
|
|
1733
|
+
}), M = null), l && Xe(l), l = void 0, t == null || t.clear(), t = null, v && e.getAllLayers().includes(v) && (e.removeLayer(v), v = null), E != null && E.parentElement && (E.innerHTML = "", E.parentElement.removeChild(E), E = null), m != null && m.parentElement && (m.innerHTML = "", m.parentElement.removeChild(m), m = null), D && e.removeOverlay(D), k && e.removeOverlay(k), Le(e, "pointer");
|
|
1734
1734
|
};
|
|
1735
1735
|
return {
|
|
1736
1736
|
open: o,
|
|
@@ -1751,13 +1751,13 @@ const at = (e, n) => {
|
|
|
1751
1751
|
const o = (b, m = !0) => {
|
|
1752
1752
|
if (!b || b.length === 0) return;
|
|
1753
1753
|
if (n.clear(), i) {
|
|
1754
|
-
const T = b.find((
|
|
1754
|
+
const T = b.find((E) => E.id === (i == null ? void 0 : i.id));
|
|
1755
1755
|
T ? i = T : b.push(i);
|
|
1756
1756
|
}
|
|
1757
1757
|
const k = [];
|
|
1758
1758
|
b.forEach((T) => {
|
|
1759
|
-
const [
|
|
1760
|
-
geometry: new ce(ee([Number(
|
|
1759
|
+
const [E, D] = T.latLon.split(","), W = new ae({
|
|
1760
|
+
geometry: new ce(ee([Number(E), Number(D)])),
|
|
1761
1761
|
portData: T,
|
|
1762
1762
|
id: T.id,
|
|
1763
1763
|
select: T.id === (i == null ? void 0 : i.id),
|
|
@@ -1774,11 +1774,11 @@ const at = (e, n) => {
|
|
|
1774
1774
|
const k = f, T = v;
|
|
1775
1775
|
if (!T) return "";
|
|
1776
1776
|
k.width = 0, k.height = 0;
|
|
1777
|
-
const
|
|
1777
|
+
const E = 2, D = 8, W = window.devicePixelRatio || 1, A = "12px sans-serif";
|
|
1778
1778
|
T.font = A;
|
|
1779
|
-
const j = T.measureText(b).width, F = D + j + D,
|
|
1780
|
-
k.width = Math.round(F * W), k.height = Math.round(
|
|
1781
|
-
const $ =
|
|
1779
|
+
const j = T.measureText(b).width, F = D + j + D, L = E + 12 + E * 2;
|
|
1780
|
+
k.width = Math.round(F * W), k.height = Math.round(L * W), T.scale(W, W), T.clearRect(0, 0, F, L), T.fillStyle = m ? "#FF5733" : "#FFF", T.fillRect(0, 0, F, L), T.font = A, T.textBaseline = "middle";
|
|
1781
|
+
const $ = L / 2;
|
|
1782
1782
|
return T.strokeStyle = m ? "#000" : "#ffffff", T.lineWidth = 1, T.strokeText(b, D, $), T.fillStyle = m ? "#FFF" : "#000000", T.fillText(b, D, $), k.toDataURL("image/png");
|
|
1783
1783
|
}, r = (b) => {
|
|
1784
1784
|
const { select: m, showTitle: k } = b.getProperties(), T = (F) => `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -1792,9 +1792,9 @@ const at = (e, n) => {
|
|
|
1792
1792
|
</clipPath>
|
|
1793
1793
|
</defs>
|
|
1794
1794
|
</svg>
|
|
1795
|
-
`,
|
|
1795
|
+
`, E = () => `data:image/svg+xml;utf8,${encodeURIComponent(T(m ? "#FF5733" : "#3370FF"))}`, D = e.getView().getZoom(), W = b.get("portData"), A = window.devicePixelRatio || 1, H = new Q({
|
|
1796
1796
|
image: new Ce({
|
|
1797
|
-
src:
|
|
1797
|
+
src: E(),
|
|
1798
1798
|
scale: 0.5 * D / 10
|
|
1799
1799
|
}),
|
|
1800
1800
|
zIndex: m ? 110 : 100
|
|
@@ -1834,16 +1834,16 @@ const at = (e, n) => {
|
|
|
1834
1834
|
}, x = (b) => {
|
|
1835
1835
|
if (n) {
|
|
1836
1836
|
if (!b)
|
|
1837
|
-
return
|
|
1838
|
-
(l == null ? void 0 : l.get("portData").id) !== b.id && (
|
|
1837
|
+
return M();
|
|
1838
|
+
(l == null ? void 0 : l.get("portData").id) !== b.id && (M(), V(b));
|
|
1839
1839
|
}
|
|
1840
|
-
},
|
|
1840
|
+
}, M = () => {
|
|
1841
1841
|
var b;
|
|
1842
1842
|
if (l) {
|
|
1843
1843
|
const m = l == null ? void 0 : l.get("portData"), k = (b = n.getFeatures()) == null ? void 0 : b.find((T) => T.get("portData").id === m.id);
|
|
1844
1844
|
k && (k.set("select", !1), k.setStyle(r(k)), l = null, i = null);
|
|
1845
1845
|
}
|
|
1846
|
-
},
|
|
1846
|
+
}, V = (b) => {
|
|
1847
1847
|
if (!n) return;
|
|
1848
1848
|
const m = n.getFeatures();
|
|
1849
1849
|
i = b, l = m.find((k) => k.get("portData").id === b.id), l && (l.set("select", !0), l.setStyle(r(l)));
|
|
@@ -1867,17 +1867,31 @@ const at = (e, n) => {
|
|
|
1867
1867
|
console.log("moveend---catch", g);
|
|
1868
1868
|
}
|
|
1869
1869
|
}), v.on("pointermove", (t) => {
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1870
|
+
if (t.dragging) return;
|
|
1871
|
+
const r = v.forEachFeatureAtPixel(
|
|
1872
|
+
t.pixel,
|
|
1873
|
+
function(M) {
|
|
1874
|
+
return M;
|
|
1875
|
+
},
|
|
1876
|
+
{
|
|
1877
|
+
hitTolerance: 3,
|
|
1878
|
+
// 3像素的容差范围
|
|
1879
|
+
layerFilter: function(M) {
|
|
1880
|
+
return M.get("interactive") === !0;
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
);
|
|
1884
|
+
console.log("pointermove", r);
|
|
1885
|
+
const g = v == null ? void 0 : v.getEventPixel(t.originalEvent);
|
|
1886
|
+
if (!g || !v) return;
|
|
1887
|
+
const x = v.getSize();
|
|
1888
|
+
if (!(g[0] < 0 || g[0] > x[0] || g[1] < 0 || g[1] > x[1]))
|
|
1889
|
+
try {
|
|
1890
|
+
const M = v == null ? void 0 : v.forEachFeatureAtPixel(g, (V) => V);
|
|
1891
|
+
s == null || s.handleTrackMapEvent(M, "hover", t), l == null || l.handleShipMapEvent(M, "hover"), M && (i == null || i.handlePortHover(M));
|
|
1892
|
+
} catch (M) {
|
|
1893
|
+
console.log("pointermove---catch", M);
|
|
1894
|
+
}
|
|
1881
1895
|
}), v.on("movestart", () => {
|
|
1882
1896
|
try {
|
|
1883
1897
|
const t = v == null ? void 0 : v.getView().getZoom();
|
|
@@ -1890,22 +1904,22 @@ const at = (e, n) => {
|
|
|
1890
1904
|
if (f.getState() !== "open")
|
|
1891
1905
|
try {
|
|
1892
1906
|
if (console.log("1", o.getState()), o.getState()) return;
|
|
1893
|
-
const
|
|
1894
|
-
|
|
1895
|
-
(
|
|
1896
|
-
if (
|
|
1897
|
-
return
|
|
1907
|
+
const M = v.getEventPixel(t.originalEvent), V = v.forEachFeatureAtPixel(
|
|
1908
|
+
M,
|
|
1909
|
+
(C) => {
|
|
1910
|
+
if (C != null && C.get("shipData") || C != null && C.get("portData"))
|
|
1911
|
+
return C;
|
|
1898
1912
|
}
|
|
1899
1913
|
);
|
|
1900
|
-
if (
|
|
1901
|
-
l.handleShipMapEvent(
|
|
1902
|
-
else if (
|
|
1903
|
-
const
|
|
1904
|
-
i.selected(
|
|
1914
|
+
if (V != null && V.get("shipData"))
|
|
1915
|
+
l.handleShipMapEvent(V, "click", (r = n.getProps()) == null ? void 0 : r.selectShip);
|
|
1916
|
+
else if (V != null && V.get("portData")) {
|
|
1917
|
+
const C = V.get("portData");
|
|
1918
|
+
i.selected(C), (x = (g = n.getProps()) == null ? void 0 : g.selectPort) == null || x.call(g, C);
|
|
1905
1919
|
}
|
|
1906
1920
|
t.preventDefault(), t.stopPropagation();
|
|
1907
|
-
} catch (
|
|
1908
|
-
console.log("click---catch",
|
|
1921
|
+
} catch (M) {
|
|
1922
|
+
console.log("click---catch", M);
|
|
1909
1923
|
}
|
|
1910
1924
|
}, 150)), v.getView().on("change:resolution", Re(() => {
|
|
1911
1925
|
const t = v == null ? void 0 : v.getView().getZoom();
|
|
@@ -1919,11 +1933,11 @@ const at = (e, n) => {
|
|
|
1919
1933
|
o.initMap(l, i);
|
|
1920
1934
|
const f = o.getInstall(), v = ko(f), t = po();
|
|
1921
1935
|
t.setProps(i), v.setShowLayerType(i.layerType), v.setGreenTileVisible(i.showGreenLayer);
|
|
1922
|
-
const r = ao(f), g = co(f, r), x = bo(f),
|
|
1923
|
-
So(o, t, r, x, b,
|
|
1936
|
+
const r = ao(f), g = co(f, r), x = bo(f), M = Mo(f), V = Eo(f, t), C = To(f, t), b = Po(f);
|
|
1937
|
+
So(o, t, r, x, b, V, C);
|
|
1924
1938
|
const m = () => {
|
|
1925
|
-
const T = f.getView().calculateExtent(o.getSize()),
|
|
1926
|
-
return [
|
|
1939
|
+
const T = f.getView().calculateExtent(o.getSize()), E = Me([T[0], T[1]], _.mercator, _.data), D = Me([T[2], T[3]], _.mercator, _.data);
|
|
1940
|
+
return [E[0], E[1], D[0], D[1]];
|
|
1927
1941
|
}, k = {
|
|
1928
1942
|
id: Symbol("map-instance"),
|
|
1929
1943
|
innerMap: null,
|
|
@@ -1942,9 +1956,9 @@ const at = (e, n) => {
|
|
|
1942
1956
|
clear: b.clear,
|
|
1943
1957
|
selected: b.selected
|
|
1944
1958
|
},
|
|
1945
|
-
position:
|
|
1946
|
-
drawLine:
|
|
1947
|
-
drawPolygon:
|
|
1959
|
+
position: M,
|
|
1960
|
+
drawLine: V,
|
|
1961
|
+
drawPolygon: C,
|
|
1948
1962
|
// 子模块
|
|
1949
1963
|
utils: {
|
|
1950
1964
|
getCalculateExtent: m,
|