zhihao-ui 1.3.3 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/{BaseInfo-BqJWKOdd.js → BaseInfo-C-n-23wy.js} +1 -1
- package/dist/es/{BaseItem-BQbkTxt9.js → BaseItem-BmbN3hxP.js} +3 -3
- package/dist/es/{Button-1UUC8v6b.js → Button-DnAj6C7o.js} +2 -2
- package/dist/es/{DatePicker-ByP3ZkhE.js → DatePicker-CLuXvVZx.js} +3 -3
- package/dist/es/{DetailHeader-CnZCthjX.js → DetailHeader-CJ49WOPF.js} +3 -3
- package/dist/es/{DetailSubTitle-COQCdb8X.js → DetailSubTitle-BTe5k4Tv.js} +2 -2
- package/dist/es/{Dialog-DFQIVnQP.js → Dialog-Bv42gNoY.js} +3 -3
- package/dist/es/{DiyDataTable-D0gTwPB4.js → DiyDataTable-DDIkdXF3.js} +4 -4
- package/dist/es/{EditInfoPair-CZpQKhX6.js → EditInfoPair-B_1jHWIS.js} +3 -3
- package/dist/es/{FileWrapper-C9Cqt-L8.js → FileWrapper-Cyfnbvfq.js} +4 -4
- package/dist/es/{Grid-CfwiS54k.js → Grid-BziKC4j6.js} +2 -2
- package/dist/es/{InfoPair-ZKRxEmIC.js → InfoPair-ggIW5r8A.js} +3 -3
- package/dist/es/{Input-CloA0e6h.js → Input-BEYAS5WB.js} +3 -3
- package/dist/es/{Loading-BXtzvylk.js → Loading-Dw6qV2j-.js} +2 -2
- package/dist/es/{Map-Ce0s7g5Z.js → Map-CVB8icRh.js} +195 -292
- package/dist/es/{MessageBox-BNOuww77.js → MessageBox-BqcS3SpW.js} +2 -2
- package/dist/es/{MoneyInput-CuHL7bEc.js → MoneyInput-BEZxWEKT.js} +9 -9
- package/dist/es/{PageHeadPanel-BroYHTD8.js → PageHeadPanel-DVd4kJnd.js} +2 -2
- package/dist/es/{Table-DFGzUqS3.js → Table-CyPkm0mk.js} +5 -5
- package/dist/es/{ToolTips-BBi5iPOb.js → ToolTips-ev7cPDVQ.js} +5 -5
- package/dist/es/index.js +22 -22
- package/dist/es/{utils-BbOeFn3W.js → utils-B9UlcPnQ.js} +3 -3
- package/dist/es/{vendor-D-B7bNnH.js → vendor-C-yFzCvN.js} +30 -29
- package/dist/index.css +1 -1
- package/dist/types/components/Map/Map.vue.d.ts +133 -0
- package/dist/types/components/Map/function/shipTrack.d.ts +5 -8
- package/dist/types/components/Map/index.d.ts +427 -0
- package/dist/types/components/Map/utils/track.d.ts +42 -0
- package/dist/umd/index.css +1 -1
- package/dist/umd/index.umd.cjs +13 -13
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ref, computed, watch, onMounted, onBeforeUnmount, h, nextTick, createVNode, render, defineComponent, openBlock, createElementBlock, inject, createElementVNode, Fragment } from "vue";
|
|
2
|
-
import { T as Text, F as Fill, S as Style, p as fromLonLat, t as transformExtent, q as getLength, R as RBush$1, O as Overlay, I as Icon, V as VectorSource, r as VectorLayer, s as debounce, i as cloneDeep, u as Feature, P as Point, h as hooks, L as LineString, v as Stroke, C as CircleStyle, w as Polyline, x as buffer, y as transform, z as getVectorContext, 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 MultiPoint } from "./vendor-
|
|
3
|
-
import { _ as _export_sfc } from "./Button-
|
|
4
|
-
import { w as withInstall } from "./utils-
|
|
2
|
+
import { T as Text, F as Fill, S as Style, p as fromLonLat, t as transformExtent, q as getLength, R as RBush$1, O as Overlay, I as Icon, V as VectorSource, r as VectorLayer, s as debounce, i as cloneDeep, u as Feature, P as Point, h as hooks, L as LineString, v as Stroke, C as CircleStyle, w as Polyline, x as buffer, y as transform, z as getVectorContext, 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-C-yFzCvN.js";
|
|
3
|
+
import { _ as _export_sfc } from "./Button-DnAj6C7o.js";
|
|
4
|
+
import { w as withInstall } from "./utils-B9UlcPnQ.js";
|
|
5
5
|
const TIAN_DI_TU_KEY = "a6e8f78974f2581f2ca00485b40c948f", MAP_ZOOM = {
|
|
6
6
|
// 地图默认层级
|
|
7
7
|
default: 13,
|
|
@@ -21,8 +21,11 @@ const TIAN_DI_TU_KEY = "a6e8f78974f2581f2ca00485b40c948f", MAP_ZOOM = {
|
|
|
21
21
|
// 墨卡托投影坐标 渲染坐标
|
|
22
22
|
mercator: "EPSG:3857"
|
|
23
23
|
}, MAP_DEFAULT_CENTER = [114.84, 30.52], CDN_URL = "https://static.zhihaoscm.cn/", equatorialCircumference = 2003750834e-2;
|
|
24
|
-
var BASE_MAP_LINK = ((e) => (e.vectorTile = `https://t0.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${TIAN_DI_TU_KEY}`, e.vectorTileMark = `https://t0.tianditu.gov.cn/cva_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${TIAN_DI_TU_KEY}`, e.satelliteImgTile = `https://t0.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${TIAN_DI_TU_KEY}`, e.satelliteImgTileMark = `https://t0.tianditu.gov.cn/cia_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cia&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${TIAN_DI_TU_KEY}`, e.greenTile = `${CDN_URL}/map/tile/{z}/{x}/{y}.png`, e))(BASE_MAP_LINK || {}), LENGTH_UNIT = /* @__PURE__ */ ((e) => (e[e.M = 1] = "M", e[e.KM = 2] = "KM", e[e.NM = 3] = "NM", e))(LENGTH_UNIT || {});
|
|
25
|
-
const
|
|
24
|
+
var BASE_MAP_LINK = ((e) => (e.vectorTile = `https://t0.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${TIAN_DI_TU_KEY}`, e.vectorTileMark = `https://t0.tianditu.gov.cn/cva_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${TIAN_DI_TU_KEY}`, e.satelliteImgTile = `https://t0.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${TIAN_DI_TU_KEY}`, e.satelliteImgTileMark = `https://t0.tianditu.gov.cn/cia_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cia&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${TIAN_DI_TU_KEY}`, e.greenTile = `${CDN_URL}/map/tile/{z}/{x}/{y}.png`, e))(BASE_MAP_LINK || {}), LENGTH_UNIT = /* @__PURE__ */ ((e) => (e[e.M = 1] = "M", e[e.KM = 2] = "KM", e[e.NM = 3] = "NM", e))(LENGTH_UNIT || {}), SHIP_SAIL_STATUS = /* @__PURE__ */ ((e) => (e[e.发动机使用中 = 0] = "发动机使用中", e[e.锚泊 = 1] = "锚泊", e[e.未操作 = 2] = "未操作", e[e.操纵能力受限 = 3] = "操纵能力受限", e[e.吃水受限 = 4] = "吃水受限", e[e.系泊 = 5] = "系泊", e[e.搁浅 = 6] = "搁浅", e[e.从事捕捞 = 7] = "从事捕捞", e[e.航行中 = 8] = "航行中", e[e.留作将来修正导航状态 = 9] = "留作将来修正导航状态", e[e.高速船留用 = 10] = "高速船留用", e[e.机动船尾推作业 = 11] = "机动船尾推作业", e[e.机动船顶推或侧推作业 = 12] = "机动船顶推或侧推作业", e[e.飞翼船留用 = 13] = "飞翼船留用", e[e.现行的 = 14] = "现行的", e[e.未定义 = 15] = "未定义", e))(SHIP_SAIL_STATUS || {}), SHIP_DIRECT = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.front = "front", e.up = "up", e.down = "down", e.back = "back", e))(SHIP_DIRECT || {});
|
|
25
|
+
const convertSixHundredThousandToLatLng = function(e, t) {
|
|
26
|
+
const n = Number(t) / 6e5;
|
|
27
|
+
return [Number(e) / 6e5, n];
|
|
28
|
+
}, calculateCirclePoints = (e, t) => {
|
|
26
29
|
const n = fromLonLat(e), o = t * 1e3, r = [
|
|
27
30
|
n[0] - o,
|
|
28
31
|
n[1] - o,
|
|
@@ -74,12 +77,7 @@ const getIconStyle = (e) => {
|
|
|
74
77
|
const n = { lon: 0, lat: 0 }, o = e[0] / equatorialCircumference * 180;
|
|
75
78
|
let r = e[1] / equatorialCircumference * 180;
|
|
76
79
|
return r = 180 / Math.PI * (2 * Math.atan(Math.exp(r * Math.PI / 180)) - Math.PI / 2), n.lon = o, n.lat = r, t === "lonlat" ? n : [o, r];
|
|
77
|
-
}, adjustBounds = (e, t) => t.length === 2 ? [e[0] - t[0], e[1] - t[1], e[2] + t[0], e[3] + t[1]] : [e[0] + t[0], e[1] + t[1], e[2] + t[2], e[3] + t[3]], isOverlapping$1 = (e, t) => e[0] <= t[2] && e[2] >= t[0] && e[1] <= t[3] && e[3] >= t[1]
|
|
78
|
-
var SHIP_SAIL_STATUS = /* @__PURE__ */ ((e) => (e[e.发动机使用中 = 0] = "发动机使用中", e[e.锚泊 = 1] = "锚泊", e[e.未操作 = 2] = "未操作", e[e.操纵能力受限 = 3] = "操纵能力受限", e[e.吃水受限 = 4] = "吃水受限", e[e.系泊 = 5] = "系泊", e[e.搁浅 = 6] = "搁浅", e[e.从事捕捞 = 7] = "从事捕捞", e[e.航行中 = 8] = "航行中", e[e.留作将来修正导航状态 = 9] = "留作将来修正导航状态", e[e.高速船留用 = 10] = "高速船留用", e[e.机动船尾推作业 = 11] = "机动船尾推作业", e[e.机动船顶推或侧推作业 = 12] = "机动船顶推或侧推作业", e[e.飞翼船留用 = 13] = "飞翼船留用", e[e.现行的 = 14] = "现行的", e[e.未定义 = 15] = "未定义", e))(SHIP_SAIL_STATUS || {}), SHIP_DIRECT = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.front = "front", e.up = "up", e.down = "down", e.back = "back", e))(SHIP_DIRECT || {});
|
|
79
|
-
const convertSixHundredThousandToLatLng = function(e, t) {
|
|
80
|
-
const n = Number(t) / 6e5;
|
|
81
|
-
return [Number(e) / 6e5, n];
|
|
82
|
-
}, getRightIcons = (e) => {
|
|
80
|
+
}, adjustBounds = (e, t) => t.length === 2 ? [e[0] - t[0], e[1] - t[1], e[2] + t[0], e[3] + t[1]] : [e[0] + t[0], e[1] + t[1], e[2] + t[2], e[3] + t[3]], isOverlapping$1 = (e, t) => e[0] <= t[2] && e[2] >= t[0] && e[1] <= t[3] && e[3] >= t[1], getRightIcons = (e) => {
|
|
83
81
|
const t = [];
|
|
84
82
|
return e.existDevice && t.push(""), e.existMobile && t.push(""), e.existWaterGauge && t.push(""), t;
|
|
85
83
|
};
|
|
@@ -110,7 +108,7 @@ function useShipOverlay(e) {
|
|
|
110
108
|
height: "14px",
|
|
111
109
|
margin: "1px 5px 1px 1px",
|
|
112
110
|
"background-color": "var(--bg-color)"
|
|
113
|
-
})),
|
|
111
|
+
})), a = computed(() => ({
|
|
114
112
|
position: "absolute",
|
|
115
113
|
top: "0px",
|
|
116
114
|
color: "var(--overlay-color)",
|
|
@@ -121,9 +119,9 @@ function useShipOverlay(e) {
|
|
|
121
119
|
height: "20px",
|
|
122
120
|
overflow: "visible"
|
|
123
121
|
}));
|
|
124
|
-
let
|
|
122
|
+
let s = null;
|
|
125
123
|
const c = () => {
|
|
126
|
-
d(),
|
|
124
|
+
d(), s = window.setInterval(() => {
|
|
127
125
|
if (t.value) {
|
|
128
126
|
const i = t.value.querySelector(".ship-overlay-content");
|
|
129
127
|
i && i.style && (i.style.backgroundColor = e.color, i.style.color = "#FFF", setTimeout(() => {
|
|
@@ -132,7 +130,7 @@ function useShipOverlay(e) {
|
|
|
132
130
|
}
|
|
133
131
|
}, 1e3);
|
|
134
132
|
}, d = () => {
|
|
135
|
-
|
|
133
|
+
s && (clearInterval(s), s = null);
|
|
136
134
|
}, u = () => {
|
|
137
135
|
n.value && n.value.setPosition(fromLonLat(e.position));
|
|
138
136
|
};
|
|
@@ -190,7 +188,7 @@ function useShipOverlay(e) {
|
|
|
190
188
|
),
|
|
191
189
|
h("svg", {
|
|
192
190
|
class: "ship-overlay-line",
|
|
193
|
-
style:
|
|
191
|
+
style: a.value,
|
|
194
192
|
viewBox: "0 0 20 20",
|
|
195
193
|
xmlns: "http://www.w3.org/2000/svg"
|
|
196
194
|
}, [
|
|
@@ -252,7 +250,7 @@ function calculateBestPosition(e, t) {
|
|
|
252
250
|
r.offsetHeight;
|
|
253
251
|
const l = r.getBoundingClientRect();
|
|
254
252
|
if (!n.some(
|
|
255
|
-
(
|
|
253
|
+
(s) => isOverlapping(l, s)
|
|
256
254
|
))
|
|
257
255
|
break;
|
|
258
256
|
}
|
|
@@ -273,10 +271,10 @@ function addOverlay(e, t, n, o) {
|
|
|
273
271
|
function setLinePath(e) {
|
|
274
272
|
const t = e.getElement(), n = t == null ? void 0 : t.querySelector(".ship-overlay-line"), o = e.getPositioning(), r = e.getOffset();
|
|
275
273
|
n && o === "top-right" && (n.style.right = "-20px"), n && o === "top-left" && (n.style.left = "-20px");
|
|
276
|
-
const l = POSITION_PRIORITY.filter((
|
|
274
|
+
const l = POSITION_PRIORITY.filter((s) => s.positioning === o && s.offset === r), a = t == null ? void 0 : t.querySelector(".ship-overlay-line line");
|
|
277
275
|
if (l.length > 0) {
|
|
278
|
-
const { x1:
|
|
279
|
-
|
|
276
|
+
const { x1: s, y1: c, x2: d, y2: u } = l[0].line;
|
|
277
|
+
a && (a.setAttribute("x1", s), a.setAttribute("y1", c), a.setAttribute("x2", d), a.setAttribute("y2", u));
|
|
280
278
|
}
|
|
281
279
|
}
|
|
282
280
|
function removeLabelOverlay(e) {
|
|
@@ -295,18 +293,18 @@ const getShipDirectPath = (e) => {
|
|
|
295
293
|
return e <= MAP_ZOOM.shipModelMax && e >= MAP_ZOOM.shipTriggleMin ? "ship" : "triangle";
|
|
296
294
|
}, getShipScale = (e, t) => {
|
|
297
295
|
if (t === "ship") {
|
|
298
|
-
const { len: n, wid: o } = e, r = 97, l = 20,
|
|
296
|
+
const { len: n, wid: o } = e, r = 97, l = 20, s = 1 / getView().getResolution(), c = n * s / r, d = o * s / l;
|
|
299
297
|
return Math.max(c, d);
|
|
300
298
|
}
|
|
301
299
|
return MAP_ZOOM.scaleNum;
|
|
302
300
|
}, initShipStyle = (e, t, n) => {
|
|
303
|
-
const { color: o, direct: r, isHighlight: l, shipData:
|
|
301
|
+
const { color: o, direct: r, isHighlight: l, shipData: a } = e.getProperties(), s = (a.cog - 90 + 360) % 360;
|
|
304
302
|
return new Style({
|
|
305
303
|
image: new Icon({
|
|
306
304
|
src: c(),
|
|
307
305
|
scale: t || MAP_ZOOM.scaleNum,
|
|
308
306
|
anchor: [0.5, 0.5],
|
|
309
|
-
rotation:
|
|
307
|
+
rotation: s * Math.PI / 180,
|
|
310
308
|
rotateWithView: !1
|
|
311
309
|
})
|
|
312
310
|
});
|
|
@@ -359,17 +357,17 @@ const getShipDirectPath = (e) => {
|
|
|
359
357
|
`, l = document.createElement("div");
|
|
360
358
|
return l.className = "ship-overlay-selected", l.innerHTML = r, l;
|
|
361
359
|
}, createLabelStyle = (e) => {
|
|
362
|
-
const t = getInstall(), { shipData: n, blinking: o } = e.getProperties(), { lon: r, lat: l } = n,
|
|
363
|
-
addOverlay(t, fromLonLat([r, l]),
|
|
360
|
+
const t = getInstall(), { shipData: n, blinking: o } = e.getProperties(), { lon: r, lat: l } = n, a = createLabelElement(e);
|
|
361
|
+
addOverlay(t, fromLonLat([r, l]), a, { ...n, blinking: o });
|
|
364
362
|
}, createLabelElement = (e) => {
|
|
365
363
|
const t = document.createElement("div");
|
|
366
364
|
t.className = "ship-overlay-box", t.style.position = "relative";
|
|
367
|
-
const n = e.getProperties(), { shipData: o, blinking: r, blinkingColor: l, name:
|
|
365
|
+
const n = e.getProperties(), { shipData: o, blinking: r, blinkingColor: l, name: a } = n, { lon: s, lat: c } = o, d = createVNode({
|
|
368
366
|
setup() {
|
|
369
367
|
return useShipOverlay({
|
|
370
|
-
position: [
|
|
368
|
+
position: [s + 2e-3, c + 2e-3],
|
|
371
369
|
selected: r,
|
|
372
|
-
name:
|
|
370
|
+
name: a,
|
|
373
371
|
color: l,
|
|
374
372
|
existDevice: o == null ? void 0 : o.existDevice,
|
|
375
373
|
existMobile: o == null ? void 0 : o.existMobile,
|
|
@@ -393,17 +391,19 @@ const renderShipList = (e) => {
|
|
|
393
391
|
console.log("renderShipList", e);
|
|
394
392
|
const t = getInstall();
|
|
395
393
|
if (!t) return;
|
|
396
|
-
t.getLayers().getArray().includes(shipsLayer) || t.addLayer(shipsLayer);
|
|
394
|
+
removeSelectedOverlay(), t.getLayers().getArray().includes(shipsLayer) || t.addLayer(shipsLayer);
|
|
397
395
|
const n = (selectedShip == null ? void 0 : selectedShip.id) || (selectedShipFeature == null ? void 0 : selectedShipFeature.get("id"));
|
|
398
|
-
removeLabelOverlay(t),
|
|
396
|
+
removeLabelOverlay(t), shipsSource && shipsSource.clear();
|
|
399
397
|
const o = [];
|
|
400
398
|
if (selectedShip) {
|
|
401
399
|
const r = e.filter((l) => l.id === n);
|
|
402
400
|
r.length === 0 ? e.push(selectedShip) : selectedShip = r[0];
|
|
403
401
|
}
|
|
404
402
|
e.forEach((r) => {
|
|
405
|
-
|
|
406
|
-
|
|
403
|
+
if (r.lon && r.lat) {
|
|
404
|
+
const l = createShipFetature(r);
|
|
405
|
+
o.push(l), createLabelStyle(l);
|
|
406
|
+
}
|
|
407
407
|
}), shipsSource.addFeatures(o), handleChangeSelected();
|
|
408
408
|
}, createShipFetature = (e) => {
|
|
409
409
|
const t = (selectedShip == null ? void 0 : selectedShip.id) || (selectedShipFeature == null ? void 0 : selectedShipFeature.get("id")), n = fromLonLat([e.lon, e.lat]), o = new Feature({
|
|
@@ -428,19 +428,17 @@ const renderShipList = (e) => {
|
|
|
428
428
|
});
|
|
429
429
|
return o.setStyle(createShipStyle(o)), o;
|
|
430
430
|
}, handleChangeSelected = () => {
|
|
431
|
-
var
|
|
431
|
+
var r;
|
|
432
432
|
if (!selectedShip) return;
|
|
433
433
|
const e = getInstall();
|
|
434
434
|
if (!e) return;
|
|
435
|
-
|
|
436
|
-
if (
|
|
437
|
-
const
|
|
438
|
-
|
|
439
|
-
} else
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
}
|
|
443
|
-
(o = n.get("element")) != null && o.parentElement && (n.get("element").parentElement.style.display = "block");
|
|
435
|
+
let o = cloneDeep(e.getOverlays().getArray()).find((l) => l.get("class") == "ship-overlay-selected");
|
|
436
|
+
if (o) {
|
|
437
|
+
const l = selectedShipElement(selectedShip);
|
|
438
|
+
o.setElement(l), o.setPosition(fromLonLat([selectedShip.lon, selectedShip.lat]));
|
|
439
|
+
} else
|
|
440
|
+
o = selectedShipStyle(selectedShip), e.addOverlay(o);
|
|
441
|
+
o && ((r = o.get("element")) != null && r.parentElement) && (o.get("element").parentElement.style.display = "block");
|
|
444
442
|
}, clearShipList = () => {
|
|
445
443
|
const e = getInstall();
|
|
446
444
|
if (!e || !shipsSource) return;
|
|
@@ -457,43 +455,42 @@ const renderShipList = (e) => {
|
|
|
457
455
|
attentionShips = e, attentionShipsColor = t;
|
|
458
456
|
const o = cloneDeep(n.getOverlays().getArray()), r = cloneDeep(shipsSource.getFeatures());
|
|
459
457
|
for (const l in attentionShips) {
|
|
460
|
-
const
|
|
461
|
-
if (
|
|
462
|
-
c.set("blinking",
|
|
463
|
-
const d =
|
|
464
|
-
d && d !== u && (p && i && i.replaceWith(p),
|
|
458
|
+
const a = attentionShips[l], s = o.find((d) => d.getId() === "label-" + l), c = r.find((d) => l === d.get("id"));
|
|
459
|
+
if (s && c) {
|
|
460
|
+
c.set("blinking", a), c.set("blinkingColor", attentionShipsColor[l] || "");
|
|
461
|
+
const d = s.getElement(), u = createLabelElement(c), i = u.querySelector(".ship-overlay-line"), p = d == null ? void 0 : d.querySelector(".ship-overlay-line");
|
|
462
|
+
d && d !== u && (p && i && i.replaceWith(p), s.setElement(u));
|
|
465
463
|
}
|
|
466
464
|
}
|
|
467
465
|
}, filterShipShow = (e) => {
|
|
468
466
|
const t = getInstall();
|
|
469
467
|
if (!t) return;
|
|
470
|
-
const n = shipsSource.getFeatures(), o = selectedShipFeature ? selectedShipFeature.get("id") : "", r = n.filter((
|
|
471
|
-
e.forEach((
|
|
472
|
-
l.set(
|
|
468
|
+
const n = shipsSource.getFeatures(), o = selectedShipFeature ? selectedShipFeature.get("id") : "", r = n.filter((s) => s.get("id") !== o), l = /* @__PURE__ */ new Map();
|
|
469
|
+
e.forEach((s) => {
|
|
470
|
+
l.set(s.id, !0);
|
|
473
471
|
});
|
|
474
|
-
const
|
|
475
|
-
r.forEach((
|
|
476
|
-
const c =
|
|
472
|
+
const a = cloneDeep(t.getOverlays().getArray());
|
|
473
|
+
r.forEach((s) => {
|
|
474
|
+
const c = s.get("id"), d = a.find((u) => u.getId() === "label-" + c);
|
|
477
475
|
if (!l.has(c))
|
|
478
|
-
|
|
476
|
+
s.setStyle([]), d && (d.get("element").style.visibility = "hidden");
|
|
479
477
|
else {
|
|
480
478
|
d && (d.get("element").style.visibility = "visible");
|
|
481
|
-
const u =
|
|
482
|
-
(u == null ? void 0 : u.length) == 0 &&
|
|
479
|
+
const u = s.getStyle();
|
|
480
|
+
(u == null ? void 0 : u.length) == 0 && s.setStyle(createShipStyle(s));
|
|
483
481
|
}
|
|
484
482
|
});
|
|
485
483
|
}, renderShipSelected = (e) => {
|
|
486
484
|
if (e) {
|
|
487
485
|
console.log("选中", e);
|
|
488
486
|
const t = shipsSource.getFeatures().find((n) => n.get("id") === e.id);
|
|
489
|
-
t && (selectedShipFeature = t), selectedShip = e;
|
|
487
|
+
t && (selectedShipFeature = t), selectedShip = e, handleChangeSelected();
|
|
490
488
|
} else
|
|
491
|
-
console.log("取消选中"), selectedShip = null, removeSelectedOverlay();
|
|
489
|
+
console.log("取消选中"), selectedShip = null, selectedShipFeature = null, removeSelectedOverlay();
|
|
492
490
|
}, renderShipSelectedChange = () => {
|
|
493
|
-
console.log("selectedShip------------------", selectedShip);
|
|
494
491
|
const e = shipsSource.getFeatures().find((t) => t.get("id") === (selectedShip == null ? void 0 : selectedShip.id));
|
|
495
|
-
if (
|
|
496
|
-
|
|
492
|
+
if (e)
|
|
493
|
+
e == null || e.setStyle(createShipStyle(e));
|
|
497
494
|
else {
|
|
498
495
|
const t = createShipFetature(selectedShip);
|
|
499
496
|
shipsSource.addFeature(t), createLabelStyle(t);
|
|
@@ -505,8 +502,8 @@ const renderShipList = (e) => {
|
|
|
505
502
|
const r = e.get("shipData"), l = e.get("id");
|
|
506
503
|
if (o.getTargetElement().style.cursor = l ? "pointer" : "", t === "click" && (renderShipSelected(r), n && n(l)), t === "hover") {
|
|
507
504
|
hoveredShipId && hoveredShipId !== l && clearHoverHight(), hoveredShipId = l;
|
|
508
|
-
const
|
|
509
|
-
|
|
505
|
+
const a = shipsSource.getFeatures().find((s) => s.get("id") === hoveredShipId);
|
|
506
|
+
a == null || a.set("isHighlight", !0), a == null || a.setStyle(createShipStyle(a));
|
|
510
507
|
}
|
|
511
508
|
} else
|
|
512
509
|
o.getTargetElement().style.cursor = "", clearHoverHight();
|
|
@@ -516,7 +513,7 @@ const renderShipList = (e) => {
|
|
|
516
513
|
}, removeSelectedOverlay = () => {
|
|
517
514
|
try {
|
|
518
515
|
const e = getInstall(), n = cloneDeep(e.getOverlays().getArray()).find((o) => o.get("class") == "ship-overlay-selected");
|
|
519
|
-
n && n.
|
|
516
|
+
n && n.setPosition(void 0);
|
|
520
517
|
} catch (e) {
|
|
521
518
|
console.log(e);
|
|
522
519
|
}
|
|
@@ -534,41 +531,30 @@ const routesSource = new VectorSource(), routeLayer = new VectorLayer({
|
|
|
534
531
|
className: "zh-map--track-layer",
|
|
535
532
|
zIndex: 102
|
|
536
533
|
});
|
|
537
|
-
let routeFeatures = [],
|
|
534
|
+
let routeFeatures = [], allTracks = {}, trackId = "", trackColor = "", trackList = [], mapInstance$1 = null, isClosing = !1;
|
|
538
535
|
const reRenderTrackLine = () => {
|
|
539
536
|
mapInstance$1 = getInstall(), isClosing || handlerRenderLine();
|
|
540
|
-
}, renderTrackLine = async (e, t, n, o =
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
return;
|
|
545
|
-
}
|
|
546
|
-
const s = {};
|
|
547
|
-
t.forEach((i) => {
|
|
548
|
-
i.state ? i.state = Number(i.state) : delete i.state;
|
|
549
|
-
}), trackId = e, s[e] = t, trackList = t;
|
|
550
|
-
const a = s[e].map(
|
|
551
|
-
(i) => transform([i.lon, i.lat], projection.data, projection.mercator)
|
|
552
|
-
), c = new LineString(a), d = formatLength(c, o) || "--";
|
|
553
|
-
console.log("length", formatLength(c, o));
|
|
554
|
-
const u = showTracks == null ? void 0 : showTracks.findIndex((i) => i.id === e);
|
|
555
|
-
u < 0 ? showTracks.push({ id: e, length: d }) : showTracks[u].length = d, console.log("showTracks", showTracks), allTracks[e] = t, trackList = [], trackColor = n, thresholdNum = l, await handlerRenderLine(), await setTrackViewCenter(trackId);
|
|
537
|
+
}, renderTrackLine = async (e, t, n, o = "ship", r = 200) => {
|
|
538
|
+
mapInstance$1 = getInstall(), mapInstance$1 && (routeLayer == null || routeLayer.setVisible(!0), t = t == null ? void 0 : t.reverse(), popupOverlay && o === "ship" && (mapInstance$1 != null && mapInstance$1.getOverlays().getArray().includes(popupOverlay) || mapInstance$1.addOverlay(popupOverlay)), isClosing = !1, !((t == null ? void 0 : t.length) < 2) && (t.forEach((l) => {
|
|
539
|
+
l.state ? l.state = Number(l.state) : delete l.state;
|
|
540
|
+
}), trackId = e, trackList = t, allTracks[e] = t, trackList = [], trackColor = n, thresholdNum = r, await handlerRenderLine(), await setTrackViewCenter(trackId)));
|
|
556
541
|
}, handlerRenderLine = async () => {
|
|
542
|
+
renderShipSelectedChange();
|
|
557
543
|
const e = trackColor || "", t = trackId, n = allTracks[trackId] || [], o = thresholdNum || 200, r = Math.max(1, Math.floor(n.length / o));
|
|
558
|
-
trackList = n.filter((
|
|
559
|
-
if (Number(
|
|
560
|
-
const [d, u] = convertSixHundredThousandToLatLng(
|
|
561
|
-
|
|
544
|
+
trackList = n.filter((s, c) => c % r === 0).map((s, c) => {
|
|
545
|
+
if (Number(s.lon) > 180 || Number(s.lat) > 180) {
|
|
546
|
+
const [d, u] = convertSixHundredThousandToLatLng(s.lon, s.lat);
|
|
547
|
+
s.lon = d, s.lat = u;
|
|
562
548
|
}
|
|
563
|
-
return
|
|
549
|
+
return s.center = [s.lon, s.lat], s.centerPoint = lonLatToMercator(s.center), s.id = t, s.index = c, s.time = hooks(s.createdAt).format("YYYY-MM-DD HH:mm:ss"), s;
|
|
564
550
|
});
|
|
565
|
-
const
|
|
566
|
-
|
|
551
|
+
const a = trackList.map((s) => s.centerPoint);
|
|
552
|
+
a.length >= 2 && (mapInstance$1 == null || mapInstance$1.addLayer(routeLayer), await createTrackLineFeature(t, a, e));
|
|
567
553
|
}, createTrackLineFeature = (e, t, n) => {
|
|
568
|
-
var
|
|
554
|
+
var a;
|
|
569
555
|
const o = new LineString(t), r = new Feature({ geometry: o });
|
|
570
|
-
r.setStyle(createTrackLineStyle(n)), r.setId(e), r.set("type", "line"), (
|
|
571
|
-
const l = routeFeatures.findIndex((
|
|
556
|
+
r.setStyle(createTrackLineStyle(n)), r.setId(e), r.set("type", "line"), (a = routeLayer == null ? void 0 : routeLayer.getSource()) == null || a.clear(), removeAllLabel(), routeFeatures = [];
|
|
557
|
+
const l = routeFeatures.findIndex((s) => s.getId() === e);
|
|
572
558
|
l >= 0 ? routeFeatures[l] = r : routeFeatures.push(r), routesSource.addFeatures([...routeFeatures]), createPointFeature(n);
|
|
573
559
|
}, createTrackLineStyle = (e) => new Style({
|
|
574
560
|
stroke: new Stroke({
|
|
@@ -579,8 +565,8 @@ const reRenderTrackLine = () => {
|
|
|
579
565
|
const o = e == null ? void 0 : e.get("trackId");
|
|
580
566
|
if (e && o && t === "hover") {
|
|
581
567
|
mapInstance$1.getTargetElement().style.cursor = o ? "pointer" : "";
|
|
582
|
-
const r = e.get("data"), l = renderTrackPointHtml(r),
|
|
583
|
-
|
|
568
|
+
const r = e.get("data"), l = renderTrackPointHtml(r), a = n == null ? void 0 : n.coordinate;
|
|
569
|
+
a && (popupEle.querySelector(".popup-content"), popupEle.innerHTML = l, popupOverlay == null || popupOverlay.setPosition(a));
|
|
584
570
|
} else
|
|
585
571
|
popupOverlay && popupOverlay.setPosition(void 0);
|
|
586
572
|
}, formatMinutesToDDHHMM = (e) => {
|
|
@@ -631,11 +617,11 @@ const reRenderTrackLine = () => {
|
|
|
631
617
|
const t = trackList || [];
|
|
632
618
|
if (!(t && t.length > 1)) return [];
|
|
633
619
|
const n = { 16: 24, 17: 15, default: 4 }, o = [], r = t.length;
|
|
634
|
-
for (let
|
|
635
|
-
t[
|
|
636
|
-
const
|
|
637
|
-
if (
|
|
638
|
-
let c =
|
|
620
|
+
for (let a = 0; a < r; a++) {
|
|
621
|
+
t[a].index = a;
|
|
622
|
+
const s = mapInstance$1 == null ? void 0 : mapInstance$1.getPixelFromCoordinate(t[a].centerPoint);
|
|
623
|
+
if (s) {
|
|
624
|
+
let c = s.concat(s);
|
|
639
625
|
c = adjustBounds(c, [20, 20]);
|
|
640
626
|
const d = mapInstance$1 == null ? void 0 : mapInstance$1.getView().getZoom();
|
|
641
627
|
if (!d) return;
|
|
@@ -644,25 +630,25 @@ const reRenderTrackLine = () => {
|
|
|
644
630
|
c = adjustBounds(c, [i, i]);
|
|
645
631
|
}
|
|
646
632
|
let u = !0;
|
|
647
|
-
if (t[
|
|
633
|
+
if (t[a].state !== "0") {
|
|
648
634
|
for (let i = 0; i < o.length; i++)
|
|
649
635
|
if (isOverlapping$1(c, o[i].bounds)) {
|
|
650
636
|
u = !1;
|
|
651
637
|
break;
|
|
652
638
|
}
|
|
653
639
|
}
|
|
654
|
-
u && (t[
|
|
640
|
+
u && (t[a].bounds = c, o.push(t[a]));
|
|
655
641
|
}
|
|
656
642
|
}
|
|
657
643
|
const l = [];
|
|
658
|
-
o.forEach((
|
|
659
|
-
const
|
|
660
|
-
geometry: new Point(
|
|
661
|
-
time:
|
|
644
|
+
o.forEach((a) => {
|
|
645
|
+
const s = new Feature({
|
|
646
|
+
geometry: new Point(a.centerPoint),
|
|
647
|
+
time: a.time
|
|
662
648
|
});
|
|
663
|
-
|
|
664
|
-
}), routesSource.addFeatures(l),
|
|
665
|
-
const
|
|
649
|
+
s.set("type", "track_point"), s.set("trackId", a.id), s.set("data", a), s.setStyle(createPointStyle(e)), l.push(s), typeof a == "object" && Object.prototype.hasOwnProperty.call(a, "state") && createIconFeature(a);
|
|
650
|
+
}), routesSource.addFeatures(l), l.forEach((a) => {
|
|
651
|
+
const s = a.getProperties().data, c = createPointLabelOverlay(e, s);
|
|
666
652
|
mapInstance$1 == null || mapInstance$1.addOverlay(c);
|
|
667
653
|
}), createArrowFetaure(o, e), createIconPointFeature();
|
|
668
654
|
}, createPointLabelOverlay = (e, t) => {
|
|
@@ -710,101 +696,6 @@ const reRenderTrackLine = () => {
|
|
|
710
696
|
radius: 3
|
|
711
697
|
})
|
|
712
698
|
})
|
|
713
|
-
//
|
|
714
|
-
// //文本框样式
|
|
715
|
-
// new Style({
|
|
716
|
-
// text: new Text({
|
|
717
|
-
// text: point.time,
|
|
718
|
-
// font: `500 ${labelConfig.fontSize}px ${labelConfig.fontFamily}`,
|
|
719
|
-
// textAlign: 'left',
|
|
720
|
-
// textBaseline: 'middle',
|
|
721
|
-
// fill: new Fill({ color: labelConfig.textColor }),
|
|
722
|
-
// backgroundFill: new Fill({
|
|
723
|
-
// color: labelConfig.bgColor,
|
|
724
|
-
// }),
|
|
725
|
-
// backgroundStroke: new Stroke({
|
|
726
|
-
// color: trackColor,
|
|
727
|
-
// width: 0.5
|
|
728
|
-
// }),
|
|
729
|
-
// padding: labelConfig.padding,
|
|
730
|
-
// offsetX: textX - boxTopLeft[0], // 转换为相对偏移
|
|
731
|
-
// offsetY: textY - boxTopLeft[1],
|
|
732
|
-
// }),
|
|
733
|
-
// zIndex:99,
|
|
734
|
-
// }),
|
|
735
|
-
// 连接线样式
|
|
736
|
-
// new Style({
|
|
737
|
-
// geometry: lineGeom, // 明确指定几何图形
|
|
738
|
-
// stroke: new Stroke({
|
|
739
|
-
// color: trackColor,
|
|
740
|
-
// width: Math.max(1, 1 / resolution),
|
|
741
|
-
// width: 1
|
|
742
|
-
// }),
|
|
743
|
-
// zIndex: 1 // 确保在点和信息框之间
|
|
744
|
-
// }),
|
|
745
|
-
//
|
|
746
|
-
// // 信息框背景
|
|
747
|
-
// new Style({
|
|
748
|
-
// geometry: boxGeom,
|
|
749
|
-
// fill: new Fill({
|
|
750
|
-
// color: labelConfig.bgColor
|
|
751
|
-
// }),
|
|
752
|
-
// stroke: new Stroke({
|
|
753
|
-
// color: trackColor,
|
|
754
|
-
// width: Math.max(0.5, 0.5 / resolution)
|
|
755
|
-
// }),
|
|
756
|
-
// zIndex: 2
|
|
757
|
-
// }),
|
|
758
|
-
// 文本样式
|
|
759
|
-
// new Style({
|
|
760
|
-
// geometry: new Point([textX, textY]),
|
|
761
|
-
// text: new Text({
|
|
762
|
-
// text: timeText,
|
|
763
|
-
// font: `${labelConfig.fontSize}px ${labelConfig.fontFamily}`,
|
|
764
|
-
// fill: new Fill({ color: labelConfig.textColor }),
|
|
765
|
-
// textAlign: 'left',
|
|
766
|
-
// textBaseline: 'middle',
|
|
767
|
-
// offsetX: 0,
|
|
768
|
-
// offsetY: 0,
|
|
769
|
-
// scale: Math.max(1, 1 / resolution),
|
|
770
|
-
// // backgroundFill: new Fill({
|
|
771
|
-
// // color: labelConfig.bgColor,
|
|
772
|
-
// // }),
|
|
773
|
-
// // backgroundStroke: new Stroke({
|
|
774
|
-
// // color: trackColor,
|
|
775
|
-
// // width: 0.5
|
|
776
|
-
// // }),
|
|
777
|
-
// padding: labelConfig.padding,
|
|
778
|
-
// }),
|
|
779
|
-
// zIndex: 3
|
|
780
|
-
// })
|
|
781
|
-
// new Style({
|
|
782
|
-
// geometry: lineGeom,
|
|
783
|
-
// stroke: new Stroke({
|
|
784
|
-
// color: trackColor,
|
|
785
|
-
// width: 1
|
|
786
|
-
// })
|
|
787
|
-
// }),
|
|
788
|
-
// 信息框样式(使用固定像素值的Text样式)
|
|
789
|
-
// new Style({
|
|
790
|
-
// text: new Text({
|
|
791
|
-
// text: timeText,
|
|
792
|
-
// font: `${FONT_SIZE}px Arial`,
|
|
793
|
-
// fill: new Fill({ color: '#333' }),
|
|
794
|
-
// backgroundFill: new Fill({
|
|
795
|
-
// color: 'rgba(255, 255, 255, 0.9)'
|
|
796
|
-
// }),
|
|
797
|
-
// backgroundStroke: new Stroke({
|
|
798
|
-
// color: 'rgba(0, 0, 0, 0.5)',
|
|
799
|
-
// width: 1
|
|
800
|
-
// }),
|
|
801
|
-
// padding: BOX_PADDING,
|
|
802
|
-
// offsetX: BOX_LEFT_OFFSET, // 固定30像素右偏移
|
|
803
|
-
// offsetY: -boxHeight, // 固定向上偏移框高度
|
|
804
|
-
// textAlign: 'left',
|
|
805
|
-
// textBaseline: 'top'
|
|
806
|
-
// })
|
|
807
|
-
// })
|
|
808
699
|
], createIconFeature = (e) => {
|
|
809
700
|
const t = new Feature({
|
|
810
701
|
//point.centerPoint
|
|
@@ -829,11 +720,11 @@ const reRenderTrackLine = () => {
|
|
|
829
720
|
o || (n.push(trackList[0]), n.push(trackList[trackList.length - 1]));
|
|
830
721
|
for (let r = 0; r < o - 1; r++) {
|
|
831
722
|
let l;
|
|
832
|
-
const
|
|
833
|
-
if (
|
|
834
|
-
l = trackList[
|
|
723
|
+
const a = e[r], s = (e[r + 1].index + a.index) / 2;
|
|
724
|
+
if (s % 2 === 0)
|
|
725
|
+
l = trackList[s].centerPoint;
|
|
835
726
|
else {
|
|
836
|
-
const c = trackList[Math.floor(
|
|
727
|
+
const c = trackList[Math.floor(s)], d = trackList[Math.ceil(s)];
|
|
837
728
|
if (c && d) {
|
|
838
729
|
const [u, i] = c.centerPoint, [p, m] = d.centerPoint;
|
|
839
730
|
l = [(u + p) / 2, (i + m) / 2];
|
|
@@ -878,13 +769,13 @@ const reRenderTrackLine = () => {
|
|
|
878
769
|
geometry: new Point(r.centerPoint)
|
|
879
770
|
});
|
|
880
771
|
l.set("type", "track_begin"), l.set("data", r);
|
|
881
|
-
const
|
|
772
|
+
const a = r.index === 0 && trackList.length >= 2 ? t : n;
|
|
882
773
|
l.setStyle(
|
|
883
774
|
new Style({
|
|
884
775
|
text: new Text({
|
|
885
776
|
font: "Normal 14px map-iconfont",
|
|
886
777
|
text: getIconFont(e),
|
|
887
|
-
fill: new Fill({ color:
|
|
778
|
+
fill: new Fill({ color: a })
|
|
888
779
|
}),
|
|
889
780
|
zIndex: 101
|
|
890
781
|
})
|
|
@@ -901,16 +792,24 @@ const reRenderTrackLine = () => {
|
|
|
901
792
|
}), playShipTrack = (e, t) => {
|
|
902
793
|
handlePlay(String(e), t);
|
|
903
794
|
}, removeAllTrackLayer = () => {
|
|
904
|
-
|
|
795
|
+
allTracks = {}, routesSource == null || routesSource.clear(), stopAnimation(), isClosing = !0;
|
|
905
796
|
}, closeTrack = (e = !1) => {
|
|
906
797
|
routeLayer == null || routeLayer.setVisible(!1);
|
|
907
798
|
const t = getInstall();
|
|
908
799
|
cloneDeep(t.getOverlays().getArray()).forEach((o) => {
|
|
909
800
|
o.get("class") === "track-label-overlay" && (o.setPosition(void 0), t.removeOverlay(o), o.dispose());
|
|
910
801
|
}), e && removeAllTrackLayer(), stopAnimation(), isClosing = !0;
|
|
911
|
-
},
|
|
912
|
-
const n =
|
|
913
|
-
|
|
802
|
+
}, getTrackLength = (e, t = LENGTH_UNIT.NM) => {
|
|
803
|
+
const n = {
|
|
804
|
+
id: e,
|
|
805
|
+
length: "--"
|
|
806
|
+
}, r = (allTracks[e] || []).map(
|
|
807
|
+
(a) => transform([a.lon, a.lat], projection.data, projection.mercator)
|
|
808
|
+
), l = new LineString(r);
|
|
809
|
+
return n.length = formatLength(l, t) || "--", console.log("showTracks", n), n;
|
|
810
|
+
}, handlePlay = (e, t) => {
|
|
811
|
+
const n = allTracks[String(e)], o = n == null ? void 0 : n.map((r) => [r.lon, r.lat]);
|
|
812
|
+
o && playAnimation(o, t);
|
|
914
813
|
}, moveFeature = (e, t) => {
|
|
915
814
|
var i, p;
|
|
916
815
|
const n = Number(50 * t), o = ((i = e.frameState) == null ? void 0 : i.time) ?? Date.now(), r = o - lastTime;
|
|
@@ -920,13 +819,13 @@ const reRenderTrackLine = () => {
|
|
|
920
819
|
}
|
|
921
820
|
const l = linePath.getCoordinateAt(
|
|
922
821
|
distance > 1 ? 2 - distance : distance
|
|
923
|
-
), s = linePath.getCoordinateAt(
|
|
924
|
-
distance > 1 ? distance - 0.01 : distance
|
|
925
822
|
), a = linePath.getCoordinateAt(
|
|
823
|
+
distance > 1 ? distance - 0.01 : distance
|
|
824
|
+
), s = linePath.getCoordinateAt(
|
|
926
825
|
distance > 1 ? 2 - distance : distance + 0.01
|
|
927
826
|
), d = getRotation(
|
|
928
|
-
mercatorToLonLat(
|
|
929
|
-
mercatorToLonLat(
|
|
827
|
+
mercatorToLonLat(a, "array"),
|
|
828
|
+
mercatorToLonLat(s, "array")
|
|
930
829
|
) * Math.PI / 180;
|
|
931
830
|
(p = geoMarkerStyle.getText()) == null || p.setRotation(d), position.setCoordinates(l);
|
|
932
831
|
const u = getVectorContext(e);
|
|
@@ -979,19 +878,19 @@ const reRenderTrackLine = () => {
|
|
|
979
878
|
"Coordinate must be GeoJSON Point or an Array of numbers"
|
|
980
879
|
);
|
|
981
880
|
}
|
|
982
|
-
function
|
|
881
|
+
function a(i, p, m = {}) {
|
|
983
882
|
if (m.final)
|
|
984
883
|
return function(k, S) {
|
|
985
|
-
return (
|
|
884
|
+
return (a(S, k) + 180) % 360;
|
|
986
885
|
}(i, p);
|
|
987
|
-
const g = l(i), y = l(p), v = r(g[0]),
|
|
988
|
-
return o(Math.atan2(
|
|
886
|
+
const g = l(i), y = l(p), v = r(g[0]), L = r(y[0]), w = r(g[1]), f = r(y[1]), T = Math.sin(L - v) * Math.cos(f), E = Math.cos(w) * Math.sin(f) - Math.sin(w) * Math.cos(f) * Math.cos(L - v);
|
|
887
|
+
return o(Math.atan2(T, E));
|
|
989
888
|
}
|
|
990
|
-
function
|
|
889
|
+
function s(i) {
|
|
991
890
|
return !isNaN(i) && i !== null && !Array.isArray(i);
|
|
992
891
|
}
|
|
993
892
|
function c(i, p = {}, m = {}) {
|
|
994
|
-
return i || console.log("Coordinates are required"), Array.isArray(i) || console.log("Coordinates must be an Array"), i.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (!
|
|
893
|
+
return i || console.log("Coordinates are required"), Array.isArray(i) || console.log("Coordinates must be an Array"), i.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (!s(i[0]) || !s(i[1])) && console.log("Coordinates must contain numbers"), d({ type: "Point", coordinates: i }, p, m);
|
|
995
894
|
}
|
|
996
895
|
function d(i, p = {}, m = {}) {
|
|
997
896
|
const g = {
|
|
@@ -1003,7 +902,7 @@ const reRenderTrackLine = () => {
|
|
|
1003
902
|
};
|
|
1004
903
|
return m.id !== void 0 && (g.id = m.id), m.bbox && (g.bbox = m.bbox), g.properties = p, g.geometry = i, g;
|
|
1005
904
|
}
|
|
1006
|
-
const u =
|
|
905
|
+
const u = a(c(e), c(t), n);
|
|
1007
906
|
return u < 0 ? 360 + u : u;
|
|
1008
907
|
}, PORT_LAYER_CLASS_NAME = "zh-map-port-layer";
|
|
1009
908
|
let vectorLayer$2, vectorSource$2;
|
|
@@ -1163,8 +1062,8 @@ const addInteraction = () => {
|
|
|
1163
1062
|
sketch$1 = t.feature, sketch$1.set("randomId", generateRandomId());
|
|
1164
1063
|
let n;
|
|
1165
1064
|
e = (o = sketch$1.getGeometry()) == null ? void 0 : o.on("change", function(r) {
|
|
1166
|
-
const l = r.target,
|
|
1167
|
-
n = l.getLastCoordinate(), measureTooltipElement$1 &&
|
|
1065
|
+
const l = r.target, a = computedDistance(l, unit.value);
|
|
1066
|
+
n = l.getLastCoordinate(), measureTooltipElement$1 && a && (measureTooltipElement$1.innerHTML = a), measureTooltip$1.setPosition(n);
|
|
1168
1067
|
});
|
|
1169
1068
|
}), draw$1.on("drawend", function() {
|
|
1170
1069
|
var t, n, o;
|
|
@@ -1173,9 +1072,9 @@ const addInteraction = () => {
|
|
|
1173
1072
|
measureHistory.value.push({ id: r, value: measureTooltipElement$1 == null ? void 0 : measureTooltipElement$1.innerHTML }), measureTooltipElement$1.innerHTML = `${measureTooltipElement$1.innerHTML}<div class="ol-tooltip-delete-button" data-id="${r}"><i class="map-iconfont icon-delete"></i></div>`;
|
|
1174
1073
|
}
|
|
1175
1074
|
(t = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || t.addEventListener("click", (r) => {
|
|
1176
|
-
var
|
|
1075
|
+
var a;
|
|
1177
1076
|
r.preventDefault(), r.stopPropagation();
|
|
1178
|
-
const l = (
|
|
1077
|
+
const l = (a = r.target) == null ? void 0 : a.getAttribute("data-id");
|
|
1179
1078
|
l && deleteLine(l);
|
|
1180
1079
|
}), measureTooltip$1.setOffset([0, -7]), sketch$1 = null, measureTooltipElement$1 = null, createMeasureTooltip$1(), e && unByKey(e), (n = getProps()) != null && n.lineDrawEnd && ((o = getProps()) == null || o.lineDrawEnd(measureHistory.value));
|
|
1181
1080
|
});
|
|
@@ -1205,13 +1104,13 @@ const createMeasureTooltip$1 = () => {
|
|
|
1205
1104
|
}), removeInteraction(), enableDoubleClickZoom(), state.value = !1;
|
|
1206
1105
|
}, deleteLine = (e) => {
|
|
1207
1106
|
var n, o, r, l;
|
|
1208
|
-
const t = measureHistory.value.findIndex((
|
|
1107
|
+
const t = measureHistory.value.findIndex((a) => a.id === e);
|
|
1209
1108
|
if (t !== -1) {
|
|
1210
1109
|
measureHistory.value.splice(t, 1);
|
|
1211
|
-
const
|
|
1212
|
-
|
|
1213
|
-
const
|
|
1214
|
-
|
|
1110
|
+
const a = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1111
|
+
a[t] && ((o = (n = a[t]) == null ? void 0 : n.parentNode) == null || o.removeChild(a[t]));
|
|
1112
|
+
const s = vectorSource$1.getFeatures();
|
|
1113
|
+
s[t] && vectorSource$1.removeFeature(s[t]);
|
|
1215
1114
|
}
|
|
1216
1115
|
(r = getProps()) != null && r.lineDrawEnd && ((l = getProps()) == null || l.lineDrawEnd(measureHistory.value));
|
|
1217
1116
|
}, computedDistance = (e, t) => {
|
|
@@ -1326,7 +1225,7 @@ const createMeasureTooltip$1 = () => {
|
|
|
1326
1225
|
const o = e.getEventPixel(n.originalEvent), r = e.forEachFeatureAtPixel(o, (l) => l);
|
|
1327
1226
|
handleShipMapEvent(r, "hover"), handleTrackMapEvent(r, "hover", n), r && handlePortHover(o);
|
|
1328
1227
|
}), e.on("movestart", () => {
|
|
1329
|
-
removeSelectedOverlay();
|
|
1228
|
+
console.log("movestart-----------------------"), removeSelectedOverlay();
|
|
1330
1229
|
}), e.on("click", debounce((n) => {
|
|
1331
1230
|
if (console.log("1", drawLine.getState()), drawLine.getState()) return;
|
|
1332
1231
|
const o = e.getEventPixel(n.originalEvent), r = e.forEachFeatureAtPixel(
|
|
@@ -1446,23 +1345,28 @@ const pointerMoveHandler = (e) => {
|
|
|
1446
1345
|
};
|
|
1447
1346
|
let draw, lineLimitError = !1;
|
|
1448
1347
|
const initDraw = () => {
|
|
1449
|
-
var t, n;
|
|
1450
1348
|
if (storeFeature) {
|
|
1451
1349
|
helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement);
|
|
1452
|
-
const
|
|
1453
|
-
if (!
|
|
1454
|
-
const
|
|
1350
|
+
const t = storeFeature.getGeometry();
|
|
1351
|
+
if (!t) return;
|
|
1352
|
+
const n = computedArea(t, "nm");
|
|
1455
1353
|
measureTooltipElement && (measureTooltipElement.innerHTML = `
|
|
1456
|
-
<span class="text">面积:${
|
|
1354
|
+
<span class="text">面积:${n}${lineLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1457
1355
|
`), measureTooltipElement && (measureTooltipElement.innerHTML += '<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');
|
|
1458
|
-
const
|
|
1459
|
-
measureTooltip.setPosition(
|
|
1356
|
+
const o = t.getCoordinates(), r = o[0][o[0].length - 2];
|
|
1357
|
+
if (measureTooltip.setPosition(r), vectorLayer) {
|
|
1358
|
+
const a = vectorLayer.getSource();
|
|
1359
|
+
a && storeFeature && (a.clear(), a.addFeature(storeFeature));
|
|
1360
|
+
}
|
|
1361
|
+
setTimeout(() => {
|
|
1460
1362
|
var a;
|
|
1461
1363
|
(a = document.querySelector(".delete-icon")) == null || a.addEventListener("click", () => {
|
|
1462
|
-
var
|
|
1463
|
-
console.log("delete"), reset(), (
|
|
1364
|
+
var s;
|
|
1365
|
+
console.log("delete"), reset(), (s = getProps()) == null || s.areaDrawEnd([]);
|
|
1464
1366
|
});
|
|
1465
1367
|
}, 0);
|
|
1368
|
+
const l = getCenter$1(storeFeature.getGeometry().getExtent());
|
|
1369
|
+
getInstall().getView().setCenter(l);
|
|
1466
1370
|
return;
|
|
1467
1371
|
}
|
|
1468
1372
|
draw = new Draw({
|
|
@@ -1485,31 +1389,31 @@ const initDraw = () => {
|
|
|
1485
1389
|
color: "rgb(51,112,255, 1)"
|
|
1486
1390
|
})
|
|
1487
1391
|
}),
|
|
1488
|
-
geometry: function(
|
|
1489
|
-
const
|
|
1490
|
-
return new MultiPoint(
|
|
1392
|
+
geometry: function(t) {
|
|
1393
|
+
const n = t.getGeometry().getCoordinates();
|
|
1394
|
+
return new MultiPoint(n);
|
|
1491
1395
|
}
|
|
1492
1396
|
})]
|
|
1493
1397
|
}), getInstall().addInteraction(draw);
|
|
1494
1398
|
let e;
|
|
1495
|
-
draw.on("drawstart", (
|
|
1496
|
-
var
|
|
1497
|
-
sketch =
|
|
1498
|
-
const
|
|
1499
|
-
if (lineLimitError = Number(getLength(
|
|
1500
|
-
const
|
|
1399
|
+
draw.on("drawstart", (t) => {
|
|
1400
|
+
var n;
|
|
1401
|
+
sketch = t.feature, e = (n = sketch.getGeometry()) == null ? void 0 : n.on("change", (o) => {
|
|
1402
|
+
const r = o.target, l = computedArea(r, "nm"), s = r.getCoordinates()[0], c = new LineString([s[s.length - 2], s[s.length - 1]]), d = computedDistance(c, "nm");
|
|
1403
|
+
if (lineLimitError = Number(getLength(c) / 1e3) > 150, !l) return;
|
|
1404
|
+
const u = '<span class="error pl-4">超出可以绘画的距离</span>';
|
|
1501
1405
|
measureTooltipElement && (measureTooltipElement.innerHTML = `
|
|
1502
1406
|
<div class="text">
|
|
1503
|
-
面积:${
|
|
1504
|
-
${lineLimitError ?
|
|
1407
|
+
面积:${l}
|
|
1408
|
+
${lineLimitError ? u : ""}
|
|
1505
1409
|
</div>
|
|
1506
1410
|
`), helpTooltipElement && (helpTooltipElement.innerHTML = `
|
|
1507
1411
|
<div class="text">
|
|
1508
|
-
面积:${
|
|
1412
|
+
面积:${l}
|
|
1509
1413
|
</div>
|
|
1510
1414
|
<div class="text ${lineLimitError ? "error" : ""}">
|
|
1511
|
-
线段 ${
|
|
1512
|
-
${lineLimitError ?
|
|
1415
|
+
线段 ${s.length - 2}: ${d}
|
|
1416
|
+
${lineLimitError ? u : ""}
|
|
1513
1417
|
|
|
1514
1418
|
</div>
|
|
1515
1419
|
<div>
|
|
@@ -1517,21 +1421,21 @@ const initDraw = () => {
|
|
|
1517
1421
|
</div>
|
|
1518
1422
|
`);
|
|
1519
1423
|
});
|
|
1520
|
-
}), draw.on("drawend", (
|
|
1521
|
-
var
|
|
1522
|
-
if (!
|
|
1523
|
-
storeFeature =
|
|
1524
|
-
const
|
|
1525
|
-
if (measureTooltip.setPosition(
|
|
1526
|
-
|
|
1527
|
-
const
|
|
1528
|
-
(
|
|
1424
|
+
}), draw.on("drawend", (t) => {
|
|
1425
|
+
var l, a, s;
|
|
1426
|
+
if (!t.feature.getGeometry()) return;
|
|
1427
|
+
storeFeature = t.feature, measureTooltipElement && (measureTooltipElement.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), measureTooltip.setOffset([10, 0]);
|
|
1428
|
+
const n = t.feature.getGeometry(), o = n.getCoordinates(), r = o[0][o[0].length - 2];
|
|
1429
|
+
if (measureTooltip.setPosition(r), helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement), (l = getProps()) != null && l.areaDrawEnd) {
|
|
1430
|
+
n.getInteriorPoint().getCoordinates();
|
|
1431
|
+
const c = o[0].map((d) => transform(d, projection.mercator, projection.data));
|
|
1432
|
+
(a = getProps()) == null || a.areaDrawEnd(c);
|
|
1529
1433
|
}
|
|
1530
|
-
draw && (draw.setActive(!1), getInstall().removeInteraction(draw), getInstall().getInteractions().forEach((
|
|
1531
|
-
|
|
1532
|
-
})), e && unByKey(e), (
|
|
1533
|
-
var
|
|
1534
|
-
reset(), (
|
|
1434
|
+
draw && (draw.setActive(!1), getInstall().removeInteraction(draw), getInstall().getInteractions().forEach((d) => {
|
|
1435
|
+
d instanceof Draw && (d.setActive(!1), getInstall().removeInteraction(d));
|
|
1436
|
+
})), e && unByKey(e), (s = document.querySelector(".delete-icon")) == null || s.addEventListener("click", () => {
|
|
1437
|
+
var c;
|
|
1438
|
+
reset(), (c = getProps()) == null || c.areaDrawEnd([]);
|
|
1535
1439
|
});
|
|
1536
1440
|
});
|
|
1537
1441
|
}, computedArea = (e, t) => {
|
|
@@ -1593,7 +1497,7 @@ const locationTruck = async (e) => {
|
|
|
1593
1497
|
const l = (e == null ? void 0 : e.drc) || "";
|
|
1594
1498
|
r.style.transform = `rotate(${l}deg)`, r.style.backgroundSize = "cover", currentTruckOverlay == null || currentTruckOverlay.setPosition(t);
|
|
1595
1499
|
}, renderTruckTrack = (e, t, n, o = 1e3) => {
|
|
1596
|
-
renderTrackLine(e, t, n, LENGTH_UNIT.KM, "truck"
|
|
1500
|
+
renderTrackLine(e, t, n, LENGTH_UNIT.KM, "truck");
|
|
1597
1501
|
}, closeTruckTrack = () => {
|
|
1598
1502
|
closeTrack();
|
|
1599
1503
|
}, removeTruckIcon = () => {
|
|
@@ -1603,13 +1507,6 @@ const locationTruck = async (e) => {
|
|
|
1603
1507
|
setTrackViewCenter(e);
|
|
1604
1508
|
}, playTrack = (e, t) => {
|
|
1605
1509
|
playShipTrack(e, t);
|
|
1606
|
-
}, carTrack = {
|
|
1607
|
-
locationTruck,
|
|
1608
|
-
renderTruckTrack,
|
|
1609
|
-
removeTruckIcon,
|
|
1610
|
-
closeTruckTrack,
|
|
1611
|
-
resetTrackView,
|
|
1612
|
-
playTrack
|
|
1613
1510
|
}, _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1614
1511
|
__name: "Map",
|
|
1615
1512
|
props: {
|
|
@@ -1632,8 +1529,8 @@ const locationTruck = async (e) => {
|
|
|
1632
1529
|
setup(e, { expose: t }) {
|
|
1633
1530
|
const n = ref(), o = ref(), r = e;
|
|
1634
1531
|
return console.log(r), onMounted(() => {
|
|
1635
|
-
var
|
|
1636
|
-
initMap(r), setProps(r), setShowLayerType(r.layerType), setGreenTileVisible(r.showGreenLayer), (
|
|
1532
|
+
var a;
|
|
1533
|
+
initMap(r), setProps(r), setShowLayerType(r.layerType), setGreenTileVisible(r.showGreenLayer), (a = o.value) == null || a.setScaleLine(r.scaleLineUnit);
|
|
1637
1534
|
}), t({
|
|
1638
1535
|
getInstall,
|
|
1639
1536
|
getZoom,
|
|
@@ -1655,13 +1552,12 @@ const locationTruck = async (e) => {
|
|
|
1655
1552
|
clear: clearShipList
|
|
1656
1553
|
},
|
|
1657
1554
|
track: {
|
|
1658
|
-
renderTrackLine,
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
getTrack: getShowTracks
|
|
1555
|
+
render: renderTrackLine,
|
|
1556
|
+
remove: removeAllTrackLayer,
|
|
1557
|
+
play: playShipTrack,
|
|
1558
|
+
setCenter: setTrackViewCenter,
|
|
1559
|
+
close: closeTrack,
|
|
1560
|
+
getLength: getTrackLength
|
|
1665
1561
|
},
|
|
1666
1562
|
port: {
|
|
1667
1563
|
render: renderPortList,
|
|
@@ -1671,16 +1567,23 @@ const locationTruck = async (e) => {
|
|
|
1671
1567
|
drawLine,
|
|
1672
1568
|
// 绘制矩形
|
|
1673
1569
|
drawPolygon,
|
|
1674
|
-
carTrack
|
|
1570
|
+
carTrack: {
|
|
1571
|
+
location: locationTruck,
|
|
1572
|
+
remove: removeTruckIcon,
|
|
1573
|
+
renderTrack: renderTruckTrack,
|
|
1574
|
+
setCenter: resetTrackView,
|
|
1575
|
+
closeTrack: closeTruckTrack,
|
|
1576
|
+
playTrack
|
|
1577
|
+
},
|
|
1675
1578
|
utils: {
|
|
1676
1579
|
getCalculateExtent: () => {
|
|
1677
|
-
const
|
|
1678
|
-
return [
|
|
1580
|
+
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);
|
|
1581
|
+
return [s[0], s[1], c[0], c[1]];
|
|
1679
1582
|
},
|
|
1680
1583
|
convertSixHundredThousandToLatLng,
|
|
1681
1584
|
calculateCirclePoints
|
|
1682
1585
|
}
|
|
1683
|
-
}), (
|
|
1586
|
+
}), (a, s) => (openBlock(), createElementBlock(Fragment, null, [
|
|
1684
1587
|
createElementVNode("div", {
|
|
1685
1588
|
id: "map",
|
|
1686
1589
|
ref_key: "zhMapRef",
|
|
@@ -1694,7 +1597,7 @@ const locationTruck = async (e) => {
|
|
|
1694
1597
|
createVNode(ZoomControl, { ref: "zoomControlRef" }, null, 512)
|
|
1695
1598
|
], 64));
|
|
1696
1599
|
}
|
|
1697
|
-
}), Map$1 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
1600
|
+
}), Map$1 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-16d189cd"]]), ZhMap = withInstall(Map$1);
|
|
1698
1601
|
export {
|
|
1699
1602
|
ZhMap as Z
|
|
1700
1603
|
};
|