zhihao-ui 1.3.42-alpha.5 → 1.3.42-alpha.7
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-ChjHXNSF.js → Map-BtQEJVq-.js} +547 -557
- package/dist/es/index.js +1 -1
- package/dist/umd/index.umd.cjs +27 -27
- package/package.json +1 -1
|
@@ -10,8 +10,8 @@ const Kt = { id: "scale-line-container" }, _t = /* @__PURE__ */ je({
|
|
|
10
10
|
i || (i = "metric");
|
|
11
11
|
const o = new Rt({
|
|
12
12
|
units: i
|
|
13
|
-
}),
|
|
14
|
-
|
|
13
|
+
}), g = document.getElementById("scale-line-container");
|
|
14
|
+
g && (o.setTarget(g), l.addControl(o));
|
|
15
15
|
}
|
|
16
16
|
}), (l, i) => (Qe(), Je("div", Kt));
|
|
17
17
|
}
|
|
@@ -28,13 +28,13 @@ const Kt = { id: "scale-line-container" }, _t = /* @__PURE__ */ je({
|
|
|
28
28
|
console.log("props", n);
|
|
29
29
|
const s = () => {
|
|
30
30
|
console.log("props");
|
|
31
|
-
const { setZoom: i, getZoom: o, getInstall:
|
|
32
|
-
if (!
|
|
31
|
+
const { setZoom: i, getZoom: o, getInstall: g } = n.mapInstance.methods;
|
|
32
|
+
if (!g()) return;
|
|
33
33
|
const t = o();
|
|
34
34
|
t && i(t + 1);
|
|
35
35
|
}, l = () => {
|
|
36
|
-
const { setZoom: i, getZoom: o, getInstall:
|
|
37
|
-
if (!
|
|
36
|
+
const { setZoom: i, getZoom: o, getInstall: g } = n.mapInstance.methods;
|
|
37
|
+
if (!g()) return;
|
|
38
38
|
const t = o();
|
|
39
39
|
t && i(t - 1);
|
|
40
40
|
};
|
|
@@ -73,34 +73,34 @@ const Kt = { id: "scale-line-container" }, _t = /* @__PURE__ */ je({
|
|
|
73
73
|
var fe = ((e) => (e.vectorTile = `https://t0.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${Ve}`, 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=${Ve}`, 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=${Ve}`, 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=${Ve}`, e.greenTile = `${gt}/map/tile/{z}/{x}/{y}.png`, e))(fe || {}), ke = /* @__PURE__ */ ((e) => (e[e.M = 1] = "M", e[e.KM = 2] = "KM", e[e.NM = 3] = "NM", e))(ke || {});
|
|
74
74
|
function ro() {
|
|
75
75
|
const e = oe(), n = () => e.value, s = () => n().getView(), l = () => {
|
|
76
|
-
var
|
|
77
|
-
return (
|
|
78
|
-
}, i = (
|
|
79
|
-
var
|
|
80
|
-
(
|
|
81
|
-
}, o = (
|
|
82
|
-
var
|
|
83
|
-
(
|
|
84
|
-
},
|
|
85
|
-
var
|
|
86
|
-
const
|
|
87
|
-
return At(
|
|
88
|
-
},
|
|
89
|
-
var
|
|
90
|
-
return (
|
|
91
|
-
}, t = new rt(), r = (
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
zoom:
|
|
95
|
-
center: ee(
|
|
76
|
+
var p;
|
|
77
|
+
return (p = s()) == null ? void 0 : p.getZoom();
|
|
78
|
+
}, i = (p) => {
|
|
79
|
+
var T;
|
|
80
|
+
(T = s()) == null || T.setZoom(p);
|
|
81
|
+
}, o = (p, T) => {
|
|
82
|
+
var z;
|
|
83
|
+
(z = s()) == null || z.setCenter(ee([p, T]));
|
|
84
|
+
}, g = () => {
|
|
85
|
+
var T;
|
|
86
|
+
const p = (T = s()) == null ? void 0 : T.getCenter();
|
|
87
|
+
return At(p);
|
|
88
|
+
}, w = () => {
|
|
89
|
+
var p;
|
|
90
|
+
return (p = n()) == null ? void 0 : p.getSize();
|
|
91
|
+
}, t = new rt(), r = (p, T) => {
|
|
92
|
+
f(T);
|
|
93
|
+
const z = {
|
|
94
|
+
zoom: T.zoom,
|
|
95
|
+
center: ee(T.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
|
|
103
|
-
target:
|
|
102
|
+
let M = {
|
|
103
|
+
target: p,
|
|
104
104
|
controls: Dt({
|
|
105
105
|
zoom: !1
|
|
106
106
|
}),
|
|
@@ -110,38 +110,38 @@ function ro() {
|
|
|
110
110
|
t.get("satelliteImgTile"),
|
|
111
111
|
t.get("satelliteImgTileMark")
|
|
112
112
|
],
|
|
113
|
-
view: new Zt(
|
|
113
|
+
view: new Zt(z)
|
|
114
114
|
};
|
|
115
|
-
const
|
|
116
|
-
e.value =
|
|
117
|
-
},
|
|
115
|
+
const x = new rt(M);
|
|
116
|
+
e.value = x;
|
|
117
|
+
}, f = (p) => {
|
|
118
118
|
t.set("vectorTile", new we({
|
|
119
119
|
source: new xe({ url: fe.vectorTile }),
|
|
120
|
-
visible:
|
|
120
|
+
visible: p.layerType === "vector",
|
|
121
121
|
zIndex: 0,
|
|
122
122
|
preload: 1,
|
|
123
123
|
className: "vector"
|
|
124
124
|
})), t.set("vectorTileMark", new we({
|
|
125
125
|
source: new xe({ url: fe.vectorTileMark }),
|
|
126
|
-
visible:
|
|
126
|
+
visible: p.layerType === "vector",
|
|
127
127
|
zIndex: 1,
|
|
128
128
|
preload: 1,
|
|
129
129
|
className: "vector"
|
|
130
130
|
})), t.set("satelliteImgTile", new we({
|
|
131
131
|
source: new xe({ url: fe.satelliteImgTile }),
|
|
132
|
-
visible:
|
|
132
|
+
visible: p.layerType === "satellite",
|
|
133
133
|
zIndex: 0,
|
|
134
134
|
preload: 1,
|
|
135
135
|
className: "satellite"
|
|
136
136
|
})), t.set("satelliteImgTileMark", new we({
|
|
137
137
|
source: new xe({ url: fe.satelliteImgTileMark }),
|
|
138
|
-
visible:
|
|
138
|
+
visible: p.layerType === "satellite",
|
|
139
139
|
zIndex: 1,
|
|
140
140
|
preload: 1,
|
|
141
141
|
className: "satellite"
|
|
142
142
|
})), t.set("greenMark", new we({
|
|
143
143
|
source: new xe({ url: fe.greenTile }),
|
|
144
|
-
visible:
|
|
144
|
+
visible: p.showGreenLayer,
|
|
145
145
|
zIndex: 2,
|
|
146
146
|
className: "greenTile"
|
|
147
147
|
}));
|
|
@@ -152,10 +152,10 @@ function ro() {
|
|
|
152
152
|
getZoom: l,
|
|
153
153
|
setZoom: i,
|
|
154
154
|
setCenter: o,
|
|
155
|
-
getCenter:
|
|
156
|
-
getSize:
|
|
155
|
+
getCenter: g,
|
|
156
|
+
getSize: w,
|
|
157
157
|
initMap: r,
|
|
158
|
-
setBaseLayerMap:
|
|
158
|
+
setBaseLayerMap: f
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
161
|
const Ue = function(e, n) {
|
|
@@ -223,42 +223,42 @@ const st = (e) => {
|
|
|
223
223
|
return l !== 0 && (o = `${String(l).padStart(2, "0")}时${o}`), s !== 0 && (o = `${String(s).padStart(2, "0")}天${o}`), o;
|
|
224
224
|
}, co = (e, n) => {
|
|
225
225
|
let s = null;
|
|
226
|
-
const l = async (
|
|
227
|
-
if (!e || (console.log("vehicleInfo",
|
|
228
|
-
const
|
|
229
|
-
i(
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
-
}, i = (
|
|
233
|
-
const
|
|
226
|
+
const l = async (f) => {
|
|
227
|
+
if (!e || (console.log("vehicleInfo", f), !(f != null && f.lon && (f != null && f.lat)))) return;
|
|
228
|
+
const p = Math.abs(Number(f.lon)) > 180 ? Ue(f.lon, f.lat) : [f.lon, f.lat];
|
|
229
|
+
i(f, ee(p));
|
|
230
|
+
const T = e == null ? void 0 : e.getView(), z = new ce(p);
|
|
231
|
+
T.setCenter(Me(z.getCoordinates(), _.data, _.mercator));
|
|
232
|
+
}, i = (f, p) => {
|
|
233
|
+
const T = `${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 z = s.getElement();
|
|
241
|
+
z.style.backgroundImage = `url(${T})`, z.style.width = "80px", z.style.height = "80px";
|
|
242
|
+
const M = (f == null ? void 0 : f.drc) || "";
|
|
243
|
+
z.style.transform = `rotate(${M}deg)`, z.style.backgroundSize = "cover", s == null || s.setPosition(p);
|
|
244
244
|
};
|
|
245
245
|
return {
|
|
246
246
|
location: l,
|
|
247
247
|
remove: () => {
|
|
248
|
-
const
|
|
249
|
-
|
|
248
|
+
const f = s == null ? void 0 : s.getElement();
|
|
249
|
+
f && (f.innerHTML = "");
|
|
250
250
|
},
|
|
251
|
-
renderTrack: (
|
|
252
|
-
n.render(
|
|
251
|
+
renderTrack: (f, p, T) => {
|
|
252
|
+
n.render(f, p, T, "truck", 1e3);
|
|
253
253
|
},
|
|
254
|
-
setCenter: (
|
|
255
|
-
n.setCenter(
|
|
254
|
+
setCenter: (f) => {
|
|
255
|
+
n.setCenter(f);
|
|
256
256
|
},
|
|
257
257
|
closeTrack: () => {
|
|
258
258
|
n.close();
|
|
259
259
|
},
|
|
260
|
-
playTrack: (
|
|
261
|
-
n.play(
|
|
260
|
+
playTrack: (f, p) => {
|
|
261
|
+
n.play(f, p);
|
|
262
262
|
}
|
|
263
263
|
};
|
|
264
264
|
};
|
|
@@ -268,17 +268,17 @@ const ao = (e) => {
|
|
|
268
268
|
let l = null;
|
|
269
269
|
const i = "--";
|
|
270
270
|
let o = null;
|
|
271
|
-
const
|
|
272
|
-
element:
|
|
271
|
+
const g = document.createElement("div"), w = new de({
|
|
272
|
+
element: g,
|
|
273
273
|
positioning: "top-left",
|
|
274
274
|
className: "track-label-popup"
|
|
275
275
|
});
|
|
276
|
-
let t, r,
|
|
277
|
-
const
|
|
276
|
+
let t, r, f, p, T, z = !1, M = Date.now(), x, y = 0, b = null, E = 20;
|
|
277
|
+
const L = 8, D = [], W = (c) => {
|
|
278
278
|
var d;
|
|
279
|
-
for (D.unshift(c); D.length >
|
|
280
|
-
const h = D.pop(),
|
|
281
|
-
|
|
279
|
+
for (D.unshift(c); D.length > L; ) {
|
|
280
|
+
const h = D.pop(), k = n.get(h);
|
|
281
|
+
k && ((d = k.getSource()) == null || d.clear(), e == null || e.removeLayer(k), n.delete(h), delete s[h]);
|
|
282
282
|
}
|
|
283
283
|
};
|
|
284
284
|
let A = "";
|
|
@@ -290,20 +290,20 @@ const ao = (e) => {
|
|
|
290
290
|
}
|
|
291
291
|
}, 300), F = (c, d) => {
|
|
292
292
|
let h = [];
|
|
293
|
-
const
|
|
294
|
-
return h = d.filter((S, Z) => Z %
|
|
293
|
+
const k = Math.max(1, Math.floor(d.length / E));
|
|
294
|
+
return h = d.filter((S, Z) => Z % k === 0).map((S, Z) => {
|
|
295
295
|
if (Number(S.lon) > 180 || Number(S.lat) > 180) {
|
|
296
296
|
const [O, Y] = Ue(S.lon, S.lat);
|
|
297
297
|
S.lon = O, S.lat = Y;
|
|
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
|
-
},
|
|
302
|
-
if (!e || JSON.stringify(s[c]) === JSON.stringify(d) && l === c || (d = d == null ? void 0 : d.reverse(),
|
|
301
|
+
}, C = async (c, d, h, k = "ship", P = 200) => {
|
|
302
|
+
if (!e || JSON.stringify(s[c]) === JSON.stringify(d) && l === c || (d = d == null ? void 0 : d.reverse(), w && k === "ship" && (e != null && e.getOverlays().getArray().includes(w) || e.addOverlay(w)), (d == null ? void 0 : d.length) < 2))
|
|
303
303
|
return;
|
|
304
|
-
W(c), l = c, s[c] = d,
|
|
304
|
+
W(c), l = c, s[c] = d, E = P;
|
|
305
305
|
const S = Object.keys(s).findIndex((Z) => Z === c) || 0;
|
|
306
|
-
A = h || H[S > 10 ? 10 : S], await
|
|
306
|
+
A = h || H[S > 10 ? 10 : S], await v(), await et(l);
|
|
307
307
|
}, $ = (c) => {
|
|
308
308
|
const d = new ge();
|
|
309
309
|
return new ye({
|
|
@@ -317,10 +317,10 @@ const ao = (e) => {
|
|
|
317
317
|
}, a = (c) => {
|
|
318
318
|
n.forEach((d, h) => {
|
|
319
319
|
var P;
|
|
320
|
-
const
|
|
321
|
-
d.getVisible() !==
|
|
320
|
+
const k = h === c;
|
|
321
|
+
d.getVisible() !== k && (d.setVisible(k), e.getLayers().getArray().includes(d) || e.addLayer(d), k || (P = d.getSource()) == null || P.clear());
|
|
322
322
|
}), l = c;
|
|
323
|
-
},
|
|
323
|
+
}, v = async () => {
|
|
324
324
|
const c = l;
|
|
325
325
|
if (!n.has(c)) {
|
|
326
326
|
const S = $(c);
|
|
@@ -329,35 +329,35 @@ const ao = (e) => {
|
|
|
329
329
|
await a(c);
|
|
330
330
|
const d = A || "", h = s[c] || [];
|
|
331
331
|
if (!(h && h.length > 1)) return [];
|
|
332
|
-
let
|
|
333
|
-
|
|
334
|
-
const P =
|
|
335
|
-
|
|
332
|
+
let k = [];
|
|
333
|
+
k = F(c, h);
|
|
334
|
+
const P = k.map((S) => S.centerPoint);
|
|
335
|
+
k.length >= 2 && await u(c, P, d);
|
|
336
336
|
}, u = (c, d, h) => {
|
|
337
|
-
const
|
|
337
|
+
const k = new ze(d), P = n.get(c).getSource(), S = P.getFeatureById(c);
|
|
338
338
|
if (S)
|
|
339
|
-
S.setGeometry(
|
|
339
|
+
S.setGeometry(k), S.setId(c), S.setStyle(m(h)), b = S;
|
|
340
340
|
else {
|
|
341
|
-
const Z = new ae({ geometry:
|
|
342
|
-
Z.setId(c), Z.set("type", "line"), Z.setStyle(
|
|
341
|
+
const Z = new ae({ geometry: k });
|
|
342
|
+
Z.setId(c), Z.set("type", "line"), Z.setStyle(m(h)), P.addFeature(Z), b = Z;
|
|
343
343
|
}
|
|
344
|
-
return
|
|
345
|
-
},
|
|
344
|
+
return b;
|
|
345
|
+
}, m = (c) => new Q({
|
|
346
346
|
stroke: new ve({
|
|
347
347
|
color: c,
|
|
348
348
|
width: 2
|
|
349
349
|
})
|
|
350
|
-
}),
|
|
350
|
+
}), V = (c, d, h) => {
|
|
351
351
|
try {
|
|
352
|
-
const
|
|
353
|
-
if (console.log("trackId-data",
|
|
354
|
-
e.getTargetElement().style.cursor =
|
|
355
|
-
const P = G(
|
|
356
|
-
S && (
|
|
352
|
+
const k = c == null ? void 0 : c.get("data");
|
|
353
|
+
if (console.log("trackId-data", k), c && k && d === "hover") {
|
|
354
|
+
e.getTargetElement().style.cursor = k ? "pointer" : "";
|
|
355
|
+
const P = G(k), S = h == null ? void 0 : h.coordinate;
|
|
356
|
+
S && (g.querySelector(".popup-content"), g.innerHTML = P, w == null || w.setPosition(S));
|
|
357
357
|
} else
|
|
358
|
-
|
|
359
|
-
} catch (
|
|
360
|
-
console.error("handleTrackMapEvent",
|
|
358
|
+
w && w.setPosition(void 0);
|
|
359
|
+
} catch (k) {
|
|
360
|
+
console.error("handleTrackMapEvent", k);
|
|
361
361
|
}
|
|
362
362
|
}, G = (c) => {
|
|
363
363
|
if (!(c != null && c.time)) return;
|
|
@@ -410,11 +410,11 @@ const ao = (e) => {
|
|
|
410
410
|
// 先初始化,后续计算
|
|
411
411
|
};
|
|
412
412
|
});
|
|
413
|
-
let
|
|
413
|
+
let k = 0;
|
|
414
414
|
h[0].distance = 0;
|
|
415
415
|
for (let O = 1; O < h.length; O++) {
|
|
416
416
|
const Y = h[O - 1].pixel, X = h[O].pixel, U = X[0] - Y[0], N = X[1] - Y[1];
|
|
417
|
-
|
|
417
|
+
k += Math.sqrt(U * U + N * N), h[O].distance = k;
|
|
418
418
|
}
|
|
419
419
|
const P = h.filter(
|
|
420
420
|
(O, Y) => Y === 0 || Y === h.length - 1
|
|
@@ -449,11 +449,11 @@ const ao = (e) => {
|
|
|
449
449
|
};
|
|
450
450
|
function J(c, d) {
|
|
451
451
|
for (let h = 1; h < c.length; h++) {
|
|
452
|
-
const
|
|
453
|
-
if (d >=
|
|
454
|
-
const S = (d -
|
|
452
|
+
const k = c[h - 1], P = c[h];
|
|
453
|
+
if (d >= k.distance && d <= P.distance) {
|
|
454
|
+
const S = (d - k.distance) / (P.distance - k.distance), Z = k.pixel[0] + S * (P.pixel[0] - k.pixel[0]), O = k.pixel[1] + S * (P.pixel[1] - k.pixel[1]), Y = e == null ? void 0 : e.getCoordinateFromPixel([Z, O]);
|
|
455
455
|
return {
|
|
456
|
-
...
|
|
456
|
+
...k,
|
|
457
457
|
// 继承前一个点的属性(可调整)
|
|
458
458
|
coord: Y,
|
|
459
459
|
pixel: [Z, O],
|
|
@@ -467,8 +467,8 @@ const ao = (e) => {
|
|
|
467
467
|
}
|
|
468
468
|
const R = async (c, d) => {
|
|
469
469
|
await se(), await Ae(c);
|
|
470
|
-
const h = B(d),
|
|
471
|
-
n.get(c).getSource().addFeatures(
|
|
470
|
+
const h = B(d), k = h.map((S) => ue(S));
|
|
471
|
+
n.get(c).getSource().addFeatures(k), wt(c, h, d, A), h.forEach((S) => {
|
|
472
472
|
const Z = le(c, A, S);
|
|
473
473
|
e.addOverlay(Z);
|
|
474
474
|
});
|
|
@@ -483,8 +483,8 @@ const ao = (e) => {
|
|
|
483
483
|
];
|
|
484
484
|
return (c.index === 0 || c.index === s[c.id].length - 1) && (h = [...xt(c)], d.set("type", "track_begin")), c.state !== void 0 && c.state !== null && (h = [...Te(c)], d.set("type", "track_icon")), d.setStyle(h), d;
|
|
485
485
|
}, le = (c, d, h) => {
|
|
486
|
-
const
|
|
487
|
-
|
|
486
|
+
const k = document.createElement("div");
|
|
487
|
+
k.className = "track-overlay-label", k.style.position = "relative", k.style.backgroundColor = "rgba(255,255,255,0.8)", k.style.border = `1px solid ${d}`, k.style.fontSize = "12px", k.innerHTML = `
|
|
488
488
|
<span>${h.time}</span>
|
|
489
489
|
<svg
|
|
490
490
|
style="position: absolute;right: -20px;top: 0;"
|
|
@@ -498,7 +498,7 @@ const ao = (e) => {
|
|
|
498
498
|
stroke-width="1" />
|
|
499
499
|
`;
|
|
500
500
|
const P = new de({
|
|
501
|
-
element:
|
|
501
|
+
element: k,
|
|
502
502
|
position: ee(h.center),
|
|
503
503
|
positioning: "top-right",
|
|
504
504
|
offset: [-20, -20],
|
|
@@ -534,10 +534,10 @@ const ao = (e) => {
|
|
|
534
534
|
})
|
|
535
535
|
// textStyle,
|
|
536
536
|
], Te = (c) => {
|
|
537
|
-
const d = "#E31818", h = "#1890FF",
|
|
537
|
+
const d = "#E31818", h = "#1890FF", k = "", P = new Q({
|
|
538
538
|
text: new be({
|
|
539
539
|
font: "Normal 22px map-iconfont",
|
|
540
|
-
text: he(
|
|
540
|
+
text: he(k),
|
|
541
541
|
offsetY: -10,
|
|
542
542
|
fill: new te({
|
|
543
543
|
color: Number(c.state) === 0 ? d : Number(c.state) === 1 ? h : ""
|
|
@@ -546,7 +546,7 @@ const ao = (e) => {
|
|
|
546
546
|
zIndex: 99
|
|
547
547
|
}), Z = st(""), Y = st(""), X = [];
|
|
548
548
|
return Number(c.state) === 0 ? X.push(Z) : Number(c.state) === 1 && X.push(Y), X.push(P), X;
|
|
549
|
-
}, wt = (c, d, h,
|
|
549
|
+
}, wt = (c, d, h, k) => {
|
|
550
550
|
const P = d || [], S = d.length;
|
|
551
551
|
S || (P.push(h[0]), P.push(h[h.length - 1]));
|
|
552
552
|
const Z = [];
|
|
@@ -571,7 +571,7 @@ const ao = (e) => {
|
|
|
571
571
|
text: new be({
|
|
572
572
|
font: "700 12px map-iconfont",
|
|
573
573
|
text: he(""),
|
|
574
|
-
fill: new te({ color:
|
|
574
|
+
fill: new te({ color: k }),
|
|
575
575
|
// 设置箭头旋转 角度转为弧度
|
|
576
576
|
rotation: tt(
|
|
577
577
|
d[Y].center,
|
|
@@ -586,9 +586,9 @@ const ao = (e) => {
|
|
|
586
586
|
O == null || O.addFeatures(Z);
|
|
587
587
|
}, et = (c) => {
|
|
588
588
|
var S, Z;
|
|
589
|
-
const d = e.getView(), h = (S = n == null ? void 0 : n.get(c)) == null ? void 0 : S.getSource(),
|
|
590
|
-
if (!
|
|
591
|
-
const P = (Z =
|
|
589
|
+
const d = e.getView(), h = (S = n == null ? void 0 : n.get(c)) == null ? void 0 : S.getSource(), k = b || (c ? h == null ? void 0 : h.getFeatureById(c) : null);
|
|
590
|
+
if (!k) return;
|
|
591
|
+
const P = (Z = k == null ? void 0 : k.getGeometry()) == null ? void 0 : Z.getExtent();
|
|
592
592
|
if (P != null && P.length)
|
|
593
593
|
try {
|
|
594
594
|
const O = Wt(P, Math.max(P[2] - P[0], P[3] - P[1]) * 0.02);
|
|
@@ -617,9 +617,9 @@ const ao = (e) => {
|
|
|
617
617
|
const d = n.get(c || l);
|
|
618
618
|
d == null || d.setVisible(!1);
|
|
619
619
|
const h = e.getOverlays().getArray();
|
|
620
|
-
for (let
|
|
621
|
-
const P = h[
|
|
622
|
-
P.get("class") === "track-label-overlay" ? (P.setPosition(void 0), e.removeOverlay(P)) :
|
|
620
|
+
for (let k = 0; k < h.length; ) {
|
|
621
|
+
const P = h[k];
|
|
622
|
+
P.get("class") === "track-label-overlay" ? (P.setPosition(void 0), e.removeOverlay(P)) : k++;
|
|
623
623
|
}
|
|
624
624
|
Fe();
|
|
625
625
|
}, pt = (c, d = ke.NM) => {
|
|
@@ -633,8 +633,8 @@ const ao = (e) => {
|
|
|
633
633
|
}, Mt = (c, d) => {
|
|
634
634
|
Ct(String(c), d);
|
|
635
635
|
}, Ct = (c, d) => {
|
|
636
|
-
const h = s[String(c)],
|
|
637
|
-
|
|
636
|
+
const h = s[String(c)], k = h == null ? void 0 : h.map((P) => [P.lon, P.lat]);
|
|
637
|
+
k && Tt(k, d);
|
|
638
638
|
}, Ge = new Q({
|
|
639
639
|
text: new be({
|
|
640
640
|
font: "700 20px map-iconfont",
|
|
@@ -645,53 +645,53 @@ const ao = (e) => {
|
|
|
645
645
|
})
|
|
646
646
|
}), Lt = (c, d) => {
|
|
647
647
|
var N, q;
|
|
648
|
-
const h = Number(50 * d),
|
|
649
|
-
if (
|
|
648
|
+
const h = Number(50 * d), k = ((N = c.frameState) == null ? void 0 : N.time) ?? Date.now(), P = k - M;
|
|
649
|
+
if (y = (y + h * P / 1e6) % 2, M = k, y >= 1) {
|
|
650
650
|
Fe();
|
|
651
651
|
return;
|
|
652
652
|
}
|
|
653
653
|
const S = r.getCoordinateAt(
|
|
654
|
-
|
|
654
|
+
y > 1 ? 2 - y : y
|
|
655
655
|
), Z = r.getCoordinateAt(
|
|
656
|
-
|
|
656
|
+
y > 1 ? y - 0.01 : y
|
|
657
657
|
), O = r.getCoordinateAt(
|
|
658
|
-
|
|
658
|
+
y > 1 ? 2 - y : y + 0.01
|
|
659
659
|
), X = tt(
|
|
660
660
|
it(Z, "array"),
|
|
661
661
|
it(O, "array")
|
|
662
662
|
) * Math.PI / 180;
|
|
663
|
-
(q = Ge.getText()) == null || q.setRotation(X),
|
|
663
|
+
(q = Ge.getText()) == null || q.setRotation(X), p.setCoordinates(S);
|
|
664
664
|
const U = Bt(c);
|
|
665
|
-
U.setStyle(Ge), U.drawGeometry(
|
|
665
|
+
U.setStyle(Ge), U.drawGeometry(p), e == null || e.render();
|
|
666
666
|
}, Et = () => {
|
|
667
667
|
var c;
|
|
668
|
-
|
|
668
|
+
z = !0, M = Date.now(), y = 0, p = ((c = f.getGeometry()) == null ? void 0 : c.clone()) || new ce([0, 0]), o && (x == null || x.on("postrender", o)), T == null || T.setGeometry(void 0);
|
|
669
669
|
}, Fe = () => {
|
|
670
|
-
|
|
670
|
+
z && (z = !1, T == null || T.setGeometry(void 0), o && x && x.un("postrender", o), x && (e == null || e.removeLayer(x)), x = null, T = null);
|
|
671
671
|
}, Tt = (c, d) => {
|
|
672
|
-
|
|
672
|
+
z && Fe(), t = new nt({
|
|
673
673
|
factor: 1e6
|
|
674
674
|
}).writeGeometry(new ze(c)), r = new nt({
|
|
675
675
|
factor: 1e6
|
|
676
676
|
}).readGeometry(t, {
|
|
677
677
|
dataProjection: _.data,
|
|
678
678
|
featureProjection: _.mercator
|
|
679
|
-
}),
|
|
679
|
+
}), f = new ae({
|
|
680
680
|
type: "icon",
|
|
681
681
|
geometry: new ce(r.getFirstCoordinate())
|
|
682
682
|
});
|
|
683
|
-
const h =
|
|
684
|
-
|
|
683
|
+
const h = f.getGeometry();
|
|
684
|
+
p = h ? h.clone() : new ce([0, 0]), T = new ae({
|
|
685
685
|
type: "geoMarker",
|
|
686
686
|
style: Ge,
|
|
687
|
-
geometry:
|
|
688
|
-
}),
|
|
687
|
+
geometry: p
|
|
688
|
+
}), x = new ye({
|
|
689
689
|
source: new ge({
|
|
690
|
-
features: [
|
|
690
|
+
features: [T]
|
|
691
691
|
})
|
|
692
|
-
}), e == null || e.addLayer(
|
|
692
|
+
}), e == null || e.addLayer(x), o = (k) => Lt(k, d), Et();
|
|
693
693
|
}, tt = (c, d, h) => {
|
|
694
|
-
function
|
|
694
|
+
function k(N) {
|
|
695
695
|
return 180 * (N % (2 * Math.PI)) / Math.PI;
|
|
696
696
|
}
|
|
697
697
|
function P(N) {
|
|
@@ -717,7 +717,7 @@ const ao = (e) => {
|
|
|
717
717
|
return (Z(Nt, St) + 180) % 360;
|
|
718
718
|
}(N, q);
|
|
719
719
|
const I = S(N), Pe = S(q), Se = P(I[0]), Ne = P(Pe[0]), ot = P(I[1]), We = P(Pe[1]), Ft = Math.sin(Ne - Se) * Math.cos(We), Pt = Math.cos(ot) * Math.sin(We) - Math.sin(ot) * Math.cos(We) * Math.cos(Ne - Se);
|
|
720
|
-
return
|
|
720
|
+
return k(Math.atan2(Ft, Pt));
|
|
721
721
|
}
|
|
722
722
|
function O(N) {
|
|
723
723
|
return !isNaN(N) && N !== null && !Array.isArray(N);
|
|
@@ -739,13 +739,13 @@ const ao = (e) => {
|
|
|
739
739
|
return U < 0 ? 360 + U : U;
|
|
740
740
|
};
|
|
741
741
|
return {
|
|
742
|
-
render:
|
|
742
|
+
render: C,
|
|
743
743
|
remove: bt,
|
|
744
744
|
play: Mt,
|
|
745
745
|
setCenter: et,
|
|
746
746
|
close: kt,
|
|
747
747
|
getLength: pt,
|
|
748
|
-
handleTrackMapEvent:
|
|
748
|
+
handleTrackMapEvent: V,
|
|
749
749
|
reRenderTrackLine: j
|
|
750
750
|
};
|
|
751
751
|
};
|
|
@@ -760,7 +760,7 @@ function uo(e) {
|
|
|
760
760
|
position: "relative",
|
|
761
761
|
"pointer-events": "none"
|
|
762
762
|
})), l = $e(() => {
|
|
763
|
-
var
|
|
763
|
+
var g;
|
|
764
764
|
return {
|
|
765
765
|
position: "relative",
|
|
766
766
|
"border-radius": "1px",
|
|
@@ -777,7 +777,7 @@ function uo(e) {
|
|
|
777
777
|
"z-index": "1",
|
|
778
778
|
display: "flex",
|
|
779
779
|
"align-items": "center",
|
|
780
|
-
animation: e.selected ? e.colors && ((
|
|
780
|
+
animation: e.selected ? e.colors && ((g = e.colors) == null ? void 0 : g.length) >= 2 ? "blink-dual 2s ease-in-out infinite" : "blink-single 1.5s ease-in-out infinite" : "none"
|
|
781
781
|
// "animation": props.selected ? 'blink 1.5s ease-in-out infinite' : 'none', // 动画开关
|
|
782
782
|
};
|
|
783
783
|
}), i = $e(() => ({
|
|
@@ -875,18 +875,18 @@ const go = (e) => {
|
|
|
875
875
|
return n <= re.shipModelMax && n >= re.shipTriggleMin ? "ship" : "triangle";
|
|
876
876
|
}, Ie = (e, n, s) => {
|
|
877
877
|
if (s === "ship") {
|
|
878
|
-
const { len: l, wid: i } = n, o = 97,
|
|
879
|
-
return
|
|
878
|
+
const { len: l, wid: i } = n, o = 97, g = 20, t = 1 / (e == null ? void 0 : e.getView().getResolution()), r = l * t / o, f = i * t / g, p = Math.min(r, f);
|
|
879
|
+
return p < 0.2 ? 0.2 : p > 2 ? 2 : p;
|
|
880
880
|
}
|
|
881
881
|
return re.scaleNum;
|
|
882
882
|
}, fo = (e, n, s) => {
|
|
883
|
-
const { color: l, direct: i, isHighlight: o, shipData:
|
|
883
|
+
const { color: l, direct: i, isHighlight: o, shipData: g } = e.getProperties(), w = ((g == null ? void 0 : g.cog) - 90 + 360) % 360;
|
|
884
884
|
return new Q({
|
|
885
885
|
image: new Ce({
|
|
886
886
|
src: t(),
|
|
887
887
|
scale: n || re.scaleNum,
|
|
888
888
|
anchor: [0.5, 0.5],
|
|
889
|
-
rotation:
|
|
889
|
+
rotation: w * Math.PI / 180,
|
|
890
890
|
rotateWithView: !1
|
|
891
891
|
})
|
|
892
892
|
});
|
|
@@ -921,7 +921,7 @@ const go = (e) => {
|
|
|
921
921
|
}
|
|
922
922
|
}
|
|
923
923
|
}, ho = (e, n) => {
|
|
924
|
-
const s = vt(e, n), l = n.id, { lon: i, lat: o } = n,
|
|
924
|
+
const s = vt(e, n), l = n.id, { lon: i, lat: o } = n, g = new de({
|
|
925
925
|
element: s,
|
|
926
926
|
position: ee([i, o]),
|
|
927
927
|
id: "selected-" + l,
|
|
@@ -929,15 +929,15 @@ const go = (e) => {
|
|
|
929
929
|
offset: [0, 5],
|
|
930
930
|
className: "ship-selected-overlay"
|
|
931
931
|
});
|
|
932
|
-
return
|
|
932
|
+
return g.set("class", "ship-overlay-selected"), g;
|
|
933
933
|
}, vt = (e, n) => {
|
|
934
934
|
const s = ht(e), l = Ie(e, n, s), i = s === "ship" ? 109 : 49, o = `
|
|
935
935
|
<svg style="transform:scale(${l});" xmlns="http://www.w3.org/2000/svg" width="${i}" height="${i}" viewBox="0 0 49 49" fill="none">
|
|
936
936
|
<path d="M1.99982 46.9998L1.99982 1.99982L46.9998 1.99982L46.9998 46.9998L1.99982 46.9998Z" fill="#FF2424" fill-opacity="0.2"/>
|
|
937
937
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M19.9998 0.5V3.5L3.49976 3.5V20H0.499756V0.500002L19.9998 0.5ZM45.4998 3.5H28.9998V0.5H48.4998V20H45.4998V3.5ZM48.4998 29L48.4998 48.5H28.9998V45.5H45.4998L45.4998 29H48.4998ZM3.49976 45.5L3.49976 29H0.499756L0.499758 48.5L19.9998 48.5V45.5L3.49976 45.5Z" fill="#FF2424"/>
|
|
938
938
|
</svg>
|
|
939
|
-
`,
|
|
940
|
-
return
|
|
939
|
+
`, g = document.createElement("div");
|
|
940
|
+
return g.className = "ship-overlay-selected", g.innerHTML = o, g;
|
|
941
941
|
};
|
|
942
942
|
function vo(e, n, s, l) {
|
|
943
943
|
if (n) {
|
|
@@ -959,12 +959,12 @@ const yo = (e, n) => {
|
|
|
959
959
|
}, yt = (e) => {
|
|
960
960
|
const n = document.createElement("div");
|
|
961
961
|
n.className = "ship-overlay-box", n.style.position = "relative";
|
|
962
|
-
const { lon: s, lat: l, blinking: i, blinkingColors: o, name:
|
|
962
|
+
const { lon: s, lat: l, blinking: i, blinkingColors: o, name: g } = e, w = He({
|
|
963
963
|
setup() {
|
|
964
964
|
return uo({
|
|
965
965
|
position: [s + 2e-3, l + 2e-3],
|
|
966
966
|
selected: i,
|
|
967
|
-
name:
|
|
967
|
+
name: g,
|
|
968
968
|
colors: o || [],
|
|
969
969
|
existDevice: e == null ? void 0 : e.existDevice,
|
|
970
970
|
existMobile: e == null ? void 0 : e.existMobile,
|
|
@@ -972,7 +972,7 @@ const yo = (e, n) => {
|
|
|
972
972
|
});
|
|
973
973
|
}
|
|
974
974
|
});
|
|
975
|
-
return $t(
|
|
975
|
+
return $t(w, n), n;
|
|
976
976
|
}, ct = (e) => {
|
|
977
977
|
const n = [];
|
|
978
978
|
return e.existDevice && n.push(""), e.existMobile && n.push(""), e.existWaterGauge && n.push(""), n;
|
|
@@ -1004,73 +1004,73 @@ function xo(e, n, s = "left-bottom", l = 2) {
|
|
|
1004
1004
|
Be = pe.getContext("2d");
|
|
1005
1005
|
}
|
|
1006
1006
|
}
|
|
1007
|
-
const o = pe,
|
|
1008
|
-
if (!
|
|
1007
|
+
const o = pe, g = Be;
|
|
1008
|
+
if (!g) return "";
|
|
1009
1009
|
o.width = 0, o.height = 0;
|
|
1010
|
-
const
|
|
1011
|
-
|
|
1012
|
-
const
|
|
1013
|
-
|
|
1014
|
-
const
|
|
1015
|
-
let D, W, A = 0, H = 0, j = 0, F = 0,
|
|
1016
|
-
switch (D = r +
|
|
1010
|
+
const w = 2, t = 8, r = 16, f = window.devicePixelRatio || 1, p = "500 12px Arial", T = "14px map-iconfont";
|
|
1011
|
+
g.font = p;
|
|
1012
|
+
const M = g.measureText(e).width;
|
|
1013
|
+
g.font = T;
|
|
1014
|
+
const x = n.map((m) => ({ width: g.measureText(he(m)).width, height: 14 })), y = x.reduce((m, V) => m + V.width, 0), b = (n.length - 1) * l, E = t + M + y + b + t, L = w + 14 + w;
|
|
1015
|
+
let D, W, A = 0, H = 0, j = 0, F = 0, C = 0, $ = 0;
|
|
1016
|
+
switch (D = r + E, s) {
|
|
1017
1017
|
case "right-top":
|
|
1018
|
-
W = r +
|
|
1018
|
+
W = r + L, A = 0, H = r + L, j = r, F = 0, C = r, $ = 0;
|
|
1019
1019
|
break;
|
|
1020
1020
|
case "right-middle":
|
|
1021
|
-
W =
|
|
1021
|
+
W = L, A = 0, H = L / 2, j = r, F = L / 2, C = r, $ = 0;
|
|
1022
1022
|
break;
|
|
1023
1023
|
case "right-bottom":
|
|
1024
|
-
W = r +
|
|
1024
|
+
W = r + L, A = 0, H = 0, j = r, F = r, C = r, $ = r;
|
|
1025
1025
|
break;
|
|
1026
1026
|
case "left-top":
|
|
1027
|
-
W = r +
|
|
1027
|
+
W = r + L, A = E, H = r, j = E + r, F = L + r, C = 0, $ = 0;
|
|
1028
1028
|
break;
|
|
1029
1029
|
case "left-middle":
|
|
1030
|
-
W =
|
|
1030
|
+
W = L, A = E, H = L / 2, j = E + r, F = L / 2, C = 0, $ = 0;
|
|
1031
1031
|
break;
|
|
1032
1032
|
case "left-bottom":
|
|
1033
|
-
W = r +
|
|
1033
|
+
W = r + L, A = E, H = L, j = E + r, F = 0, C = 0, $ = r;
|
|
1034
1034
|
break;
|
|
1035
1035
|
}
|
|
1036
|
-
W = W +
|
|
1037
|
-
const a = $ +
|
|
1038
|
-
|
|
1039
|
-
let
|
|
1040
|
-
n.length > 0 && n.forEach((
|
|
1041
|
-
const G = $ +
|
|
1042
|
-
|
|
1036
|
+
W = W + w, o.width = Math.round(D * f), o.height = Math.round(W * f), g.scale(f, f), g.clearRect(0, 0, D, W), g.beginPath(), g.moveTo(A, H), g.lineTo(j, F), g.strokeStyle = "#FFF", g.lineWidth = 1, g.stroke(), g.fillStyle = "#FFF", g.fillRect(C, $, E, L), g.font = p, g.textBaseline = "middle";
|
|
1037
|
+
const a = $ + w + L / 2;
|
|
1038
|
+
g.strokeStyle = "#ffffff", g.lineWidth = 1, g.strokeText(e, C + t, a), g.fillStyle = "#000000", g.fillText(e, C + t, a), g.font = T, g.fillStyle = "#3370ff";
|
|
1039
|
+
let v = C + t + M + l;
|
|
1040
|
+
n.length > 0 && n.forEach((m, V) => {
|
|
1041
|
+
const G = $ + w + L / 2;
|
|
1042
|
+
g.fillText(he(m), v, G), v += x[V].width + l;
|
|
1043
1043
|
});
|
|
1044
1044
|
const u = o.toDataURL("image/png");
|
|
1045
1045
|
return Ye.set(i, u), u;
|
|
1046
1046
|
}
|
|
1047
1047
|
const at = (e, n) => {
|
|
1048
|
-
const { name: s, rightIcons: l, selected: i } = e.getProperties(), o = n !== 1 ? mo() : "right-top",
|
|
1049
|
-
let
|
|
1048
|
+
const { name: s, rightIcons: l, selected: i } = e.getProperties(), o = n !== 1 ? mo() : "right-top", g = xo(s, l, o);
|
|
1049
|
+
let w = [0, 0];
|
|
1050
1050
|
switch (o) {
|
|
1051
1051
|
case "right-top":
|
|
1052
|
-
|
|
1052
|
+
w = [0, 1];
|
|
1053
1053
|
break;
|
|
1054
1054
|
case "right-middle":
|
|
1055
|
-
|
|
1055
|
+
w = [0, 0.5];
|
|
1056
1056
|
break;
|
|
1057
1057
|
case "right-bottom":
|
|
1058
|
-
|
|
1058
|
+
w = [0, 0];
|
|
1059
1059
|
break;
|
|
1060
1060
|
case "left-top":
|
|
1061
|
-
|
|
1061
|
+
w = [1, 1];
|
|
1062
1062
|
break;
|
|
1063
1063
|
case "left-middle":
|
|
1064
|
-
|
|
1064
|
+
w = [1, 0.5];
|
|
1065
1065
|
break;
|
|
1066
1066
|
case "left-bottom":
|
|
1067
|
-
|
|
1067
|
+
w = [1, 0];
|
|
1068
1068
|
break;
|
|
1069
1069
|
}
|
|
1070
1070
|
return new Q({
|
|
1071
1071
|
image: new Ce({
|
|
1072
|
-
src:
|
|
1073
|
-
anchor:
|
|
1072
|
+
src: g,
|
|
1073
|
+
anchor: w,
|
|
1074
1074
|
displacement: [0, 0],
|
|
1075
1075
|
scale: 1 / wo,
|
|
1076
1076
|
anchorXUnits: "fraction",
|
|
@@ -1086,7 +1086,7 @@ const at = (e, n) => {
|
|
|
1086
1086
|
renderBuffer: 300,
|
|
1087
1087
|
zIndex: 101,
|
|
1088
1088
|
hitTolerance: 10
|
|
1089
|
-
}), o = new ge(),
|
|
1089
|
+
}), o = new ge(), g = new ye({
|
|
1090
1090
|
source: o,
|
|
1091
1091
|
className: "zh-map--ship-label-layer",
|
|
1092
1092
|
zIndex: 102,
|
|
@@ -1098,25 +1098,25 @@ const at = (e, n) => {
|
|
|
1098
1098
|
// 自定义分组名称
|
|
1099
1099
|
}
|
|
1100
1100
|
});
|
|
1101
|
-
e == null || e.addLayer(i), e == null || e.addLayer(
|
|
1102
|
-
let
|
|
1103
|
-
const
|
|
1101
|
+
e == null || e.addLayer(i), e == null || e.addLayer(g);
|
|
1102
|
+
let w = null, t = "", r = {}, f = {};
|
|
1103
|
+
const p = (a) => {
|
|
1104
1104
|
if (!a || !e) return;
|
|
1105
|
-
const
|
|
1105
|
+
const v = (s == null ? void 0 : s.id) || (n == null ? void 0 : n.get("id"));
|
|
1106
1106
|
if (s) {
|
|
1107
|
-
const u = a.filter((
|
|
1107
|
+
const u = a.filter((m) => m.id === v);
|
|
1108
1108
|
u.length === 0 ? a.push(s) : s = u[0];
|
|
1109
1109
|
}
|
|
1110
|
-
|
|
1111
|
-
},
|
|
1110
|
+
y(), $(a), z(), D();
|
|
1111
|
+
}, T = (a) => {
|
|
1112
1112
|
var R;
|
|
1113
|
-
const
|
|
1113
|
+
const v = (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]), m = ((R = f[a.id]) == null ? void 0 : R.blinkColors) || [], G = m[m.length - 1] || a.fill || "#04C900", B = go(a), J = new ae({
|
|
1114
1114
|
geometry: new ce(u),
|
|
1115
1115
|
// 船舶数据
|
|
1116
1116
|
shipData: a,
|
|
1117
1117
|
id: a.id,
|
|
1118
1118
|
name: a.cnname || a.enname || a.name || a.id || "未命名船舶",
|
|
1119
|
-
selected: a.id ===
|
|
1119
|
+
selected: a.id === v,
|
|
1120
1120
|
// 图标
|
|
1121
1121
|
rightIcons: ct(a),
|
|
1122
1122
|
// 船舶颜色
|
|
@@ -1127,90 +1127,90 @@ const at = (e, n) => {
|
|
|
1127
1127
|
isHighlight: !1
|
|
1128
1128
|
});
|
|
1129
1129
|
return J.set("clickGeometry", new Ht(u)), J;
|
|
1130
|
-
},
|
|
1130
|
+
}, z = async () => {
|
|
1131
1131
|
if (!s || !e) return;
|
|
1132
|
-
let
|
|
1133
|
-
if (
|
|
1132
|
+
let v = e.getOverlays().getArray().find((u) => u.get("class") == "ship-overlay-selected");
|
|
1133
|
+
if (v) {
|
|
1134
1134
|
const u = vt(e, s);
|
|
1135
|
-
await
|
|
1135
|
+
await v.setElement(u), await v.setPosition(ee([s.lon, s.lat]));
|
|
1136
1136
|
} else
|
|
1137
|
-
|
|
1137
|
+
v = ho(e, s), v && e.addOverlay(v);
|
|
1138
1138
|
setTimeout(() => {
|
|
1139
1139
|
var u;
|
|
1140
|
-
|
|
1140
|
+
v && ((u = v.get("element")) != null && u.parentElement) && (v.get("element").parentElement.style.display = "block");
|
|
1141
1141
|
}, 20);
|
|
1142
|
-
},
|
|
1142
|
+
}, M = (a) => {
|
|
1143
1143
|
if (a === "start") {
|
|
1144
|
-
const
|
|
1144
|
+
const v = () => {
|
|
1145
1145
|
l.getFeatures().forEach((u) => {
|
|
1146
1146
|
u.setStyle(me(e, u));
|
|
1147
|
-
}),
|
|
1147
|
+
}), w = requestAnimationFrame(v);
|
|
1148
1148
|
};
|
|
1149
|
-
|
|
1149
|
+
v();
|
|
1150
1150
|
}
|
|
1151
|
-
a === "end" &&
|
|
1152
|
-
},
|
|
1153
|
-
const
|
|
1154
|
-
if (
|
|
1155
|
-
const u =
|
|
1156
|
-
console.log(
|
|
1151
|
+
a === "end" && w && (cancelAnimationFrame(w), w = null);
|
|
1152
|
+
}, x = () => {
|
|
1153
|
+
const v = (e == null ? void 0 : e.getOverlays().getArray()).find((u) => u.get("class") == "ship-overlay-selected");
|
|
1154
|
+
if (v) {
|
|
1155
|
+
const u = v.getElement(), m = Ie(e, s, "ship"), V = u.querySelector("svg");
|
|
1156
|
+
console.log(V), V && (V.style.transform = `scale(${m})`);
|
|
1157
1157
|
}
|
|
1158
|
-
},
|
|
1159
|
-
e && l && (
|
|
1160
|
-
},
|
|
1161
|
-
const
|
|
1162
|
-
if (
|
|
1163
|
-
for (let u = 0; u <
|
|
1164
|
-
if (
|
|
1165
|
-
const
|
|
1166
|
-
console.log("overlay---",
|
|
1158
|
+
}, y = () => {
|
|
1159
|
+
e && l && (b(), l.clear(), o.clear(), M("end"));
|
|
1160
|
+
}, b = (a) => {
|
|
1161
|
+
const v = e.getOverlays().getArray().filter((u) => u.get("class") == "zh-map-ship-overlay");
|
|
1162
|
+
if (v && v.length > 0) {
|
|
1163
|
+
for (let u = 0; u < v.length; u++)
|
|
1164
|
+
if (v[u].get("class") !== "ship-overlay-selected") {
|
|
1165
|
+
const m = v[u];
|
|
1166
|
+
console.log("overlay---", m), m.setPosition(void 0), e.removeOverlay(m), m.dispose();
|
|
1167
1167
|
}
|
|
1168
1168
|
}
|
|
1169
|
-
},
|
|
1170
|
-
r = a,
|
|
1171
|
-
const u = e.getOverlays().getArray(),
|
|
1172
|
-
for (const
|
|
1173
|
-
const G = r[
|
|
1169
|
+
}, E = (a, v) => {
|
|
1170
|
+
r = a, f = v;
|
|
1171
|
+
const u = e.getOverlays().getArray(), m = l.getFeatures();
|
|
1172
|
+
for (const V in r) {
|
|
1173
|
+
const G = r[V], B = u.find((R) => R.getId() === "label-" + V), J = m.find((R) => V === R.get("id"));
|
|
1174
1174
|
if (B && J) {
|
|
1175
|
-
const R =
|
|
1175
|
+
const R = v[V].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 + "(" +
|
|
1181
|
+
name: le + "(" + v[V].shipState + ")"
|
|
1182
1182
|
}, Ee = B.getElement(), Te = yt(Ae);
|
|
1183
1183
|
Ee && Ee !== Te && B.setElement(Te);
|
|
1184
1184
|
}
|
|
1185
1185
|
}
|
|
1186
|
-
},
|
|
1186
|
+
}, L = () => {
|
|
1187
1187
|
const a = e.getOverlays().getArray();
|
|
1188
1188
|
if (r)
|
|
1189
|
-
for (const
|
|
1190
|
-
const u = a.find((
|
|
1189
|
+
for (const v in r) {
|
|
1190
|
+
const u = a.find((m) => m.getId() === "label-" + v);
|
|
1191
1191
|
if (u) {
|
|
1192
|
-
const
|
|
1193
|
-
|
|
1192
|
+
const m = u.getElement();
|
|
1193
|
+
m && (m.style.opacity = 0);
|
|
1194
1194
|
}
|
|
1195
1195
|
}
|
|
1196
1196
|
}, D = () => {
|
|
1197
1197
|
const a = e.getOverlays().getArray();
|
|
1198
1198
|
if (r)
|
|
1199
|
-
for (const
|
|
1200
|
-
const u = a.find((
|
|
1199
|
+
for (const v in r) {
|
|
1200
|
+
const u = a.find((m) => m.getId() === "label-" + v);
|
|
1201
1201
|
if (u) {
|
|
1202
|
-
const
|
|
1203
|
-
|
|
1202
|
+
const m = u.getElement();
|
|
1203
|
+
m && (m.style.opacity = 1);
|
|
1204
1204
|
}
|
|
1205
1205
|
}
|
|
1206
1206
|
}, W = (a) => {
|
|
1207
1207
|
if (!e) return;
|
|
1208
|
-
const
|
|
1208
|
+
const v = l.getFeatures(), u = o.getFeatures(), m = n ? n.get("id") : "", V = v.filter((R) => R.get("id") !== m), G = u == null ? void 0 : u.filter((R) => R.get("id") !== m), 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
|
+
V.forEach((R) => {
|
|
1214
1214
|
const ue = R.get("id");
|
|
1215
1215
|
if (!B.has(ue))
|
|
1216
1216
|
R.setStyle([]);
|
|
@@ -1232,36 +1232,36 @@ const at = (e, n) => {
|
|
|
1232
1232
|
}, A = (a) => {
|
|
1233
1233
|
if (a) {
|
|
1234
1234
|
console.log("选中", a);
|
|
1235
|
-
const
|
|
1236
|
-
|
|
1235
|
+
const v = l.getFeatures().find((m) => m.get("id") === a.id), u = o.getFeatures().find((m) => m.get("id") === a.id);
|
|
1236
|
+
v && (n = v), u && u.set("selected", !0), s = a, z();
|
|
1237
1237
|
} else
|
|
1238
1238
|
console.log("取消选中"), s = null, n = null, F();
|
|
1239
|
-
}, H = Re((a,
|
|
1239
|
+
}, H = Re((a, v, u) => {
|
|
1240
1240
|
try {
|
|
1241
1241
|
if (a) {
|
|
1242
|
-
const
|
|
1243
|
-
if (e.getTargetElement().style.cursor =
|
|
1244
|
-
t && t !==
|
|
1242
|
+
const m = a.get("shipData"), V = a.get("id");
|
|
1243
|
+
if (e.getTargetElement().style.cursor = V ? "pointer" : "", v === "click" && (A(m), u && u(V)), v === "hover") {
|
|
1244
|
+
t && t !== V && j(), t = V;
|
|
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
|
}
|
|
1248
1248
|
} else
|
|
1249
1249
|
e.getTargetElement().style.cursor = "", j();
|
|
1250
|
-
} catch (
|
|
1251
|
-
console.log("handleShipMapEvent",
|
|
1250
|
+
} catch (m) {
|
|
1251
|
+
console.log("handleShipMapEvent", m);
|
|
1252
1252
|
}
|
|
1253
1253
|
}, 10), j = () => {
|
|
1254
|
-
const a = t ? l.getFeatures().find((
|
|
1254
|
+
const a = t ? l.getFeatures().find((v) => v.get("id") === t) : null;
|
|
1255
1255
|
t = null, a == null || a.set("isHighlight", !1), a == null || a.setStyle(me(e, a));
|
|
1256
1256
|
}, F = () => {
|
|
1257
1257
|
try {
|
|
1258
|
-
const
|
|
1259
|
-
|
|
1258
|
+
const v = e.getOverlays().getArray().find((u) => u.get("class") == "ship-overlay-selected");
|
|
1259
|
+
v && v.setPosition(void 0);
|
|
1260
1260
|
} catch (a) {
|
|
1261
1261
|
console.log(a);
|
|
1262
1262
|
}
|
|
1263
|
-
},
|
|
1264
|
-
const u = ee([a == null ? void 0 : a.lon, a == null ? void 0 : a.lat]),
|
|
1263
|
+
}, C = (a, v) => {
|
|
1264
|
+
const u = ee([a == null ? void 0 : a.lon, a == null ? void 0 : a.lat]), m = new ae({
|
|
1265
1265
|
geometry: new ce(u),
|
|
1266
1266
|
name: a.cnname || a.enname || a.name || a.id || "未命名船舶",
|
|
1267
1267
|
// 图标
|
|
@@ -1269,17 +1269,17 @@ const at = (e, n) => {
|
|
|
1269
1269
|
selected: (a == null ? void 0 : a.id) === (s == null ? void 0 : s.id),
|
|
1270
1270
|
shipData: a
|
|
1271
1271
|
});
|
|
1272
|
-
|
|
1273
|
-
const
|
|
1274
|
-
return
|
|
1272
|
+
m.set("id", a.id);
|
|
1273
|
+
const V = at(m, v);
|
|
1274
|
+
return m.setStyle(V), m;
|
|
1275
1275
|
}, $ = (a) => {
|
|
1276
|
-
const
|
|
1276
|
+
const v = e.getView().getZoom();
|
|
1277
1277
|
a.forEach((u) => {
|
|
1278
|
-
const
|
|
1279
|
-
if (
|
|
1278
|
+
const m = T(u);
|
|
1279
|
+
if (m.setStyle(me(e, m)), l.addFeature(m), (s == null ? void 0 : s.id) == u.id || v >= re.shipModelMin)
|
|
1280
1280
|
if (r[u.id]) {
|
|
1281
|
-
if (u.id &&
|
|
1282
|
-
const
|
|
1281
|
+
if (u.id && f[u == null ? void 0 : u.id]) {
|
|
1282
|
+
const V = f[u == null ? void 0 : u.id] || {}, G = (V == null ? void 0 : V.blinkColors) || [], B = (V == null ? void 0 : V.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,29 +1288,29 @@ const at = (e, n) => {
|
|
|
1288
1288
|
yo(e, R);
|
|
1289
1289
|
}
|
|
1290
1290
|
} else {
|
|
1291
|
-
const
|
|
1292
|
-
o.addFeature(
|
|
1291
|
+
const V = C(u, a.length);
|
|
1292
|
+
o.addFeature(V);
|
|
1293
1293
|
}
|
|
1294
1294
|
});
|
|
1295
1295
|
};
|
|
1296
1296
|
return {
|
|
1297
|
-
render:
|
|
1297
|
+
render: p,
|
|
1298
1298
|
selected: A,
|
|
1299
1299
|
filter: W,
|
|
1300
|
-
blinking:
|
|
1301
|
-
clear:
|
|
1300
|
+
blinking: E,
|
|
1301
|
+
clear: y,
|
|
1302
1302
|
handleShipMapEvent: H,
|
|
1303
|
-
changeShipScale:
|
|
1304
|
-
changeSelectedScale:
|
|
1305
|
-
hiddenShipBlink:
|
|
1303
|
+
changeShipScale: M,
|
|
1304
|
+
changeSelectedScale: x,
|
|
1305
|
+
hiddenShipBlink: L,
|
|
1306
1306
|
showShipBlink: D
|
|
1307
1307
|
};
|
|
1308
1308
|
}, ko = (e) => {
|
|
1309
1309
|
const n = () => e == null ? void 0 : e.getLayers(), s = oe("vector"), l = () => s.value, i = (t) => {
|
|
1310
1310
|
s.value = t;
|
|
1311
1311
|
const r = n();
|
|
1312
|
-
r && (r == null || r.getArray().forEach((
|
|
1313
|
-
(
|
|
1312
|
+
r && (r == null || r.getArray().forEach((f) => {
|
|
1313
|
+
(f.className_ === "vector" || f.className_ === "satellite") && f.setVisible(f.className_ === t);
|
|
1314
1314
|
}));
|
|
1315
1315
|
}, o = oe(!1);
|
|
1316
1316
|
return {
|
|
@@ -1320,18 +1320,18 @@ const at = (e, n) => {
|
|
|
1320
1320
|
if (t !== o.value) {
|
|
1321
1321
|
if (t) {
|
|
1322
1322
|
const r = n();
|
|
1323
|
-
if (!r.getArray().find((
|
|
1324
|
-
const
|
|
1323
|
+
if (!r.getArray().find((p) => p.className_ === "greenTile")) {
|
|
1324
|
+
const p = new we({
|
|
1325
1325
|
source: new xe({ url: fe.greenTile }),
|
|
1326
1326
|
visible: t,
|
|
1327
1327
|
zIndex: 2,
|
|
1328
1328
|
className: "greenTile"
|
|
1329
1329
|
});
|
|
1330
|
-
r.push(
|
|
1330
|
+
r.push(p);
|
|
1331
1331
|
}
|
|
1332
1332
|
} else {
|
|
1333
|
-
const r = n(),
|
|
1334
|
-
|
|
1333
|
+
const r = n(), f = r.getArray().find((p) => p.className_ === "greenTile");
|
|
1334
|
+
f && r.remove(f);
|
|
1335
1335
|
}
|
|
1336
1336
|
o.value = t;
|
|
1337
1337
|
}
|
|
@@ -1350,34 +1350,34 @@ 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
|
|
1354
|
-
if (!(!
|
|
1353
|
+
const g = (M) => {
|
|
1354
|
+
if (!(!M || M.length === 0)) {
|
|
1355
1355
|
if (l || (l = new ge()), l.clear(), o) {
|
|
1356
|
-
const
|
|
1357
|
-
|
|
1356
|
+
const x = M.find((y) => y.id === o.id);
|
|
1357
|
+
x ? o = x : M.push(o);
|
|
1358
1358
|
}
|
|
1359
|
-
|
|
1360
|
-
|
|
1359
|
+
M.forEach((x) => {
|
|
1360
|
+
w(x);
|
|
1361
1361
|
}), s || (s = new ye({
|
|
1362
1362
|
className: n,
|
|
1363
1363
|
source: l,
|
|
1364
1364
|
zIndex: 100
|
|
1365
1365
|
}), e == null || e.addLayer(s));
|
|
1366
1366
|
}
|
|
1367
|
-
},
|
|
1368
|
-
const
|
|
1369
|
-
geometry: new ce(ee([Number(
|
|
1367
|
+
}, w = (M) => {
|
|
1368
|
+
const x = e == null ? void 0 : e.getView().getZoom(), [y, b] = M.latLon.split(","), E = new ae({
|
|
1369
|
+
geometry: new ce(ee([Number(y), Number(b)]))
|
|
1370
1370
|
});
|
|
1371
|
-
|
|
1372
|
-
}, t = (
|
|
1373
|
-
const
|
|
1371
|
+
E.setStyle(t(M, x, M.id === (o == null ? void 0 : o.id))), E.set("loactionData", M), l.addFeature(E);
|
|
1372
|
+
}, t = (M, x, y) => {
|
|
1373
|
+
const b = {
|
|
1374
1374
|
image: new Ce({
|
|
1375
|
-
src:
|
|
1376
|
-
scale: 0.5 *
|
|
1375
|
+
src: y && M.selectedPath || M.defaultPath,
|
|
1376
|
+
scale: 0.5 * x / 10
|
|
1377
1377
|
})
|
|
1378
1378
|
};
|
|
1379
|
-
return
|
|
1380
|
-
text:
|
|
1379
|
+
return M.name && (b.text = new be({
|
|
1380
|
+
text: M.name,
|
|
1381
1381
|
font: "12px sans-serif",
|
|
1382
1382
|
fill: new te({
|
|
1383
1383
|
color: "#000000"
|
|
@@ -1386,37 +1386,37 @@ const at = (e, n) => {
|
|
|
1386
1386
|
color: "#FFFFFF"
|
|
1387
1387
|
}),
|
|
1388
1388
|
offsetY: 30
|
|
1389
|
-
})), new Q(
|
|
1389
|
+
})), new Q(b);
|
|
1390
1390
|
}, r = () => {
|
|
1391
1391
|
if (i) {
|
|
1392
|
-
const
|
|
1393
|
-
l.getFeatures().forEach((
|
|
1394
|
-
|
|
1392
|
+
const M = i.get("loactionData").id;
|
|
1393
|
+
l.getFeatures().forEach((x) => {
|
|
1394
|
+
x.get("loactionData").id !== M && l.removeFeature(x);
|
|
1395
1395
|
});
|
|
1396
1396
|
} else
|
|
1397
1397
|
l.clear();
|
|
1398
|
-
},
|
|
1399
|
-
var
|
|
1400
|
-
const
|
|
1401
|
-
l.getFeatures().forEach((
|
|
1402
|
-
|
|
1398
|
+
}, f = () => {
|
|
1399
|
+
var b;
|
|
1400
|
+
const M = i.get("loactionData"), x = (b = e == null ? void 0 : e.getView()) == null ? void 0 : b.getZoom();
|
|
1401
|
+
l.getFeatures().forEach((E) => {
|
|
1402
|
+
E.get("loactionData").id === M.id && (E == null || E.setStyle(t(M, x, !1)));
|
|
1403
1403
|
}), o = null, i = null;
|
|
1404
|
-
},
|
|
1405
|
-
|
|
1406
|
-
},
|
|
1407
|
-
var
|
|
1404
|
+
}, p = (M) => {
|
|
1405
|
+
M ? (T(), z(M)) : clearSelectedPort();
|
|
1406
|
+
}, T = () => {
|
|
1407
|
+
var M;
|
|
1408
1408
|
if (i) {
|
|
1409
|
-
const
|
|
1410
|
-
i.setStyle(t(
|
|
1409
|
+
const x = i.get("loactionData"), y = (M = e == null ? void 0 : e.getView()) == null ? void 0 : M.getZoom();
|
|
1410
|
+
i.setStyle(t(x, y, !1));
|
|
1411
1411
|
}
|
|
1412
|
-
},
|
|
1413
|
-
const
|
|
1414
|
-
o =
|
|
1412
|
+
}, z = (M) => {
|
|
1413
|
+
const x = l.getFeatures();
|
|
1414
|
+
o = M, i = x.find((y) => y.get("loactionData").id === M.id);
|
|
1415
1415
|
};
|
|
1416
1416
|
return {
|
|
1417
|
-
render:
|
|
1418
|
-
selected:
|
|
1419
|
-
clearSelected:
|
|
1417
|
+
render: g,
|
|
1418
|
+
selected: p,
|
|
1419
|
+
clearSelected: f,
|
|
1420
1420
|
clear: r
|
|
1421
1421
|
};
|
|
1422
1422
|
}, Co = (e) => {
|
|
@@ -1435,13 +1435,13 @@ const at = (e, n) => {
|
|
|
1435
1435
|
l.value = F;
|
|
1436
1436
|
};
|
|
1437
1437
|
let o;
|
|
1438
|
-
const
|
|
1439
|
-
Le(e, "crosshair"),
|
|
1438
|
+
const g = oe(!1), w = () => {
|
|
1439
|
+
Le(e, "crosshair"), f(), Co(e), e.on("pointermove", z), e.getViewport().addEventListener("mouseout", () => {
|
|
1440
1440
|
o && o.classList.add("hidden");
|
|
1441
|
-
}),
|
|
1441
|
+
}), x(), g.value = !0;
|
|
1442
1442
|
};
|
|
1443
1443
|
let t, r;
|
|
1444
|
-
const
|
|
1444
|
+
const f = () => {
|
|
1445
1445
|
t = new ge(), r = new ye({
|
|
1446
1446
|
source: t,
|
|
1447
1447
|
zIndex: 1e3,
|
|
@@ -1454,16 +1454,16 @@ const at = (e, n) => {
|
|
|
1454
1454
|
}
|
|
1455
1455
|
}), e == null || e.addLayer(r);
|
|
1456
1456
|
};
|
|
1457
|
-
let
|
|
1458
|
-
const
|
|
1457
|
+
let p, T;
|
|
1458
|
+
const z = (F) => {
|
|
1459
1459
|
if (F.dragging)
|
|
1460
1460
|
return;
|
|
1461
|
-
let
|
|
1462
|
-
|
|
1461
|
+
let C = "点击选择起点";
|
|
1462
|
+
p && (C = "单击继续,双击结束"), o && (o.innerHTML = C, T.setPosition(F.coordinate), o.classList.remove("hidden"));
|
|
1463
1463
|
};
|
|
1464
|
-
let
|
|
1465
|
-
const
|
|
1466
|
-
|
|
1464
|
+
let M;
|
|
1465
|
+
const x = () => {
|
|
1466
|
+
M = new Oe({
|
|
1467
1467
|
source: t,
|
|
1468
1468
|
type: "LineString",
|
|
1469
1469
|
style: new Q({
|
|
@@ -1486,81 +1486,81 @@ const at = (e, n) => {
|
|
|
1486
1486
|
})
|
|
1487
1487
|
}),
|
|
1488
1488
|
// 添加条件函数,判断是否应该出发点绘制
|
|
1489
|
-
condition: (
|
|
1490
|
-
}), e == null || e.addInteraction(
|
|
1489
|
+
condition: (C) => C.originalEvent.target.tagName !== "DIV"
|
|
1490
|
+
}), e == null || e.addInteraction(M), L(), D();
|
|
1491
1491
|
let F;
|
|
1492
|
-
|
|
1492
|
+
M.on("drawstart", function(C) {
|
|
1493
1493
|
var a;
|
|
1494
|
-
|
|
1494
|
+
p = C.feature, p.set("randomId", y());
|
|
1495
1495
|
let $;
|
|
1496
|
-
F = (a =
|
|
1497
|
-
const u =
|
|
1498
|
-
$ = u.getLastCoordinate(),
|
|
1496
|
+
F = (a = p.getGeometry()) == null ? void 0 : a.on("change", function(v) {
|
|
1497
|
+
const u = v.target, m = mt(u, l.value);
|
|
1498
|
+
$ = u.getLastCoordinate(), b && m && (b.innerHTML = m), E.setPosition($);
|
|
1499
1499
|
});
|
|
1500
|
-
}),
|
|
1501
|
-
var
|
|
1502
|
-
if (
|
|
1503
|
-
const
|
|
1504
|
-
s.value.push({ id:
|
|
1500
|
+
}), M.on("drawend", function() {
|
|
1501
|
+
var C, $, a;
|
|
1502
|
+
if (b && (b.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), b != null && b.innerHTML) {
|
|
1503
|
+
const v = (p == null ? void 0 : p.get("randomId")) || y();
|
|
1504
|
+
s.value.push({ id: v, value: b == null ? void 0 : b.innerHTML }), b.innerHTML = `${b.innerHTML}<div class="ol-tooltip-delete-button" data-id="${v}"><i class="map-iconfont icon-delete"></i></div>`;
|
|
1505
1505
|
}
|
|
1506
|
-
(
|
|
1507
|
-
var
|
|
1508
|
-
|
|
1509
|
-
const u = (
|
|
1506
|
+
(C = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || C.addEventListener("click", (v) => {
|
|
1507
|
+
var m;
|
|
1508
|
+
v.preventDefault(), v.stopPropagation();
|
|
1509
|
+
const u = (m = v.target) == null ? void 0 : m.getAttribute("data-id");
|
|
1510
1510
|
u && A(u);
|
|
1511
|
-
}),
|
|
1511
|
+
}), E.setOffset([0, -7]), p = null, b = null, L(), F && Xe(F), (a = ($ = n.getProps()) == null ? void 0 : $.lineDrawEnd) == null || a.call($, s.value);
|
|
1512
1512
|
});
|
|
1513
|
-
},
|
|
1514
|
-
let
|
|
1515
|
-
const
|
|
1516
|
-
|
|
1517
|
-
element:
|
|
1513
|
+
}, y = () => Math.random().toString(36).substring(2, 9);
|
|
1514
|
+
let b, E;
|
|
1515
|
+
const L = () => {
|
|
1516
|
+
b != null && b.parentNode && b.parentNode.removeChild(b), b = document.createElement("div"), b.className = "ol-tooltip ol-tooltip-measure", E = new de({
|
|
1517
|
+
element: b,
|
|
1518
1518
|
offset: [0, -15],
|
|
1519
1519
|
positioning: "bottom-center",
|
|
1520
1520
|
stopEvent: !1,
|
|
1521
1521
|
insertFirst: !1
|
|
1522
|
-
}), e == null || e.addOverlay(
|
|
1522
|
+
}), e == null || e.addOverlay(E);
|
|
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", T = 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(T);
|
|
1529
1529
|
}, W = () => {
|
|
1530
|
-
s.value.forEach((F,
|
|
1531
|
-
var
|
|
1530
|
+
s.value.forEach((F, C) => {
|
|
1531
|
+
var v, u;
|
|
1532
1532
|
const $ = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1533
|
-
$[
|
|
1533
|
+
$[C] && ((u = (v = $[C]) == null ? void 0 : v.parentNode) == null || u.removeChild($[C]));
|
|
1534
1534
|
const a = t.getFeatures();
|
|
1535
|
-
a[
|
|
1536
|
-
}), H(), Lo(e),
|
|
1535
|
+
a[C] && t.removeFeature(a[C]);
|
|
1536
|
+
}), H(), Lo(e), g.value = !1, Le(e, "pointer");
|
|
1537
1537
|
}, A = (F) => {
|
|
1538
|
-
var $, a,
|
|
1539
|
-
const
|
|
1540
|
-
if (
|
|
1541
|
-
s.value.splice(
|
|
1542
|
-
const
|
|
1543
|
-
|
|
1544
|
-
const
|
|
1545
|
-
|
|
1538
|
+
var $, a, v, u;
|
|
1539
|
+
const C = s.value.findIndex((m) => m.id === F);
|
|
1540
|
+
if (C !== -1) {
|
|
1541
|
+
s.value.splice(C, 1);
|
|
1542
|
+
const m = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1543
|
+
m[C] && ((a = ($ = m[C]) == null ? void 0 : $.parentNode) == null || a.removeChild(m[C]));
|
|
1544
|
+
const V = t.getFeatures();
|
|
1545
|
+
V[C] && t.removeFeature(V[C]);
|
|
1546
1546
|
}
|
|
1547
|
-
(u = (
|
|
1547
|
+
(u = (v = n.getProps()) == null ? void 0 : v.lineDrawEnd) == null || u.call(v, 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 C;
|
|
1551
|
+
(C = F == null ? void 0 : F.parentNode) == null || C.removeChild(F);
|
|
1552
|
+
}), t == null || t.clear(), M) {
|
|
1553
|
+
const F = e.getInteractions().getArray().find((C) => lt(C) === lt(M));
|
|
1554
1554
|
F && e.removeInteraction(F);
|
|
1555
1555
|
}
|
|
1556
|
-
e.removeLayer(r), o != null && o.parentNode && o.parentNode.removeChild(o),
|
|
1556
|
+
e.removeLayer(r), o != null && o.parentNode && o.parentNode.removeChild(o), b != null && b.parentNode && b.parentNode.removeChild(b);
|
|
1557
1557
|
};
|
|
1558
1558
|
return {
|
|
1559
|
-
open:
|
|
1559
|
+
open: w,
|
|
1560
1560
|
close: W,
|
|
1561
1561
|
deleteLine: A,
|
|
1562
1562
|
setUnit: i,
|
|
1563
|
-
getState: () =>
|
|
1563
|
+
getState: () => g.value
|
|
1564
1564
|
};
|
|
1565
1565
|
}, mt = (e, n) => {
|
|
1566
1566
|
const l = Ke(e);
|
|
@@ -1580,14 +1580,14 @@ const at = (e, n) => {
|
|
|
1580
1580
|
}, To = (e, n) => {
|
|
1581
1581
|
let s, l, i = "close";
|
|
1582
1582
|
const o = () => {
|
|
1583
|
-
H(), i = "open",
|
|
1584
|
-
},
|
|
1585
|
-
r(),
|
|
1583
|
+
H(), i = "open", g(), Le(e, "crosshair");
|
|
1584
|
+
}, g = () => {
|
|
1585
|
+
r(), E(), W(), M();
|
|
1586
1586
|
};
|
|
1587
|
-
let
|
|
1587
|
+
let w = null, t = null;
|
|
1588
1588
|
const r = () => {
|
|
1589
|
-
if (
|
|
1590
|
-
const F = new ge(),
|
|
1589
|
+
if (w && t) return;
|
|
1590
|
+
const F = new ge(), C = new ye({
|
|
1591
1591
|
source: F,
|
|
1592
1592
|
style: new Q({
|
|
1593
1593
|
stroke: new ve({
|
|
@@ -1597,43 +1597,43 @@ const at = (e, n) => {
|
|
|
1597
1597
|
}),
|
|
1598
1598
|
zIndex: 1e3
|
|
1599
1599
|
});
|
|
1600
|
-
|
|
1601
|
-
|
|
1600
|
+
w = C, t = F, e.on("pointermove", p), e.addLayer(C), e.on(["dblclick"], function($) {
|
|
1601
|
+
T && ($.stopPropagation(), $.preventDefault());
|
|
1602
1602
|
});
|
|
1603
1603
|
};
|
|
1604
|
-
let
|
|
1605
|
-
const
|
|
1604
|
+
let f;
|
|
1605
|
+
const p = (F) => {
|
|
1606
1606
|
if (F.dragging) return;
|
|
1607
|
-
const
|
|
1608
|
-
|
|
1607
|
+
const C = f ? "单击继续,双击结束" : "点击选择起点";
|
|
1608
|
+
L && (L.innerHTML = C, D.setPosition(F.coordinate));
|
|
1609
1609
|
};
|
|
1610
|
-
let
|
|
1611
|
-
const
|
|
1610
|
+
let T, z = !1;
|
|
1611
|
+
const M = () => {
|
|
1612
1612
|
if (s) {
|
|
1613
|
-
|
|
1613
|
+
L != null && L.parentNode && L.parentNode.removeChild(L);
|
|
1614
1614
|
const F = s.getGeometry();
|
|
1615
1615
|
if (!F) return;
|
|
1616
|
-
const
|
|
1617
|
-
|
|
1618
|
-
<span class="text">面积:${
|
|
1619
|
-
`),
|
|
1616
|
+
const C = x(F, "nm");
|
|
1617
|
+
y && (y.innerHTML = `
|
|
1618
|
+
<span class="text">面积:${C}${z ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1619
|
+
`), y && (y.innerHTML += '<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');
|
|
1620
1620
|
const $ = F.getCoordinates(), a = $[0][$[0].length - 2];
|
|
1621
|
-
if (
|
|
1622
|
-
const u =
|
|
1621
|
+
if (b.setPosition(a), w) {
|
|
1622
|
+
const u = w.getSource();
|
|
1623
1623
|
u && s && (u.clear(), u.addFeature(s));
|
|
1624
1624
|
}
|
|
1625
1625
|
setTimeout(() => {
|
|
1626
1626
|
var u;
|
|
1627
1627
|
(u = document.querySelector(".delete-icon")) == null || u.addEventListener("click", () => {
|
|
1628
|
-
var
|
|
1629
|
-
console.log("delete"), A(), (
|
|
1628
|
+
var m, V;
|
|
1629
|
+
console.log("delete"), A(), (V = (m = n.getProps()) == null ? void 0 : m.areaDrawEnd) == null || V.call(m, []);
|
|
1630
1630
|
});
|
|
1631
1631
|
}, 0);
|
|
1632
|
-
const
|
|
1633
|
-
e == null || e.getView().setCenter(
|
|
1632
|
+
const v = jt(s.getGeometry().getExtent());
|
|
1633
|
+
e == null || e.getView().setCenter(v);
|
|
1634
1634
|
return;
|
|
1635
1635
|
}
|
|
1636
|
-
|
|
1636
|
+
T = 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 C = F.getGeometry().getCoordinates();
|
|
1658
|
+
return new Qt(C);
|
|
1659
1659
|
}
|
|
1660
1660
|
})]
|
|
1661
|
-
}), e == null || e.addInteraction(
|
|
1662
|
-
var
|
|
1663
|
-
|
|
1664
|
-
const a = $.target,
|
|
1665
|
-
if (
|
|
1661
|
+
}), e == null || e.addInteraction(T), T.on("drawstart", (F) => {
|
|
1662
|
+
var C;
|
|
1663
|
+
f = F.feature, l = (C = f.getGeometry()) == null ? void 0 : C.on("change", ($) => {
|
|
1664
|
+
const a = $.target, v = x(a, "nm"), m = a.getCoordinates()[0], V = new ze([m[m.length - 2], m[m.length - 1]]), G = mt(V, "nm");
|
|
1665
|
+
if (z = Number(Ke(V) / 1e3) > 150, !v) return;
|
|
1666
1666
|
const B = '<span class="error pl-4">超出可以绘画的距离</span>';
|
|
1667
|
-
|
|
1667
|
+
y && (y.innerHTML = `
|
|
1668
1668
|
<div class="text">
|
|
1669
|
-
面积:${
|
|
1670
|
-
${
|
|
1669
|
+
面积:${v}
|
|
1670
|
+
${z ? B : ""}
|
|
1671
1671
|
</div>
|
|
1672
|
-
`),
|
|
1672
|
+
`), L && (L.innerHTML = `
|
|
1673
1673
|
<div class="text">
|
|
1674
|
-
面积:${
|
|
1674
|
+
面积:${v}
|
|
1675
1675
|
</div>
|
|
1676
|
-
<div class="text ${
|
|
1677
|
-
线段 ${
|
|
1678
|
-
${
|
|
1676
|
+
<div class="text ${z ? "error" : ""}">
|
|
1677
|
+
线段 ${m.length - 2}: ${G}
|
|
1678
|
+
${z ? B : ""}
|
|
1679
1679
|
|
|
1680
1680
|
</div>
|
|
1681
1681
|
<div>
|
|
@@ -1683,54 +1683,54 @@ const at = (e, n) => {
|
|
|
1683
1683
|
</div>
|
|
1684
1684
|
`);
|
|
1685
1685
|
});
|
|
1686
|
-
}),
|
|
1687
|
-
var
|
|
1686
|
+
}), T.on("drawend", (F) => {
|
|
1687
|
+
var v, u, m, V;
|
|
1688
1688
|
if (!F.feature.getGeometry()) return;
|
|
1689
|
-
|
|
1689
|
+
y && !s && (y.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), s = F.feature, b.setOffset([10, 0]);
|
|
1690
1690
|
const $ = F.feature.getGeometry().getCoordinates(), a = $[0][$[0].length - 2];
|
|
1691
|
-
if (
|
|
1691
|
+
if (b.setPosition(a), L != null && L.parentNode && L.parentNode.removeChild(L), (v = n.getProps()) != null && v.areaDrawEnd) {
|
|
1692
1692
|
const G = $[0].map((B) => Me(B, _.mercator, _.data));
|
|
1693
|
-
(
|
|
1693
|
+
(m = (u = n.getProps()) == null ? void 0 : u.areaDrawEnd) == null || m.call(u, G);
|
|
1694
1694
|
}
|
|
1695
|
-
|
|
1695
|
+
T && (T.setActive(!1), e == null || e.removeInteraction(T), (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), (V = document.querySelector(".delete-icon")) == null || V.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
|
-
},
|
|
1702
|
+
}, x = (F, C) => {
|
|
1703
1703
|
const $ = Xt(F);
|
|
1704
|
-
switch (
|
|
1704
|
+
switch (C) {
|
|
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":
|
|
1708
1708
|
return $ > 1e4 ? Math.round($ / 1e6 / Math.pow(1.852, 2) * 100) / 100 + " nm<sup>2</sup>" : Math.round($ * 100) / 100 + " m<sup>2</sup>";
|
|
1709
1709
|
}
|
|
1710
1710
|
};
|
|
1711
|
-
let
|
|
1712
|
-
const
|
|
1713
|
-
|
|
1714
|
-
element:
|
|
1711
|
+
let y, b;
|
|
1712
|
+
const E = () => {
|
|
1713
|
+
y != null && y.parentNode && y.parentNode.removeChild(y), y = document.createElement("div"), y.style.display = "flex", y.className = "ol-tooltip ol-tooltip-draw-polygon", b = new de({
|
|
1714
|
+
element: y,
|
|
1715
1715
|
offset: [0, -15],
|
|
1716
1716
|
positioning: "bottom-center",
|
|
1717
1717
|
stopEvent: !1,
|
|
1718
1718
|
insertFirst: !1
|
|
1719
|
-
}), e == null || e.addOverlay(
|
|
1719
|
+
}), e == null || e.addOverlay(b);
|
|
1720
1720
|
};
|
|
1721
|
-
let
|
|
1721
|
+
let L, D;
|
|
1722
1722
|
const W = () => {
|
|
1723
|
-
|
|
1724
|
-
element:
|
|
1723
|
+
L != null && L.parentNode && L.parentNode.removeChild(L), L = document.createElement("div"), L.className = "ol-tooltip ol-help-tooltip", D = new de({
|
|
1724
|
+
element: L,
|
|
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",
|
|
1732
|
-
|
|
1733
|
-
}),
|
|
1731
|
+
i = "close", e.un("pointermove", p), f = null, T && (T.abortDrawing(), console.log("abortDrawing"), T.setActive(!1), (e == null ? void 0 : e.getInteractions()).forEach((C) => {
|
|
1732
|
+
C instanceof Oe && (C.setActive(!1), e == null || e.removeInteraction(C));
|
|
1733
|
+
}), T = null), l && Xe(l), l = void 0, t == null || t.clear(), t = null, w && e.getAllLayers().includes(w) && (e.removeLayer(w), w = null), L != null && L.parentElement && (L.innerHTML = "", L.parentElement.removeChild(L), L = null), y != null && y.parentElement && (y.innerHTML = "", y.parentElement.removeChild(y), y = null), D && e.removeOverlay(D), b && e.removeOverlay(b), Le(e, "pointer");
|
|
1734
1734
|
};
|
|
1735
1735
|
return {
|
|
1736
1736
|
open: o,
|
|
@@ -1748,40 +1748,40 @@ const at = (e, n) => {
|
|
|
1748
1748
|
});
|
|
1749
1749
|
e == null || e.addLayer(s);
|
|
1750
1750
|
let l = null, i = null;
|
|
1751
|
-
const o = (
|
|
1752
|
-
if (!
|
|
1751
|
+
const o = (x, y = !0) => {
|
|
1752
|
+
if (!x || x.length === 0) return;
|
|
1753
1753
|
if (n.clear(), i) {
|
|
1754
|
-
const
|
|
1755
|
-
|
|
1754
|
+
const E = x.find((L) => L.id === (i == null ? void 0 : i.id));
|
|
1755
|
+
E ? i = E : x.push(i);
|
|
1756
1756
|
}
|
|
1757
|
-
const
|
|
1758
|
-
|
|
1759
|
-
const [
|
|
1760
|
-
geometry: new ce(ee([Number(
|
|
1761
|
-
portData:
|
|
1762
|
-
id:
|
|
1763
|
-
select:
|
|
1764
|
-
showTitle:
|
|
1757
|
+
const b = [];
|
|
1758
|
+
x.forEach((E) => {
|
|
1759
|
+
const [L, D] = E.latLon.split(","), W = new ae({
|
|
1760
|
+
geometry: new ce(ee([Number(L), Number(D)])),
|
|
1761
|
+
portData: E,
|
|
1762
|
+
id: E.id,
|
|
1763
|
+
select: E.id === (i == null ? void 0 : i.id),
|
|
1764
|
+
showTitle: E.id === (i == null ? void 0 : i.id) || y
|
|
1765
1765
|
}), A = r(W);
|
|
1766
|
-
W.setStyle(A),
|
|
1767
|
-
}), n.addFeatures(
|
|
1766
|
+
W.setStyle(A), b.push(W);
|
|
1767
|
+
}), n.addFeatures(b);
|
|
1768
1768
|
};
|
|
1769
|
-
let
|
|
1770
|
-
const t = (
|
|
1771
|
-
|
|
1769
|
+
let g = null, w = null;
|
|
1770
|
+
const t = (x, y) => {
|
|
1771
|
+
g || (g = document.createElement("canvas"), w = g.getContext("2d", {
|
|
1772
1772
|
willReadFrequently: !0
|
|
1773
1773
|
}));
|
|
1774
|
-
const
|
|
1775
|
-
if (!
|
|
1776
|
-
|
|
1777
|
-
const
|
|
1778
|
-
|
|
1779
|
-
const j =
|
|
1780
|
-
|
|
1781
|
-
const $ =
|
|
1782
|
-
return
|
|
1783
|
-
}, r = (
|
|
1784
|
-
const { select:
|
|
1774
|
+
const b = g, E = w;
|
|
1775
|
+
if (!E) return "";
|
|
1776
|
+
b.width = 0, b.height = 0;
|
|
1777
|
+
const L = 2, D = 8, W = window.devicePixelRatio || 1, A = "12px sans-serif";
|
|
1778
|
+
E.font = A;
|
|
1779
|
+
const j = E.measureText(x).width, F = D + j + D, C = L + 12 + L * 2;
|
|
1780
|
+
b.width = Math.round(F * W), b.height = Math.round(C * W), E.scale(W, W), E.clearRect(0, 0, F, C), E.fillStyle = y ? "#FF5733" : "#FFF", E.fillRect(0, 0, F, C), E.font = A, E.textBaseline = "middle";
|
|
1781
|
+
const $ = C / 2;
|
|
1782
|
+
return E.strokeStyle = y ? "#000" : "#ffffff", E.lineWidth = 1, E.strokeText(x, D, $), E.fillStyle = y ? "#FFF" : "#000000", E.fillText(x, D, $), b.toDataURL("image/png");
|
|
1783
|
+
}, r = (x) => {
|
|
1784
|
+
const { select: y, showTitle: b } = x.getProperties(), E = (F) => `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1785
1785
|
<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="${F}"/>
|
|
1786
1786
|
<g clip-path="url(#clip0_10059_122082)">
|
|
1787
1787
|
<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"/>
|
|
@@ -1792,22 +1792,22 @@ const at = (e, n) => {
|
|
|
1792
1792
|
</clipPath>
|
|
1793
1793
|
</defs>
|
|
1794
1794
|
</svg>
|
|
1795
|
-
`,
|
|
1795
|
+
`, L = () => `data:image/svg+xml;utf8,${encodeURIComponent(E(y ? "#FF5733" : "#3370FF"))}`, D = e.getView().getZoom(), W = x.get("portData"), A = window.devicePixelRatio || 1, H = new Q({
|
|
1796
1796
|
image: new Ce({
|
|
1797
|
-
src:
|
|
1797
|
+
src: L(),
|
|
1798
1798
|
scale: 0.5 * D / 10
|
|
1799
1799
|
}),
|
|
1800
|
-
zIndex:
|
|
1800
|
+
zIndex: y ? 110 : 100
|
|
1801
1801
|
}), j = new Q({
|
|
1802
1802
|
image: new Ce({
|
|
1803
|
-
src: t(W.shortName,
|
|
1803
|
+
src: t(W.shortName, y),
|
|
1804
1804
|
anchor: [0.5, 0.5],
|
|
1805
1805
|
displacement: [0, -26],
|
|
1806
1806
|
scale: 1 / A,
|
|
1807
1807
|
anchorXUnits: "fraction",
|
|
1808
1808
|
anchorYUnits: "fraction"
|
|
1809
1809
|
}),
|
|
1810
|
-
zIndex:
|
|
1810
|
+
zIndex: y ? 110 : 100
|
|
1811
1811
|
// text: new Text({
|
|
1812
1812
|
// text: port.shortName,
|
|
1813
1813
|
// font: '12px sans-serif',
|
|
@@ -1820,109 +1820,99 @@ const at = (e, n) => {
|
|
|
1820
1820
|
// offsetY: 30,
|
|
1821
1821
|
// }),
|
|
1822
1822
|
});
|
|
1823
|
-
return !
|
|
1824
|
-
},
|
|
1823
|
+
return !b && !y ? H : [H, j];
|
|
1824
|
+
}, f = () => {
|
|
1825
1825
|
if (n)
|
|
1826
1826
|
if (l) {
|
|
1827
1827
|
console.log("清除非选中的港口");
|
|
1828
|
-
const
|
|
1829
|
-
n.getFeatures().forEach((
|
|
1830
|
-
|
|
1828
|
+
const x = l.get("portData").id;
|
|
1829
|
+
n.getFeatures().forEach((y) => {
|
|
1830
|
+
y.get("portData").id !== x && n.removeFeature(y);
|
|
1831
1831
|
});
|
|
1832
1832
|
} else
|
|
1833
1833
|
console.log("清除所有港口", n), n == null || n.clear();
|
|
1834
|
-
},
|
|
1834
|
+
}, p = (x) => {
|
|
1835
1835
|
if (n) {
|
|
1836
|
-
if (!
|
|
1837
|
-
return
|
|
1838
|
-
(l == null ? void 0 : l.get("portData").id) !==
|
|
1836
|
+
if (!x)
|
|
1837
|
+
return T();
|
|
1838
|
+
(l == null ? void 0 : l.get("portData").id) !== x.id && (T(), z(x));
|
|
1839
1839
|
}
|
|
1840
|
-
},
|
|
1841
|
-
var
|
|
1840
|
+
}, T = () => {
|
|
1841
|
+
var x;
|
|
1842
1842
|
if (l) {
|
|
1843
|
-
const
|
|
1844
|
-
|
|
1843
|
+
const y = l == null ? void 0 : l.get("portData"), b = (x = n.getFeatures()) == null ? void 0 : x.find((E) => E.get("portData").id === y.id);
|
|
1844
|
+
b && (b.set("select", !1), b.setStyle(r(b)), l = null, i = null);
|
|
1845
1845
|
}
|
|
1846
|
-
},
|
|
1846
|
+
}, z = (x) => {
|
|
1847
1847
|
if (!n) return;
|
|
1848
|
-
const
|
|
1849
|
-
i =
|
|
1848
|
+
const y = n.getFeatures();
|
|
1849
|
+
i = x, l = y.find((b) => b.get("portData").id === x.id), l && (l.set("select", !0), l.setStyle(r(l)));
|
|
1850
1850
|
};
|
|
1851
1851
|
return {
|
|
1852
1852
|
render: o,
|
|
1853
|
-
clear:
|
|
1854
|
-
selected:
|
|
1855
|
-
handlePortHover: (
|
|
1856
|
-
|
|
1853
|
+
clear: f,
|
|
1854
|
+
selected: p,
|
|
1855
|
+
handlePortHover: (x) => {
|
|
1856
|
+
x && x.get("portData") && (e != null && e.getTargetElement()) && Le(e, "pointer");
|
|
1857
1857
|
}
|
|
1858
1858
|
};
|
|
1859
|
-
}, So = (e, n, s, l, i, o,
|
|
1860
|
-
const
|
|
1861
|
-
|
|
1859
|
+
}, So = (e, n, s, l, i, o, g) => {
|
|
1860
|
+
const w = e.getInstall();
|
|
1861
|
+
w.on("moveend", () => {
|
|
1862
1862
|
var t, r;
|
|
1863
1863
|
try {
|
|
1864
|
-
const
|
|
1865
|
-
(r = (t = n.getProps()).mapMoveEnd) == null || r.call(t,
|
|
1866
|
-
} catch (
|
|
1867
|
-
console.log("moveend---catch",
|
|
1864
|
+
const f = e.getZoom();
|
|
1865
|
+
(r = (t = n.getProps()).mapMoveEnd) == null || r.call(t, f), s.reRenderTrackLine(), l.changeShipScale("end");
|
|
1866
|
+
} catch (f) {
|
|
1867
|
+
console.log("moveend---catch", f);
|
|
1868
1868
|
}
|
|
1869
|
-
}),
|
|
1870
|
-
if (t.dragging) return;
|
|
1871
|
-
const r =
|
|
1869
|
+
}), w.on("pointermove", (t) => {
|
|
1870
|
+
if (t.dragging || !w) return;
|
|
1871
|
+
const r = w.forEachFeatureAtPixel(
|
|
1872
1872
|
t.pixel,
|
|
1873
|
-
function(
|
|
1874
|
-
return
|
|
1873
|
+
function(f) {
|
|
1874
|
+
return f;
|
|
1875
1875
|
},
|
|
1876
1876
|
{
|
|
1877
|
-
hitTolerance: 3
|
|
1877
|
+
hitTolerance: 3
|
|
1878
1878
|
// 3像素的容差范围
|
|
1879
|
-
layerFilter: function(
|
|
1880
|
-
|
|
1881
|
-
}
|
|
1879
|
+
// layerFilter: function (layer) {
|
|
1880
|
+
// return layer.get('interactive') === true; // 只检查可交互的图层
|
|
1881
|
+
// }
|
|
1882
1882
|
}
|
|
1883
1883
|
);
|
|
1884
|
-
console.log("
|
|
1885
|
-
|
|
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
|
-
}
|
|
1895
|
-
}), v.on("movestart", () => {
|
|
1884
|
+
console.log("feature", r), s == null || s.handleTrackMapEvent(r, "hover", t), l == null || l.handleShipMapEvent(r, "hover"), r && (i == null || i.handlePortHover(r));
|
|
1885
|
+
}), w.on("movestart", () => {
|
|
1896
1886
|
try {
|
|
1897
|
-
const t =
|
|
1887
|
+
const t = w == null ? void 0 : w.getView().getZoom();
|
|
1898
1888
|
t && t <= re.shipModelMax && t >= re.shipTriggleMin && l.changeShipScale("start"), l.hiddenShipBlink();
|
|
1899
1889
|
} catch (t) {
|
|
1900
1890
|
console.log("movestart---catch", t);
|
|
1901
1891
|
}
|
|
1902
|
-
}),
|
|
1903
|
-
var r,
|
|
1904
|
-
if (
|
|
1892
|
+
}), w.on("click", Re((t) => {
|
|
1893
|
+
var r, f, p;
|
|
1894
|
+
if (g.getState() !== "open")
|
|
1905
1895
|
try {
|
|
1906
1896
|
if (console.log("1", o.getState()), o.getState()) return;
|
|
1907
|
-
const
|
|
1908
|
-
|
|
1909
|
-
(
|
|
1910
|
-
if (
|
|
1911
|
-
return
|
|
1897
|
+
const T = w.getEventPixel(t.originalEvent), z = w.forEachFeatureAtPixel(
|
|
1898
|
+
T,
|
|
1899
|
+
(M) => {
|
|
1900
|
+
if (M != null && M.get("shipData") || M != null && M.get("portData"))
|
|
1901
|
+
return M;
|
|
1912
1902
|
}
|
|
1913
1903
|
);
|
|
1914
|
-
if (
|
|
1915
|
-
l.handleShipMapEvent(
|
|
1916
|
-
else if (
|
|
1917
|
-
const
|
|
1918
|
-
i.selected(
|
|
1904
|
+
if (z != null && z.get("shipData"))
|
|
1905
|
+
l.handleShipMapEvent(z, "click", (r = n.getProps()) == null ? void 0 : r.selectShip);
|
|
1906
|
+
else if (z != null && z.get("portData")) {
|
|
1907
|
+
const M = z.get("portData");
|
|
1908
|
+
i.selected(M), (p = (f = n.getProps()) == null ? void 0 : f.selectPort) == null || p.call(f, M);
|
|
1919
1909
|
}
|
|
1920
1910
|
t.preventDefault(), t.stopPropagation();
|
|
1921
|
-
} catch (
|
|
1922
|
-
console.log("click---catch",
|
|
1911
|
+
} catch (T) {
|
|
1912
|
+
console.log("click---catch", T);
|
|
1923
1913
|
}
|
|
1924
|
-
}, 150)),
|
|
1925
|
-
const t =
|
|
1914
|
+
}, 150)), w.getView().on("change:resolution", Re(() => {
|
|
1915
|
+
const t = w == null ? void 0 : w.getView().getZoom();
|
|
1926
1916
|
t && t <= re.shipModelMax && t >= re.shipTriggleMin && l.changeSelectedScale("start");
|
|
1927
1917
|
}, 10));
|
|
1928
1918
|
}, No = () => {
|
|
@@ -1931,43 +1921,43 @@ const at = (e, n) => {
|
|
|
1931
1921
|
createInstance: (l, i) => {
|
|
1932
1922
|
const o = ro();
|
|
1933
1923
|
o.initMap(l, i);
|
|
1934
|
-
const
|
|
1935
|
-
t.setProps(i),
|
|
1936
|
-
const r = ao(
|
|
1937
|
-
So(o, t, r,
|
|
1938
|
-
const
|
|
1939
|
-
const
|
|
1940
|
-
return [
|
|
1941
|
-
},
|
|
1924
|
+
const g = o.getInstall(), w = ko(g), t = po();
|
|
1925
|
+
t.setProps(i), w.setShowLayerType(i.layerType), w.setGreenTileVisible(i.showGreenLayer);
|
|
1926
|
+
const r = ao(g), f = co(g, r), p = bo(g), T = Mo(g), z = Eo(g, t), M = To(g, t), x = Po(g);
|
|
1927
|
+
So(o, t, r, p, x, z, M);
|
|
1928
|
+
const y = () => {
|
|
1929
|
+
const E = g.getView().calculateExtent(o.getSize()), L = Me([E[0], E[1]], _.mercator, _.data), D = Me([E[2], E[3]], _.mercator, _.data);
|
|
1930
|
+
return [L[0], L[1], D[0], D[1]];
|
|
1931
|
+
}, b = {
|
|
1942
1932
|
id: Symbol("map-instance"),
|
|
1943
1933
|
innerMap: null,
|
|
1944
1934
|
map: o.getInstall(),
|
|
1945
1935
|
destroy: () => {
|
|
1946
|
-
e.splice(e.indexOf(
|
|
1936
|
+
e.splice(e.indexOf(b), 1);
|
|
1947
1937
|
},
|
|
1948
1938
|
methods: {
|
|
1949
1939
|
...o,
|
|
1950
|
-
layer:
|
|
1951
|
-
ship:
|
|
1940
|
+
layer: w,
|
|
1941
|
+
ship: p,
|
|
1952
1942
|
track: r,
|
|
1953
|
-
carTrack:
|
|
1943
|
+
carTrack: f,
|
|
1954
1944
|
port: {
|
|
1955
|
-
render:
|
|
1956
|
-
clear:
|
|
1957
|
-
selected:
|
|
1945
|
+
render: x.render,
|
|
1946
|
+
clear: x.clear,
|
|
1947
|
+
selected: x.selected
|
|
1958
1948
|
},
|
|
1959
|
-
position:
|
|
1960
|
-
drawLine:
|
|
1961
|
-
drawPolygon:
|
|
1949
|
+
position: T,
|
|
1950
|
+
drawLine: z,
|
|
1951
|
+
drawPolygon: M,
|
|
1962
1952
|
// 子模块
|
|
1963
1953
|
utils: {
|
|
1964
|
-
getCalculateExtent:
|
|
1954
|
+
getCalculateExtent: y,
|
|
1965
1955
|
convertSixHundredThousandToLatLng: Ue,
|
|
1966
1956
|
calculateCirclePoints: no
|
|
1967
1957
|
}
|
|
1968
1958
|
}
|
|
1969
1959
|
};
|
|
1970
|
-
return e.push(
|
|
1960
|
+
return e.push(b), b;
|
|
1971
1961
|
},
|
|
1972
1962
|
destroyInstance: (l) => {
|
|
1973
1963
|
const i = e.findIndex((o) => o.id === l);
|
|
@@ -1998,13 +1988,13 @@ const at = (e, n) => {
|
|
|
1998
1988
|
} }
|
|
1999
1989
|
},
|
|
2000
1990
|
setup(e, { expose: n }) {
|
|
2001
|
-
const s = oe(), l = oe(), i = No(), o = oe(),
|
|
1991
|
+
const s = oe(), l = oe(), i = No(), o = oe(), g = e, w = oe({
|
|
2002
1992
|
getInstall() {
|
|
2003
1993
|
}
|
|
2004
1994
|
});
|
|
2005
1995
|
return zt(() => {
|
|
2006
1996
|
var t;
|
|
2007
|
-
o.value = i.createInstance(s.value,
|
|
1997
|
+
o.value = i.createInstance(s.value, g), w.value = o.value.methods, (t = l.value) == null || t.setScaleLine(o.value.map, g.scaleLineUnit);
|
|
2008
1998
|
}), Ot(() => {
|
|
2009
1999
|
var t, r;
|
|
2010
2000
|
i.destroyInstance((t = o == null ? void 0 : o.value) == null ? void 0 : t.id), (r = o.value) == null || r.destroy();
|
|
@@ -2026,16 +2016,16 @@ const at = (e, n) => {
|
|
|
2026
2016
|
return (t = o.value) == null ? void 0 : t.methods.getView();
|
|
2027
2017
|
},
|
|
2028
2018
|
setCenter: (t, r) => {
|
|
2029
|
-
var
|
|
2030
|
-
return (
|
|
2019
|
+
var f;
|
|
2020
|
+
return (f = o.value) == null ? void 0 : f.methods.setCenter(t, r);
|
|
2031
2021
|
},
|
|
2032
2022
|
getSize: () => {
|
|
2033
2023
|
var t;
|
|
2034
2024
|
return (t = o.value) == null ? void 0 : t.methods.getSize();
|
|
2035
2025
|
},
|
|
2036
2026
|
getCenter: (t, r) => {
|
|
2037
|
-
var
|
|
2038
|
-
return (
|
|
2027
|
+
var f;
|
|
2028
|
+
return (f = o.value) == null ? void 0 : f.methods.getCenter();
|
|
2039
2029
|
},
|
|
2040
2030
|
layer: {
|
|
2041
2031
|
setGreenTileVisible: (t) => {
|
|
@@ -2131,8 +2121,8 @@ const at = (e, n) => {
|
|
|
2131
2121
|
},
|
|
2132
2122
|
port: {
|
|
2133
2123
|
render: (t, r) => {
|
|
2134
|
-
var
|
|
2135
|
-
return (
|
|
2124
|
+
var f;
|
|
2125
|
+
return (f = o.value) == null ? void 0 : f.methods.port.render(t, r);
|
|
2136
2126
|
},
|
|
2137
2127
|
clear: () => {
|
|
2138
2128
|
var t;
|
|
@@ -2208,8 +2198,8 @@ const at = (e, n) => {
|
|
|
2208
2198
|
return (r = o.value) == null ? void 0 : r.methods.utils.convertSixHundredThousandToLatLng(...t);
|
|
2209
2199
|
},
|
|
2210
2200
|
calculateCirclePoints: (t, r) => {
|
|
2211
|
-
var
|
|
2212
|
-
return (
|
|
2201
|
+
var f;
|
|
2202
|
+
return (f = o.value) == null ? void 0 : f.methods.utils.calculateCirclePoints(t, r);
|
|
2213
2203
|
}
|
|
2214
2204
|
}
|
|
2215
2205
|
}), (t, r) => (Qe(), Je("div", $o, [
|