zhihao-ui 1.3.8 → 1.3.10
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/{BaseInfo-DFEg4oWo.js → BaseInfo-Bhin5Xqy.js} +1 -1
- package/dist/es/{BaseItem-BvdMV2Gu.js → BaseItem-BoLcxB-U.js} +3 -3
- package/dist/es/{Button-NgQ5sHIG.js → Button-DdMNoo0g.js} +2 -2
- package/dist/es/{DatePicker-B2pu6NJQ.js → DatePicker-sUXbd9V4.js} +3 -3
- package/dist/es/{DetailHeader-DDDbFDig.js → DetailHeader--0WANmGX.js} +3 -3
- package/dist/es/{DetailSubTitle-IqUKEU6D.js → DetailSubTitle-BUqZQxrl.js} +2 -2
- package/dist/es/{Dialog-DzTqitsD.js → Dialog-BKHohBv4.js} +3 -3
- package/dist/es/{DiyDataTable-DlgBshaZ.js → DiyDataTable-GuaKFrG5.js} +4 -4
- package/dist/es/{EditInfoPair-DQQoCmp8.js → EditInfoPair-CajUIoGj.js} +3 -3
- package/dist/es/{FileWrapper-pzSCoy4C.js → FileWrapper-CvYOVYx4.js} +4 -4
- package/dist/es/{Grid-D3sfvKjP.js → Grid-eLpow9Qb.js} +2 -2
- package/dist/es/{InfoPair-O3-tZH-B.js → InfoPair-BoTzSjD8.js} +3 -3
- package/dist/es/{Input-m8a-UuQp.js → Input-BKzWwcsD.js} +3 -3
- package/dist/es/{Loading-5WuhZO5j.js → Loading-3Cz4Wb5p.js} +2 -2
- package/dist/es/{Map-C3C8lRE-.js → Map-Dw2qcOkb.js} +349 -283
- package/dist/es/{MessageBox-3q9YfNRL.js → MessageBox--A4VqZyI.js} +2 -2
- package/dist/es/{MoneyInput-DddMW7cV.js → MoneyInput-DeYknAkX.js} +5 -5
- package/dist/es/{PageHeadPanel-BLvPIfGZ.js → PageHeadPanel-8pDHbfnc.js} +2 -2
- package/dist/es/{Table-iJRuASc3.js → Table-DcnAnAAU.js} +5 -5
- package/dist/es/{ToolTips-Cv8eNWyC.js → ToolTips-xwoX6Ww8.js} +3 -3
- package/dist/es/index.js +22 -22
- package/dist/es/{utils-DSw1USoH.js → utils-pSjFFegY.js} +1 -1
- package/dist/es/{vendor-Cc_TVxUO.js → vendor-CINc7P9P.js} +8 -8
- package/dist/index.css +1 -1
- package/dist/types/components/Map/Map.vue.d.ts +6 -16
- package/dist/types/components/Map/function/position.d.ts +14 -0
- package/dist/types/components/Map/function/shipTrack.d.ts +7 -4
- package/dist/types/components/Map/index.d.ts +18 -48
- package/dist/types/components/Map/interface/index.d.ts +1 -0
- package/dist/types/components/Map/utils/util.d.ts +42 -0
- package/dist/umd/index.css +1 -1
- package/dist/umd/index.umd.cjs +17 -17
- package/package.json +1 -1
- package/dist/types/components/Map/function/label.d.ts +0 -9
- package/dist/types/components/Map/function/location.d.ts +0 -7
- package/dist/types/components/Map/function/ship.d.ts +0 -34
- package/dist/types/components/Map/function/shipLabel.d.ts +0 -25
- /package/dist/types/components/Map/interface/{loaction.d.ts → position.d.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { _ as _export_sfc } from "./Button-
|
|
4
|
-
import { w as withInstall } from "./utils-
|
|
1
|
+
import { ref, computed, watch, onMounted, onBeforeUnmount, h, nextTick, createVNode, render as render$1, defineComponent, openBlock, createElementBlock, createElementVNode } from "vue";
|
|
2
|
+
import { h as hooks, p as fromLonLat, t as transformExtent, q as getLength, T as Text, F as Fill, S as Style, O as Overlay, r as debounce, P as Polyline, L as LineString, s as Feature, u as Point, V as VectorLayer, v as VectorSource, i as cloneDeep, w as buffer, x as Stroke, y as transform, C as CircleStyle, z as getVectorContext, R as RBush$1, I as Icon, D as DoubleClickZoom, A as Draw, B as unByKey, G as getUid, M as Map$2, H as TileLayer, X as XYZ, J as View, K as defaults, N as toLonLat, Q as ScaleLine$1, U as getArea, W as getCenter$1, Y as MultiPoint } from "./vendor-CINc7P9P.js";
|
|
3
|
+
import { _ as _export_sfc } from "./Button-DdMNoo0g.js";
|
|
4
|
+
import { w as withInstall } from "./utils-pSjFFegY.js";
|
|
5
5
|
const TIAN_DI_TU_KEY = "a6e8f78974f2581f2ca00485b40c948f", MAP_ZOOM = {
|
|
6
6
|
// 地图默认层级
|
|
7
7
|
default: 13,
|
|
@@ -93,7 +93,7 @@ const popupEle = document.createElement("div"), popupOverlay = new Overlay({
|
|
|
93
93
|
stopEvent: !1,
|
|
94
94
|
className: "track-label-popup"
|
|
95
95
|
});
|
|
96
|
-
let polyline, linePath, startMarker, position, geoMarker, trackAnimating = !1, lastTime = Date.now(), vectorLayer$
|
|
96
|
+
let polyline, linePath, startMarker, position$1, geoMarker, trackAnimating = !1, lastTime = Date.now(), vectorLayer$4, distance = 0, routeFeature = null;
|
|
97
97
|
const MAX_CACHED_LAYERS = 5, usedIds = [], manageLayerCache = (e) => {
|
|
98
98
|
var n;
|
|
99
99
|
const t = getInstall();
|
|
@@ -103,27 +103,27 @@ const MAX_CACHED_LAYERS = 5, usedIds = [], manageLayerCache = (e) => {
|
|
|
103
103
|
}
|
|
104
104
|
};
|
|
105
105
|
let trackColor = "";
|
|
106
|
-
const colors = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], reRenderTrackLine = () => {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
}, preprocessTrackData = (e, t) => {
|
|
106
|
+
const colors = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], reRenderTrackLine = debounce(() => {
|
|
107
|
+
if (console.log("reRenderTrackLine------------"), activeTrackId && allTracks[activeTrackId] && trackLayers.get(activeTrackId).getVisible()) {
|
|
108
|
+
const e = cloneDeep(preprocessTrackData(activeTrackId, allTracks[activeTrackId]));
|
|
109
|
+
createPointFeature(activeTrackId, e);
|
|
110
|
+
}
|
|
111
|
+
}, 300), preprocessTrackData = (e, t) => {
|
|
112
112
|
let n = [];
|
|
113
113
|
return n = t.map((o, r) => {
|
|
114
114
|
if (Number(o.lon) > 180 || Number(o.lat) > 180) {
|
|
115
115
|
const [l, a] = convertSixHundredThousandToLatLng(o.lon, o.lat);
|
|
116
116
|
o.lon = l, o.lat = a;
|
|
117
117
|
}
|
|
118
|
-
return o.center = [o.lon, o.lat], o.centerPoint = lonLatToMercator(o.center), o.time = hooks(o.createdAt).format("YYYY-MM-DD HH:mm:ss"), o.id = e, o.index = r, o
|
|
118
|
+
return o.center = [o.lon, o.lat], o.centerPoint = lonLatToMercator(o.center), o.time = hooks(o.createdAt).format("YYYY-MM-DD HH:mm:ss"), o.id = e, o.index = r, o;
|
|
119
119
|
}), n;
|
|
120
|
-
}, renderTrackLine = async (e, t, n, o = "ship"
|
|
121
|
-
const
|
|
122
|
-
if (!
|
|
120
|
+
}, renderTrackLine = async (e, t, n, o = "ship") => {
|
|
121
|
+
const r = getInstall();
|
|
122
|
+
if (!r || (t = t == null ? void 0 : t.reverse(), popupOverlay && o === "ship" && (r != null && r.getOverlays().getArray().includes(popupOverlay) || r.addOverlay(popupOverlay)), (t == null ? void 0 : t.length) < 2))
|
|
123
123
|
return;
|
|
124
124
|
manageLayerCache(e), activeTrackId = e, allTracks[e] = t;
|
|
125
|
-
const
|
|
126
|
-
trackColor = n || colors[
|
|
125
|
+
const l = Object.keys(allTracks).findIndex((a) => a === e) || 0;
|
|
126
|
+
trackColor = n || colors[l > 10 ? 10 : l], await handlerRenderLine(), await setTrackViewCenter(activeTrackId);
|
|
127
127
|
}, createTrackLayer = (e) => {
|
|
128
128
|
const t = new VectorSource();
|
|
129
129
|
return new VectorLayer({
|
|
@@ -144,19 +144,16 @@ const colors = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080"
|
|
|
144
144
|
}, handlerRenderLine = async () => {
|
|
145
145
|
const e = activeTrackId;
|
|
146
146
|
if (!trackLayers.has(e)) {
|
|
147
|
-
const
|
|
148
|
-
trackLayers.set(e,
|
|
147
|
+
const l = createTrackLayer(e);
|
|
148
|
+
trackLayers.set(e, l);
|
|
149
149
|
}
|
|
150
|
-
setActiveLayer(e);
|
|
151
|
-
const t =
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
const r =
|
|
156
|
-
|
|
157
|
-
a = preprocessTrackData(e, l);
|
|
158
|
-
const s = a.map((c) => c.centerPoint);
|
|
159
|
-
console.log("processedList", a.length), removeAllLabel(), a.length >= 2 && (await createTrackLineFeature(e, s, n), await createPointFeature(e, a, n));
|
|
150
|
+
await setActiveLayer(e);
|
|
151
|
+
const t = trackColor || "", n = allTracks[e] || [];
|
|
152
|
+
if (!(n && n.length > 1)) return [];
|
|
153
|
+
let o = [];
|
|
154
|
+
o = cloneDeep(preprocessTrackData(e, n));
|
|
155
|
+
const r = o.map((l) => l.centerPoint);
|
|
156
|
+
o.length >= 2 && await createTrackLineFeature(e, r, t);
|
|
160
157
|
}, createTrackLineFeature = (e, t, n) => {
|
|
161
158
|
const o = new LineString(t), r = trackLayers.get(e).getSource(), l = r.getFeatureById(e);
|
|
162
159
|
if (l)
|
|
@@ -219,83 +216,83 @@ const colors = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080"
|
|
|
219
216
|
</div>
|
|
220
217
|
${t ?? t}
|
|
221
218
|
</div>`;
|
|
222
|
-
},
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
o.addOverlay(g);
|
|
239
|
-
});
|
|
240
|
-
return;
|
|
219
|
+
}, filterPoints = (e) => {
|
|
220
|
+
const t = getInstall(), n = 100, o = e.map((i) => {
|
|
221
|
+
const d = t.getPixelFromCoordinate(fromLonLat(i.center));
|
|
222
|
+
return {
|
|
223
|
+
...i,
|
|
224
|
+
original: i,
|
|
225
|
+
pixel: d,
|
|
226
|
+
distance: 0
|
|
227
|
+
// 先初始化,后续计算
|
|
228
|
+
};
|
|
229
|
+
});
|
|
230
|
+
let r = 0;
|
|
231
|
+
o[0].distance = 0;
|
|
232
|
+
for (let i = 1; i < o.length; i++) {
|
|
233
|
+
const d = o[i - 1].pixel, u = o[i].pixel, c = u[0] - d[0], p = u[1] - d[1];
|
|
234
|
+
r += Math.sqrt(c * c + p * p), o[i].distance = r;
|
|
241
235
|
}
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
236
|
+
const l = o.filter(
|
|
237
|
+
(i, d) => d === 0 || d === o.length - 1
|
|
238
|
+
// || point.state
|
|
239
|
+
), a = [];
|
|
240
|
+
for (let i = 0; i < l.length; i++) {
|
|
241
|
+
const d = l[i];
|
|
242
|
+
if (a.push(d), i < l.length - 1) {
|
|
243
|
+
const u = l[i + 1], c = u.distance - d.distance, p = Math.floor(c / n);
|
|
244
|
+
for (let m = 1; m <= p; m++) {
|
|
245
|
+
const g = d.distance + m * n;
|
|
246
|
+
if (g >= u.distance) break;
|
|
247
|
+
const f = interpolateBetweenPoints(
|
|
248
|
+
o,
|
|
249
|
+
g
|
|
250
|
+
);
|
|
251
|
+
f && a.push(f);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
250
254
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
return Array.from(
|
|
256
|
+
new Map(a.map((i) => [i.distance.toFixed(2), i])).values()
|
|
257
|
+
).map((i) => ({
|
|
258
|
+
...i.original,
|
|
259
|
+
// 优先保留原始数据
|
|
260
|
+
...i,
|
|
261
|
+
// 覆盖坐标等计算属性
|
|
262
|
+
coord: i.coord,
|
|
263
|
+
// 确保使用插值后的坐标
|
|
264
|
+
pixel: i.pixel,
|
|
265
|
+
distance: i.distance
|
|
266
|
+
}));
|
|
257
267
|
};
|
|
258
|
-
function
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
let r = 0;
|
|
274
|
-
if (t < n) {
|
|
275
|
-
const l = e[t], a = e[n];
|
|
276
|
-
let s = 0;
|
|
277
|
-
for (let c = t + 1; c < n; c++) {
|
|
278
|
-
const d = pointToLineDistance(e[c], l, a);
|
|
279
|
-
d > s && (s = d, r = c);
|
|
268
|
+
function interpolateBetweenPoints(e, t) {
|
|
269
|
+
const n = getInstall();
|
|
270
|
+
for (let o = 1; o < e.length; o++) {
|
|
271
|
+
const r = e[o - 1], l = e[o];
|
|
272
|
+
if (t >= r.distance && t <= l.distance) {
|
|
273
|
+
const a = (t - r.distance) / (l.distance - r.distance), s = r.pixel[0] + a * (l.pixel[0] - r.pixel[0]), i = r.pixel[1] + a * (l.pixel[1] - r.pixel[1]), d = n.getCoordinateFromPixel([s, i]);
|
|
274
|
+
return {
|
|
275
|
+
...r,
|
|
276
|
+
// 继承前一个点的属性(可调整)
|
|
277
|
+
coord: d,
|
|
278
|
+
pixel: [s, i],
|
|
279
|
+
distance: t,
|
|
280
|
+
original: void 0
|
|
281
|
+
// 明确标记为插值生成点
|
|
282
|
+
};
|
|
280
283
|
}
|
|
281
|
-
if (s > 1e-4) {
|
|
282
|
-
const c = douglasPeuckerIndex(e, t, r), d = douglasPeuckerIndex(e, r, n);
|
|
283
|
-
o.push(...c.slice(1), ...d.slice(1));
|
|
284
|
-
} else
|
|
285
|
-
o.push(n);
|
|
286
284
|
}
|
|
287
|
-
return
|
|
285
|
+
return null;
|
|
288
286
|
}
|
|
289
|
-
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
}
|
|
298
|
-
const createPointFeatureWithStyle = (e) => {
|
|
287
|
+
const createPointFeature = async (e, t) => {
|
|
288
|
+
const n = getInstall();
|
|
289
|
+
await removeAllLabel(), await removeAllFetaure(e);
|
|
290
|
+
const o = filterPoints(t), r = o.map((a) => createPointFeatureWithStyle(a));
|
|
291
|
+
trackLayers.get(e).getSource().addFeatures(r), createArrowFetaure(e, o, t, trackColor), o.forEach((a) => {
|
|
292
|
+
const s = createPointLabelOverlay(e, trackColor, a);
|
|
293
|
+
n.addOverlay(s);
|
|
294
|
+
});
|
|
295
|
+
}, createPointFeatureWithStyle = (e) => {
|
|
299
296
|
const t = new Feature({
|
|
300
297
|
geometry: new Point(e.centerPoint),
|
|
301
298
|
data: e
|
|
@@ -334,6 +331,11 @@ const createPointFeatureWithStyle = (e) => {
|
|
|
334
331
|
n && n.length > 0 && n.forEach((o) => {
|
|
335
332
|
o.setPosition(void 0), e.removeOverlay(o), o.dispose();
|
|
336
333
|
});
|
|
334
|
+
}, removeAllFetaure = (e) => {
|
|
335
|
+
const t = trackLayers.get(e).getSource();
|
|
336
|
+
t.forEachFeature((n) => {
|
|
337
|
+
n.get("type") !== "line" && t.removeFeature(n);
|
|
338
|
+
});
|
|
337
339
|
}, createPointStyle = (e) => [
|
|
338
340
|
new Style({
|
|
339
341
|
// 扩大交互热区
|
|
@@ -361,29 +363,29 @@ const createPointFeatureWithStyle = (e) => {
|
|
|
361
363
|
})
|
|
362
364
|
}),
|
|
363
365
|
zIndex: 99
|
|
364
|
-
}), a = getIconStyle(""),
|
|
365
|
-
return Number(e.state) === 0 ? d.push(a) : Number(e.state) === 1 && d.push(
|
|
366
|
+
}), a = getIconStyle(""), i = getIconStyle(""), d = [];
|
|
367
|
+
return Number(e.state) === 0 ? d.push(a) : Number(e.state) === 1 && d.push(i), d.push(r), d;
|
|
366
368
|
}, createArrowFetaure = (e, t, n, o) => {
|
|
367
369
|
const r = t || [], l = t.length;
|
|
368
370
|
l || (r.push(n[0]), r.push(n[n.length - 1]));
|
|
369
371
|
const a = [];
|
|
370
|
-
for (let
|
|
372
|
+
for (let i = 0; i < l - 1; i++) {
|
|
371
373
|
let d;
|
|
372
|
-
const
|
|
373
|
-
if (
|
|
374
|
-
d = n[
|
|
374
|
+
const u = t[i], c = (t[i + 1].index + u.index) / 2;
|
|
375
|
+
if (c % 2 === 0)
|
|
376
|
+
d = n[c].centerPoint;
|
|
375
377
|
else {
|
|
376
|
-
const
|
|
377
|
-
if (
|
|
378
|
-
const [g, f] =
|
|
378
|
+
const p = n[Math.floor(c)], m = n[Math.ceil(c)];
|
|
379
|
+
if (p && m) {
|
|
380
|
+
const [g, f] = p.centerPoint, [y, v] = m.centerPoint;
|
|
379
381
|
d = [(g + y) / 2, (f + v) / 2];
|
|
380
382
|
}
|
|
381
383
|
}
|
|
382
384
|
if (d) {
|
|
383
|
-
const
|
|
385
|
+
const p = new Feature({
|
|
384
386
|
geometry: new Point(d)
|
|
385
387
|
});
|
|
386
|
-
|
|
388
|
+
p.set("type", "track_arrow"), p.setStyle(
|
|
387
389
|
new Style({
|
|
388
390
|
text: new Text({
|
|
389
391
|
font: "700 12px map-iconfont",
|
|
@@ -391,12 +393,12 @@ const createPointFeatureWithStyle = (e) => {
|
|
|
391
393
|
fill: new Fill({ color: o }),
|
|
392
394
|
// 设置箭头旋转 角度转为弧度
|
|
393
395
|
rotation: getRotation(
|
|
394
|
-
t[
|
|
395
|
-
t[
|
|
396
|
+
t[i].center,
|
|
397
|
+
t[i + 1].center
|
|
396
398
|
) * (Math.PI / 180)
|
|
397
399
|
})
|
|
398
400
|
})
|
|
399
|
-
), a.push(
|
|
401
|
+
), a.push(p);
|
|
400
402
|
}
|
|
401
403
|
}
|
|
402
404
|
const s = trackLayers.get(e).getSource();
|
|
@@ -444,7 +446,7 @@ const createPointFeatureWithStyle = (e) => {
|
|
|
444
446
|
}, r = (allTracks[e] || []).map(
|
|
445
447
|
(a) => transform([a.lon, a.lat], projection.data, projection.mercator)
|
|
446
448
|
), l = new LineString(r);
|
|
447
|
-
return n.length = formatLength(l, t) || "--",
|
|
449
|
+
return n.length = formatLength(l, t) || "--", n;
|
|
448
450
|
}, playShipTrack = (e, t) => {
|
|
449
451
|
handlePlay(String(e), t);
|
|
450
452
|
}, handlePlay = (e, t) => {
|
|
@@ -459,8 +461,8 @@ const createPointFeatureWithStyle = (e) => {
|
|
|
459
461
|
// 初始旋转角度
|
|
460
462
|
})
|
|
461
463
|
}), moveFeature = (e, t) => {
|
|
462
|
-
var
|
|
463
|
-
const n = getInstall(), o = Number(50 * t), r = ((
|
|
464
|
+
var p, m;
|
|
465
|
+
const n = getInstall(), o = Number(50 * t), r = ((p = e.frameState) == null ? void 0 : p.time) ?? Date.now(), l = r - lastTime;
|
|
464
466
|
if (distance = (distance + o * l / 1e6) % 2, lastTime = r, distance >= 1) {
|
|
465
467
|
stopAnimation();
|
|
466
468
|
return;
|
|
@@ -469,21 +471,21 @@ const createPointFeatureWithStyle = (e) => {
|
|
|
469
471
|
distance > 1 ? 2 - distance : distance
|
|
470
472
|
), s = linePath.getCoordinateAt(
|
|
471
473
|
distance > 1 ? distance - 0.01 : distance
|
|
472
|
-
),
|
|
474
|
+
), i = linePath.getCoordinateAt(
|
|
473
475
|
distance > 1 ? 2 - distance : distance + 0.01
|
|
474
|
-
),
|
|
476
|
+
), u = getRotation(
|
|
475
477
|
mercatorToLonLat(s, "array"),
|
|
476
|
-
mercatorToLonLat(
|
|
478
|
+
mercatorToLonLat(i, "array")
|
|
477
479
|
) * Math.PI / 180;
|
|
478
|
-
(m = geoMarkerStyle.getText()) == null || m.setRotation(
|
|
479
|
-
const
|
|
480
|
-
|
|
480
|
+
(m = geoMarkerStyle.getText()) == null || m.setRotation(u), position$1.setCoordinates(a);
|
|
481
|
+
const c = getVectorContext(e);
|
|
482
|
+
c.setStyle(geoMarkerStyle), c.drawGeometry(position$1), n == null || n.render();
|
|
481
483
|
}, startAnimation = () => {
|
|
482
484
|
var e;
|
|
483
|
-
trackAnimating = !0, lastTime = Date.now(), distance = 0, position = ((e = startMarker.getGeometry()) == null ? void 0 : e.clone()) || new Point([0, 0]), moveFeatureHandler && (vectorLayer$
|
|
485
|
+
trackAnimating = !0, lastTime = Date.now(), distance = 0, position$1 = ((e = startMarker.getGeometry()) == null ? void 0 : e.clone()) || new Point([0, 0]), moveFeatureHandler && (vectorLayer$4 == null || vectorLayer$4.on("postrender", moveFeatureHandler)), geoMarker == null || geoMarker.setGeometry(void 0);
|
|
484
486
|
}, stopAnimation = () => {
|
|
485
487
|
const e = getInstall();
|
|
486
|
-
trackAnimating && (trackAnimating = !1, geoMarker == null || geoMarker.setGeometry(void 0), moveFeatureHandler && vectorLayer$
|
|
488
|
+
trackAnimating && (trackAnimating = !1, geoMarker == null || geoMarker.setGeometry(void 0), moveFeatureHandler && vectorLayer$4 && vectorLayer$4.un("postrender", moveFeatureHandler), vectorLayer$4 && (e == null || e.removeLayer(vectorLayer$4)), vectorLayer$4 = null, geoMarker = null);
|
|
487
489
|
}, playAnimation = (e, t) => {
|
|
488
490
|
trackAnimating && stopAnimation(), polyline = new Polyline({
|
|
489
491
|
factor: 1e6
|
|
@@ -497,53 +499,53 @@ const createPointFeatureWithStyle = (e) => {
|
|
|
497
499
|
geometry: new Point(linePath.getFirstCoordinate())
|
|
498
500
|
});
|
|
499
501
|
const n = startMarker.getGeometry();
|
|
500
|
-
position = n ? n.clone() : new Point([0, 0]), geoMarker = new Feature({
|
|
502
|
+
position$1 = n ? n.clone() : new Point([0, 0]), geoMarker = new Feature({
|
|
501
503
|
type: "geoMarker",
|
|
502
504
|
style: geoMarkerStyle,
|
|
503
|
-
geometry: position
|
|
504
|
-
}), vectorLayer$
|
|
505
|
+
geometry: position$1
|
|
506
|
+
}), vectorLayer$4 = new VectorLayer({
|
|
505
507
|
source: new VectorSource({
|
|
506
508
|
features: [geoMarker]
|
|
507
509
|
})
|
|
508
510
|
});
|
|
509
511
|
const o = getInstall();
|
|
510
|
-
o == null || o.addLayer(vectorLayer$
|
|
512
|
+
o == null || o.addLayer(vectorLayer$4), moveFeatureHandler = (r) => moveFeature(r, t), startAnimation();
|
|
511
513
|
}, getRotation = (e, t, n) => {
|
|
512
|
-
function o(
|
|
513
|
-
return 180 * (
|
|
514
|
+
function o(c) {
|
|
515
|
+
return 180 * (c % (2 * Math.PI)) / Math.PI;
|
|
514
516
|
}
|
|
515
|
-
function r(
|
|
516
|
-
return
|
|
517
|
+
function r(c) {
|
|
518
|
+
return c % 360 * Math.PI / 180;
|
|
517
519
|
}
|
|
518
|
-
function l(
|
|
519
|
-
var
|
|
520
|
-
if (!
|
|
521
|
-
if (!Array.isArray(
|
|
522
|
-
if ((
|
|
523
|
-
return
|
|
524
|
-
if (
|
|
520
|
+
function l(c) {
|
|
521
|
+
var p;
|
|
522
|
+
if (!c) throw new Error("Coordinate is required");
|
|
523
|
+
if (!Array.isArray(c)) {
|
|
524
|
+
if ((c == null ? void 0 : c.type) === "Feature" && (c == null ? void 0 : c.geometry) !== null && ((p = c == null ? void 0 : c.geometry) == null ? void 0 : p.type) === "Point")
|
|
525
|
+
return c == null ? void 0 : c.geometry.coordinates;
|
|
526
|
+
if (c.type === "Point") return (c == null ? void 0 : c.coordinates) || [];
|
|
525
527
|
}
|
|
526
|
-
if (Array.isArray(
|
|
527
|
-
return
|
|
528
|
+
if (Array.isArray(c) && c.length >= 2 && !Array.isArray(c[0]) && !Array.isArray(c[1]))
|
|
529
|
+
return c;
|
|
528
530
|
throw new Error(
|
|
529
531
|
"Coordinate must be GeoJSON Point or an Array of numbers"
|
|
530
532
|
);
|
|
531
533
|
}
|
|
532
|
-
function a(
|
|
534
|
+
function a(c, p, m = {}) {
|
|
533
535
|
if (m.final)
|
|
534
|
-
return function(
|
|
535
|
-
return (a(
|
|
536
|
-
}(
|
|
537
|
-
const g = l(
|
|
536
|
+
return function(S, k) {
|
|
537
|
+
return (a(k, S) + 180) % 360;
|
|
538
|
+
}(c, p);
|
|
539
|
+
const g = l(c), f = l(p), y = r(g[0]), v = r(f[0]), L = r(g[1]), T = r(f[1]), w = Math.sin(v - y) * Math.cos(T), E = Math.cos(L) * Math.sin(T) - Math.sin(L) * Math.cos(T) * Math.cos(v - y);
|
|
538
540
|
return o(Math.atan2(w, E));
|
|
539
541
|
}
|
|
540
|
-
function s(
|
|
541
|
-
return !isNaN(
|
|
542
|
+
function s(c) {
|
|
543
|
+
return !isNaN(c) && c !== null && !Array.isArray(c);
|
|
542
544
|
}
|
|
543
|
-
function c
|
|
544
|
-
return
|
|
545
|
+
function i(c, p = {}, m = {}) {
|
|
546
|
+
return c || console.log("Coordinates are required"), Array.isArray(c) || console.log("Coordinates must be an Array"), c.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (!s(c[0]) || !s(c[1])) && console.log("Coordinates must contain numbers"), d({ type: "Point", coordinates: c }, p, m);
|
|
545
547
|
}
|
|
546
|
-
function d(
|
|
548
|
+
function d(c, p = {}, m = {}) {
|
|
547
549
|
const g = {
|
|
548
550
|
type: "Feature",
|
|
549
551
|
id: "",
|
|
@@ -551,10 +553,10 @@ const createPointFeatureWithStyle = (e) => {
|
|
|
551
553
|
bbox: {},
|
|
552
554
|
geometry: {}
|
|
553
555
|
};
|
|
554
|
-
return m.id !== void 0 && (g.id = m.id), m.bbox && (g.bbox = m.bbox), g.properties =
|
|
556
|
+
return m.id !== void 0 && (g.id = m.id), m.bbox && (g.bbox = m.bbox), g.properties = p, g.geometry = c, g;
|
|
555
557
|
}
|
|
556
|
-
const
|
|
557
|
-
return
|
|
558
|
+
const u = a(i(e), i(t), n);
|
|
559
|
+
return u < 0 ? 360 + u : u;
|
|
558
560
|
}, getRightIcons = (e) => {
|
|
559
561
|
const t = [];
|
|
560
562
|
return e.existDevice && t.push(""), e.existMobile && t.push(""), e.existWaterGauge && t.push(""), t;
|
|
@@ -598,24 +600,24 @@ function useShipOverlay(e) {
|
|
|
598
600
|
overflow: "visible"
|
|
599
601
|
}));
|
|
600
602
|
let s = null;
|
|
601
|
-
const
|
|
603
|
+
const i = () => {
|
|
602
604
|
d(), s = window.setInterval(() => {
|
|
603
605
|
if (t.value) {
|
|
604
|
-
const
|
|
605
|
-
|
|
606
|
-
|
|
606
|
+
const c = t.value.querySelector(".ship-overlay-content");
|
|
607
|
+
c && c.style && (c.style.backgroundColor = e.color, c.style.color = "#FFF", setTimeout(() => {
|
|
608
|
+
c && c.style && (c.style.backgroundColor = "#ffffff", c.style.color = "#000");
|
|
607
609
|
}, 500));
|
|
608
610
|
}
|
|
609
611
|
}, 1e3);
|
|
610
612
|
}, d = () => {
|
|
611
613
|
s && (clearInterval(s), s = null);
|
|
612
|
-
},
|
|
614
|
+
}, u = () => {
|
|
613
615
|
n.value && n.value.setPosition(fromLonLat(e.position));
|
|
614
616
|
};
|
|
615
|
-
return watch(() => e.selected, (
|
|
616
|
-
|
|
617
|
+
return watch(() => e.selected, (c) => {
|
|
618
|
+
c ? i() : d();
|
|
617
619
|
}, { immediate: !0 }), watch(() => e.position, () => {
|
|
618
|
-
|
|
620
|
+
u();
|
|
619
621
|
}, { deep: !0 }), onMounted(() => {
|
|
620
622
|
}), onBeforeUnmount(() => {
|
|
621
623
|
d();
|
|
@@ -751,12 +753,14 @@ function setLinePath(e) {
|
|
|
751
753
|
n && o === "top-right" && (n.style.right = "-20px"), n && o === "top-left" && (n.style.left = "-20px");
|
|
752
754
|
const l = POSITION_PRIORITY.filter((s) => s.positioning === o && s.offset === r), a = t == null ? void 0 : t.querySelector(".ship-overlay-line line");
|
|
753
755
|
if (l.length > 0) {
|
|
754
|
-
const { x1: s, y1:
|
|
755
|
-
a && (a.setAttribute("x1", s), a.setAttribute("y1",
|
|
756
|
+
const { x1: s, y1: i, x2: d, y2: u } = l[0].line;
|
|
757
|
+
a && (a.setAttribute("x1", s), a.setAttribute("y1", i), a.setAttribute("x2", d), a.setAttribute("y2", u));
|
|
756
758
|
}
|
|
757
759
|
}
|
|
758
760
|
function removeLabelOverlay(e) {
|
|
759
|
-
existingOverlays.value = []
|
|
761
|
+
existingOverlays.value = [];
|
|
762
|
+
const n = e.getOverlays().getArray().filter((o) => o.get("class") === "zh-map-ship-overlay");
|
|
763
|
+
console.log("labelOverlays--------", n), n.forEach((o) => {
|
|
760
764
|
o.setPosition(void 0), o.setElement(void 0), e.removeOverlay(o), o.dispose();
|
|
761
765
|
});
|
|
762
766
|
}
|
|
@@ -771,22 +775,22 @@ const getShipDirectPath = (e) => {
|
|
|
771
775
|
return e <= MAP_ZOOM.shipModelMax && e >= MAP_ZOOM.shipTriggleMin ? "ship" : "triangle";
|
|
772
776
|
}, getShipScale = (e, t) => {
|
|
773
777
|
if (t === "ship") {
|
|
774
|
-
const { len: n, wid: o } = e, r = 97, l = 20, s = 1 / getView().getResolution(),
|
|
775
|
-
return Math.max(
|
|
778
|
+
const { len: n, wid: o } = e, r = 97, l = 20, s = 1 / getView().getResolution(), i = n * s / r, d = o * s / l;
|
|
779
|
+
return Math.max(i, d);
|
|
776
780
|
}
|
|
777
781
|
return MAP_ZOOM.scaleNum;
|
|
778
782
|
}, initShipStyle = (e, t, n) => {
|
|
779
783
|
const { color: o, direct: r, isHighlight: l, shipData: a } = e.getProperties(), s = (a.cog - 90 + 360) % 360;
|
|
780
784
|
return new Style({
|
|
781
785
|
image: new Icon({
|
|
782
|
-
src:
|
|
786
|
+
src: i(),
|
|
783
787
|
scale: t || MAP_ZOOM.scaleNum,
|
|
784
788
|
anchor: [0.5, 0.5],
|
|
785
789
|
rotation: s * Math.PI / 180,
|
|
786
790
|
rotateWithView: !1
|
|
787
791
|
})
|
|
788
792
|
});
|
|
789
|
-
function
|
|
793
|
+
function i() {
|
|
790
794
|
return `data:image/svg+xml;utf8,${encodeURIComponent(d())}`;
|
|
791
795
|
}
|
|
792
796
|
function d() {
|
|
@@ -840,10 +844,10 @@ const getShipDirectPath = (e) => {
|
|
|
840
844
|
}, createLabelElement = (e) => {
|
|
841
845
|
const t = document.createElement("div");
|
|
842
846
|
t.className = "ship-overlay-box", t.style.position = "relative";
|
|
843
|
-
const n = e.getProperties(), { shipData: o, blinking: r, blinkingColor: l, name: a } = n, { lon: s, lat:
|
|
847
|
+
const n = e.getProperties(), { shipData: o, blinking: r, blinkingColor: l, name: a } = n, { lon: s, lat: i } = o, d = createVNode({
|
|
844
848
|
setup() {
|
|
845
849
|
return useShipOverlay({
|
|
846
|
-
position: [s + 2e-3,
|
|
850
|
+
position: [s + 2e-3, i + 2e-3],
|
|
847
851
|
selected: r,
|
|
848
852
|
name: a,
|
|
849
853
|
color: l,
|
|
@@ -853,7 +857,7 @@ const getShipDirectPath = (e) => {
|
|
|
853
857
|
});
|
|
854
858
|
}
|
|
855
859
|
});
|
|
856
|
-
return render(d, t), t;
|
|
860
|
+
return render$1(d, t), t;
|
|
857
861
|
};
|
|
858
862
|
let selectedShipFeature = null, selectedShip = null;
|
|
859
863
|
const shipsSource = new VectorSource(), shipsLayer = new VectorLayer({
|
|
@@ -866,12 +870,11 @@ const shipsSource = new VectorSource(), shipsLayer = new VectorLayer({
|
|
|
866
870
|
});
|
|
867
871
|
let hoveredShipId = "", attentionShips = {}, attentionShipsColor = {};
|
|
868
872
|
const renderShipList = (e) => {
|
|
869
|
-
console.log("renderShipList", e);
|
|
870
873
|
const t = getInstall();
|
|
871
874
|
if (!e || !t) return;
|
|
872
|
-
removeSelectedOverlay(), t.getLayers().getArray().includes(shipsLayer) || t.addLayer(shipsLayer);
|
|
875
|
+
removeSelectedOverlay(), removeLabelOverlay(t), t.getLayers().getArray().includes(shipsLayer) || t.addLayer(shipsLayer);
|
|
873
876
|
const n = (selectedShip == null ? void 0 : selectedShip.id) || (selectedShipFeature == null ? void 0 : selectedShipFeature.get("id"));
|
|
874
|
-
|
|
877
|
+
shipsSource && shipsSource.clear();
|
|
875
878
|
const o = [];
|
|
876
879
|
if (selectedShip) {
|
|
877
880
|
const l = e.filter((a) => a.id === n);
|
|
@@ -906,18 +909,20 @@ const renderShipList = (e) => {
|
|
|
906
909
|
isHighlight: !1
|
|
907
910
|
});
|
|
908
911
|
return o.setStyle(createShipStyle(o)), o;
|
|
909
|
-
}, handleChangeSelected = () => {
|
|
910
|
-
var r;
|
|
912
|
+
}, handleChangeSelected = async () => {
|
|
911
913
|
if (!selectedShip) return;
|
|
912
914
|
const e = getInstall();
|
|
913
915
|
if (!e) return;
|
|
914
|
-
let o = cloneDeep(e.getOverlays().getArray()).find((
|
|
915
|
-
if (o) {
|
|
916
|
-
const
|
|
917
|
-
o.setElement(
|
|
916
|
+
let o = cloneDeep(e.getOverlays().getArray()).find((r) => r.get("class") == "ship-overlay-selected");
|
|
917
|
+
if (console.log("selected----------", o), o) {
|
|
918
|
+
const r = selectedShipElement(selectedShip);
|
|
919
|
+
await o.setElement(r), await o.setPosition(fromLonLat([selectedShip.lon, selectedShip.lat]));
|
|
918
920
|
} else
|
|
919
921
|
o = selectedShipStyle(selectedShip), e.addOverlay(o);
|
|
920
|
-
|
|
922
|
+
setTimeout(() => {
|
|
923
|
+
var r;
|
|
924
|
+
o && ((r = o.get("element")) != null && r.parentElement) && (o.get("element").parentElement.style.display = "block");
|
|
925
|
+
}, 20);
|
|
921
926
|
}, clearShipList = () => {
|
|
922
927
|
const e = getInstall();
|
|
923
928
|
if (!e || !shipsSource) return;
|
|
@@ -934,11 +939,11 @@ const renderShipList = (e) => {
|
|
|
934
939
|
attentionShips = e, attentionShipsColor = t;
|
|
935
940
|
const o = cloneDeep(n.getOverlays().getArray()), r = cloneDeep(shipsSource.getFeatures());
|
|
936
941
|
for (const l in attentionShips) {
|
|
937
|
-
const a = attentionShips[l], s = o.find((d) => d.getId() === "label-" + l),
|
|
938
|
-
if (s &&
|
|
939
|
-
|
|
940
|
-
const d = s.getElement(),
|
|
941
|
-
d && d !==
|
|
942
|
+
const a = attentionShips[l], s = o.find((d) => d.getId() === "label-" + l), i = r.find((d) => l === d.get("id"));
|
|
943
|
+
if (s && i) {
|
|
944
|
+
i.set("blinking", a), i.set("blinkingColor", attentionShipsColor[l] || "");
|
|
945
|
+
const d = s.getElement(), u = createLabelElement(i), c = u.querySelector(".ship-overlay-line"), p = d == null ? void 0 : d.querySelector(".ship-overlay-line");
|
|
946
|
+
d && d !== u && (p && c && c.replaceWith(p), s.setElement(u));
|
|
942
947
|
}
|
|
943
948
|
}
|
|
944
949
|
}, filterShipShow = (e) => {
|
|
@@ -950,13 +955,13 @@ const renderShipList = (e) => {
|
|
|
950
955
|
});
|
|
951
956
|
const a = cloneDeep(t.getOverlays().getArray());
|
|
952
957
|
r.forEach((s) => {
|
|
953
|
-
const
|
|
954
|
-
if (!l.has(
|
|
958
|
+
const i = s.get("id"), d = a.find((u) => u.getId() === "label-" + i);
|
|
959
|
+
if (!l.has(i))
|
|
955
960
|
s.setStyle([]), d && (d.get("element").style.visibility = "hidden");
|
|
956
961
|
else {
|
|
957
962
|
d && (d.get("element").style.visibility = "visible");
|
|
958
|
-
const
|
|
959
|
-
(
|
|
963
|
+
const u = s.getStyle();
|
|
964
|
+
(u == null ? void 0 : u.length) == 0 && s.setStyle(createShipStyle(s));
|
|
960
965
|
}
|
|
961
966
|
});
|
|
962
967
|
}, renderShipSelected = (e) => {
|
|
@@ -981,6 +986,7 @@ const renderShipList = (e) => {
|
|
|
981
986
|
const e = hoveredShipId ? shipsSource.getFeatures().find((t) => t.get("id") === hoveredShipId) : null;
|
|
982
987
|
hoveredShipId = null, e == null || e.set("isHighlight", !1), e == null || e.setStyle(createShipStyle(e));
|
|
983
988
|
}, removeSelectedOverlay = () => {
|
|
989
|
+
console.log("removeSelectedOverlay-------");
|
|
984
990
|
try {
|
|
985
991
|
const e = getInstall(), n = cloneDeep(e.getOverlays().getArray()).find((o) => o.get("class") == "ship-overlay-selected");
|
|
986
992
|
n && n.setPosition(void 0);
|
|
@@ -988,28 +994,28 @@ const renderShipList = (e) => {
|
|
|
988
994
|
console.log(e);
|
|
989
995
|
}
|
|
990
996
|
}, PORT_LAYER_CLASS_NAME = "zh-map-port-layer";
|
|
991
|
-
let vectorLayer$
|
|
997
|
+
let vectorLayer$3, vectorSource$3;
|
|
992
998
|
const renderPortList = (e) => {
|
|
993
999
|
var t;
|
|
994
1000
|
if (!(!e || e.length === 0)) {
|
|
995
|
-
if (vectorSource$
|
|
1001
|
+
if (vectorSource$3 || (vectorSource$3 = new VectorSource()), vectorSource$3.clear(), selectedPortData) {
|
|
996
1002
|
const n = e.find((o) => o.id === selectedPortData.id);
|
|
997
1003
|
n ? selectedPortData = n : e.push(selectedPortData);
|
|
998
1004
|
}
|
|
999
1005
|
e.forEach((n) => {
|
|
1000
|
-
renderPortPoint(n);
|
|
1001
|
-
}), vectorLayer$
|
|
1006
|
+
renderPortPoint$1(n);
|
|
1007
|
+
}), vectorLayer$3 || (vectorLayer$3 = new VectorLayer({
|
|
1002
1008
|
className: PORT_LAYER_CLASS_NAME,
|
|
1003
|
-
source: vectorSource$
|
|
1009
|
+
source: vectorSource$3,
|
|
1004
1010
|
zIndex: 100
|
|
1005
|
-
}), (t = getInstall()) == null || t.addLayer(vectorLayer$
|
|
1011
|
+
}), (t = getInstall()) == null || t.addLayer(vectorLayer$3));
|
|
1006
1012
|
}
|
|
1007
|
-
}, renderPortPoint = (e) => {
|
|
1013
|
+
}, renderPortPoint$1 = (e) => {
|
|
1008
1014
|
const t = getZoom(), [n, o] = e.latLon.split(","), r = new Feature({
|
|
1009
1015
|
geometry: new Point(fromLonLat([Number(n), Number(o)]))
|
|
1010
1016
|
});
|
|
1011
|
-
r.setStyle(setPortStyle(e, t, e.id === (selectedPortData == null ? void 0 : selectedPortData.id))), r.set("portData", e), vectorSource$
|
|
1012
|
-
}, setPortStyle = (e, t, n) => {
|
|
1017
|
+
r.setStyle(setPortStyle$1(e, t, e.id === (selectedPortData == null ? void 0 : selectedPortData.id))), r.set("portData", e), vectorSource$3.addFeature(r);
|
|
1018
|
+
}, setPortStyle$1 = (e, t, n) => {
|
|
1013
1019
|
const o = (l) => `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1014
1020
|
<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="${l}"/>
|
|
1015
1021
|
<g clip-path="url(#clip0_10059_122082)">
|
|
@@ -1040,31 +1046,31 @@ const renderPortList = (e) => {
|
|
|
1040
1046
|
})
|
|
1041
1047
|
});
|
|
1042
1048
|
}, clearPortList = () => {
|
|
1043
|
-
if (selectedPortFeature) {
|
|
1049
|
+
if (selectedPortFeature$1) {
|
|
1044
1050
|
console.log("清除非选中的港口");
|
|
1045
|
-
const e = selectedPortFeature.get("portData").id;
|
|
1046
|
-
vectorSource$
|
|
1047
|
-
t.get("portData").id !== e && vectorSource$
|
|
1051
|
+
const e = selectedPortFeature$1.get("portData").id;
|
|
1052
|
+
vectorSource$3.getFeatures().forEach((t) => {
|
|
1053
|
+
t.get("portData").id !== e && vectorSource$3.removeFeature(t);
|
|
1048
1054
|
});
|
|
1049
1055
|
} else
|
|
1050
|
-
console.log("清除所有港口"), vectorSource$
|
|
1051
|
-
}, clearSelectedPort = () => {
|
|
1052
|
-
const e = selectedPortFeature.get("portData"), t = getZoom();
|
|
1053
|
-
vectorSource$
|
|
1054
|
-
o.get("portData").id === e.id && (o == null || o.setStyle(setPortStyle(e, t, !1)));
|
|
1055
|
-
}), selectedPortData = null, selectedPortFeature = null;
|
|
1056
|
+
console.log("清除所有港口"), vectorSource$3.clear();
|
|
1057
|
+
}, clearSelectedPort$1 = () => {
|
|
1058
|
+
const e = selectedPortFeature$1 == null ? void 0 : selectedPortFeature$1.get("portData"), t = getZoom();
|
|
1059
|
+
e && vectorSource$3.getFeatures().forEach((o) => {
|
|
1060
|
+
o.get("portData").id === e.id && (o == null || o.setStyle(setPortStyle$1(e, t, !1)));
|
|
1061
|
+
}), selectedPortData = null, selectedPortFeature$1 = null;
|
|
1056
1062
|
};
|
|
1057
|
-
let selectedPortFeature = null, selectedPortData = null;
|
|
1063
|
+
let selectedPortFeature$1 = null, selectedPortData = null;
|
|
1058
1064
|
const selectedPort = (e) => {
|
|
1059
|
-
e ? (clearPrevSelectedPort(), addSelectedPortStyle(e)) : clearSelectedPort();
|
|
1060
|
-
}, clearPrevSelectedPort = () => {
|
|
1061
|
-
if (selectedPortFeature) {
|
|
1062
|
-
const e = selectedPortFeature.get("portData"), t = getZoom();
|
|
1063
|
-
selectedPortFeature.setStyle(setPortStyle(e, t, !1));
|
|
1065
|
+
e ? (clearPrevSelectedPort$1(), addSelectedPortStyle$1(e)) : clearSelectedPort$1();
|
|
1066
|
+
}, clearPrevSelectedPort$1 = () => {
|
|
1067
|
+
if (selectedPortFeature$1) {
|
|
1068
|
+
const e = selectedPortFeature$1 == null ? void 0 : selectedPortFeature$1.get("portData"), t = getZoom();
|
|
1069
|
+
selectedPortFeature$1.setStyle(setPortStyle$1(e, t, !1));
|
|
1064
1070
|
}
|
|
1065
|
-
}, addSelectedPortStyle = (e) => {
|
|
1066
|
-
const t = vectorSource$
|
|
1067
|
-
selectedPortData = e, selectedPortFeature = t.find((n) => n.get("portData").id === e.id);
|
|
1071
|
+
}, addSelectedPortStyle$1 = (e) => {
|
|
1072
|
+
const t = vectorSource$3.getFeatures();
|
|
1073
|
+
selectedPortData = e, selectedPortFeature$1 = t.find((n) => n.get("portData").id === e.id);
|
|
1068
1074
|
}, handlePortHover = (e) => {
|
|
1069
1075
|
const t = getInstall(), n = t.forEachFeatureAtPixel(e, (o) => o);
|
|
1070
1076
|
n && n.get("portData") && (t.getTargetElement().style.cursor = "pointer");
|
|
@@ -1089,10 +1095,10 @@ const state = ref(!1), open$1 = () => {
|
|
|
1089
1095
|
helpTooltipElement$1 && helpTooltipElement$1.classList.add("hidden");
|
|
1090
1096
|
}), addInteraction(), state.value = !0;
|
|
1091
1097
|
};
|
|
1092
|
-
let vectorSource$
|
|
1098
|
+
let vectorSource$2, vectorLayer$2;
|
|
1093
1099
|
const initMapLayer = () => {
|
|
1094
|
-
vectorSource$
|
|
1095
|
-
source: vectorSource$
|
|
1100
|
+
vectorSource$2 = new VectorSource(), vectorLayer$2 = new VectorLayer({
|
|
1101
|
+
source: vectorSource$2,
|
|
1096
1102
|
zIndex: 1e3,
|
|
1097
1103
|
style: {
|
|
1098
1104
|
"fill-color": "rgba(255, 255, 255, 0.2)",
|
|
@@ -1101,7 +1107,7 @@ const initMapLayer = () => {
|
|
|
1101
1107
|
"circle-radius": 7,
|
|
1102
1108
|
"circle-fill-color": "#ffcc33"
|
|
1103
1109
|
}
|
|
1104
|
-
}), getInstall().addLayer(vectorLayer$
|
|
1110
|
+
}), getInstall().addLayer(vectorLayer$2);
|
|
1105
1111
|
};
|
|
1106
1112
|
let sketch$1, helpTooltip;
|
|
1107
1113
|
const pointerMoveHandler$1 = (e) => {
|
|
@@ -1115,7 +1121,7 @@ const pointerMoveHandler$1 = (e) => {
|
|
|
1115
1121
|
let draw$1;
|
|
1116
1122
|
const addInteraction = () => {
|
|
1117
1123
|
draw$1 = new Draw({
|
|
1118
|
-
source: vectorSource$
|
|
1124
|
+
source: vectorSource$2,
|
|
1119
1125
|
type: "LineString",
|
|
1120
1126
|
style: new Style({
|
|
1121
1127
|
fill: new Fill({
|
|
@@ -1182,8 +1188,8 @@ const createMeasureTooltip$1 = () => {
|
|
|
1182
1188
|
var r, l;
|
|
1183
1189
|
const n = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1184
1190
|
n[t] && ((l = (r = n[t]) == null ? void 0 : r.parentNode) == null || l.removeChild(n[t]));
|
|
1185
|
-
const o = vectorSource$
|
|
1186
|
-
o[t] && vectorSource$
|
|
1191
|
+
const o = vectorSource$2.getFeatures();
|
|
1192
|
+
o[t] && vectorSource$2.removeFeature(o[t]);
|
|
1187
1193
|
}), removeInteraction(), enableDoubleClickZoom(), state.value = !1;
|
|
1188
1194
|
}, deleteLine = (e) => {
|
|
1189
1195
|
var n, o, r, l;
|
|
@@ -1192,8 +1198,8 @@ const createMeasureTooltip$1 = () => {
|
|
|
1192
1198
|
measureHistory.value.splice(t, 1);
|
|
1193
1199
|
const a = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1194
1200
|
a[t] && ((o = (n = a[t]) == null ? void 0 : n.parentNode) == null || o.removeChild(a[t]));
|
|
1195
|
-
const s = vectorSource$
|
|
1196
|
-
s[t] && vectorSource$
|
|
1201
|
+
const s = vectorSource$2.getFeatures();
|
|
1202
|
+
s[t] && vectorSource$2.removeFeature(s[t]);
|
|
1197
1203
|
}
|
|
1198
1204
|
(r = getProps()) != null && r.lineDrawEnd && ((l = getProps()) == null || l.lineDrawEnd(measureHistory.value));
|
|
1199
1205
|
}, computedDistance = (e, t) => {
|
|
@@ -1215,13 +1221,13 @@ const createMeasureTooltip$1 = () => {
|
|
|
1215
1221
|
measureHistory.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((t) => {
|
|
1216
1222
|
var n;
|
|
1217
1223
|
(n = t == null ? void 0 : t.parentNode) == null || n.removeChild(t);
|
|
1218
|
-
}), vectorSource$
|
|
1224
|
+
}), vectorSource$2.clear();
|
|
1219
1225
|
const e = getInstall();
|
|
1220
1226
|
if (draw$1) {
|
|
1221
1227
|
const t = e.getInteractions().getArray().find((n) => getUid(n) === getUid(draw$1));
|
|
1222
1228
|
t && e.removeInteraction(t);
|
|
1223
1229
|
}
|
|
1224
|
-
e.removeLayer(vectorLayer$
|
|
1230
|
+
e.removeLayer(vectorLayer$2), helpTooltipElement$1 != null && helpTooltipElement$1.parentNode && helpTooltipElement$1.parentNode.removeChild(helpTooltipElement$1), measureTooltipElement$1 != null && measureTooltipElement$1.parentNode && measureTooltipElement$1.parentNode.removeChild(measureTooltipElement$1);
|
|
1225
1231
|
}, getState = () => state.value, drawLine = {
|
|
1226
1232
|
open: open$1,
|
|
1227
1233
|
close: close$1,
|
|
@@ -1327,7 +1333,7 @@ const createMeasureTooltip$1 = () => {
|
|
|
1327
1333
|
}
|
|
1328
1334
|
}
|
|
1329
1335
|
}, 150));
|
|
1330
|
-
}, _hoisted_1$
|
|
1336
|
+
}, _hoisted_1$2 = { id: "scale-line-container" }, _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
1331
1337
|
__name: "scaleLine",
|
|
1332
1338
|
setup(e, { expose: t }) {
|
|
1333
1339
|
return t({
|
|
@@ -1338,36 +1344,32 @@ const createMeasureTooltip$1 = () => {
|
|
|
1338
1344
|
}), l = document.getElementById("scale-line-container");
|
|
1339
1345
|
l && (r.setTarget(l), getInstall().addControl(r));
|
|
1340
1346
|
}
|
|
1341
|
-
}), (o, r) => (openBlock(), createElementBlock("div", _hoisted_1$
|
|
1347
|
+
}), (o, r) => (openBlock(), createElementBlock("div", _hoisted_1$2));
|
|
1342
1348
|
}
|
|
1343
|
-
}), ScaleLine = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-31ff8293"]]), _hoisted_1 = { class: "zoom" }, _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
1349
|
+
}), ScaleLine = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-31ff8293"]]), _hoisted_1$1 = { class: "zoom" }, _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
1344
1350
|
__name: "zoomControl",
|
|
1345
1351
|
setup(e) {
|
|
1346
|
-
const t =
|
|
1347
|
-
if (
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
const r = getZoom();
|
|
1355
|
-
if (!r) return;
|
|
1356
|
-
setZoom(r - 1);
|
|
1357
|
-
}
|
|
1352
|
+
const t = () => {
|
|
1353
|
+
if (!getInstall()) return;
|
|
1354
|
+
const r = getZoom();
|
|
1355
|
+
r && setZoom(r + 1);
|
|
1356
|
+
}, n = () => {
|
|
1357
|
+
if (!getInstall()) return;
|
|
1358
|
+
const r = getZoom();
|
|
1359
|
+
r && setZoom(r - 1);
|
|
1358
1360
|
};
|
|
1359
|
-
return (
|
|
1361
|
+
return (o, r) => (openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
1360
1362
|
createElementVNode("div", {
|
|
1361
1363
|
class: "button big-button",
|
|
1362
|
-
onClick:
|
|
1364
|
+
onClick: t
|
|
1363
1365
|
}, " + "),
|
|
1364
1366
|
createElementVNode("div", {
|
|
1365
1367
|
class: "button small-button",
|
|
1366
|
-
onClick:
|
|
1368
|
+
onClick: n
|
|
1367
1369
|
}, " - ")
|
|
1368
1370
|
]));
|
|
1369
1371
|
}
|
|
1370
|
-
}), ZoomControl = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
1372
|
+
}), ZoomControl = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-2b7e25f2"]]), getLayers = () => {
|
|
1371
1373
|
var e;
|
|
1372
1374
|
return (e = getInstall()) == null ? void 0 : e.getLayers();
|
|
1373
1375
|
}, layerType = ref("vector"), getShowLayerType = () => layerType.value, setShowLayerType = (e) => {
|
|
@@ -1402,9 +1404,9 @@ const open = () => {
|
|
|
1402
1404
|
}, init = () => {
|
|
1403
1405
|
initLayer(), createMeasureTooltip(), createHelpTooltip(), initDraw();
|
|
1404
1406
|
};
|
|
1405
|
-
let vectorLayer = null, vectorSource = null;
|
|
1407
|
+
let vectorLayer$1 = null, vectorSource$1 = null;
|
|
1406
1408
|
const initLayer = () => {
|
|
1407
|
-
if (vectorLayer || vectorSource) return;
|
|
1409
|
+
if (vectorLayer$1 || vectorSource$1) return;
|
|
1408
1410
|
const e = new VectorSource(), t = new VectorLayer({
|
|
1409
1411
|
source: e,
|
|
1410
1412
|
style: new Style({
|
|
@@ -1414,7 +1416,7 @@ const initLayer = () => {
|
|
|
1414
1416
|
})
|
|
1415
1417
|
})
|
|
1416
1418
|
});
|
|
1417
|
-
vectorLayer = t, vectorSource = e;
|
|
1419
|
+
vectorLayer$1 = t, vectorSource$1 = e;
|
|
1418
1420
|
const n = getInstall();
|
|
1419
1421
|
n.on("pointermove", pointerMoveHandler), n.addLayer(t), n.on(["dblclick"], function(o) {
|
|
1420
1422
|
draw && (o.stopPropagation(), o.preventDefault());
|
|
@@ -1437,8 +1439,8 @@ const initDraw = () => {
|
|
|
1437
1439
|
<span class="text">面积:${n}${lineLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1438
1440
|
`), measureTooltipElement && (measureTooltipElement.innerHTML += '<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');
|
|
1439
1441
|
const o = t.getCoordinates(), r = o[0][o[0].length - 2];
|
|
1440
|
-
if (measureTooltip.setPosition(r), vectorLayer) {
|
|
1441
|
-
const a = vectorLayer.getSource();
|
|
1442
|
+
if (measureTooltip.setPosition(r), vectorLayer$1) {
|
|
1443
|
+
const a = vectorLayer$1.getSource();
|
|
1442
1444
|
a && storeFeature && (a.clear(), a.addFeature(storeFeature));
|
|
1443
1445
|
}
|
|
1444
1446
|
setTimeout(() => {
|
|
@@ -1454,7 +1456,7 @@ const initDraw = () => {
|
|
|
1454
1456
|
}
|
|
1455
1457
|
draw = new Draw({
|
|
1456
1458
|
type: "Polygon",
|
|
1457
|
-
source: vectorSource,
|
|
1459
|
+
source: vectorSource$1,
|
|
1458
1460
|
trace: !0,
|
|
1459
1461
|
style: [new Style({
|
|
1460
1462
|
stroke: new Stroke({
|
|
@@ -1482,13 +1484,13 @@ const initDraw = () => {
|
|
|
1482
1484
|
draw.on("drawstart", (t) => {
|
|
1483
1485
|
var n;
|
|
1484
1486
|
sketch = t.feature, e = (n = sketch.getGeometry()) == null ? void 0 : n.on("change", (o) => {
|
|
1485
|
-
const r = o.target, l = computedArea(r, "nm"), s = r.getCoordinates()[0],
|
|
1486
|
-
if (lineLimitError = Number(getLength(
|
|
1487
|
-
const
|
|
1487
|
+
const r = o.target, l = computedArea(r, "nm"), s = r.getCoordinates()[0], i = new LineString([s[s.length - 2], s[s.length - 1]]), d = computedDistance(i, "nm");
|
|
1488
|
+
if (lineLimitError = Number(getLength(i) / 1e3) > 150, !l) return;
|
|
1489
|
+
const u = '<span class="error pl-4">超出可以绘画的距离</span>';
|
|
1488
1490
|
measureTooltipElement && (measureTooltipElement.innerHTML = `
|
|
1489
1491
|
<div class="text">
|
|
1490
1492
|
面积:${l}
|
|
1491
|
-
${lineLimitError ?
|
|
1493
|
+
${lineLimitError ? u : ""}
|
|
1492
1494
|
</div>
|
|
1493
1495
|
`), helpTooltipElement && (helpTooltipElement.innerHTML = `
|
|
1494
1496
|
<div class="text">
|
|
@@ -1496,7 +1498,7 @@ const initDraw = () => {
|
|
|
1496
1498
|
</div>
|
|
1497
1499
|
<div class="text ${lineLimitError ? "error" : ""}">
|
|
1498
1500
|
线段 ${s.length - 2}: ${d}
|
|
1499
|
-
${lineLimitError ?
|
|
1501
|
+
${lineLimitError ? u : ""}
|
|
1500
1502
|
|
|
1501
1503
|
</div>
|
|
1502
1504
|
<div>
|
|
@@ -1511,14 +1513,14 @@ const initDraw = () => {
|
|
|
1511
1513
|
const n = t.feature.getGeometry(), o = n.getCoordinates(), r = o[0][o[0].length - 2];
|
|
1512
1514
|
if (measureTooltip.setPosition(r), helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement), (l = getProps()) != null && l.areaDrawEnd) {
|
|
1513
1515
|
n.getInteriorPoint().getCoordinates();
|
|
1514
|
-
const
|
|
1515
|
-
(a = getProps()) == null || a.areaDrawEnd(
|
|
1516
|
+
const i = o[0].map((d) => transform(d, projection.mercator, projection.data));
|
|
1517
|
+
(a = getProps()) == null || a.areaDrawEnd(i);
|
|
1516
1518
|
}
|
|
1517
1519
|
draw && (draw.setActive(!1), getInstall().removeInteraction(draw), getInstall().getInteractions().forEach((d) => {
|
|
1518
1520
|
d instanceof Draw && (d.setActive(!1), getInstall().removeInteraction(d));
|
|
1519
1521
|
})), e && unByKey(e), (s = document.querySelector(".delete-icon")) == null || s.addEventListener("click", () => {
|
|
1520
|
-
var
|
|
1521
|
-
reset(), (
|
|
1522
|
+
var i;
|
|
1523
|
+
reset(), (i = getProps()) == null || i.areaDrawEnd([]);
|
|
1522
1524
|
});
|
|
1523
1525
|
});
|
|
1524
1526
|
}, computedArea = (e, t) => {
|
|
@@ -1548,10 +1550,10 @@ const createHelpTooltip = () => {
|
|
|
1548
1550
|
positioning: "center-left"
|
|
1549
1551
|
}), getInstall().addOverlay(tipOverlay);
|
|
1550
1552
|
}, reset = () => {
|
|
1551
|
-
vectorSource == null || vectorSource.clear(), storeFeature = null, createMeasureTooltip(), createHelpTooltip(), initDraw();
|
|
1553
|
+
vectorSource$1 == null || vectorSource$1.clear(), storeFeature = null, createMeasureTooltip(), createHelpTooltip(), initDraw();
|
|
1552
1554
|
}, close = () => {
|
|
1553
1555
|
const e = getInstall();
|
|
1554
|
-
vectorSource == null || vectorSource.clear(), vectorSource = null, vectorLayer && (e.removeLayer(vectorLayer), vectorLayer = null), sketch = null, draw && (draw = null, e.getInteractions().forEach((t) => {
|
|
1556
|
+
vectorSource$1 == null || vectorSource$1.clear(), vectorSource$1 = null, vectorLayer$1 && (e.removeLayer(vectorLayer$1), vectorLayer$1 = null), sketch = null, draw && (draw = null, e.getInteractions().forEach((t) => {
|
|
1555
1557
|
t instanceof Draw && e.removeInteraction(t);
|
|
1556
1558
|
})), helpTooltipElement != null && helpTooltipElement.parentElement && helpTooltipElement.parentElement.removeChild(helpTooltipElement), measureTooltipElement != null && measureTooltipElement.parentElement && measureTooltipElement.parentElement.removeChild(measureTooltipElement), tipOverlay && e.removeOverlay(tipOverlay), measureTooltip && e.removeOverlay(measureTooltip);
|
|
1557
1559
|
}, drawPolygon = {
|
|
@@ -1580,7 +1582,7 @@ const locationTruck = async (e) => {
|
|
|
1580
1582
|
const l = (e == null ? void 0 : e.drc) || "";
|
|
1581
1583
|
r.style.transform = `rotate(${l}deg)`, r.style.backgroundSize = "cover", currentTruckOverlay == null || currentTruckOverlay.setPosition(t);
|
|
1582
1584
|
}, renderTruckTrack = (e, t, n, o = 1e3) => {
|
|
1583
|
-
renderTrackLine(e, t, n, LENGTH_UNIT.KM
|
|
1585
|
+
renderTrackLine(e, t, n, LENGTH_UNIT.KM);
|
|
1584
1586
|
}, closeTruckTrack = () => {
|
|
1585
1587
|
closeTrack();
|
|
1586
1588
|
}, removeTruckIcon = () => {
|
|
@@ -1590,7 +1592,75 @@ const locationTruck = async (e) => {
|
|
|
1590
1592
|
setTrackViewCenter(e);
|
|
1591
1593
|
}, playTrack = (e, t) => {
|
|
1592
1594
|
playShipTrack(e, t);
|
|
1593
|
-
},
|
|
1595
|
+
}, LOCATION_LAYER_CLASS_NAME = "zh-map-location-layer";
|
|
1596
|
+
let vectorLayer, vectorSource, selectedPortFeature = null, selectedloactionData = null;
|
|
1597
|
+
const render = (e) => {
|
|
1598
|
+
var t;
|
|
1599
|
+
if (!(!e || e.length === 0)) {
|
|
1600
|
+
if (vectorSource || (vectorSource = new VectorSource()), vectorSource.clear(), selectedloactionData) {
|
|
1601
|
+
const n = e.find((o) => o.id === selectedloactionData.id);
|
|
1602
|
+
n ? selectedloactionData = n : e.push(selectedloactionData);
|
|
1603
|
+
}
|
|
1604
|
+
e.forEach((n) => {
|
|
1605
|
+
renderPortPoint(n);
|
|
1606
|
+
}), vectorLayer || (vectorLayer = new VectorLayer({
|
|
1607
|
+
className: LOCATION_LAYER_CLASS_NAME,
|
|
1608
|
+
source: vectorSource,
|
|
1609
|
+
zIndex: 100
|
|
1610
|
+
}), (t = getInstall()) == null || t.addLayer(vectorLayer));
|
|
1611
|
+
}
|
|
1612
|
+
}, renderPortPoint = (e) => {
|
|
1613
|
+
const t = getZoom(), [n, o] = e.latLon.split(","), r = new Feature({
|
|
1614
|
+
geometry: new Point(fromLonLat([Number(n), Number(o)]))
|
|
1615
|
+
});
|
|
1616
|
+
r.setStyle(setPortStyle(e, t, e.id === (selectedloactionData == null ? void 0 : selectedloactionData.id))), r.set("loactionData", e), vectorSource.addFeature(r);
|
|
1617
|
+
}, setPortStyle = (e, t, n) => {
|
|
1618
|
+
const o = {
|
|
1619
|
+
image: new Icon({
|
|
1620
|
+
src: n && e.selectedPath || e.defaultPath,
|
|
1621
|
+
scale: 0.5 * t / 10
|
|
1622
|
+
})
|
|
1623
|
+
};
|
|
1624
|
+
return e.name && (o.text = new Text({
|
|
1625
|
+
text: e.name,
|
|
1626
|
+
font: "12px sans-serif",
|
|
1627
|
+
fill: new Fill({
|
|
1628
|
+
color: "#000000"
|
|
1629
|
+
}),
|
|
1630
|
+
backgroundFill: new Fill({
|
|
1631
|
+
color: "#FFFFFF"
|
|
1632
|
+
}),
|
|
1633
|
+
offsetY: 30
|
|
1634
|
+
})), new Style(o);
|
|
1635
|
+
}, clearList = () => {
|
|
1636
|
+
if (selectedPortFeature) {
|
|
1637
|
+
const e = selectedPortFeature.get("loactionData").id;
|
|
1638
|
+
vectorSource.getFeatures().forEach((t) => {
|
|
1639
|
+
t.get("loactionData").id !== e && vectorSource.removeFeature(t);
|
|
1640
|
+
});
|
|
1641
|
+
} else
|
|
1642
|
+
vectorSource.clear();
|
|
1643
|
+
}, clearSelected = () => {
|
|
1644
|
+
const e = selectedPortFeature.get("loactionData"), t = getZoom();
|
|
1645
|
+
vectorSource.getFeatures().forEach((o) => {
|
|
1646
|
+
o.get("loactionData").id === e.id && (o == null || o.setStyle(setPortStyle(e, t, !1)));
|
|
1647
|
+
}), selectedloactionData = null, selectedPortFeature = null;
|
|
1648
|
+
}, selectedLocation = (e) => {
|
|
1649
|
+
e ? (clearPrevSelectedPort(), addSelectedPortStyle(e)) : clearSelectedPort();
|
|
1650
|
+
}, clearPrevSelectedPort = () => {
|
|
1651
|
+
if (selectedPortFeature) {
|
|
1652
|
+
const e = selectedPortFeature.get("loactionData"), t = getZoom();
|
|
1653
|
+
selectedPortFeature.setStyle(setPortStyle(e, t, !1));
|
|
1654
|
+
}
|
|
1655
|
+
}, addSelectedPortStyle = (e) => {
|
|
1656
|
+
const t = vectorSource.getFeatures();
|
|
1657
|
+
selectedloactionData = e, selectedPortFeature = t.find((n) => n.get("loactionData").id === e.id);
|
|
1658
|
+
}, position = {
|
|
1659
|
+
render,
|
|
1660
|
+
selected: selectedLocation,
|
|
1661
|
+
clearSelected,
|
|
1662
|
+
clear: clearList
|
|
1663
|
+
}, _hoisted_1 = { class: "zh-map-box" }, _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1594
1664
|
__name: "Map",
|
|
1595
1665
|
props: {
|
|
1596
1666
|
zoom: { default: MAP_ZOOM.default },
|
|
@@ -1611,15 +1681,10 @@ const locationTruck = async (e) => {
|
|
|
1611
1681
|
},
|
|
1612
1682
|
setup(e, { expose: t }) {
|
|
1613
1683
|
const n = ref(), o = ref(), r = e;
|
|
1614
|
-
|
|
1684
|
+
return onMounted(() => {
|
|
1615
1685
|
var a;
|
|
1616
1686
|
initMap(r), setProps(r), setShowLayerType(r.layerType), setGreenTileVisible(r.showGreenLayer), (a = o.value) == null || a.setScaleLine(r.scaleLineUnit);
|
|
1617
|
-
})
|
|
1618
|
-
const l = () => {
|
|
1619
|
-
const a = getView().calculateExtent(getSize()), s = transform([a[0], a[1]], projection.mercator, projection.data), c = transform([a[2], a[3]], projection.mercator, projection.data);
|
|
1620
|
-
return [s[0], s[1], c[0], c[1]];
|
|
1621
|
-
};
|
|
1622
|
-
return t({
|
|
1687
|
+
}), t({
|
|
1623
1688
|
getInstall,
|
|
1624
1689
|
getZoom,
|
|
1625
1690
|
setZoom,
|
|
@@ -1652,9 +1717,7 @@ const locationTruck = async (e) => {
|
|
|
1652
1717
|
clear: clearPortList,
|
|
1653
1718
|
selected: selectedPort
|
|
1654
1719
|
},
|
|
1655
|
-
|
|
1656
|
-
...location
|
|
1657
|
-
},
|
|
1720
|
+
position,
|
|
1658
1721
|
drawLine,
|
|
1659
1722
|
// 绘制矩形
|
|
1660
1723
|
drawPolygon,
|
|
@@ -1667,11 +1730,14 @@ const locationTruck = async (e) => {
|
|
|
1667
1730
|
playTrack
|
|
1668
1731
|
},
|
|
1669
1732
|
utils: {
|
|
1670
|
-
getCalculateExtent:
|
|
1733
|
+
getCalculateExtent: () => {
|
|
1734
|
+
const a = getView().calculateExtent(getSize()), s = transform([a[0], a[1]], projection.mercator, projection.data), i = transform([a[2], a[3]], projection.mercator, projection.data);
|
|
1735
|
+
return [s[0], s[1], i[0], i[1]];
|
|
1736
|
+
},
|
|
1671
1737
|
convertSixHundredThousandToLatLng,
|
|
1672
1738
|
calculateCirclePoints
|
|
1673
1739
|
}
|
|
1674
|
-
}), (a, s) => (openBlock(), createElementBlock(
|
|
1740
|
+
}), (a, s) => (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
1675
1741
|
createElementVNode("div", {
|
|
1676
1742
|
id: "map",
|
|
1677
1743
|
ref_key: "zhMapRef",
|
|
@@ -1683,9 +1749,9 @@ const locationTruck = async (e) => {
|
|
|
1683
1749
|
ref: o
|
|
1684
1750
|
}, null, 512),
|
|
1685
1751
|
createVNode(ZoomControl, { ref: "zoomControlRef" }, null, 512)
|
|
1686
|
-
]
|
|
1752
|
+
]));
|
|
1687
1753
|
}
|
|
1688
|
-
}), Map$1 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
1754
|
+
}), Map$1 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-d813907c"]]), ZhMap = withInstall(Map$1);
|
|
1689
1755
|
export {
|
|
1690
1756
|
ZhMap as Z
|
|
1691
1757
|
};
|