zhihao-ui 1.3.19 → 1.3.20
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-wVG8G0gT.js → Map-DlXenBet.js} +397 -391
- package/dist/es/index.js +1 -1
- package/dist/index.css +1 -1
- package/dist/types/components/Map/Map.vue.d.ts +1 -1
- package/dist/types/components/Map/function/port.d.ts +1 -1
- package/dist/types/components/Map/index.d.ts +3 -3
- package/dist/umd/index.css +1 -1
- package/dist/umd/index.umd.cjs +19 -19
- package/package.json +1 -1
|
@@ -10,8 +10,8 @@ const _hoisted_1$2 = { id: "scale-line-container" }, _sfc_main$2 = /* @__PURE__
|
|
|
10
10
|
i || (i = "metric");
|
|
11
11
|
const t = new ScaleLine$1({
|
|
12
12
|
units: i
|
|
13
|
-
}),
|
|
14
|
-
|
|
13
|
+
}), m = document.getElementById("scale-line-container");
|
|
14
|
+
m && (t.setTarget(m), n.addControl(t));
|
|
15
15
|
}
|
|
16
16
|
}), (n, i) => (openBlock(), createElementBlock("div", _hoisted_1$2));
|
|
17
17
|
}
|
|
@@ -28,13 +28,13 @@ const _hoisted_1$2 = { id: "scale-line-container" }, _sfc_main$2 = /* @__PURE__
|
|
|
28
28
|
console.log("props", s);
|
|
29
29
|
const l = () => {
|
|
30
30
|
console.log("props");
|
|
31
|
-
const { setZoom: i, getZoom: t, getInstall:
|
|
32
|
-
if (!
|
|
31
|
+
const { setZoom: i, getZoom: t, getInstall: m } = s.mapInstance.methods;
|
|
32
|
+
if (!m()) return;
|
|
33
33
|
const o = t();
|
|
34
34
|
o && i(o + 1);
|
|
35
35
|
}, n = () => {
|
|
36
|
-
const { setZoom: i, getZoom: t, getInstall:
|
|
37
|
-
if (!
|
|
36
|
+
const { setZoom: i, getZoom: t, getInstall: m } = s.mapInstance.methods;
|
|
37
|
+
if (!m()) return;
|
|
38
38
|
const o = t();
|
|
39
39
|
o && i(o - 1);
|
|
40
40
|
};
|
|
@@ -81,15 +81,15 @@ function useMapInitializer() {
|
|
|
81
81
|
}, t = (y, P) => {
|
|
82
82
|
var V;
|
|
83
83
|
(V = l()) == null || V.setCenter(fromLonLat([y, P]));
|
|
84
|
-
},
|
|
84
|
+
}, m = () => {
|
|
85
85
|
var P;
|
|
86
86
|
const y = (P = l()) == null ? void 0 : P.getCenter();
|
|
87
87
|
return toLonLat(y);
|
|
88
|
-
},
|
|
88
|
+
}, v = () => {
|
|
89
89
|
var y;
|
|
90
90
|
return (y = s()) == null ? void 0 : y.getSize();
|
|
91
91
|
}, o = new Map$2(), r = (y, P) => {
|
|
92
|
-
|
|
92
|
+
p(P);
|
|
93
93
|
const V = {
|
|
94
94
|
zoom: P.zoom,
|
|
95
95
|
center: fromLonLat(P.center),
|
|
@@ -112,7 +112,7 @@ function useMapInitializer() {
|
|
|
112
112
|
view: new View(V)
|
|
113
113
|
});
|
|
114
114
|
e.value = f;
|
|
115
|
-
},
|
|
115
|
+
}, p = (y) => {
|
|
116
116
|
o.set("vectorTile", new TileLayer({
|
|
117
117
|
source: new XYZ({ url: BASE_MAP_LINK.vectorTile }),
|
|
118
118
|
visible: y.layerType === "vector",
|
|
@@ -150,10 +150,10 @@ function useMapInitializer() {
|
|
|
150
150
|
getZoom: n,
|
|
151
151
|
setZoom: i,
|
|
152
152
|
setCenter: t,
|
|
153
|
-
getCenter:
|
|
154
|
-
getSize:
|
|
153
|
+
getCenter: m,
|
|
154
|
+
getSize: v,
|
|
155
155
|
initMap: r,
|
|
156
|
-
setBaseLayerMap:
|
|
156
|
+
setBaseLayerMap: p
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
159
|
const convertSixHundredThousandToLatLng = function(e, s) {
|
|
@@ -217,13 +217,13 @@ const getIconStyle = (e) => {
|
|
|
217
217
|
return n !== 0 && (t = `${String(n).padStart(2, "0")}时${t}`), l !== 0 && (t = `${String(l).padStart(2, "0")}天${t}`), t;
|
|
218
218
|
}, useCarTrackManager = (e, s) => {
|
|
219
219
|
let l = null;
|
|
220
|
-
const n = async (
|
|
221
|
-
if (!e || (console.log("vehicleInfo",
|
|
222
|
-
const y = Math.abs(Number(
|
|
223
|
-
i(
|
|
220
|
+
const n = async (p) => {
|
|
221
|
+
if (!e || (console.log("vehicleInfo", p), !(p != null && p.lon && (p != null && p.lat)))) return;
|
|
222
|
+
const y = Math.abs(Number(p.lon)) > 180 ? convertSixHundredThousandToLatLng(p.lon, p.lat) : [p.lon, p.lat];
|
|
223
|
+
i(p, fromLonLat(y));
|
|
224
224
|
const P = e == null ? void 0 : e.getView(), V = new Point(y);
|
|
225
225
|
P.setCenter(transform(V.getCoordinates(), projection.data, projection.mercator));
|
|
226
|
-
}, i = (
|
|
226
|
+
}, i = (p, y) => {
|
|
227
227
|
const P = `${CDN_URL}map/car-icon.gif`;
|
|
228
228
|
l || (l = new Overlay({
|
|
229
229
|
element: document.createElement("div"),
|
|
@@ -233,26 +233,26 @@ const getIconStyle = (e) => {
|
|
|
233
233
|
}), e.addOverlay(l));
|
|
234
234
|
const V = l.getElement();
|
|
235
235
|
V.style.backgroundImage = `url(${P})`, V.style.width = "80px", V.style.height = "80px";
|
|
236
|
-
const f = (
|
|
236
|
+
const f = (p == null ? void 0 : p.drc) || "";
|
|
237
237
|
V.style.transform = `rotate(${f}deg)`, V.style.backgroundSize = "cover", l == null || l.setPosition(y);
|
|
238
238
|
};
|
|
239
239
|
return {
|
|
240
240
|
location: n,
|
|
241
241
|
remove: () => {
|
|
242
|
-
const
|
|
243
|
-
|
|
242
|
+
const p = l == null ? void 0 : l.getElement();
|
|
243
|
+
p && (p.innerHTML = "");
|
|
244
244
|
},
|
|
245
|
-
renderTrack: (
|
|
246
|
-
s.render(
|
|
245
|
+
renderTrack: (p, y, P) => {
|
|
246
|
+
s.render(p, y, P, "truck", 1e3);
|
|
247
247
|
},
|
|
248
|
-
setCenter: (
|
|
249
|
-
s.setCenter(
|
|
248
|
+
setCenter: (p) => {
|
|
249
|
+
s.setCenter(p);
|
|
250
250
|
},
|
|
251
251
|
closeTrack: () => {
|
|
252
252
|
s.close();
|
|
253
253
|
},
|
|
254
|
-
playTrack: (
|
|
255
|
-
s.play(
|
|
254
|
+
playTrack: (p, y) => {
|
|
255
|
+
s.play(p, y);
|
|
256
256
|
}
|
|
257
257
|
};
|
|
258
258
|
};
|
|
@@ -262,13 +262,13 @@ const useTrackManager = (e) => {
|
|
|
262
262
|
let n = null;
|
|
263
263
|
const i = "--";
|
|
264
264
|
let t = null;
|
|
265
|
-
const
|
|
266
|
-
element:
|
|
265
|
+
const m = document.createElement("div"), v = new Overlay({
|
|
266
|
+
element: m,
|
|
267
267
|
positioning: "top-left",
|
|
268
268
|
stopEvent: !1,
|
|
269
269
|
className: "track-label-popup"
|
|
270
270
|
});
|
|
271
|
-
let o, r,
|
|
271
|
+
let o, r, p, y, P, V = !1, f = Date.now(), w, k = 0, L = null, S = 20, _ = !1;
|
|
272
272
|
const H = 5, B = [], W = (a) => {
|
|
273
273
|
var d;
|
|
274
274
|
for (B.unshift(a); B.length > H; ) {
|
|
@@ -277,28 +277,28 @@ const useTrackManager = (e) => {
|
|
|
277
277
|
}
|
|
278
278
|
};
|
|
279
279
|
let c = "";
|
|
280
|
-
const
|
|
281
|
-
if (n && l[n] && s.get(n).getVisible() &&
|
|
280
|
+
const x = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], u = debounce(() => {
|
|
281
|
+
if (n && l[n] && s.get(n).getVisible() && _) {
|
|
282
282
|
console.log("reRenderTrackLine------------");
|
|
283
283
|
const a = cloneDeep(M(n, l[n]));
|
|
284
284
|
ce(n, a);
|
|
285
285
|
}
|
|
286
286
|
}, 300), M = (a, d) => {
|
|
287
287
|
let g = [];
|
|
288
|
-
const b = Math.max(1, Math.floor(d.length /
|
|
289
|
-
return g = d.filter((
|
|
290
|
-
if (Number(
|
|
291
|
-
const [$, A] = convertSixHundredThousandToLatLng(
|
|
292
|
-
|
|
288
|
+
const b = Math.max(1, Math.floor(d.length / S));
|
|
289
|
+
return g = d.filter((T, R) => R % b === 0).map((T, R) => {
|
|
290
|
+
if (Number(T.lon) > 180 || Number(T.lat) > 180) {
|
|
291
|
+
const [$, A] = convertSixHundredThousandToLatLng(T.lon, T.lat);
|
|
292
|
+
T.lon = $, T.lat = A;
|
|
293
293
|
}
|
|
294
|
-
return
|
|
294
|
+
return T.center = [T.lon, T.lat], T.centerPoint = lonLatToMercator(T.center), T.time = hooks(T.createdAt).format("YYYY-MM-DD HH:mm:ss"), T.id = a, T.index = R, T;
|
|
295
295
|
}), g;
|
|
296
|
-
}, D = async (a, d, g, b = "ship",
|
|
297
|
-
if (!e || (d = d == null ? void 0 : d.reverse(),
|
|
296
|
+
}, D = async (a, d, g, b = "ship", C = 200) => {
|
|
297
|
+
if (!e || (d = d == null ? void 0 : d.reverse(), v && b === "ship" && (e != null && e.getOverlays().getArray().includes(v) || e.addOverlay(v)), (d == null ? void 0 : d.length) < 2))
|
|
298
298
|
return;
|
|
299
|
-
W(a), n = a, l[a] = d,
|
|
300
|
-
const
|
|
301
|
-
c = g ||
|
|
299
|
+
W(a), n = a, l[a] = d, S = C;
|
|
300
|
+
const T = Object.keys(l).findIndex((R) => R === a) || 0;
|
|
301
|
+
c = g || x[T > 10 ? 10 : T], _ = !0, await z(), await ne(n);
|
|
302
302
|
}, N = (a) => {
|
|
303
303
|
const d = new VectorSource();
|
|
304
304
|
return new VectorLayer({
|
|
@@ -311,32 +311,32 @@ const useTrackManager = (e) => {
|
|
|
311
311
|
});
|
|
312
312
|
}, O = (a) => {
|
|
313
313
|
s.forEach((d, g) => {
|
|
314
|
-
var
|
|
314
|
+
var C;
|
|
315
315
|
const b = g === a;
|
|
316
|
-
d.getVisible() !== b && (d.setVisible(b), e.getLayers().getArray().includes(d) || e.addLayer(d), b || (
|
|
316
|
+
d.getVisible() !== b && (d.setVisible(b), e.getLayers().getArray().includes(d) || e.addLayer(d), b || (C = d.getSource()) == null || C.clear());
|
|
317
317
|
}), n = a;
|
|
318
|
-
},
|
|
318
|
+
}, z = async () => {
|
|
319
319
|
const a = n;
|
|
320
320
|
if (!s.has(a)) {
|
|
321
|
-
const
|
|
322
|
-
s.set(a,
|
|
321
|
+
const T = N(a);
|
|
322
|
+
s.set(a, T);
|
|
323
323
|
}
|
|
324
324
|
await O(a);
|
|
325
325
|
const d = c || "", g = l[a] || [];
|
|
326
326
|
if (!(g && g.length > 1)) return [];
|
|
327
327
|
let b = [];
|
|
328
328
|
b = M(a, g);
|
|
329
|
-
const
|
|
330
|
-
b.length >= 2 && await F(a,
|
|
329
|
+
const C = b.map((T) => T.centerPoint);
|
|
330
|
+
b.length >= 2 && await F(a, C, d);
|
|
331
331
|
}, F = (a, d, g) => {
|
|
332
|
-
const b = new LineString(d),
|
|
333
|
-
if (
|
|
334
|
-
|
|
332
|
+
const b = new LineString(d), C = s.get(a).getSource(), T = C.getFeatureById(a);
|
|
333
|
+
if (T)
|
|
334
|
+
T.setGeometry(b), T.setId(a), T.setStyle(Z(g)), L = T;
|
|
335
335
|
else {
|
|
336
336
|
const R = new Feature({ geometry: b });
|
|
337
|
-
R.setId(a), R.set("type", "line"), R.setStyle(Z(g)),
|
|
337
|
+
R.setId(a), R.set("type", "line"), R.setStyle(Z(g)), C.addFeature(R), L = R;
|
|
338
338
|
}
|
|
339
|
-
return
|
|
339
|
+
return L;
|
|
340
340
|
}, Z = (a) => new Style({
|
|
341
341
|
stroke: new Stroke({
|
|
342
342
|
color: a,
|
|
@@ -346,10 +346,10 @@ const useTrackManager = (e) => {
|
|
|
346
346
|
const b = a == null ? void 0 : a.get("trackId");
|
|
347
347
|
if (a && b && d === "hover") {
|
|
348
348
|
e.getTargetElement().style.cursor = b ? "pointer" : "";
|
|
349
|
-
const
|
|
350
|
-
R && (
|
|
349
|
+
const C = a.get("data"), T = Q(C), R = g == null ? void 0 : g.coordinate;
|
|
350
|
+
R && (m.querySelector(".popup-content"), m.innerHTML = T, v == null || v.setPosition(R));
|
|
351
351
|
} else
|
|
352
|
-
|
|
352
|
+
v && v.setPosition(void 0);
|
|
353
353
|
}, Q = (a) => {
|
|
354
354
|
if (!(a != null && a.time)) return;
|
|
355
355
|
let d = "";
|
|
@@ -404,29 +404,29 @@ const useTrackManager = (e) => {
|
|
|
404
404
|
let b = 0;
|
|
405
405
|
g[0].distance = 0;
|
|
406
406
|
for (let $ = 1; $ < g.length; $++) {
|
|
407
|
-
const A = g[$ - 1].pixel, Y = g[$].pixel, X = Y[0] - A[0],
|
|
408
|
-
b += Math.sqrt(X * X +
|
|
407
|
+
const A = g[$ - 1].pixel, Y = g[$].pixel, X = Y[0] - A[0], E = Y[1] - A[1];
|
|
408
|
+
b += Math.sqrt(X * X + E * E), g[$].distance = b;
|
|
409
409
|
}
|
|
410
|
-
const
|
|
410
|
+
const C = g.filter(
|
|
411
411
|
($, A) => A === 0 || A === g.length - 1
|
|
412
|
-
),
|
|
413
|
-
for (let $ = 0; $ <
|
|
414
|
-
const A =
|
|
415
|
-
if (
|
|
416
|
-
const Y =
|
|
417
|
-
for (let G = 1; G <=
|
|
412
|
+
), T = [];
|
|
413
|
+
for (let $ = 0; $ < C.length; $++) {
|
|
414
|
+
const A = C[$];
|
|
415
|
+
if (T.push(A), $ < C.length - 1) {
|
|
416
|
+
const Y = C[$ + 1], X = Y.distance - A.distance, E = Math.floor(X / 100);
|
|
417
|
+
for (let G = 1; G <= E; G++) {
|
|
418
418
|
const j = A.distance + G * 100;
|
|
419
419
|
if (j >= Y.distance) break;
|
|
420
420
|
const q = ae(
|
|
421
421
|
g,
|
|
422
422
|
j
|
|
423
423
|
);
|
|
424
|
-
q &&
|
|
424
|
+
q && T.push(q);
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
427
|
}
|
|
428
428
|
return Array.from(
|
|
429
|
-
new Map(
|
|
429
|
+
new Map(T.map(($) => [$.distance.toFixed(2), $])).values()
|
|
430
430
|
).map(($) => ({
|
|
431
431
|
...$.original,
|
|
432
432
|
// 优先保留原始数据
|
|
@@ -440,9 +440,9 @@ const useTrackManager = (e) => {
|
|
|
440
440
|
};
|
|
441
441
|
function ae(a, d) {
|
|
442
442
|
for (let g = 1; g < a.length; g++) {
|
|
443
|
-
const b = a[g - 1],
|
|
444
|
-
if (d >= b.distance && d <=
|
|
445
|
-
const
|
|
443
|
+
const b = a[g - 1], C = a[g];
|
|
444
|
+
if (d >= b.distance && d <= C.distance) {
|
|
445
|
+
const T = (d - b.distance) / (C.distance - b.distance), R = b.pixel[0] + T * (C.pixel[0] - b.pixel[0]), $ = b.pixel[1] + T * (C.pixel[1] - b.pixel[1]), A = e == null ? void 0 : e.getCoordinateFromPixel([R, $]);
|
|
446
446
|
return {
|
|
447
447
|
...b,
|
|
448
448
|
// 继承前一个点的属性(可调整)
|
|
@@ -458,9 +458,9 @@ const useTrackManager = (e) => {
|
|
|
458
458
|
}
|
|
459
459
|
const ce = async (a, d) => {
|
|
460
460
|
await re(), await ge(a);
|
|
461
|
-
const g = ie(d), b = g.map((
|
|
462
|
-
s.get(a).getSource().addFeatures(b), he(a, g, d, c), g.forEach((
|
|
463
|
-
const R = ue(a, c,
|
|
461
|
+
const g = ie(d), b = g.map((T) => de(T));
|
|
462
|
+
s.get(a).getSource().addFeatures(b), he(a, g, d, c), g.forEach((T) => {
|
|
463
|
+
const R = ue(a, c, T);
|
|
464
464
|
e.addOverlay(R);
|
|
465
465
|
});
|
|
466
466
|
}, de = (a) => {
|
|
@@ -488,7 +488,7 @@ const useTrackManager = (e) => {
|
|
|
488
488
|
stroke="${d}"
|
|
489
489
|
stroke-width="1" />
|
|
490
490
|
`;
|
|
491
|
-
const
|
|
491
|
+
const C = new Overlay({
|
|
492
492
|
element: b,
|
|
493
493
|
position: fromLonLat(g.center),
|
|
494
494
|
positioning: "top-left",
|
|
@@ -496,7 +496,7 @@ const useTrackManager = (e) => {
|
|
|
496
496
|
stopEvent: !1,
|
|
497
497
|
className: "track-label-time-overlay"
|
|
498
498
|
});
|
|
499
|
-
return
|
|
499
|
+
return C.set("class", "track-label-overlay"), C.set("trackId", a), C;
|
|
500
500
|
}, re = () => {
|
|
501
501
|
const a = e == null ? void 0 : e.getOverlays().getArray(), d = a == null ? void 0 : a.filter((g) => g.get("class") === "track-label-overlay");
|
|
502
502
|
d && d.length > 0 && d.forEach((g) => {
|
|
@@ -525,7 +525,7 @@ const useTrackManager = (e) => {
|
|
|
525
525
|
})
|
|
526
526
|
// textStyle,
|
|
527
527
|
]), ye = (a) => {
|
|
528
|
-
const d = "#E31818", g = "#1890FF", b = "",
|
|
528
|
+
const d = "#E31818", g = "#1890FF", b = "", C = new Style({
|
|
529
529
|
text: new Text({
|
|
530
530
|
font: "Normal 22px map-iconfont",
|
|
531
531
|
text: getIconFont(b),
|
|
@@ -536,18 +536,18 @@ const useTrackManager = (e) => {
|
|
|
536
536
|
}),
|
|
537
537
|
zIndex: 99
|
|
538
538
|
}), R = getIconStyle(""), A = getIconStyle(""), Y = [];
|
|
539
|
-
return Number(a.state) === 0 ? Y.push(R) : Number(a.state) === 1 && Y.push(A), Y.push(
|
|
539
|
+
return Number(a.state) === 0 ? Y.push(R) : Number(a.state) === 1 && Y.push(A), Y.push(C), Y;
|
|
540
540
|
}, he = (a, d, g, b) => {
|
|
541
|
-
const
|
|
542
|
-
|
|
541
|
+
const C = d || [], T = d.length;
|
|
542
|
+
T || (C.push(g[0]), C.push(g[g.length - 1]));
|
|
543
543
|
const R = [];
|
|
544
|
-
for (let A = 0; A <
|
|
544
|
+
for (let A = 0; A < T - 1; A++) {
|
|
545
545
|
let Y;
|
|
546
|
-
const X = d[A],
|
|
547
|
-
if (
|
|
548
|
-
Y = g[
|
|
546
|
+
const X = d[A], E = (d[A + 1].index + X.index) / 2;
|
|
547
|
+
if (E % 2 === 0)
|
|
548
|
+
Y = g[E].centerPoint;
|
|
549
549
|
else {
|
|
550
|
-
const G = g[Math.floor(
|
|
550
|
+
const G = g[Math.floor(E)], j = g[Math.ceil(E)];
|
|
551
551
|
if (G && j) {
|
|
552
552
|
const [q, J] = G.centerPoint, [I, ee] = j.centerPoint;
|
|
553
553
|
Y = [(q + I) / 2, (J + ee) / 2];
|
|
@@ -576,24 +576,24 @@ const useTrackManager = (e) => {
|
|
|
576
576
|
const $ = s.get(a).getSource();
|
|
577
577
|
$ == null || $.addFeatures(R);
|
|
578
578
|
}, ne = (a) => {
|
|
579
|
-
var
|
|
580
|
-
const d = e.getView(), g = (
|
|
579
|
+
var T, R;
|
|
580
|
+
const d = e.getView(), g = (T = s == null ? void 0 : s.get(a)) == null ? void 0 : T.getSource(), b = L || (a ? g == null ? void 0 : g.getFeatureById(a) : null);
|
|
581
581
|
if (!b) return;
|
|
582
|
-
const
|
|
583
|
-
if (
|
|
582
|
+
const C = (R = b == null ? void 0 : b.getGeometry()) == null ? void 0 : R.getExtent();
|
|
583
|
+
if (C != null && C.length)
|
|
584
584
|
try {
|
|
585
|
-
const $ = buffer(
|
|
585
|
+
const $ = buffer(C, Math.max(C[2] - C[0], C[3] - C[1]) * 0.02);
|
|
586
586
|
d.fit($);
|
|
587
587
|
} catch ($) {
|
|
588
588
|
console.log($);
|
|
589
589
|
}
|
|
590
590
|
}, me = (a) => {
|
|
591
|
-
const d = "",
|
|
591
|
+
const d = "", C = a.index === 0 ? "#fcdc3f" : "#ff0000";
|
|
592
592
|
return [new Style({
|
|
593
593
|
text: new Text({
|
|
594
594
|
font: "Normal 14px map-iconfont",
|
|
595
595
|
text: getIconFont(d),
|
|
596
|
-
fill: new Fill({ color:
|
|
596
|
+
fill: new Fill({ color: C })
|
|
597
597
|
}),
|
|
598
598
|
zIndex: 101
|
|
599
599
|
})];
|
|
@@ -603,28 +603,28 @@ const useTrackManager = (e) => {
|
|
|
603
603
|
(g = d.getSource()) == null || g.clear(), e == null || e.removeLayer(d);
|
|
604
604
|
}), Object.keys(l).forEach((d) => {
|
|
605
605
|
s.delete(d), delete l[d];
|
|
606
|
-
}),
|
|
606
|
+
}), _ = !1, re();
|
|
607
607
|
}, we = (a) => {
|
|
608
608
|
const d = s.get(a || n);
|
|
609
609
|
d == null || d.setVisible(!1);
|
|
610
610
|
const g = e.getOverlays().getArray();
|
|
611
611
|
for (let b = 0; b < g.length; ) {
|
|
612
|
-
const
|
|
613
|
-
|
|
612
|
+
const C = g[b];
|
|
613
|
+
C.get("class") === "track-label-overlay" ? (C.setPosition(void 0), e.removeOverlay(C)) : b++;
|
|
614
614
|
}
|
|
615
615
|
U();
|
|
616
616
|
}, pe = (a, d = LENGTH_UNIT.NM) => {
|
|
617
617
|
const g = {
|
|
618
618
|
id: a,
|
|
619
619
|
length: "--"
|
|
620
|
-
},
|
|
620
|
+
}, C = (l[a] || []).map(
|
|
621
621
|
(R) => transform([R.lon, R.lat], projection.data, projection.mercator)
|
|
622
|
-
),
|
|
623
|
-
return g.length = formatLength(
|
|
622
|
+
), T = new LineString(C);
|
|
623
|
+
return g.length = formatLength(T, d) || "--", g;
|
|
624
624
|
}, Le = (a, d) => {
|
|
625
625
|
xe(String(a), d);
|
|
626
626
|
}, xe = (a, d) => {
|
|
627
|
-
const g = l[String(a)], b = g == null ? void 0 : g.map((
|
|
627
|
+
const g = l[String(a)], b = g == null ? void 0 : g.map((C) => [C.lon, C.lat]);
|
|
628
628
|
b && ke(b, d);
|
|
629
629
|
}, te = new Style({
|
|
630
630
|
text: new Text({
|
|
@@ -635,30 +635,30 @@ const useTrackManager = (e) => {
|
|
|
635
635
|
// 初始旋转角度
|
|
636
636
|
})
|
|
637
637
|
}), be = (a, d) => {
|
|
638
|
-
var
|
|
639
|
-
const g = Number(50 * d), b = ((
|
|
640
|
-
if (
|
|
638
|
+
var E, G;
|
|
639
|
+
const g = Number(50 * d), b = ((E = a.frameState) == null ? void 0 : E.time) ?? Date.now(), C = b - f;
|
|
640
|
+
if (k = (k + g * C / 1e6) % 2, f = b, k >= 1) {
|
|
641
641
|
U();
|
|
642
642
|
return;
|
|
643
643
|
}
|
|
644
|
-
const
|
|
645
|
-
|
|
644
|
+
const T = r.getCoordinateAt(
|
|
645
|
+
k > 1 ? 2 - k : k
|
|
646
646
|
), R = r.getCoordinateAt(
|
|
647
|
-
|
|
647
|
+
k > 1 ? k - 0.01 : k
|
|
648
648
|
), $ = r.getCoordinateAt(
|
|
649
|
-
|
|
649
|
+
k > 1 ? 2 - k : k + 0.01
|
|
650
650
|
), Y = le(
|
|
651
651
|
mercatorToLonLat(R, "array"),
|
|
652
652
|
mercatorToLonLat($, "array")
|
|
653
653
|
) * Math.PI / 180;
|
|
654
|
-
(G = te.getText()) == null || G.setRotation(Y), y.setCoordinates(
|
|
654
|
+
(G = te.getText()) == null || G.setRotation(Y), y.setCoordinates(T);
|
|
655
655
|
const X = getVectorContext(a);
|
|
656
656
|
X.setStyle(te), X.drawGeometry(y), e == null || e.render();
|
|
657
657
|
}, Me = () => {
|
|
658
658
|
var a;
|
|
659
|
-
V = !0, f = Date.now(),
|
|
659
|
+
V = !0, f = Date.now(), k = 0, y = ((a = p.getGeometry()) == null ? void 0 : a.clone()) || new Point([0, 0]), t && (w == null || w.on("postrender", t)), P == null || P.setGeometry(void 0);
|
|
660
660
|
}, U = () => {
|
|
661
|
-
V && (V = !1, P == null || P.setGeometry(void 0), t &&
|
|
661
|
+
V && (V = !1, P == null || P.setGeometry(void 0), t && w && w.un("postrender", t), w && (e == null || e.removeLayer(w)), w = null, P = null);
|
|
662
662
|
}, ke = (a, d) => {
|
|
663
663
|
V && U(), o = new Polyline({
|
|
664
664
|
factor: 1e6
|
|
@@ -667,56 +667,56 @@ const useTrackManager = (e) => {
|
|
|
667
667
|
}).readGeometry(o, {
|
|
668
668
|
dataProjection: projection.data,
|
|
669
669
|
featureProjection: projection.mercator
|
|
670
|
-
}),
|
|
670
|
+
}), p = new Feature({
|
|
671
671
|
type: "icon",
|
|
672
672
|
geometry: new Point(r.getFirstCoordinate())
|
|
673
673
|
});
|
|
674
|
-
const g =
|
|
674
|
+
const g = p.getGeometry();
|
|
675
675
|
y = g ? g.clone() : new Point([0, 0]), P = new Feature({
|
|
676
676
|
type: "geoMarker",
|
|
677
677
|
style: te,
|
|
678
678
|
geometry: y
|
|
679
|
-
}),
|
|
679
|
+
}), w = new VectorLayer({
|
|
680
680
|
source: new VectorSource({
|
|
681
681
|
features: [P]
|
|
682
682
|
})
|
|
683
|
-
}), e == null || e.addLayer(
|
|
683
|
+
}), e == null || e.addLayer(w), t = (b) => be(b, d), Me();
|
|
684
684
|
}, le = (a, d, g) => {
|
|
685
|
-
function b(
|
|
686
|
-
return 180 * (
|
|
685
|
+
function b(E) {
|
|
686
|
+
return 180 * (E % (2 * Math.PI)) / Math.PI;
|
|
687
687
|
}
|
|
688
|
-
function
|
|
689
|
-
return
|
|
688
|
+
function C(E) {
|
|
689
|
+
return E % 360 * Math.PI / 180;
|
|
690
690
|
}
|
|
691
|
-
function E
|
|
691
|
+
function T(E) {
|
|
692
692
|
var G;
|
|
693
|
-
if (!
|
|
694
|
-
if (!Array.isArray(
|
|
695
|
-
if ((
|
|
696
|
-
return
|
|
697
|
-
if (
|
|
693
|
+
if (!E) throw new Error("Coordinate is required");
|
|
694
|
+
if (!Array.isArray(E)) {
|
|
695
|
+
if ((E == null ? void 0 : E.type) === "Feature" && (E == null ? void 0 : E.geometry) !== null && ((G = E == null ? void 0 : E.geometry) == null ? void 0 : G.type) === "Point")
|
|
696
|
+
return E == null ? void 0 : E.geometry.coordinates;
|
|
697
|
+
if (E.type === "Point") return (E == null ? void 0 : E.coordinates) || [];
|
|
698
698
|
}
|
|
699
|
-
if (Array.isArray(
|
|
700
|
-
return
|
|
699
|
+
if (Array.isArray(E) && E.length >= 2 && !Array.isArray(E[0]) && !Array.isArray(E[1]))
|
|
700
|
+
return E;
|
|
701
701
|
throw new Error(
|
|
702
702
|
"Coordinate must be GeoJSON Point or an Array of numbers"
|
|
703
703
|
);
|
|
704
704
|
}
|
|
705
|
-
function R(
|
|
705
|
+
function R(E, G, j = {}) {
|
|
706
706
|
if (j.final)
|
|
707
707
|
return function(Ee, Se) {
|
|
708
708
|
return (R(Se, Ee) + 180) % 360;
|
|
709
|
-
}(
|
|
710
|
-
const q = E
|
|
709
|
+
}(E, G);
|
|
710
|
+
const q = T(E), J = T(G), I = C(q[0]), ee = C(J[0]), se = C(q[1]), oe = C(J[1]), Ce = Math.sin(ee - I) * Math.cos(oe), Te = Math.cos(se) * Math.sin(oe) - Math.sin(se) * Math.cos(oe) * Math.cos(ee - I);
|
|
711
711
|
return b(Math.atan2(Ce, Te));
|
|
712
712
|
}
|
|
713
|
-
function $(
|
|
714
|
-
return !isNaN(
|
|
713
|
+
function $(E) {
|
|
714
|
+
return !isNaN(E) && E !== null && !Array.isArray(E);
|
|
715
715
|
}
|
|
716
|
-
function A(
|
|
717
|
-
return
|
|
716
|
+
function A(E, G = {}, j = {}) {
|
|
717
|
+
return E || console.log("Coordinates are required"), Array.isArray(E) || console.log("Coordinates must be an Array"), E.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (!$(E[0]) || !$(E[1])) && console.log("Coordinates must contain numbers"), Y({ type: "Point", coordinates: E }, G, j);
|
|
718
718
|
}
|
|
719
|
-
function Y(
|
|
719
|
+
function Y(E, G = {}, j = {}) {
|
|
720
720
|
const q = {
|
|
721
721
|
type: "Feature",
|
|
722
722
|
id: "",
|
|
@@ -724,7 +724,7 @@ const useTrackManager = (e) => {
|
|
|
724
724
|
bbox: {},
|
|
725
725
|
geometry: {}
|
|
726
726
|
};
|
|
727
|
-
return j.id !== void 0 && (q.id = j.id), j.bbox && (q.bbox = j.bbox), q.properties = G, q.geometry =
|
|
727
|
+
return j.id !== void 0 && (q.id = j.id), j.bbox && (q.bbox = j.bbox), q.properties = G, q.geometry = E, q;
|
|
728
728
|
}
|
|
729
729
|
const X = R(A(a), A(d), g);
|
|
730
730
|
return X < 0 ? 360 + X : X;
|
|
@@ -876,18 +876,18 @@ const getShipDirectPath = (e) => {
|
|
|
876
876
|
return s <= MAP_ZOOM.shipModelMax && s >= MAP_ZOOM.shipTriggleMin ? "ship" : "triangle";
|
|
877
877
|
}, getShipScale = (e, s, l) => {
|
|
878
878
|
if (l === "ship") {
|
|
879
|
-
const { len: n, wid: i } = s, t = 97,
|
|
879
|
+
const { len: n, wid: i } = s, t = 97, m = 20, o = 1 / (e == null ? void 0 : e.getView().getResolution()), r = n * o / t, p = i * o / m, y = Math.min(r, p);
|
|
880
880
|
return y < 0.2 ? 0.2 : y > 2 ? 2 : y;
|
|
881
881
|
}
|
|
882
882
|
return MAP_ZOOM.scaleNum;
|
|
883
883
|
}, initShipStyle = (e, s, l) => {
|
|
884
|
-
const { color: n, direct: i, isHighlight: t, shipData:
|
|
884
|
+
const { color: n, direct: i, isHighlight: t, shipData: m } = e.getProperties(), v = ((m == null ? void 0 : m.cog) - 90 + 360) % 360;
|
|
885
885
|
return new Style({
|
|
886
886
|
image: new Icon({
|
|
887
887
|
src: o(),
|
|
888
888
|
scale: s || MAP_ZOOM.scaleNum,
|
|
889
889
|
anchor: [0.5, 0.5],
|
|
890
|
-
rotation:
|
|
890
|
+
rotation: v * Math.PI / 180,
|
|
891
891
|
rotateWithView: !1
|
|
892
892
|
})
|
|
893
893
|
});
|
|
@@ -922,7 +922,7 @@ const getShipDirectPath = (e) => {
|
|
|
922
922
|
}
|
|
923
923
|
}
|
|
924
924
|
}, selectedShipStyle = (e, s) => {
|
|
925
|
-
const l = selectedShipElement(e, s), n = s.id, { lon: i, lat: t } = s,
|
|
925
|
+
const l = selectedShipElement(e, s), n = s.id, { lon: i, lat: t } = s, m = new Overlay({
|
|
926
926
|
element: l,
|
|
927
927
|
position: fromLonLat([i, t]),
|
|
928
928
|
id: "selected-" + n,
|
|
@@ -930,26 +930,26 @@ const getShipDirectPath = (e) => {
|
|
|
930
930
|
offset: [0, 5],
|
|
931
931
|
className: "ship-selected-overlay"
|
|
932
932
|
});
|
|
933
|
-
return
|
|
933
|
+
return m.set("class", "ship-overlay-selected"), m;
|
|
934
934
|
}, selectedShipElement = (e, s) => {
|
|
935
935
|
const l = getShipType(e), n = getShipScale(e, s, l), i = l === "ship" ? 109 : 49, t = `
|
|
936
936
|
<svg style="transform:scale(${n});" xmlns="http://www.w3.org/2000/svg" width="${i}" height="${i}" viewBox="0 0 49 49" fill="none">
|
|
937
937
|
<path d="M1.99982 46.9998L1.99982 1.99982L46.9998 1.99982L46.9998 46.9998L1.99982 46.9998Z" fill="#FF2424" fill-opacity="0.2"/>
|
|
938
938
|
<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"/>
|
|
939
939
|
</svg>
|
|
940
|
-
`,
|
|
941
|
-
return
|
|
940
|
+
`, m = document.createElement("div");
|
|
941
|
+
return m.className = "ship-overlay-selected", m.innerHTML = t, m;
|
|
942
942
|
}, createLabelStyle = (e, s) => {
|
|
943
|
-
const { shipData: l, blinking: n } = s.getProperties(), { lon: i, lat: t } = l,
|
|
944
|
-
i && t && addOverlay(e, fromLonLat([i, t]),
|
|
943
|
+
const { shipData: l, blinking: n } = s.getProperties(), { lon: i, lat: t } = l, m = createLabelElement(s);
|
|
944
|
+
i && t && addOverlay(e, fromLonLat([i, t]), m, { ...l, blinking: n });
|
|
945
945
|
}, createLabelElement = (e) => {
|
|
946
946
|
const s = document.createElement("div");
|
|
947
947
|
s.className = "ship-overlay-box", s.style.position = "relative";
|
|
948
|
-
const l = e.getProperties(), { shipData: n, blinking: i, blinkingColor: t, name:
|
|
948
|
+
const l = e.getProperties(), { shipData: n, blinking: i, blinkingColor: t, name: m } = l, { lon: v, lat: o } = n, r = createVNode({
|
|
949
949
|
setup() {
|
|
950
950
|
return useShipOverlay({
|
|
951
951
|
selected: i,
|
|
952
|
-
name:
|
|
952
|
+
name: m,
|
|
953
953
|
color: t,
|
|
954
954
|
existDevice: n == null ? void 0 : n.existDevice,
|
|
955
955
|
existMobile: n == null ? void 0 : n.existMobile,
|
|
@@ -977,39 +977,39 @@ const devicePixelRatio = window.devicePixelRatio || 1;
|
|
|
977
977
|
function generateBase64Icon(e, s, l = "left-bottom", n = 2) {
|
|
978
978
|
const i = document.createElement("canvas"), t = i.getContext("2d");
|
|
979
979
|
if (!t) return "";
|
|
980
|
-
const
|
|
980
|
+
const m = 2, v = 16, o = window.devicePixelRatio || 1, r = "500 12px Arial", p = "14px map-iconfont";
|
|
981
981
|
t.font = r;
|
|
982
982
|
const P = t.measureText(e).width;
|
|
983
|
-
t.font =
|
|
984
|
-
const V = s.map((N) => ({ width: t.measureText(getIconFont(N)).width, height: 14 })), f = V.reduce((N, O) => N + O.width, 0),
|
|
985
|
-
let
|
|
986
|
-
switch (
|
|
983
|
+
t.font = p;
|
|
984
|
+
const V = s.map((N) => ({ width: t.measureText(getIconFont(N)).width, height: 14 })), f = V.reduce((N, O) => N + O.width, 0), w = (s.length - 1) * n, k = m + P + f + w + m * 2, L = m + 16 + m;
|
|
985
|
+
let S, _, H = 0, B = 0, W = 0, c = 0, x = 0, u = 0;
|
|
986
|
+
switch (S = v + k, l) {
|
|
987
987
|
case "right-top":
|
|
988
|
-
|
|
988
|
+
_ = v + L, H = 0, B = v + L, W = v, c = 0, x = v, u = 0;
|
|
989
989
|
break;
|
|
990
990
|
case "right-middle":
|
|
991
|
-
|
|
991
|
+
_ = L, H = 0, B = L / 2, W = v, c = L / 2, x = v, u = 0;
|
|
992
992
|
break;
|
|
993
993
|
case "right-bottom":
|
|
994
|
-
|
|
994
|
+
_ = v + L, H = 0, B = 0, W = v, c = v, x = v, u = v;
|
|
995
995
|
break;
|
|
996
996
|
case "left-top":
|
|
997
|
-
|
|
997
|
+
_ = v + L, H = k, B = v, W = k + v, c = L + v, x = 0, u = 0;
|
|
998
998
|
break;
|
|
999
999
|
case "left-middle":
|
|
1000
|
-
|
|
1000
|
+
_ = L, H = k, B = L / 2, W = k + v, c = L / 2, x = 0, u = 0;
|
|
1001
1001
|
break;
|
|
1002
1002
|
case "left-bottom":
|
|
1003
|
-
|
|
1003
|
+
_ = v + L, H = k, B = L, W = k + v, c = 0, x = 0, u = v;
|
|
1004
1004
|
break;
|
|
1005
1005
|
}
|
|
1006
|
-
i.width = Math.round(
|
|
1007
|
-
const M = u +
|
|
1008
|
-
t.strokeStyle = "#ffffff", t.lineWidth = 1, t.strokeText(e,
|
|
1009
|
-
let D =
|
|
1006
|
+
i.width = Math.round(S * o), i.height = Math.round(_ * o), i.style.width = `${S}px`, i.style.height = `${_}px`, t.scale(o, o), t.clearRect(0, 0, S, _), t.beginPath(), t.moveTo(H, B), t.lineTo(W, c), t.strokeStyle = "#FFF", t.lineWidth = 1, t.stroke(), t.fillStyle = "#FFF", t.fillRect(x, u, k, L), t.font = r, t.textBaseline = "middle";
|
|
1007
|
+
const M = u + m + L / 2;
|
|
1008
|
+
t.strokeStyle = "#ffffff", t.lineWidth = 1, t.strokeText(e, x + m, M), t.fillStyle = "#000000", t.fillText(e, x + m, M), t.font = p, t.fillStyle = "#3370ff";
|
|
1009
|
+
let D = x + m + P + n;
|
|
1010
1010
|
return s.forEach((N, O) => {
|
|
1011
|
-
const
|
|
1012
|
-
t.fillText(getIconFont(N), D,
|
|
1011
|
+
const z = u + m + L / 2;
|
|
1012
|
+
t.fillText(getIconFont(N), D, z), D += V[O].width + n;
|
|
1013
1013
|
}), i.toDataURL("image/png");
|
|
1014
1014
|
}
|
|
1015
1015
|
const createLabelFeatureStyle = (e) => {
|
|
@@ -1052,34 +1052,34 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1052
1052
|
className: "zh-map--ship-layer",
|
|
1053
1053
|
renderBuffer: 300,
|
|
1054
1054
|
zIndex: 101
|
|
1055
|
-
}), t = new VectorSource(),
|
|
1055
|
+
}), t = new VectorSource(), m = new VectorLayer({
|
|
1056
1056
|
source: t,
|
|
1057
1057
|
className: "zh-map--ship-label-layer",
|
|
1058
1058
|
zIndex: 102,
|
|
1059
1059
|
updateWhileInteracting: !1,
|
|
1060
1060
|
updateWhileAnimating: !1,
|
|
1061
|
-
declutter: function(c,
|
|
1062
|
-
return !
|
|
1061
|
+
declutter: function(c, x) {
|
|
1062
|
+
return !x.get("selected");
|
|
1063
1063
|
}
|
|
1064
1064
|
});
|
|
1065
|
-
e == null || e.addLayer(i), e == null || e.addLayer(
|
|
1066
|
-
let
|
|
1067
|
-
const
|
|
1065
|
+
e == null || e.addLayer(i), e == null || e.addLayer(m);
|
|
1066
|
+
let v = "", o = {}, r = {};
|
|
1067
|
+
const p = (c) => {
|
|
1068
1068
|
if (!c || !e) return;
|
|
1069
|
-
const
|
|
1069
|
+
const x = (l == null ? void 0 : l.id) || (s == null ? void 0 : s.get("id"));
|
|
1070
1070
|
if (l) {
|
|
1071
|
-
const u = c.filter((M) => M.id ===
|
|
1071
|
+
const u = c.filter((M) => M.id === x);
|
|
1072
1072
|
u.length === 0 ? c.push(l) : l = u[0];
|
|
1073
1073
|
}
|
|
1074
1074
|
V(), f(!0), W(c), P();
|
|
1075
1075
|
}, y = (c) => {
|
|
1076
|
-
const
|
|
1076
|
+
const x = (l == null ? void 0 : l.id) || (s == null ? void 0 : s.get("id")), u = fromLonLat([c == null ? void 0 : c.lon, c == null ? void 0 : c.lat]), M = c.fill || "#04C900", D = getShipDirectPath(c), N = new Feature({
|
|
1077
1077
|
geometry: new Point(u),
|
|
1078
1078
|
// 船舶数据
|
|
1079
1079
|
shipData: c,
|
|
1080
1080
|
id: c.id,
|
|
1081
1081
|
name: c.cnname || "未命名船舶",
|
|
1082
|
-
selected: c.id ===
|
|
1082
|
+
selected: c.id === x,
|
|
1083
1083
|
// 图标
|
|
1084
1084
|
rightIcons: getRightIcons(c),
|
|
1085
1085
|
// 是否闪烁
|
|
@@ -1099,45 +1099,45 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1099
1099
|
return N.set("clickGeometry", new Circle(u)), N;
|
|
1100
1100
|
}, P = async () => {
|
|
1101
1101
|
if (!l || !e) return;
|
|
1102
|
-
let
|
|
1103
|
-
if (console.log("selectedOverlay----------",
|
|
1102
|
+
let x = e.getOverlays().getArray().find((u) => u.get("class") == "ship-overlay-selected");
|
|
1103
|
+
if (console.log("selectedOverlay----------", x), x) {
|
|
1104
1104
|
const u = selectedShipElement(e, l);
|
|
1105
|
-
await
|
|
1105
|
+
await x.setElement(u), await x.setPosition(fromLonLat([l.lon, l.lat]));
|
|
1106
1106
|
} else
|
|
1107
|
-
|
|
1107
|
+
x = selectedShipStyle(e, l), x && e.addOverlay(x);
|
|
1108
1108
|
setTimeout(() => {
|
|
1109
1109
|
var u;
|
|
1110
|
-
|
|
1110
|
+
x && ((u = x.get("element")) != null && u.parentElement) && (x.get("element").parentElement.style.display = "block");
|
|
1111
1111
|
}, 20);
|
|
1112
1112
|
}, V = () => {
|
|
1113
1113
|
e && n && (n.clear(), t.clear(), f());
|
|
1114
1114
|
}, f = (c) => {
|
|
1115
|
-
const
|
|
1116
|
-
if (
|
|
1117
|
-
for (let u = 0; u <
|
|
1118
|
-
if (!c &&
|
|
1119
|
-
const M =
|
|
1115
|
+
const x = e.getOverlays().getArray().filter((u) => u.get("class") == "zh-map-ship-overlay");
|
|
1116
|
+
if (x && x.length > 0) {
|
|
1117
|
+
for (let u = 0; u < x.length; u++)
|
|
1118
|
+
if (!c && x[u].get("class") !== "ship-overlay-selected") {
|
|
1119
|
+
const M = x[u];
|
|
1120
1120
|
M.setPosition(void 0), e.removeOverlay(M), M.dispose();
|
|
1121
1121
|
}
|
|
1122
1122
|
}
|
|
1123
|
-
},
|
|
1124
|
-
o = c, r =
|
|
1123
|
+
}, w = (c, x) => {
|
|
1124
|
+
o = c, r = x;
|
|
1125
1125
|
const u = e.getOverlays().getArray(), M = n.getFeatures();
|
|
1126
1126
|
for (const D in o) {
|
|
1127
|
-
const N = o[D], O = u.find((F) => F.getId() === "label-" + D),
|
|
1128
|
-
if (O &&
|
|
1129
|
-
|
|
1130
|
-
const F = O.getElement(), Z = createLabelElement(
|
|
1127
|
+
const N = o[D], O = u.find((F) => F.getId() === "label-" + D), z = M.find((F) => D === F.get("id"));
|
|
1128
|
+
if (O && z) {
|
|
1129
|
+
z.set("blinking", N), z.set("blinkingColor", r[D] || "");
|
|
1130
|
+
const F = O.getElement(), Z = createLabelElement(z), K = Z.querySelector(".ship-overlay-line"), Q = F == null ? void 0 : F.querySelector(".ship-overlay-line");
|
|
1131
1131
|
F && F !== Z && (Q && K && K.replaceWith(Q), O.setElement(Z));
|
|
1132
1132
|
}
|
|
1133
1133
|
}
|
|
1134
|
-
},
|
|
1134
|
+
}, k = (c) => {
|
|
1135
1135
|
if (!e) return;
|
|
1136
|
-
const
|
|
1136
|
+
const x = n.getFeatures(), u = t.getFeatures(), M = s ? s.get("id") : "", D = x.filter((F) => F.get("id") !== M), N = u == null ? void 0 : u.filter((F) => F.get("id") !== M), O = /* @__PURE__ */ new Map();
|
|
1137
1137
|
c.forEach((F) => {
|
|
1138
1138
|
O.set(F.id, !0);
|
|
1139
1139
|
});
|
|
1140
|
-
const
|
|
1140
|
+
const z = e.getOverlays().getArray();
|
|
1141
1141
|
D.forEach((F) => {
|
|
1142
1142
|
const Z = F.get("id");
|
|
1143
1143
|
if (!O.has(Z))
|
|
@@ -1146,7 +1146,7 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1146
1146
|
const Q = F.getStyle();
|
|
1147
1147
|
(Q == null ? void 0 : Q.length) == 0 && F.setStyle(createShipStyle(e, F));
|
|
1148
1148
|
}
|
|
1149
|
-
const K =
|
|
1149
|
+
const K = z.find((Q) => Q.getId() === "label-" + Z);
|
|
1150
1150
|
K && K.setPosition(void 0);
|
|
1151
1151
|
}), N.forEach((F) => {
|
|
1152
1152
|
const Z = F.get("id");
|
|
@@ -1157,36 +1157,36 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1157
1157
|
(K == null ? void 0 : K.length) == 0 && F.setStyle(createLabelFeatureStyle(F));
|
|
1158
1158
|
}
|
|
1159
1159
|
});
|
|
1160
|
-
},
|
|
1160
|
+
}, L = (c) => {
|
|
1161
1161
|
if (c) {
|
|
1162
1162
|
console.log("选中", c);
|
|
1163
|
-
const
|
|
1164
|
-
|
|
1163
|
+
const x = n.getFeatures().find((M) => M.get("id") === c.id), u = t.getFeatures().find((M) => M.get("id") === c.id);
|
|
1164
|
+
x && (s = x), u && u.set("selected", !0), l = c, P();
|
|
1165
1165
|
} else
|
|
1166
1166
|
console.log("取消选中"), l = null, s = null, H();
|
|
1167
|
-
},
|
|
1167
|
+
}, S = debounce((c, x, u) => {
|
|
1168
1168
|
if (c) {
|
|
1169
1169
|
const M = c.get("shipData"), D = c.get("id");
|
|
1170
|
-
if (e.getTargetElement().style.cursor = D ? "pointer" : "",
|
|
1171
|
-
|
|
1172
|
-
const N = n.getFeatures().find((O) => O.get("id") ===
|
|
1170
|
+
if (e.getTargetElement().style.cursor = D ? "pointer" : "", x === "click" && (L(M), u && u(D)), x === "hover") {
|
|
1171
|
+
v && v !== D && _(), v = D;
|
|
1172
|
+
const N = n.getFeatures().find((O) => O.get("id") === v);
|
|
1173
1173
|
N == null || N.set("isHighlight", !0), N == null || N.setStyle(createShipStyle(e, N));
|
|
1174
1174
|
}
|
|
1175
1175
|
} else
|
|
1176
|
-
e.getTargetElement().style.cursor = "",
|
|
1177
|
-
}, 10),
|
|
1178
|
-
const c =
|
|
1179
|
-
|
|
1176
|
+
e.getTargetElement().style.cursor = "", _();
|
|
1177
|
+
}, 10), _ = () => {
|
|
1178
|
+
const c = v ? n.getFeatures().find((x) => x.get("id") === v) : null;
|
|
1179
|
+
v = null, c == null || c.set("isHighlight", !1), c == null || c.setStyle(createShipStyle(e, c));
|
|
1180
1180
|
}, H = () => {
|
|
1181
1181
|
try {
|
|
1182
|
-
const
|
|
1183
|
-
|
|
1182
|
+
const x = e.getOverlays().getArray().find((u) => u.get("class") == "ship-overlay-selected");
|
|
1183
|
+
x && x.setPosition(void 0);
|
|
1184
1184
|
} catch (c) {
|
|
1185
1185
|
console.log(c);
|
|
1186
1186
|
}
|
|
1187
1187
|
}, B = (c) => {
|
|
1188
|
-
const
|
|
1189
|
-
geometry: new Point(
|
|
1188
|
+
const x = fromLonLat([c == null ? void 0 : c.lon, c == null ? void 0 : c.lat]), u = new Feature({
|
|
1189
|
+
geometry: new Point(x),
|
|
1190
1190
|
name: c.cnname || c.enname || c.id || "未命名船舶",
|
|
1191
1191
|
// 图标
|
|
1192
1192
|
rightIcons: getRightIcons(c),
|
|
@@ -1196,10 +1196,10 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1196
1196
|
const M = createLabelFeatureStyle(u);
|
|
1197
1197
|
return u.setStyle(M), u;
|
|
1198
1198
|
}, W = (c) => {
|
|
1199
|
-
const
|
|
1199
|
+
const x = e.getView().getZoom();
|
|
1200
1200
|
c.forEach((u) => {
|
|
1201
1201
|
const M = y(u);
|
|
1202
|
-
if (M.setStyle(createShipStyle(e, M)), n.addFeature(M), (l == null ? void 0 : l.id) == u.id ||
|
|
1202
|
+
if (M.setStyle(createShipStyle(e, M)), n.addFeature(M), (l == null ? void 0 : l.id) == u.id || x >= MAP_ZOOM.shipModelMin)
|
|
1203
1203
|
if (o[u.id])
|
|
1204
1204
|
createLabelStyle(e, M);
|
|
1205
1205
|
else {
|
|
@@ -1209,19 +1209,19 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1209
1209
|
});
|
|
1210
1210
|
};
|
|
1211
1211
|
return {
|
|
1212
|
-
render:
|
|
1213
|
-
selected:
|
|
1214
|
-
filter:
|
|
1215
|
-
blinking:
|
|
1212
|
+
render: p,
|
|
1213
|
+
selected: L,
|
|
1214
|
+
filter: k,
|
|
1215
|
+
blinking: w,
|
|
1216
1216
|
clear: V,
|
|
1217
|
-
handleShipMapEvent:
|
|
1217
|
+
handleShipMapEvent: S
|
|
1218
1218
|
};
|
|
1219
1219
|
}, useLayerManager = (e) => {
|
|
1220
1220
|
const s = () => e == null ? void 0 : e.getLayers(), l = ref("vector"), n = () => l.value, i = (o) => {
|
|
1221
1221
|
l.value = o;
|
|
1222
1222
|
const r = s();
|
|
1223
|
-
r && (r == null || r.getArray().forEach((
|
|
1224
|
-
(
|
|
1223
|
+
r && (r == null || r.getArray().forEach((p) => {
|
|
1224
|
+
(p.className_ === "vector" || p.className_ === "satellite") && p.setVisible(p.className_ === o);
|
|
1225
1225
|
}));
|
|
1226
1226
|
}, t = ref(!1);
|
|
1227
1227
|
return {
|
|
@@ -1241,8 +1241,8 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1241
1241
|
r.push(y);
|
|
1242
1242
|
}
|
|
1243
1243
|
} else {
|
|
1244
|
-
const r = s(),
|
|
1245
|
-
|
|
1244
|
+
const r = s(), p = r.getArray().find((y) => y.className_ === "greenTile");
|
|
1245
|
+
p && r.remove(p);
|
|
1246
1246
|
}
|
|
1247
1247
|
t.value = o;
|
|
1248
1248
|
}
|
|
@@ -1261,33 +1261,33 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1261
1261
|
}, usePositionManager = (e) => {
|
|
1262
1262
|
const s = "zh-map-location-layer";
|
|
1263
1263
|
let l, n, i = null, t = null;
|
|
1264
|
-
const
|
|
1264
|
+
const m = (f) => {
|
|
1265
1265
|
if (!(!f || f.length === 0)) {
|
|
1266
1266
|
if (n || (n = new VectorSource()), n.clear(), t) {
|
|
1267
|
-
const
|
|
1268
|
-
|
|
1267
|
+
const w = f.find((k) => k.id === t.id);
|
|
1268
|
+
w ? t = w : f.push(t);
|
|
1269
1269
|
}
|
|
1270
|
-
f.forEach((
|
|
1271
|
-
w
|
|
1270
|
+
f.forEach((w) => {
|
|
1271
|
+
v(w);
|
|
1272
1272
|
}), l || (l = new VectorLayer({
|
|
1273
1273
|
className: s,
|
|
1274
1274
|
source: n,
|
|
1275
1275
|
zIndex: 100
|
|
1276
1276
|
}), e == null || e.addLayer(l));
|
|
1277
1277
|
}
|
|
1278
|
-
},
|
|
1279
|
-
const
|
|
1280
|
-
geometry: new Point(fromLonLat([Number(
|
|
1278
|
+
}, v = (f) => {
|
|
1279
|
+
const w = getZoom(), [k, L] = f.latLon.split(","), S = new Feature({
|
|
1280
|
+
geometry: new Point(fromLonLat([Number(k), Number(L)]))
|
|
1281
1281
|
});
|
|
1282
|
-
|
|
1283
|
-
}, o = (f,
|
|
1284
|
-
const
|
|
1282
|
+
S.setStyle(o(f, w, f.id === (t == null ? void 0 : t.id))), S.set("loactionData", f), n.addFeature(S);
|
|
1283
|
+
}, o = (f, w, k) => {
|
|
1284
|
+
const L = {
|
|
1285
1285
|
image: new Icon({
|
|
1286
|
-
src:
|
|
1287
|
-
scale: 0.5 *
|
|
1286
|
+
src: k && f.selectedPath || f.defaultPath,
|
|
1287
|
+
scale: 0.5 * w / 10
|
|
1288
1288
|
})
|
|
1289
1289
|
};
|
|
1290
|
-
return f.name && (
|
|
1290
|
+
return f.name && (L.text = new Text({
|
|
1291
1291
|
text: f.name,
|
|
1292
1292
|
font: "12px sans-serif",
|
|
1293
1293
|
fill: new Fill({
|
|
@@ -1297,35 +1297,35 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1297
1297
|
color: "#FFFFFF"
|
|
1298
1298
|
}),
|
|
1299
1299
|
offsetY: 30
|
|
1300
|
-
})), new Style(
|
|
1300
|
+
})), new Style(L);
|
|
1301
1301
|
}, r = () => {
|
|
1302
1302
|
if (i) {
|
|
1303
1303
|
const f = i.get("loactionData").id;
|
|
1304
|
-
n.getFeatures().forEach((
|
|
1305
|
-
|
|
1304
|
+
n.getFeatures().forEach((w) => {
|
|
1305
|
+
w.get("loactionData").id !== f && n.removeFeature(w);
|
|
1306
1306
|
});
|
|
1307
1307
|
} else
|
|
1308
1308
|
n.clear();
|
|
1309
|
-
},
|
|
1310
|
-
const f = i.get("loactionData"),
|
|
1311
|
-
n.getFeatures().forEach((
|
|
1312
|
-
|
|
1309
|
+
}, p = () => {
|
|
1310
|
+
const f = i.get("loactionData"), w = getZoom();
|
|
1311
|
+
n.getFeatures().forEach((L) => {
|
|
1312
|
+
L.get("loactionData").id === f.id && (L == null || L.setStyle(o(f, w, !1)));
|
|
1313
1313
|
}), t = null, i = null;
|
|
1314
1314
|
}, y = (f) => {
|
|
1315
1315
|
f ? (P(), V(f)) : clearSelectedPort();
|
|
1316
1316
|
}, P = () => {
|
|
1317
1317
|
if (i) {
|
|
1318
|
-
const f = i.get("loactionData"),
|
|
1319
|
-
i.setStyle(o(f,
|
|
1318
|
+
const f = i.get("loactionData"), w = getZoom();
|
|
1319
|
+
i.setStyle(o(f, w, !1));
|
|
1320
1320
|
}
|
|
1321
1321
|
}, V = (f) => {
|
|
1322
|
-
const
|
|
1323
|
-
t = f, i =
|
|
1322
|
+
const w = n.getFeatures();
|
|
1323
|
+
t = f, i = w.find((k) => k.get("loactionData").id === f.id);
|
|
1324
1324
|
};
|
|
1325
1325
|
return {
|
|
1326
|
-
render:
|
|
1326
|
+
render: m,
|
|
1327
1327
|
selected: y,
|
|
1328
|
-
clearSelected:
|
|
1328
|
+
clearSelected: p,
|
|
1329
1329
|
clear: r
|
|
1330
1330
|
};
|
|
1331
1331
|
}, disableDoubleClickZoom = (e) => {
|
|
@@ -1344,13 +1344,13 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1344
1344
|
n.value = u;
|
|
1345
1345
|
};
|
|
1346
1346
|
let t;
|
|
1347
|
-
const
|
|
1348
|
-
|
|
1347
|
+
const m = ref(!1), v = () => {
|
|
1348
|
+
p(), disableDoubleClickZoom(e), changeCursor(e, "crosshair"), e.on("pointermove", V), e.getViewport().addEventListener("mouseout", () => {
|
|
1349
1349
|
t && t.classList.add("hidden");
|
|
1350
|
-
}),
|
|
1350
|
+
}), w(), m.value = !0;
|
|
1351
1351
|
};
|
|
1352
1352
|
let o, r;
|
|
1353
|
-
const
|
|
1353
|
+
const p = () => {
|
|
1354
1354
|
o = new VectorSource(), r = new VectorLayer({
|
|
1355
1355
|
source: o,
|
|
1356
1356
|
zIndex: 1e3,
|
|
@@ -1371,7 +1371,7 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1371
1371
|
y && (M = "单击继续,双击结束"), t && (t.innerHTML = M, P.setPosition(u.coordinate), t.classList.remove("hidden"));
|
|
1372
1372
|
};
|
|
1373
1373
|
let f;
|
|
1374
|
-
const
|
|
1374
|
+
const w = () => {
|
|
1375
1375
|
f = new Draw({
|
|
1376
1376
|
source: o,
|
|
1377
1377
|
type: "LineString",
|
|
@@ -1396,39 +1396,39 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1396
1396
|
}),
|
|
1397
1397
|
// 添加条件函数,判断是否应该出发点绘制
|
|
1398
1398
|
condition: (M) => M.originalEvent.target.tagName !== "DIV"
|
|
1399
|
-
}), e == null || e.addInteraction(f),
|
|
1399
|
+
}), e == null || e.addInteraction(f), _(), H();
|
|
1400
1400
|
let u;
|
|
1401
1401
|
f.on("drawstart", function(M) {
|
|
1402
1402
|
var N;
|
|
1403
|
-
y = M.feature, y.set("randomId",
|
|
1403
|
+
y = M.feature, y.set("randomId", k());
|
|
1404
1404
|
let D;
|
|
1405
1405
|
u = (N = y.getGeometry()) == null ? void 0 : N.on("change", function(O) {
|
|
1406
|
-
const
|
|
1407
|
-
D =
|
|
1406
|
+
const z = O.target, F = computedDistance(z, n.value);
|
|
1407
|
+
D = z.getLastCoordinate(), L && F && (L.innerHTML = F), S.setPosition(D);
|
|
1408
1408
|
});
|
|
1409
1409
|
}), f.on("drawend", function() {
|
|
1410
1410
|
var M, D, N;
|
|
1411
|
-
if (
|
|
1412
|
-
const O = (y == null ? void 0 : y.get("randomId")) ||
|
|
1413
|
-
l.value.push({ id: O, value:
|
|
1411
|
+
if (L && (L.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), L != null && L.innerHTML) {
|
|
1412
|
+
const O = (y == null ? void 0 : y.get("randomId")) || k();
|
|
1413
|
+
l.value.push({ id: O, value: L == null ? void 0 : L.innerHTML }), L.innerHTML = `${L.innerHTML}<div class="ol-tooltip-delete-button" data-id="${O}"><i class="map-iconfont icon-delete"></i></div>`;
|
|
1414
1414
|
}
|
|
1415
1415
|
(M = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || M.addEventListener("click", (O) => {
|
|
1416
1416
|
var F;
|
|
1417
1417
|
O.preventDefault(), O.stopPropagation();
|
|
1418
|
-
const
|
|
1419
|
-
|
|
1420
|
-
}),
|
|
1418
|
+
const z = (F = O.target) == null ? void 0 : F.getAttribute("data-id");
|
|
1419
|
+
z && W(z);
|
|
1420
|
+
}), S.setOffset([0, -7]), y = null, L = null, _(), u && unByKey(u), (N = (D = s.getProps()) == null ? void 0 : D.lineDrawEnd) == null || N.call(D, l.value);
|
|
1421
1421
|
});
|
|
1422
|
-
},
|
|
1423
|
-
let
|
|
1424
|
-
const
|
|
1425
|
-
|
|
1426
|
-
element:
|
|
1422
|
+
}, k = () => Math.random().toString(36).substring(2, 9);
|
|
1423
|
+
let L, S;
|
|
1424
|
+
const _ = () => {
|
|
1425
|
+
L != null && L.parentNode && L.parentNode.removeChild(L), L = document.createElement("div"), L.className = "ol-tooltip ol-tooltip-measure", S = new Overlay({
|
|
1426
|
+
element: L,
|
|
1427
1427
|
offset: [0, -15],
|
|
1428
1428
|
positioning: "bottom-center",
|
|
1429
1429
|
stopEvent: !1,
|
|
1430
1430
|
insertFirst: !1
|
|
1431
|
-
}), e == null || e.addOverlay(
|
|
1431
|
+
}), e == null || e.addOverlay(S);
|
|
1432
1432
|
}, H = () => {
|
|
1433
1433
|
t != null && t.parentNode && t.parentNode.removeChild(t), t = document.createElement("div"), t.className = "ol-tooltip hidden", P = new Overlay({
|
|
1434
1434
|
element: t,
|
|
@@ -1437,14 +1437,14 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1437
1437
|
}), e == null || e.addOverlay(P);
|
|
1438
1438
|
}, B = () => {
|
|
1439
1439
|
l.value.forEach((u, M) => {
|
|
1440
|
-
var O,
|
|
1440
|
+
var O, z;
|
|
1441
1441
|
const D = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1442
|
-
D[M] && ((
|
|
1442
|
+
D[M] && ((z = (O = D[M]) == null ? void 0 : O.parentNode) == null || z.removeChild(D[M]));
|
|
1443
1443
|
const N = o.getFeatures();
|
|
1444
1444
|
N[M] && o.removeFeature(N[M]);
|
|
1445
|
-
}), c(), enableDoubleClickZoom(e),
|
|
1445
|
+
}), c(), enableDoubleClickZoom(e), m.value = !1;
|
|
1446
1446
|
}, W = (u) => {
|
|
1447
|
-
var D, N, O,
|
|
1447
|
+
var D, N, O, z;
|
|
1448
1448
|
const M = l.value.findIndex((F) => F.id === u);
|
|
1449
1449
|
if (M !== -1) {
|
|
1450
1450
|
l.value.splice(M, 1);
|
|
@@ -1453,7 +1453,7 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1453
1453
|
const Z = o.getFeatures();
|
|
1454
1454
|
Z[M] && o.removeFeature(Z[M]);
|
|
1455
1455
|
}
|
|
1456
|
-
(
|
|
1456
|
+
(z = (O = s.getProps()) == null ? void 0 : O.lineDrawEnd) == null || z.call(O, l.value);
|
|
1457
1457
|
}, c = () => {
|
|
1458
1458
|
if (l.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((u) => {
|
|
1459
1459
|
var M;
|
|
@@ -1462,14 +1462,14 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1462
1462
|
const u = e.getInteractions().getArray().find((M) => getUid(M) === getUid(f));
|
|
1463
1463
|
u && e.removeInteraction(u);
|
|
1464
1464
|
}
|
|
1465
|
-
e.removeLayer(r), t != null && t.parentNode && t.parentNode.removeChild(t),
|
|
1465
|
+
e.removeLayer(r), t != null && t.parentNode && t.parentNode.removeChild(t), L != null && L.parentNode && L.parentNode.removeChild(L);
|
|
1466
1466
|
};
|
|
1467
1467
|
return {
|
|
1468
|
-
open:
|
|
1468
|
+
open: v,
|
|
1469
1469
|
close: B,
|
|
1470
1470
|
deleteLine: W,
|
|
1471
1471
|
setUnit: i,
|
|
1472
|
-
getState: () =>
|
|
1472
|
+
getState: () => m.value
|
|
1473
1473
|
};
|
|
1474
1474
|
}, computedDistance = (e, s) => {
|
|
1475
1475
|
const n = getLength(e);
|
|
@@ -1491,12 +1491,12 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1491
1491
|
const i = () => {
|
|
1492
1492
|
t(), changeCursor(e, "crosshair");
|
|
1493
1493
|
}, t = () => {
|
|
1494
|
-
o(),
|
|
1494
|
+
o(), L(), H(), V();
|
|
1495
1495
|
};
|
|
1496
|
-
let
|
|
1496
|
+
let m = null, v = null;
|
|
1497
1497
|
const o = () => {
|
|
1498
|
-
if (
|
|
1499
|
-
const c = new VectorSource(),
|
|
1498
|
+
if (m && v) return;
|
|
1499
|
+
const c = new VectorSource(), x = new VectorLayer({
|
|
1500
1500
|
source: c,
|
|
1501
1501
|
style: new Style({
|
|
1502
1502
|
stroke: new Stroke({
|
|
@@ -1505,36 +1505,36 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1505
1505
|
})
|
|
1506
1506
|
})
|
|
1507
1507
|
});
|
|
1508
|
-
|
|
1508
|
+
m = x, v = c, e.on("pointermove", p), e.addLayer(x), e.on(["dblclick"], function(u) {
|
|
1509
1509
|
y && (u.stopPropagation(), u.preventDefault());
|
|
1510
1510
|
});
|
|
1511
1511
|
};
|
|
1512
1512
|
let r;
|
|
1513
|
-
const
|
|
1513
|
+
const p = (c) => {
|
|
1514
1514
|
if (c.dragging) return;
|
|
1515
|
-
const
|
|
1516
|
-
|
|
1515
|
+
const x = r ? "单击继续,双击结束" : "点击选择起点";
|
|
1516
|
+
S && (S.innerHTML = x, _.setPosition(c.coordinate));
|
|
1517
1517
|
};
|
|
1518
1518
|
let y, P = !1;
|
|
1519
1519
|
const V = () => {
|
|
1520
1520
|
if (l) {
|
|
1521
|
-
|
|
1521
|
+
S != null && S.parentNode && S.parentNode.removeChild(S);
|
|
1522
1522
|
const c = l.getGeometry();
|
|
1523
1523
|
if (!c) return;
|
|
1524
|
-
const
|
|
1525
|
-
|
|
1526
|
-
<span class="text">面积:${
|
|
1527
|
-
`),
|
|
1524
|
+
const x = f(c, "nm");
|
|
1525
|
+
w && (w.innerHTML = `
|
|
1526
|
+
<span class="text">面积:${x}${P ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1527
|
+
`), w && (w.innerHTML += '<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');
|
|
1528
1528
|
const u = c.getCoordinates(), M = u[0][u[0].length - 2];
|
|
1529
|
-
if (
|
|
1530
|
-
const N =
|
|
1529
|
+
if (k.setPosition(M), m) {
|
|
1530
|
+
const N = m.getSource();
|
|
1531
1531
|
N && l && (N.clear(), N.addFeature(l));
|
|
1532
1532
|
}
|
|
1533
1533
|
setTimeout(() => {
|
|
1534
1534
|
var N;
|
|
1535
1535
|
(N = document.querySelector(".delete-icon")) == null || N.addEventListener("click", () => {
|
|
1536
|
-
var O,
|
|
1537
|
-
console.log("delete"), B(), (
|
|
1536
|
+
var O, z;
|
|
1537
|
+
console.log("delete"), B(), (z = (O = s.getProps()) == null ? void 0 : O.areaDrawEnd) == null || z.call(O, []);
|
|
1538
1538
|
});
|
|
1539
1539
|
}, 0);
|
|
1540
1540
|
const D = getCenter(l.getGeometry().getExtent());
|
|
@@ -1543,7 +1543,7 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1543
1543
|
}
|
|
1544
1544
|
y = new Draw({
|
|
1545
1545
|
type: "Polygon",
|
|
1546
|
-
source:
|
|
1546
|
+
source: v,
|
|
1547
1547
|
trace: !0,
|
|
1548
1548
|
style: [new Style({
|
|
1549
1549
|
stroke: new Stroke({
|
|
@@ -1562,22 +1562,22 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1562
1562
|
})
|
|
1563
1563
|
}),
|
|
1564
1564
|
geometry: function(c) {
|
|
1565
|
-
const
|
|
1566
|
-
return new MultiPoint(
|
|
1565
|
+
const x = c.getGeometry().getCoordinates();
|
|
1566
|
+
return new MultiPoint(x);
|
|
1567
1567
|
}
|
|
1568
1568
|
})]
|
|
1569
1569
|
}), e == null || e.addInteraction(y), y.on("drawstart", (c) => {
|
|
1570
|
-
var
|
|
1571
|
-
r = c.feature, n = (
|
|
1572
|
-
const M = u.target, D = f(M, "nm"), O = M.getCoordinates()[0],
|
|
1573
|
-
if (P = Number(getLength(
|
|
1570
|
+
var x;
|
|
1571
|
+
r = c.feature, n = (x = r.getGeometry()) == null ? void 0 : x.on("change", (u) => {
|
|
1572
|
+
const M = u.target, D = f(M, "nm"), O = M.getCoordinates()[0], z = new LineString([O[O.length - 2], O[O.length - 1]]), F = computedDistance(z, "nm");
|
|
1573
|
+
if (P = Number(getLength(z) / 1e3) > 150, !D) return;
|
|
1574
1574
|
const Z = '<span class="error pl-4">超出可以绘画的距离</span>';
|
|
1575
|
-
|
|
1575
|
+
w && (w.innerHTML = `
|
|
1576
1576
|
<div class="text">
|
|
1577
1577
|
面积:${D}
|
|
1578
1578
|
${P ? Z : ""}
|
|
1579
1579
|
</div>
|
|
1580
|
-
`),
|
|
1580
|
+
`), S && (S.innerHTML = `
|
|
1581
1581
|
<div class="text">
|
|
1582
1582
|
面积:${D}
|
|
1583
1583
|
</div>
|
|
@@ -1592,84 +1592,84 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1592
1592
|
`);
|
|
1593
1593
|
});
|
|
1594
1594
|
}), y.on("drawend", (c) => {
|
|
1595
|
-
var D, N, O,
|
|
1595
|
+
var D, N, O, z;
|
|
1596
1596
|
if (!c.feature.getGeometry()) return;
|
|
1597
|
-
l = c.feature,
|
|
1597
|
+
l = c.feature, w && (w.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), k.setOffset([10, 0]);
|
|
1598
1598
|
const u = c.feature.getGeometry().getCoordinates(), M = u[0][u[0].length - 2];
|
|
1599
|
-
if (
|
|
1599
|
+
if (k.setPosition(M), S != null && S.parentNode && S.parentNode.removeChild(S), (D = s.getProps()) != null && D.areaDrawEnd) {
|
|
1600
1600
|
const F = u[0].map((Z) => transform(Z, projection.mercator, projection.data));
|
|
1601
1601
|
(O = (N = s.getProps()) == null ? void 0 : N.areaDrawEnd) == null || O.call(N, F);
|
|
1602
1602
|
}
|
|
1603
1603
|
y && (y.setActive(!1), e == null || e.removeInteraction(y), (e == null ? void 0 : e.getInteractions()).forEach((Z) => {
|
|
1604
1604
|
Z instanceof Draw && (Z.setActive(!1), e == null || e.removeInteraction(Z));
|
|
1605
|
-
})), n && unByKey(n), (
|
|
1605
|
+
})), n && unByKey(n), (z = document.querySelector(".delete-icon")) == null || z.addEventListener("click", () => {
|
|
1606
1606
|
var F, Z;
|
|
1607
1607
|
B(), (Z = (F = s.getProps()) == null ? void 0 : F.areaDrawEnd) == null || Z.call(F, []);
|
|
1608
1608
|
});
|
|
1609
1609
|
});
|
|
1610
|
-
}, f = (c,
|
|
1610
|
+
}, f = (c, x) => {
|
|
1611
1611
|
const u = getArea(c);
|
|
1612
|
-
switch (
|
|
1612
|
+
switch (x) {
|
|
1613
1613
|
case "km":
|
|
1614
1614
|
return u > 1e4 ? Math.round(u / 1e6 * 100) / 100 + " km<sup>2</sup>" : Math.round(u * 100) / 100 + " m<sup>2</sup>";
|
|
1615
1615
|
case "nm":
|
|
1616
1616
|
return u > 1e4 ? Math.round(u / 1e6 / Math.pow(1.852, 2) * 100) / 100 + " nm<sup>2</sup>" : Math.round(u * 100) / 100 + " m<sup>2</sup>";
|
|
1617
1617
|
}
|
|
1618
1618
|
};
|
|
1619
|
-
let
|
|
1620
|
-
const
|
|
1621
|
-
|
|
1622
|
-
element:
|
|
1619
|
+
let w, k;
|
|
1620
|
+
const L = () => {
|
|
1621
|
+
w != null && w.parentNode && w.parentNode.removeChild(w), w = document.createElement("div"), w.style.display = "flex", w.className = "ol-tooltip ol-tooltip-draw-polygon", k = new Overlay({
|
|
1622
|
+
element: w,
|
|
1623
1623
|
offset: [0, -15],
|
|
1624
1624
|
positioning: "bottom-center",
|
|
1625
1625
|
stopEvent: !1,
|
|
1626
1626
|
insertFirst: !1
|
|
1627
|
-
}), e == null || e.addOverlay(
|
|
1627
|
+
}), e == null || e.addOverlay(k);
|
|
1628
1628
|
};
|
|
1629
|
-
let
|
|
1629
|
+
let S, _;
|
|
1630
1630
|
const H = () => {
|
|
1631
|
-
|
|
1632
|
-
element:
|
|
1631
|
+
S != null && S.parentNode && S.parentNode.removeChild(S), S = document.createElement("div"), S.className = "ol-tooltip ol-help-tooltip", _ = new Overlay({
|
|
1632
|
+
element: S,
|
|
1633
1633
|
offset: [15, 0],
|
|
1634
1634
|
positioning: "center-left"
|
|
1635
|
-
}), e == null || e.addOverlay(
|
|
1635
|
+
}), e == null || e.addOverlay(_);
|
|
1636
1636
|
}, B = () => {
|
|
1637
|
-
|
|
1637
|
+
v == null || v.clear(), l = null, L(), H(), V();
|
|
1638
1638
|
};
|
|
1639
1639
|
return {
|
|
1640
1640
|
open: i,
|
|
1641
1641
|
close: () => {
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
}), y = null), n && unByKey(n),
|
|
1642
|
+
v == null || v.clear(), v = null, m && (e.removeLayer(m), m = null), r = null, y && (y.setActive(!1), (e == null ? void 0 : e.getInteractions()).forEach((x) => {
|
|
1643
|
+
x instanceof Draw && (x.setActive(!1), e == null || e.removeInteraction(x));
|
|
1644
|
+
}), y = null), n && unByKey(n), S != null && S.parentElement && S.parentElement.removeChild(S), w != null && w.parentElement && w.parentElement.removeChild(w), _ && e.removeOverlay(_), k && e.removeOverlay(k), changeCursor(e, "pointer");
|
|
1645
1645
|
},
|
|
1646
1646
|
reset: B
|
|
1647
1647
|
};
|
|
1648
1648
|
}, PORT_LAYER_CLASS_NAME = "zh-map-port-layer", usePortManager = (e) => {
|
|
1649
1649
|
const s = e.getInstall();
|
|
1650
1650
|
let l, n, i = null, t = null;
|
|
1651
|
-
const
|
|
1651
|
+
const m = (f, w = !0) => {
|
|
1652
1652
|
if (!(!f || f.length === 0)) {
|
|
1653
1653
|
if (n || (n = new VectorSource()), n.clear(), t) {
|
|
1654
|
-
const
|
|
1655
|
-
|
|
1654
|
+
const k = f.find((L) => L.id === t.id);
|
|
1655
|
+
k ? t = k : f.push(t);
|
|
1656
1656
|
}
|
|
1657
|
-
f.forEach((
|
|
1658
|
-
w
|
|
1657
|
+
f.forEach((k) => {
|
|
1658
|
+
v(k, w);
|
|
1659
1659
|
}), l || (l = new VectorLayer({
|
|
1660
1660
|
className: PORT_LAYER_CLASS_NAME,
|
|
1661
1661
|
source: n,
|
|
1662
1662
|
zIndex: 100
|
|
1663
1663
|
}), s.addLayer(l));
|
|
1664
1664
|
}
|
|
1665
|
-
},
|
|
1666
|
-
const
|
|
1667
|
-
geometry: new Point(fromLonLat([Number(
|
|
1665
|
+
}, v = (f, w = !0) => {
|
|
1666
|
+
const k = e.getZoom(), [L, S] = f.latLon.split(","), _ = new Feature({
|
|
1667
|
+
geometry: new Point(fromLonLat([Number(L), Number(S)]))
|
|
1668
1668
|
});
|
|
1669
|
-
|
|
1670
|
-
}, o = (f,
|
|
1671
|
-
const
|
|
1672
|
-
<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="${
|
|
1669
|
+
_.setStyle(o(f, k, f.id === (t == null ? void 0 : t.id), w)), _.set("portData", f), n.addFeature(_);
|
|
1670
|
+
}, o = (f, w, k, L = !0) => {
|
|
1671
|
+
const S = (H) => `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1672
|
+
<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="${H}"/>
|
|
1673
1673
|
<g clip-path="url(#clip0_10059_122082)">
|
|
1674
1674
|
<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"/>
|
|
1675
1675
|
</g>
|
|
@@ -1679,71 +1679,77 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1679
1679
|
</clipPath>
|
|
1680
1680
|
</defs>
|
|
1681
1681
|
</svg>
|
|
1682
|
-
`,
|
|
1683
|
-
return new Style({
|
|
1682
|
+
`, _ = () => `data:image/svg+xml;utf8,${encodeURIComponent(S(k ? "#FF5733" : "#3370FF"))}`;
|
|
1683
|
+
return L ? new Style({
|
|
1684
1684
|
text: new Text({
|
|
1685
1685
|
text: f.shortName,
|
|
1686
1686
|
font: "12px sans-serif",
|
|
1687
1687
|
fill: new Fill({
|
|
1688
|
-
color:
|
|
1688
|
+
color: k ? "#ffffff" : "#000000"
|
|
1689
1689
|
}),
|
|
1690
1690
|
backgroundFill: new Fill({
|
|
1691
|
-
color:
|
|
1691
|
+
color: k ? "#FF5733" : "#FFFFFF"
|
|
1692
1692
|
}),
|
|
1693
1693
|
offsetY: 30
|
|
1694
1694
|
}),
|
|
1695
1695
|
image: new Icon({
|
|
1696
|
-
src:
|
|
1697
|
-
scale: 0.5 *
|
|
1696
|
+
src: _(),
|
|
1697
|
+
scale: 0.5 * w / 10
|
|
1698
1698
|
}),
|
|
1699
|
-
zIndex:
|
|
1699
|
+
zIndex: k ? 110 : 100
|
|
1700
|
+
}) : new Style({
|
|
1701
|
+
image: new Icon({
|
|
1702
|
+
src: _(),
|
|
1703
|
+
scale: 0.5 * w / 10
|
|
1704
|
+
}),
|
|
1705
|
+
zIndex: k ? 110 : 100
|
|
1700
1706
|
});
|
|
1701
1707
|
}, r = () => {
|
|
1702
1708
|
if (i) {
|
|
1703
1709
|
console.log("清除非选中的港口");
|
|
1704
1710
|
const f = i.get("portData").id;
|
|
1705
|
-
n.getFeatures().forEach((
|
|
1706
|
-
|
|
1711
|
+
n.getFeatures().forEach((w) => {
|
|
1712
|
+
w.get("portData").id !== f && n.removeFeature(w);
|
|
1707
1713
|
});
|
|
1708
1714
|
} else
|
|
1709
1715
|
console.log("清除所有港口", n), n == null || n.clear();
|
|
1710
|
-
},
|
|
1716
|
+
}, p = (f) => {
|
|
1711
1717
|
if (!f)
|
|
1712
1718
|
return y();
|
|
1713
1719
|
(i == null ? void 0 : i.get("portData").id) !== f.id && (y(), P(f));
|
|
1714
1720
|
}, y = () => {
|
|
1715
1721
|
if (i) {
|
|
1716
|
-
const f = i == null ? void 0 : i.get("portData"),
|
|
1717
|
-
i.setStyle(o(f,
|
|
1722
|
+
const f = i == null ? void 0 : i.get("portData"), w = e.getZoom();
|
|
1723
|
+
i.setStyle(o(f, w, !1));
|
|
1718
1724
|
}
|
|
1719
1725
|
}, P = (f) => {
|
|
1720
|
-
const
|
|
1721
|
-
t = f, i =
|
|
1726
|
+
const w = n.getFeatures();
|
|
1727
|
+
t = f, i = w.find((k) => k.get("portData").id === f.id), i == null || i.setStyle(o(f, e.getZoom(), !0));
|
|
1722
1728
|
};
|
|
1723
1729
|
return {
|
|
1724
|
-
render:
|
|
1730
|
+
render: m,
|
|
1725
1731
|
clear: r,
|
|
1726
|
-
selected:
|
|
1732
|
+
selected: p,
|
|
1727
1733
|
handlePortHover: (f) => {
|
|
1728
|
-
const
|
|
1729
|
-
f && f.get("portData") &&
|
|
1734
|
+
const w = s == null ? void 0 : s.getTargetElement();
|
|
1735
|
+
f && f.get("portData") && w && (w.style.cursor = "pointer");
|
|
1730
1736
|
}
|
|
1731
1737
|
};
|
|
1732
1738
|
}, useEventManager = (e, s, l, n, i, t) => {
|
|
1733
|
-
const
|
|
1734
|
-
|
|
1739
|
+
const m = e.getInstall();
|
|
1740
|
+
m.on("moveend", () => {
|
|
1735
1741
|
var o, r;
|
|
1736
|
-
const
|
|
1737
|
-
(r = (o = s.getProps()).mapMoveEnd) == null || r.call(o,
|
|
1738
|
-
}),
|
|
1739
|
-
const o =
|
|
1740
|
-
n.handleShipMapEvent(r, "hover"), l.handleTrackMapEvent(r, "hover",
|
|
1741
|
-
}),
|
|
1742
|
+
const v = e.getZoom();
|
|
1743
|
+
(r = (o = s.getProps()).mapMoveEnd) == null || r.call(o, v), l.reRenderTrackLine();
|
|
1744
|
+
}), m.on("pointermove", (v) => {
|
|
1745
|
+
const o = m.getEventPixel(v.originalEvent), r = m.forEachFeatureAtPixel(o, (p) => p);
|
|
1746
|
+
n.handleShipMapEvent(r, "hover"), l.handleTrackMapEvent(r, "hover", v), r && i.handlePortHover(r);
|
|
1747
|
+
}), m.on("movestart", () => {
|
|
1742
1748
|
console.log("movestart-----------------------");
|
|
1743
|
-
}),
|
|
1744
|
-
var
|
|
1749
|
+
}), m.on("click", debounce((v) => {
|
|
1750
|
+
var p, y, P;
|
|
1745
1751
|
if (console.log("1", t.getState()), t.getState()) return;
|
|
1746
|
-
const o =
|
|
1752
|
+
const o = m.getEventPixel(v.originalEvent), r = m.forEachFeatureAtPixel(
|
|
1747
1753
|
o,
|
|
1748
1754
|
(V) => {
|
|
1749
1755
|
if (V != null && V.get("shipData") || V != null && V.get("portData"))
|
|
@@ -1751,8 +1757,8 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1751
1757
|
}
|
|
1752
1758
|
);
|
|
1753
1759
|
if (console.log("2", r), !!r) {
|
|
1754
|
-
if (
|
|
1755
|
-
n.handleShipMapEvent(r, "click", (
|
|
1760
|
+
if (v.preventDefault(), v.stopPropagation(), r.get("shipData"))
|
|
1761
|
+
n.handleShipMapEvent(r, "click", (p = s.getProps()) == null ? void 0 : p.selectShip);
|
|
1756
1762
|
else if (r.get("portData")) {
|
|
1757
1763
|
const V = r.get("portData");
|
|
1758
1764
|
i.selected(V), (P = (y = s.getProps()) == null ? void 0 : y.selectPort) == null || P.call(y, V);
|
|
@@ -1765,43 +1771,43 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1765
1771
|
createInstance: (n, i) => {
|
|
1766
1772
|
const t = useMapInitializer();
|
|
1767
1773
|
t.initMap(n, i);
|
|
1768
|
-
const
|
|
1769
|
-
o.setProps(i),
|
|
1770
|
-
const r = useTrackManager(
|
|
1771
|
-
useEventManager(t, o, r, y,
|
|
1772
|
-
const
|
|
1773
|
-
const
|
|
1774
|
-
return [
|
|
1775
|
-
},
|
|
1774
|
+
const m = t.getInstall(), v = useLayerManager(m), o = usePropsManager();
|
|
1775
|
+
o.setProps(i), v.setShowLayerType(i.layerType), v.setGreenTileVisible(i.showGreenLayer);
|
|
1776
|
+
const r = useTrackManager(m), p = useCarTrackManager(m, r), y = useShipManager(m), P = usePositionManager(m), V = useDrawLineManager(m, o), f = useDrawPolygonManager(m, o), w = usePortManager(t);
|
|
1777
|
+
useEventManager(t, o, r, y, w, V);
|
|
1778
|
+
const k = () => {
|
|
1779
|
+
const S = m.getView().calculateExtent(t.getSize()), _ = transform([S[0], S[1]], projection.mercator, projection.data), H = transform([S[2], S[3]], projection.mercator, projection.data);
|
|
1780
|
+
return [_[0], _[1], H[0], H[1]];
|
|
1781
|
+
}, L = {
|
|
1776
1782
|
id: Symbol("map-instance"),
|
|
1777
1783
|
innerMap: null,
|
|
1778
1784
|
map: t.getInstall(),
|
|
1779
1785
|
destroy: () => {
|
|
1780
|
-
e.splice(e.indexOf(
|
|
1786
|
+
e.splice(e.indexOf(L), 1);
|
|
1781
1787
|
},
|
|
1782
1788
|
methods: {
|
|
1783
1789
|
...t,
|
|
1784
|
-
layer:
|
|
1790
|
+
layer: v,
|
|
1785
1791
|
ship: y,
|
|
1786
1792
|
track: r,
|
|
1787
|
-
carTrack:
|
|
1793
|
+
carTrack: p,
|
|
1788
1794
|
port: {
|
|
1789
|
-
render:
|
|
1790
|
-
clear:
|
|
1791
|
-
selected:
|
|
1795
|
+
render: w.render,
|
|
1796
|
+
clear: w.clear,
|
|
1797
|
+
selected: w.selected
|
|
1792
1798
|
},
|
|
1793
1799
|
position: P,
|
|
1794
1800
|
drawLine: V,
|
|
1795
1801
|
drawPolygon: f,
|
|
1796
1802
|
// 子模块
|
|
1797
1803
|
utils: {
|
|
1798
|
-
getCalculateExtent:
|
|
1804
|
+
getCalculateExtent: k,
|
|
1799
1805
|
convertSixHundredThousandToLatLng,
|
|
1800
1806
|
calculateCirclePoints
|
|
1801
1807
|
}
|
|
1802
1808
|
}
|
|
1803
1809
|
};
|
|
1804
|
-
return e.push(
|
|
1810
|
+
return e.push(L), L;
|
|
1805
1811
|
},
|
|
1806
1812
|
destroyInstance: (n) => {
|
|
1807
1813
|
const i = e.findIndex((t) => t.id === n);
|
|
@@ -1832,13 +1838,13 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1832
1838
|
} }
|
|
1833
1839
|
},
|
|
1834
1840
|
setup(e, { expose: s }) {
|
|
1835
|
-
const l = ref(), n = ref(), i = useMapController(), t = ref(),
|
|
1841
|
+
const l = ref(), n = ref(), i = useMapController(), t = ref(), m = e, v = ref({
|
|
1836
1842
|
getInstall() {
|
|
1837
1843
|
}
|
|
1838
1844
|
});
|
|
1839
1845
|
return onMounted(() => {
|
|
1840
1846
|
var o;
|
|
1841
|
-
t.value = i.createInstance(l.value,
|
|
1847
|
+
t.value = i.createInstance(l.value, m), console.log(" instance.value?.methods", t.value.map), v.value = t.value.methods, (o = n.value) == null || o.setScaleLine(t.value.map, m.scaleLineUnit);
|
|
1842
1848
|
}), onUnmounted(() => {
|
|
1843
1849
|
var o, r;
|
|
1844
1850
|
i.destroyInstance((o = t == null ? void 0 : t.value) == null ? void 0 : o.id), (r = t.value) == null || r.destroy();
|
|
@@ -1860,16 +1866,16 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1860
1866
|
return (o = t.value) == null ? void 0 : o.methods.getView();
|
|
1861
1867
|
},
|
|
1862
1868
|
setCenter: (o, r) => {
|
|
1863
|
-
var
|
|
1864
|
-
return (
|
|
1869
|
+
var p;
|
|
1870
|
+
return (p = t.value) == null ? void 0 : p.methods.setCenter(o, r);
|
|
1865
1871
|
},
|
|
1866
1872
|
getSize: () => {
|
|
1867
1873
|
var o;
|
|
1868
1874
|
return (o = t.value) == null ? void 0 : o.methods.getSize();
|
|
1869
1875
|
},
|
|
1870
1876
|
getCenter: (o, r) => {
|
|
1871
|
-
var
|
|
1872
|
-
return (
|
|
1877
|
+
var p;
|
|
1878
|
+
return (p = t.value) == null ? void 0 : p.methods.getCenter();
|
|
1873
1879
|
},
|
|
1874
1880
|
layer: {
|
|
1875
1881
|
setGreenTileVisible: (o) => {
|
|
@@ -1964,9 +1970,9 @@ const createLabelFeatureStyle = (e) => {
|
|
|
1964
1970
|
}
|
|
1965
1971
|
},
|
|
1966
1972
|
port: {
|
|
1967
|
-
render: (o) => {
|
|
1968
|
-
var
|
|
1969
|
-
return (
|
|
1973
|
+
render: (o, r) => {
|
|
1974
|
+
var p;
|
|
1975
|
+
return (p = t.value) == null ? void 0 : p.methods.port.render(o, r);
|
|
1970
1976
|
},
|
|
1971
1977
|
clear: () => {
|
|
1972
1978
|
var o;
|
|
@@ -2042,8 +2048,8 @@ const createLabelFeatureStyle = (e) => {
|
|
|
2042
2048
|
return (r = t.value) == null ? void 0 : r.methods.utils.convertSixHundredThousandToLatLng(...o);
|
|
2043
2049
|
},
|
|
2044
2050
|
calculateCirclePoints: (o, r) => {
|
|
2045
|
-
var
|
|
2046
|
-
return (
|
|
2051
|
+
var p;
|
|
2052
|
+
return (p = t.value) == null ? void 0 : p.methods.utils.calculateCirclePoints(o, r);
|
|
2047
2053
|
}
|
|
2048
2054
|
}
|
|
2049
2055
|
}), (o, r) => (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
@@ -2063,7 +2069,7 @@ const createLabelFeatureStyle = (e) => {
|
|
|
2063
2069
|
}, null, 8, ["map-instance"])
|
|
2064
2070
|
]));
|
|
2065
2071
|
}
|
|
2066
|
-
}), Map$1 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
2072
|
+
}), Map$1 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-cb0faecb"]]), ZhMap = withInstall(Map$1);
|
|
2067
2073
|
export {
|
|
2068
2074
|
ZhMap as Z
|
|
2069
2075
|
};
|