zhihao-ui 1.3.11 → 1.3.13
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-Bhin5Xqy.js → BaseInfo-BhnEjLKF.js} +1 -1
- package/dist/es/{BaseItem-BoLcxB-U.js → BaseItem-C4NJy1i4.js} +3 -3
- package/dist/es/{Button-DdMNoo0g.js → Button-CGndQwez.js} +2 -2
- package/dist/es/{DatePicker-sUXbd9V4.js → DatePicker-Dy1K1cJQ.js} +3 -3
- package/dist/es/{DetailHeader--0WANmGX.js → DetailHeader-DaabNj_4.js} +3 -3
- package/dist/es/{DetailSubTitle-BUqZQxrl.js → DetailSubTitle-CzFZPXeE.js} +2 -2
- package/dist/es/{Dialog-BKHohBv4.js → Dialog-BUW6ag1B.js} +3 -3
- package/dist/es/{DiyDataTable-GuaKFrG5.js → DiyDataTable-D-UZVciZ.js} +4 -4
- package/dist/es/{EditInfoPair-CajUIoGj.js → EditInfoPair-B2f6zoGY.js} +3 -3
- package/dist/es/{FileWrapper-CvYOVYx4.js → FileWrapper-D4IxJemr.js} +4 -4
- package/dist/es/{Grid-eLpow9Qb.js → Grid-DIs695lY.js} +2 -2
- package/dist/es/{InfoPair-BoTzSjD8.js → InfoPair-Ce7nDfxD.js} +3 -3
- package/dist/es/{Input-BKzWwcsD.js → Input-C5X2X_YD.js} +3 -3
- package/dist/es/{Loading-3Cz4Wb5p.js → Loading-BgoEv5qE.js} +2 -2
- package/dist/es/Map-BJQ9eIcs.js +1998 -0
- package/dist/es/{MessageBox--A4VqZyI.js → MessageBox-DiGH5x51.js} +2 -2
- package/dist/es/{MoneyInput-DeYknAkX.js → MoneyInput-D0kYiOfP.js} +10 -10
- package/dist/es/{PageHeadPanel-8pDHbfnc.js → PageHeadPanel-C6IdOq6I.js} +2 -2
- package/dist/es/{Table-DcnAnAAU.js → Table-B_3YA1mb.js} +5 -5
- package/dist/es/{ToolTips-xwoX6Ww8.js → ToolTips-CiQHxGrw.js} +5 -5
- package/dist/es/index.js +22 -22
- package/dist/es/{utils-pSjFFegY.js → utils-D2wHR1YB.js} +1 -1
- package/dist/es/{vendor-CINc7P9P.js → vendor-D2mv9LHk.js} +8407 -8013
- package/dist/index.css +1 -1
- package/dist/types/components/Map/Map.vue.d.ts +47 -68
- package/dist/types/components/Map/components/scaleLine.vue.d.ts +2 -1
- package/dist/types/components/Map/components/zoomControl.vue.d.ts +13 -1
- package/dist/types/components/Map/function/carTrack.d.ts +7 -14
- package/dist/types/components/Map/function/drawLine.d.ts +4 -4
- package/dist/types/components/Map/function/drawPolygon.d.ts +4 -2
- package/dist/types/components/Map/function/event.d.ts +8 -0
- package/dist/types/components/Map/function/layers.d.ts +8 -5
- package/dist/types/components/Map/function/map.d.ts +14 -10
- package/dist/types/components/Map/function/port.d.ts +8 -6
- package/dist/types/components/Map/function/position.d.ts +1 -7
- package/dist/types/components/Map/function/props.d.ts +5 -2
- package/dist/types/components/Map/function/ship/index.d.ts +8 -28
- package/dist/types/components/Map/function/ship/style.d.ts +36 -4
- package/dist/types/components/Map/function/shipTrack.d.ts +12 -37
- package/dist/types/components/Map/index.d.ts +141 -216
- package/dist/types/components/Map/interface/mapProps.d.ts +5 -5
- package/dist/types/components/Map/useMap.d.ts +17 -0
- package/dist/types/components/Map/utils/shipOverlay.d.ts +12 -0
- package/dist/umd/index.css +1 -1
- package/dist/umd/index.umd.cjs +66 -64
- package/package.json +1 -1
- package/dist/es/Map-Dhm6AjZp.js +0 -1756
package/dist/es/Map-Dhm6AjZp.js
DELETED
|
@@ -1,1756 +0,0 @@
|
|
|
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
|
-
const TIAN_DI_TU_KEY = "a6e8f78974f2581f2ca00485b40c948f", MAP_ZOOM = {
|
|
6
|
-
// 地图默认层级
|
|
7
|
-
default: 13,
|
|
8
|
-
// 地图缩放最小层级
|
|
9
|
-
min: 3,
|
|
10
|
-
// 地图缩放最大层级
|
|
11
|
-
max: 18,
|
|
12
|
-
// 船形图标最小渲染层级
|
|
13
|
-
shipModelMin: 13,
|
|
14
|
-
// 船形图标最小渲染层级
|
|
15
|
-
shipTriggleMin: 16,
|
|
16
|
-
// 船形图标最大渲染层级
|
|
17
|
-
shipModelMax: 18,
|
|
18
|
-
//根据原系统canvas图片转换svg长宽比例计算缩放值
|
|
19
|
-
scaleNum: 0.555
|
|
20
|
-
}, projection = {
|
|
21
|
-
// 经纬度 源数据 地理坐标 WGS84
|
|
22
|
-
data: "EPSG:4326",
|
|
23
|
-
// 墨卡托投影坐标 渲染坐标
|
|
24
|
-
mercator: "EPSG:3857"
|
|
25
|
-
}, MAP_DEFAULT_CENTER = [114.84, 30.52], CDN_URL = "https://static.zhihaoscm.cn/", equatorialCircumference = 2003750834e-2;
|
|
26
|
-
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 || {});
|
|
27
|
-
const convertSixHundredThousandToLatLng = function(e, t) {
|
|
28
|
-
const n = Number(t) / 6e5;
|
|
29
|
-
return [Number(e) / 6e5, n];
|
|
30
|
-
}, calculateCirclePoints = (e, t) => {
|
|
31
|
-
const n = fromLonLat(e), o = t * 1e3, r = [
|
|
32
|
-
n[0] - o,
|
|
33
|
-
n[1] - o,
|
|
34
|
-
n[0] + o,
|
|
35
|
-
n[1] + o
|
|
36
|
-
], l = transformExtent(r, projection.mercator, projection.data);
|
|
37
|
-
return {
|
|
38
|
-
leftTopPoint: { lng: l[0], lat: l[3] },
|
|
39
|
-
rightTopPoint: { lng: l[2], lat: l[3] },
|
|
40
|
-
rightBottomPoint: { lng: l[2], lat: l[1] },
|
|
41
|
-
leftBottomPoint: { lng: l[0], lat: l[1] }
|
|
42
|
-
};
|
|
43
|
-
}, formatLength = function(e, t) {
|
|
44
|
-
const o = getLength(e);
|
|
45
|
-
let r = "";
|
|
46
|
-
switch (console.log(t, LENGTH_UNIT), t) {
|
|
47
|
-
case LENGTH_UNIT.M:
|
|
48
|
-
r = Math.round(o * 100) / 100 + " m";
|
|
49
|
-
break;
|
|
50
|
-
case LENGTH_UNIT.KM:
|
|
51
|
-
r = Math.round(o / 1e3 * 100) / 100 + " km";
|
|
52
|
-
break;
|
|
53
|
-
case LENGTH_UNIT.NM:
|
|
54
|
-
r = (Math.round(o / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
return r;
|
|
58
|
-
};
|
|
59
|
-
function lonLatToMercator(e) {
|
|
60
|
-
const t = e[0] * equatorialCircumference / 180;
|
|
61
|
-
let n = Math.log(Math.tan((90 + e[1]) * Math.PI / 360)) / (Math.PI / 180);
|
|
62
|
-
return n = n * equatorialCircumference / 180, [t, n];
|
|
63
|
-
}
|
|
64
|
-
function getIconFont(unicode = "") {
|
|
65
|
-
return unicode.indexOf("&") !== -1 && (unicode = unicode.replace("&", "&")), unicode.indexOf("&") !== -1 && (unicode = unicode.replace("&", "&")), eval('("' + unicode.replace("&#x", "\\u").replace(";", "") + '")');
|
|
66
|
-
}
|
|
67
|
-
const getIconStyle = (e) => {
|
|
68
|
-
const t = new Text({
|
|
69
|
-
font: "Normal 14px map-iconfont",
|
|
70
|
-
text: getIconFont(e),
|
|
71
|
-
fill: new Fill({ color: "#fff" }),
|
|
72
|
-
offsetY: -14
|
|
73
|
-
});
|
|
74
|
-
return new Style({
|
|
75
|
-
text: t,
|
|
76
|
-
zIndex: 100
|
|
77
|
-
});
|
|
78
|
-
}, mercatorToLonLat = (e, t = "lonlat") => {
|
|
79
|
-
const n = { lon: 0, lat: 0 }, o = e[0] / equatorialCircumference * 180;
|
|
80
|
-
let r = e[1] / equatorialCircumference * 180;
|
|
81
|
-
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];
|
|
82
|
-
}, formatMinutesToDDHHMM = (e) => {
|
|
83
|
-
const t = hooks.duration(e, "minutes"), n = Math.floor(t.asDays()), o = t.hours(), r = t.minutes();
|
|
84
|
-
let l = `${String(r).padStart(2, "0")}分`;
|
|
85
|
-
return o !== 0 && (l = `${String(o).padStart(2, "0")}时${l}`), n !== 0 && (l = `${String(n).padStart(2, "0")}天${l}`), l;
|
|
86
|
-
}, trackLayers = /* @__PURE__ */ new Map(), allTracks = {};
|
|
87
|
-
let activeTrackId = null;
|
|
88
|
-
const DEFAULT_VALUE = "--";
|
|
89
|
-
let moveFeatureHandler = null;
|
|
90
|
-
const popupEle = document.createElement("div"), popupOverlay = new Overlay({
|
|
91
|
-
element: popupEle,
|
|
92
|
-
positioning: "top-left",
|
|
93
|
-
stopEvent: !1,
|
|
94
|
-
className: "track-label-popup"
|
|
95
|
-
});
|
|
96
|
-
let polyline, linePath, startMarker, position$1, geoMarker, trackAnimating = !1, lastTime = Date.now(), vectorLayer$4, distance = 0, routeFeature = null;
|
|
97
|
-
const MAX_CACHED_LAYERS = 5, usedIds = [], manageLayerCache = (e) => {
|
|
98
|
-
var n;
|
|
99
|
-
const t = getInstall();
|
|
100
|
-
for (usedIds.unshift(e); usedIds.length > MAX_CACHED_LAYERS; ) {
|
|
101
|
-
const o = usedIds.pop(), r = trackLayers.get(o);
|
|
102
|
-
r && ((n = r.getSource()) == null || n.clear(), t == null || t.removeLayer(r), trackLayers.delete(o), delete allTracks[o]);
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
let trackColor = "";
|
|
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
|
-
let n = [];
|
|
113
|
-
return n = t.map((o, r) => {
|
|
114
|
-
if (Number(o.lon) > 180 || Number(o.lat) > 180) {
|
|
115
|
-
const [l, a] = convertSixHundredThousandToLatLng(o.lon, o.lat);
|
|
116
|
-
o.lon = l, o.lat = a;
|
|
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;
|
|
119
|
-
}), n;
|
|
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
|
-
return;
|
|
124
|
-
manageLayerCache(e), activeTrackId = e, allTracks[e] = t;
|
|
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
|
-
}, createTrackLayer = (e) => {
|
|
128
|
-
const t = new VectorSource();
|
|
129
|
-
return new VectorLayer({
|
|
130
|
-
source: t,
|
|
131
|
-
visible: !1,
|
|
132
|
-
// 默认隐藏
|
|
133
|
-
className: `track-layer-${e}`,
|
|
134
|
-
renderBuffer: 1024
|
|
135
|
-
// 增大渲染缓冲区
|
|
136
|
-
});
|
|
137
|
-
}, setActiveLayer = (e) => {
|
|
138
|
-
const t = getInstall();
|
|
139
|
-
trackLayers.forEach((n, o) => {
|
|
140
|
-
var l;
|
|
141
|
-
const r = o === e;
|
|
142
|
-
n.getVisible() !== r && (n.setVisible(r), t.getLayers().getArray().includes(n) || t.addLayer(n), r || (l = n.getSource()) == null || l.clear());
|
|
143
|
-
}), activeTrackId = e;
|
|
144
|
-
}, handlerRenderLine = async () => {
|
|
145
|
-
const e = activeTrackId;
|
|
146
|
-
if (!trackLayers.has(e)) {
|
|
147
|
-
const l = createTrackLayer(e);
|
|
148
|
-
trackLayers.set(e, l);
|
|
149
|
-
}
|
|
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);
|
|
157
|
-
}, createTrackLineFeature = (e, t, n) => {
|
|
158
|
-
const o = new LineString(t), r = trackLayers.get(e).getSource(), l = r.getFeatureById(e);
|
|
159
|
-
if (l)
|
|
160
|
-
l.setGeometry(o), l.setId(e), l.setStyle(createTrackLineStyle(n)), routeFeature = l;
|
|
161
|
-
else {
|
|
162
|
-
const a = new Feature({ geometry: o });
|
|
163
|
-
a.setId(e), a.set("type", "line"), a.setStyle(createTrackLineStyle(n)), r.addFeature(a), routeFeature = a;
|
|
164
|
-
}
|
|
165
|
-
return routeFeature;
|
|
166
|
-
}, createTrackLineStyle = (e) => new Style({
|
|
167
|
-
stroke: new Stroke({
|
|
168
|
-
color: e,
|
|
169
|
-
width: 2
|
|
170
|
-
})
|
|
171
|
-
}), handleTrackMapEvent = (e, t, n) => {
|
|
172
|
-
const o = e == null ? void 0 : e.get("trackId"), r = getInstall();
|
|
173
|
-
if (e && o && t === "hover") {
|
|
174
|
-
r.getTargetElement().style.cursor = o ? "pointer" : "";
|
|
175
|
-
const l = e.get("data"), a = renderTrackPointHtml(l), s = n == null ? void 0 : n.coordinate;
|
|
176
|
-
s && (popupEle.querySelector(".popup-content"), popupEle.innerHTML = a, popupOverlay == null || popupOverlay.setPosition(s));
|
|
177
|
-
} else
|
|
178
|
-
popupOverlay && popupOverlay.setPosition(void 0);
|
|
179
|
-
}, renderTrackPointHtml = (e) => {
|
|
180
|
-
if (!(e != null && e.time)) return;
|
|
181
|
-
let t = "";
|
|
182
|
-
return e != null && e.stayTime && (t = `
|
|
183
|
-
<div class="item w-100">
|
|
184
|
-
<div class="item-label">停泊时间约</div>
|
|
185
|
-
<div class="item-item">${formatMinutesToDDHHMM(Number(e.stayTime))}</div>
|
|
186
|
-
</div>
|
|
187
|
-
`), `
|
|
188
|
-
<div class="track-point-popup">
|
|
189
|
-
<div class="item">
|
|
190
|
-
<div class="item-label">状态</div>
|
|
191
|
-
<div class="item-item">${e != null && e.sailStatus ? SHIP_SAIL_STATUS[e.sailStatus] : DEFAULT_VALUE}</div>
|
|
192
|
-
</div>
|
|
193
|
-
<div class="item">
|
|
194
|
-
<div class="item-label">航速</div>
|
|
195
|
-
<div class="item-item">${e.speed || DEFAULT_VALUE}</div>
|
|
196
|
-
</div>
|
|
197
|
-
<div class="item">
|
|
198
|
-
<div class="item-label">艏向</div>
|
|
199
|
-
<div class="item-item">${e.hdg || DEFAULT_VALUE}</div>
|
|
200
|
-
</div>
|
|
201
|
-
<div class="item">
|
|
202
|
-
<div class="item-label">航向</div>
|
|
203
|
-
<div class="item-item">${e.cog || DEFAULT_VALUE}</div>
|
|
204
|
-
</div>
|
|
205
|
-
<div class="item">
|
|
206
|
-
<div class="item-label">经度</div>
|
|
207
|
-
<div class="item-item">${e.lon || DEFAULT_VALUE}</div>
|
|
208
|
-
</div>
|
|
209
|
-
<div class="item">
|
|
210
|
-
<div class="item-label">纬度</div>
|
|
211
|
-
<div class="item-item">${e.lat || DEFAULT_VALUE}</div>
|
|
212
|
-
</div>
|
|
213
|
-
<div class="item w-100">
|
|
214
|
-
<div class="item-label">时间</div>
|
|
215
|
-
<div class="item-item">${e.time}</div>
|
|
216
|
-
</div>
|
|
217
|
-
${t ?? t}
|
|
218
|
-
</div>`;
|
|
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;
|
|
235
|
-
}
|
|
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
|
-
}
|
|
254
|
-
}
|
|
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
|
-
}));
|
|
267
|
-
};
|
|
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
|
-
};
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
return null;
|
|
286
|
-
}
|
|
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) => {
|
|
296
|
-
const t = new Feature({
|
|
297
|
-
geometry: new Point(e.centerPoint),
|
|
298
|
-
data: e
|
|
299
|
-
});
|
|
300
|
-
t.set("type", "track_point"), t.set("trackId", e.id), t.set("data", e);
|
|
301
|
-
let n = [
|
|
302
|
-
...createPointStyle(trackColor)
|
|
303
|
-
];
|
|
304
|
-
return (e.index === 0 || e.index === allTracks[e.id].length - 1) && (n = [...createIconPointStyle(e)], t.set("type", "track_begin")), e.state !== void 0 && e.state !== null && (n = [...createIconStateStyle(e)], t.set("type", "track_icon")), t.setStyle(n), t;
|
|
305
|
-
}, createPointLabelOverlay = (e, t, n) => {
|
|
306
|
-
const o = document.createElement("div");
|
|
307
|
-
o.className = "track-overlay-label", o.style.position = "relative", o.style.backgroundColor = "rgba(255,255,255,0.8)", o.style.border = `1px solid ${t}`, o.style.fontSize = "12px", o.innerHTML = `
|
|
308
|
-
<span>${n.time}</span>
|
|
309
|
-
<svg
|
|
310
|
-
style="position: absolute;left: -20px;top: 0;"
|
|
311
|
-
viewBox="0 0 20 20"
|
|
312
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
313
|
-
width="20"
|
|
314
|
-
height="20">
|
|
315
|
-
<line x1="0" y1="20"
|
|
316
|
-
x2="20" y2="0"
|
|
317
|
-
stroke="${t}"
|
|
318
|
-
stroke-width="1" />
|
|
319
|
-
`;
|
|
320
|
-
const r = new Overlay({
|
|
321
|
-
element: o,
|
|
322
|
-
position: fromLonLat(n.center),
|
|
323
|
-
positioning: "top-left",
|
|
324
|
-
offset: [20, -20],
|
|
325
|
-
stopEvent: !1,
|
|
326
|
-
className: "track-label-time-overlay"
|
|
327
|
-
});
|
|
328
|
-
return r.set("class", "track-label-overlay"), r.set("trackId", e), r;
|
|
329
|
-
}, removeAllLabel = () => {
|
|
330
|
-
const e = getInstall(), t = cloneDeep(e == null ? void 0 : e.getOverlays().getArray()), n = t == null ? void 0 : t.filter((o) => o.get("class") === "track-label-overlay");
|
|
331
|
-
n && n.length > 0 && n.forEach((o) => {
|
|
332
|
-
o.setPosition(void 0), e.removeOverlay(o), o.dispose();
|
|
333
|
-
});
|
|
334
|
-
}, removeAllFetaure = (e) => {
|
|
335
|
-
const t = trackLayers.get(e).getSource();
|
|
336
|
-
t.forEachFeature((n) => {
|
|
337
|
-
n.get("type") !== "line" && t.removeFeature(n);
|
|
338
|
-
});
|
|
339
|
-
}, createPointStyle = (e) => [
|
|
340
|
-
new Style({
|
|
341
|
-
// 扩大交互热区
|
|
342
|
-
image: new CircleStyle({
|
|
343
|
-
stroke: new Stroke({ color: "rgba(0, 0, 0, 0.01)", width: 20 }),
|
|
344
|
-
radius: 3
|
|
345
|
-
})
|
|
346
|
-
}),
|
|
347
|
-
// 轨迹点样式
|
|
348
|
-
new Style({
|
|
349
|
-
image: new CircleStyle({
|
|
350
|
-
fill: new Fill({ color: e }),
|
|
351
|
-
stroke: new Stroke({ color: "#fff", width: 2 }),
|
|
352
|
-
radius: 3
|
|
353
|
-
})
|
|
354
|
-
})
|
|
355
|
-
], createIconStateStyle = (e) => {
|
|
356
|
-
const t = "#E31818", n = "#1890FF", o = "", r = new Style({
|
|
357
|
-
text: new Text({
|
|
358
|
-
font: "Normal 22px map-iconfont",
|
|
359
|
-
text: getIconFont(o),
|
|
360
|
-
offsetY: -10,
|
|
361
|
-
fill: new Fill({
|
|
362
|
-
color: Number(e.state) === 0 ? t : Number(e.state) === 1 ? n : ""
|
|
363
|
-
})
|
|
364
|
-
}),
|
|
365
|
-
zIndex: 99
|
|
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;
|
|
368
|
-
}, createArrowFetaure = (e, t, n, o) => {
|
|
369
|
-
const r = t || [], l = t.length;
|
|
370
|
-
l || (r.push(n[0]), r.push(n[n.length - 1]));
|
|
371
|
-
const a = [];
|
|
372
|
-
for (let i = 0; i < l - 1; i++) {
|
|
373
|
-
let d;
|
|
374
|
-
const u = t[i], c = (t[i + 1].index + u.index) / 2;
|
|
375
|
-
if (c % 2 === 0)
|
|
376
|
-
d = n[c].centerPoint;
|
|
377
|
-
else {
|
|
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;
|
|
381
|
-
d = [(g + y) / 2, (f + v) / 2];
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
if (d) {
|
|
385
|
-
const p = new Feature({
|
|
386
|
-
geometry: new Point(d)
|
|
387
|
-
});
|
|
388
|
-
p.set("type", "track_arrow"), p.setStyle(
|
|
389
|
-
new Style({
|
|
390
|
-
text: new Text({
|
|
391
|
-
font: "700 12px map-iconfont",
|
|
392
|
-
text: getIconFont(""),
|
|
393
|
-
fill: new Fill({ color: o }),
|
|
394
|
-
// 设置箭头旋转 角度转为弧度
|
|
395
|
-
rotation: getRotation(
|
|
396
|
-
t[i].center,
|
|
397
|
-
t[i + 1].center
|
|
398
|
-
) * (Math.PI / 180)
|
|
399
|
-
})
|
|
400
|
-
})
|
|
401
|
-
), a.push(p);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
const s = trackLayers.get(e).getSource();
|
|
405
|
-
s == null || s.addFeatures(a);
|
|
406
|
-
}, setTrackViewCenter = (e) => {
|
|
407
|
-
var a;
|
|
408
|
-
const n = getInstall().getView(), o = trackLayers.get(e).getSource(), r = routeFeature || (e ? o.getFeatureById(e) : null);
|
|
409
|
-
if (!r) return;
|
|
410
|
-
const l = (a = r == null ? void 0 : r.getGeometry()) == null ? void 0 : a.getExtent();
|
|
411
|
-
if (l != null && l.length)
|
|
412
|
-
try {
|
|
413
|
-
const s = buffer(l, Math.max(l[2] - l[0], l[3] - l[1]) * 0.02);
|
|
414
|
-
n.fit(s);
|
|
415
|
-
} catch (s) {
|
|
416
|
-
console.log(s);
|
|
417
|
-
}
|
|
418
|
-
}, createIconPointStyle = (e) => {
|
|
419
|
-
const t = "", r = e.index === 0 ? "#fcdc3f" : "#ff0000";
|
|
420
|
-
return [new Style({
|
|
421
|
-
text: new Text({
|
|
422
|
-
font: "Normal 14px map-iconfont",
|
|
423
|
-
text: getIconFont(t),
|
|
424
|
-
fill: new Fill({ color: r })
|
|
425
|
-
}),
|
|
426
|
-
zIndex: 101
|
|
427
|
-
})];
|
|
428
|
-
}, removeAllTrackLayer = () => {
|
|
429
|
-
console.log("清除所有的轨迹-----");
|
|
430
|
-
const e = getInstall();
|
|
431
|
-
stopAnimation(), trackLayers.forEach((n) => {
|
|
432
|
-
var o;
|
|
433
|
-
(o = n.getSource()) == null || o.clear(), e == null || e.removeLayer(n);
|
|
434
|
-
}), Object.keys(allTracks).forEach((n) => {
|
|
435
|
-
trackLayers.delete(n), delete allTracks[n];
|
|
436
|
-
}), removeAllLabel();
|
|
437
|
-
}, closeTrack = (e) => {
|
|
438
|
-
const t = getInstall(), n = trackLayers.get(e || activeTrackId);
|
|
439
|
-
n == null || n.setVisible(!1), cloneDeep(t.getOverlays().getArray()).forEach((r) => {
|
|
440
|
-
r.get("class") === "track-label-overlay" && (r.setPosition(void 0), t.removeOverlay(r));
|
|
441
|
-
}), stopAnimation();
|
|
442
|
-
}, getTrackLength = (e, t = LENGTH_UNIT.NM) => {
|
|
443
|
-
const n = {
|
|
444
|
-
id: e,
|
|
445
|
-
length: "--"
|
|
446
|
-
}, r = (allTracks[e] || []).map(
|
|
447
|
-
(a) => transform([a.lon, a.lat], projection.data, projection.mercator)
|
|
448
|
-
), l = new LineString(r);
|
|
449
|
-
return n.length = formatLength(l, t) || "--", n;
|
|
450
|
-
}, playShipTrack = (e, t) => {
|
|
451
|
-
handlePlay(String(e), t);
|
|
452
|
-
}, handlePlay = (e, t) => {
|
|
453
|
-
const n = allTracks[String(e)], o = n == null ? void 0 : n.map((r) => [r.lon, r.lat]);
|
|
454
|
-
o && playAnimation(o, t);
|
|
455
|
-
}, geoMarkerStyle = new Style({
|
|
456
|
-
text: new Text({
|
|
457
|
-
font: "700 20px map-iconfont",
|
|
458
|
-
text: getIconFont(""),
|
|
459
|
-
fill: new Fill({ color: "#ff0000" }),
|
|
460
|
-
rotation: 0
|
|
461
|
-
// 初始旋转角度
|
|
462
|
-
})
|
|
463
|
-
}), moveFeature = (e, t) => {
|
|
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;
|
|
466
|
-
if (distance = (distance + o * l / 1e6) % 2, lastTime = r, distance >= 1) {
|
|
467
|
-
stopAnimation();
|
|
468
|
-
return;
|
|
469
|
-
}
|
|
470
|
-
const a = linePath.getCoordinateAt(
|
|
471
|
-
distance > 1 ? 2 - distance : distance
|
|
472
|
-
), s = linePath.getCoordinateAt(
|
|
473
|
-
distance > 1 ? distance - 0.01 : distance
|
|
474
|
-
), i = linePath.getCoordinateAt(
|
|
475
|
-
distance > 1 ? 2 - distance : distance + 0.01
|
|
476
|
-
), u = getRotation(
|
|
477
|
-
mercatorToLonLat(s, "array"),
|
|
478
|
-
mercatorToLonLat(i, "array")
|
|
479
|
-
) * Math.PI / 180;
|
|
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();
|
|
483
|
-
}, startAnimation = () => {
|
|
484
|
-
var e;
|
|
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);
|
|
486
|
-
}, stopAnimation = () => {
|
|
487
|
-
const e = getInstall();
|
|
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);
|
|
489
|
-
}, playAnimation = (e, t) => {
|
|
490
|
-
trackAnimating && stopAnimation(), polyline = new Polyline({
|
|
491
|
-
factor: 1e6
|
|
492
|
-
}).writeGeometry(new LineString(e)), linePath = new Polyline({
|
|
493
|
-
factor: 1e6
|
|
494
|
-
}).readGeometry(polyline, {
|
|
495
|
-
dataProjection: projection.data,
|
|
496
|
-
featureProjection: projection.mercator
|
|
497
|
-
}), startMarker = new Feature({
|
|
498
|
-
type: "icon",
|
|
499
|
-
geometry: new Point(linePath.getFirstCoordinate())
|
|
500
|
-
});
|
|
501
|
-
const n = startMarker.getGeometry();
|
|
502
|
-
position$1 = n ? n.clone() : new Point([0, 0]), geoMarker = new Feature({
|
|
503
|
-
type: "geoMarker",
|
|
504
|
-
style: geoMarkerStyle,
|
|
505
|
-
geometry: position$1
|
|
506
|
-
}), vectorLayer$4 = new VectorLayer({
|
|
507
|
-
source: new VectorSource({
|
|
508
|
-
features: [geoMarker]
|
|
509
|
-
})
|
|
510
|
-
});
|
|
511
|
-
const o = getInstall();
|
|
512
|
-
o == null || o.addLayer(vectorLayer$4), moveFeatureHandler = (r) => moveFeature(r, t), startAnimation();
|
|
513
|
-
}, getRotation = (e, t, n) => {
|
|
514
|
-
function o(c) {
|
|
515
|
-
return 180 * (c % (2 * Math.PI)) / Math.PI;
|
|
516
|
-
}
|
|
517
|
-
function r(c) {
|
|
518
|
-
return c % 360 * Math.PI / 180;
|
|
519
|
-
}
|
|
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) || [];
|
|
527
|
-
}
|
|
528
|
-
if (Array.isArray(c) && c.length >= 2 && !Array.isArray(c[0]) && !Array.isArray(c[1]))
|
|
529
|
-
return c;
|
|
530
|
-
throw new Error(
|
|
531
|
-
"Coordinate must be GeoJSON Point or an Array of numbers"
|
|
532
|
-
);
|
|
533
|
-
}
|
|
534
|
-
function a(c, p, m = {}) {
|
|
535
|
-
if (m.final)
|
|
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);
|
|
540
|
-
return o(Math.atan2(w, E));
|
|
541
|
-
}
|
|
542
|
-
function s(c) {
|
|
543
|
-
return !isNaN(c) && c !== null && !Array.isArray(c);
|
|
544
|
-
}
|
|
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);
|
|
547
|
-
}
|
|
548
|
-
function d(c, p = {}, m = {}) {
|
|
549
|
-
const g = {
|
|
550
|
-
type: "Feature",
|
|
551
|
-
id: "",
|
|
552
|
-
properties: {},
|
|
553
|
-
bbox: {},
|
|
554
|
-
geometry: {}
|
|
555
|
-
};
|
|
556
|
-
return m.id !== void 0 && (g.id = m.id), m.bbox && (g.bbox = m.bbox), g.properties = p, g.geometry = c, g;
|
|
557
|
-
}
|
|
558
|
-
const u = a(i(e), i(t), n);
|
|
559
|
-
return u < 0 ? 360 + u : u;
|
|
560
|
-
}, getRightIcons = (e) => {
|
|
561
|
-
const t = [];
|
|
562
|
-
return e.existDevice && t.push(""), e.existMobile && t.push(""), e.existWaterGauge && t.push(""), t;
|
|
563
|
-
};
|
|
564
|
-
new RBush$1();
|
|
565
|
-
function useShipOverlay(e) {
|
|
566
|
-
const t = ref(null), n = ref(null), o = computed(() => ({
|
|
567
|
-
"--overlay-color": e.color || "#FFF",
|
|
568
|
-
"--bg-color": e.selected ? e.color : "#ffffff",
|
|
569
|
-
position: "relative",
|
|
570
|
-
"pointer-events": "none"
|
|
571
|
-
})), r = computed(() => ({
|
|
572
|
-
position: "relative",
|
|
573
|
-
"border-radius": "1px",
|
|
574
|
-
"background-color": "var(--bg-color)",
|
|
575
|
-
color: "#000",
|
|
576
|
-
"padding-right": "5px",
|
|
577
|
-
"box-shadow": "0 2px 10px rgba(0, 0, 0, 0.2)",
|
|
578
|
-
"font-size": "10px",
|
|
579
|
-
"white-space": "nowrap",
|
|
580
|
-
border: "1px solid #FFF",
|
|
581
|
-
"pointer-events": "auto",
|
|
582
|
-
transition: "background-color 0.5s ease, border 0.5s ease",
|
|
583
|
-
"z-index": "1",
|
|
584
|
-
display: "flex",
|
|
585
|
-
"align-items": "center"
|
|
586
|
-
})), l = computed(() => ({
|
|
587
|
-
width: "14px",
|
|
588
|
-
height: "14px",
|
|
589
|
-
margin: "1px 5px 1px 1px",
|
|
590
|
-
"background-color": "var(--bg-color)"
|
|
591
|
-
})), a = computed(() => ({
|
|
592
|
-
position: "absolute",
|
|
593
|
-
top: "0px",
|
|
594
|
-
color: "var(--overlay-color)",
|
|
595
|
-
"pointer-events": "none",
|
|
596
|
-
transform: "translateY(-1px)",
|
|
597
|
-
"z-index": "0",
|
|
598
|
-
width: "20px",
|
|
599
|
-
height: "20px",
|
|
600
|
-
overflow: "visible"
|
|
601
|
-
}));
|
|
602
|
-
let s = null;
|
|
603
|
-
const i = () => {
|
|
604
|
-
d(), s = window.setInterval(() => {
|
|
605
|
-
if (t.value) {
|
|
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");
|
|
609
|
-
}, 500));
|
|
610
|
-
}
|
|
611
|
-
}, 1e3);
|
|
612
|
-
}, d = () => {
|
|
613
|
-
s && (clearInterval(s), s = null);
|
|
614
|
-
}, u = () => {
|
|
615
|
-
n.value && n.value.setPosition(fromLonLat(e.position));
|
|
616
|
-
};
|
|
617
|
-
return watch(() => e.selected, (c) => {
|
|
618
|
-
c ? i() : d();
|
|
619
|
-
}, { immediate: !0 }), watch(() => e.position, () => {
|
|
620
|
-
u();
|
|
621
|
-
}, { deep: !0 }), onMounted(() => {
|
|
622
|
-
}), onBeforeUnmount(() => {
|
|
623
|
-
d();
|
|
624
|
-
}), () => h("div", {
|
|
625
|
-
ref: t,
|
|
626
|
-
class: "ship-overlay-container",
|
|
627
|
-
style: o.value
|
|
628
|
-
}, [
|
|
629
|
-
h(
|
|
630
|
-
"div",
|
|
631
|
-
{
|
|
632
|
-
class: "ship-overlay-content",
|
|
633
|
-
style: r.value
|
|
634
|
-
},
|
|
635
|
-
[
|
|
636
|
-
h("div", {
|
|
637
|
-
style: e.selected ? l.value : {}
|
|
638
|
-
}, ""),
|
|
639
|
-
h("div", {
|
|
640
|
-
class: "text"
|
|
641
|
-
}, e.name || "未命名船舶"),
|
|
642
|
-
h("div", {
|
|
643
|
-
class: "icons",
|
|
644
|
-
style: {
|
|
645
|
-
color: "#3370ff"
|
|
646
|
-
}
|
|
647
|
-
}, [
|
|
648
|
-
e.existDevice ? h("i", {
|
|
649
|
-
class: "iconfont icon-Frame-19",
|
|
650
|
-
style: {
|
|
651
|
-
fontSize: "12px"
|
|
652
|
-
}
|
|
653
|
-
}) : "",
|
|
654
|
-
e.existMobile ? h("i", {
|
|
655
|
-
class: "iconfont icon-Frame13",
|
|
656
|
-
style: {
|
|
657
|
-
fontSize: "12px"
|
|
658
|
-
}
|
|
659
|
-
}) : "",
|
|
660
|
-
e.existWaterGauge ? h("i", {
|
|
661
|
-
class: "iconfont icon-a-Frame7",
|
|
662
|
-
style: {
|
|
663
|
-
fontSize: "12px"
|
|
664
|
-
}
|
|
665
|
-
}) : ""
|
|
666
|
-
])
|
|
667
|
-
]
|
|
668
|
-
),
|
|
669
|
-
h("svg", {
|
|
670
|
-
class: "ship-overlay-line",
|
|
671
|
-
style: a.value,
|
|
672
|
-
viewBox: "0 0 20 20",
|
|
673
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
674
|
-
}, [
|
|
675
|
-
h("line", {
|
|
676
|
-
x1: "0",
|
|
677
|
-
y1: "0",
|
|
678
|
-
x2: "0",
|
|
679
|
-
y2: "0",
|
|
680
|
-
stroke: "white",
|
|
681
|
-
"stroke-width": "1"
|
|
682
|
-
})
|
|
683
|
-
])
|
|
684
|
-
]);
|
|
685
|
-
}
|
|
686
|
-
const POSITION_PRIORITY = [
|
|
687
|
-
{
|
|
688
|
-
positioning: "top-left",
|
|
689
|
-
offset: [20, -20],
|
|
690
|
-
line: { x1: "0", y1: "20", x2: "20", y2: "4" }
|
|
691
|
-
},
|
|
692
|
-
{
|
|
693
|
-
positioning: "top-right",
|
|
694
|
-
offset: [-20, -20],
|
|
695
|
-
line: { x1: "0", y1: "4", x2: "20", y2: "20" }
|
|
696
|
-
},
|
|
697
|
-
{
|
|
698
|
-
positioning: "top-left",
|
|
699
|
-
offset: [20, 0],
|
|
700
|
-
line: { x1: "0", y1: "0", x2: "20", y2: "4" }
|
|
701
|
-
},
|
|
702
|
-
{
|
|
703
|
-
positioning: "top-right",
|
|
704
|
-
offset: [-20, 0],
|
|
705
|
-
line: { x1: "0", y1: "4", x2: "20", y2: "0" }
|
|
706
|
-
},
|
|
707
|
-
{
|
|
708
|
-
positioning: "top-left",
|
|
709
|
-
offset: [20, 20],
|
|
710
|
-
line: { x1: "20", y1: "4", x2: "0", y2: "-20" }
|
|
711
|
-
},
|
|
712
|
-
{
|
|
713
|
-
positioning: "top-right",
|
|
714
|
-
offset: [-20, 20],
|
|
715
|
-
line: { x1: "0", y1: "4", x2: "20", y2: "-20" }
|
|
716
|
-
}
|
|
717
|
-
], existingOverlays = ref([]);
|
|
718
|
-
function isOverlapping(e, t) {
|
|
719
|
-
return !(e.right < t.left || e.left > t.right || e.bottom < t.top || e.top > t.bottom);
|
|
720
|
-
}
|
|
721
|
-
function calculateBestPosition(e, t) {
|
|
722
|
-
const n = existingOverlays.value.filter((o) => o !== e).map((o) => {
|
|
723
|
-
var r;
|
|
724
|
-
return (r = o.getElement()) == null ? void 0 : r.getBoundingClientRect();
|
|
725
|
-
}).filter((o) => o !== void 0);
|
|
726
|
-
for (const o of POSITION_PRIORITY) {
|
|
727
|
-
e.setPositioning(o.positioning), e.setOffset(o.offset), e.setPosition(t);
|
|
728
|
-
const r = e.getElement();
|
|
729
|
-
if (!r) continue;
|
|
730
|
-
r.offsetHeight;
|
|
731
|
-
const l = r.getBoundingClientRect();
|
|
732
|
-
if (!n.some(
|
|
733
|
-
(s) => isOverlapping(l, s)
|
|
734
|
-
))
|
|
735
|
-
break;
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
function addOverlay(e, t, n, o) {
|
|
739
|
-
const r = new Overlay({
|
|
740
|
-
element: n,
|
|
741
|
-
positioning: "top-left",
|
|
742
|
-
id: "label-" + (o == null ? void 0 : o.id),
|
|
743
|
-
offset: [0, 0],
|
|
744
|
-
autoPan: !1,
|
|
745
|
-
className: o.blinking ? "ship-label-overlay-blinking" : "ship-label-overlay"
|
|
746
|
-
});
|
|
747
|
-
r.set("class", "zh-map-ship-overlay"), e.addOverlay(r), existingOverlays.value.push(r), nextTick(async () => {
|
|
748
|
-
await calculateBestPosition(r, t), setLinePath(r);
|
|
749
|
-
});
|
|
750
|
-
}
|
|
751
|
-
function setLinePath(e) {
|
|
752
|
-
const t = e.getElement(), n = t == null ? void 0 : t.querySelector(".ship-overlay-line"), o = e.getPositioning(), r = e.getOffset();
|
|
753
|
-
n && o === "top-right" && (n.style.right = "-20px"), n && o === "top-left" && (n.style.left = "-20px");
|
|
754
|
-
const l = POSITION_PRIORITY.filter((s) => s.positioning === o && s.offset === r), a = t == null ? void 0 : t.querySelector(".ship-overlay-line line");
|
|
755
|
-
if (l.length > 0) {
|
|
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));
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
function removeLabelOverlay(e) {
|
|
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) => {
|
|
764
|
-
o.setPosition(void 0), o.setElement(void 0), e.removeOverlay(o), o.dispose();
|
|
765
|
-
});
|
|
766
|
-
}
|
|
767
|
-
const getShipDirectPath = (e) => {
|
|
768
|
-
const { spd: t, hdg: n, cog: o } = e;
|
|
769
|
-
return t ? n !== null && +n != 511 && o !== null ? o - +n >= 3 ? SHIP_DIRECT.right : o - +n <= -3 ? SHIP_DIRECT.left : SHIP_DIRECT.front : SHIP_DIRECT.front : "";
|
|
770
|
-
}, createShipStyle = (e) => {
|
|
771
|
-
const { shipData: t } = e.getProperties(), n = getShipType(), o = getShipScale(t, n);
|
|
772
|
-
return initShipStyle(e, o, n);
|
|
773
|
-
}, getShipType = () => {
|
|
774
|
-
const e = getZoom();
|
|
775
|
-
return e <= MAP_ZOOM.shipModelMax && e >= MAP_ZOOM.shipTriggleMin ? "ship" : "triangle";
|
|
776
|
-
}, getShipScale = (e, t) => {
|
|
777
|
-
if (t === "ship") {
|
|
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);
|
|
780
|
-
}
|
|
781
|
-
return MAP_ZOOM.scaleNum;
|
|
782
|
-
}, initShipStyle = (e, t, n) => {
|
|
783
|
-
const { color: o, direct: r, isHighlight: l, shipData: a } = e.getProperties(), s = (a.cog - 90 + 360) % 360;
|
|
784
|
-
return new Style({
|
|
785
|
-
image: new Icon({
|
|
786
|
-
src: i(),
|
|
787
|
-
scale: t || MAP_ZOOM.scaleNum,
|
|
788
|
-
anchor: [0.5, 0.5],
|
|
789
|
-
rotation: s * Math.PI / 180,
|
|
790
|
-
rotateWithView: !1
|
|
791
|
-
})
|
|
792
|
-
});
|
|
793
|
-
function i() {
|
|
794
|
-
return `data:image/svg+xml;utf8,${encodeURIComponent(d())}`;
|
|
795
|
-
}
|
|
796
|
-
function d() {
|
|
797
|
-
switch (n) {
|
|
798
|
-
case "triangle":
|
|
799
|
-
return `<svg width="41" height="24" viewBox="0 0 41 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
800
|
-
<path d="M30.8843 12.6777L2.21343 21.7067C1.75559 21.8509 1.28947 21.509 1.28947 21.029L1.28947 2.97103C1.28947 2.49102 1.75558 2.14913 2.21342 2.29331L30.8843 11.3223C31.5471 11.531 31.5471 12.469 30.8843 12.6777Z"
|
|
801
|
-
fill="${o}" stroke="${l ? "#FF2424" : "black"}" stroke-width="${l ? "2" : "0.578947"}" />
|
|
802
|
-
<!--path船航向左边或者向前-->
|
|
803
|
-
${r === SHIP_DIRECT.left && `<path d="M30 12L40 12L40 8" stroke="${l ? "#FF2424" : "black"}" stroke-width="2"/>`}
|
|
804
|
-
<!--path船航向右边-->
|
|
805
|
-
${r === SHIP_DIRECT.right && `<path d="M30 12L40 12L40 16" stroke="${l ? "#FF2424" : "black"}" stroke-width="2"/>`}
|
|
806
|
-
<!--path黑线无左右-->
|
|
807
|
-
${r === SHIP_DIRECT.front && `<path d="M30 12L40 12" stroke="${l ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
808
|
-
</svg>
|
|
809
|
-
`;
|
|
810
|
-
case "ship":
|
|
811
|
-
return `<svg width="97" height="20" viewBox="0 0 97 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
812
|
-
<path d="M0.289474 17.3433L0.289474 2.65655C0.289474 2.28572 0.574654 1.97725 0.944343 1.9482L22.0544 0.289473L67.5204 0.289473C67.6295 0.289473 67.7372 0.314613 67.835 0.362943L86.0565 9.3629C86.5844 9.6236 86.5844 10.3763 86.0565 10.637L67.835 19.6371C67.7372 19.6854 67.6295 19.7105 67.5203 19.7105L22.0544 19.7105L0.944343 18.0517C0.574653 18.0226 0.289474 17.7142 0.289474 17.3433Z"
|
|
813
|
-
fill="${o}" stroke="${l ? "#FF2424" : "black"}" stroke-width="${l ? "4" : "0.578947"}"/>
|
|
814
|
-
${r === SHIP_DIRECT.left && `<path d="M86 10L96 10L96 6" stroke="${l ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
815
|
-
${r === SHIP_DIRECT.right && `<path d="M86 10L96 10L96 14" stroke="${l ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
816
|
-
${r === SHIP_DIRECT.front && `<path d="M86 10L96 10" stroke="${l ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
817
|
-
</svg>
|
|
818
|
-
`;
|
|
819
|
-
default:
|
|
820
|
-
return "";
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
}, selectedShipStyle = (e) => {
|
|
824
|
-
const t = selectedShipElement(e), n = e.id, { lon: o, lat: r } = e, l = new Overlay({
|
|
825
|
-
element: t,
|
|
826
|
-
position: fromLonLat([o, r]),
|
|
827
|
-
id: "selected-" + n,
|
|
828
|
-
positioning: "center-center",
|
|
829
|
-
offset: [0, 5],
|
|
830
|
-
className: "ship-selected-overlay"
|
|
831
|
-
});
|
|
832
|
-
return l.set("class", "ship-overlay-selected"), l;
|
|
833
|
-
}, selectedShipElement = (e) => {
|
|
834
|
-
const t = getShipType(), n = getShipScale(e, t), o = t === "ship" ? 109 : 49, r = `
|
|
835
|
-
<svg style="transform:scale(${n});" xmlns="http://www.w3.org/2000/svg" width="${o}" height="${o}" viewBox="0 0 49 49" fill="none">
|
|
836
|
-
<path d="M1.99982 46.9998L1.99982 1.99982L46.9998 1.99982L46.9998 46.9998L1.99982 46.9998Z" fill="#FF2424" fill-opacity="0.2"/>
|
|
837
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M19.9998 0.5V3.5L3.49976 3.5V20H0.499756V0.500002L19.9998 0.5ZM45.4998 3.5H28.9998V0.5H48.4998V20H45.4998V3.5ZM48.4998 29L48.4998 48.5H28.9998V45.5H45.4998L45.4998 29H48.4998ZM3.49976 45.5L3.49976 29H0.499756L0.499758 48.5L19.9998 48.5V45.5L3.49976 45.5Z" fill="#FF2424"/>
|
|
838
|
-
</svg>
|
|
839
|
-
`, l = document.createElement("div");
|
|
840
|
-
return l.className = "ship-overlay-selected", l.innerHTML = r, l;
|
|
841
|
-
}, createLabelStyle = (e) => {
|
|
842
|
-
const t = getInstall(), { shipData: n, blinking: o } = e.getProperties(), { lon: r, lat: l } = n, a = createLabelElement(e);
|
|
843
|
-
addOverlay(t, fromLonLat([r, l]), a, { ...n, blinking: o });
|
|
844
|
-
}, createLabelElement = (e) => {
|
|
845
|
-
const t = document.createElement("div");
|
|
846
|
-
t.className = "ship-overlay-box", t.style.position = "relative";
|
|
847
|
-
const n = e.getProperties(), { shipData: o, blinking: r, blinkingColor: l, name: a } = n, { lon: s, lat: i } = o, d = createVNode({
|
|
848
|
-
setup() {
|
|
849
|
-
return useShipOverlay({
|
|
850
|
-
position: [s + 2e-3, i + 2e-3],
|
|
851
|
-
selected: r,
|
|
852
|
-
name: a,
|
|
853
|
-
color: l,
|
|
854
|
-
existDevice: o == null ? void 0 : o.existDevice,
|
|
855
|
-
existMobile: o == null ? void 0 : o.existMobile,
|
|
856
|
-
existWaterGauge: o == null ? void 0 : o.existWaterGauge
|
|
857
|
-
});
|
|
858
|
-
}
|
|
859
|
-
});
|
|
860
|
-
return render$1(d, t), t;
|
|
861
|
-
};
|
|
862
|
-
let selectedShipFeature = null, selectedShip = null;
|
|
863
|
-
const shipsSource = new VectorSource(), shipsLayer = new VectorLayer({
|
|
864
|
-
source: shipsSource,
|
|
865
|
-
className: "zh-map--ship-layer",
|
|
866
|
-
updateWhileInteracting: !1,
|
|
867
|
-
updateWhileAnimating: !1,
|
|
868
|
-
renderBuffer: 300,
|
|
869
|
-
zIndex: 101
|
|
870
|
-
});
|
|
871
|
-
let hoveredShipId = "", attentionShips = {}, attentionShipsColor = {};
|
|
872
|
-
const renderShipList = (e) => {
|
|
873
|
-
const t = getInstall();
|
|
874
|
-
if (!e || !t) return;
|
|
875
|
-
removeSelectedOverlay(), removeLabelOverlay(t), t.getLayers().getArray().includes(shipsLayer) || t.addLayer(shipsLayer);
|
|
876
|
-
const n = (selectedShip == null ? void 0 : selectedShip.id) || (selectedShipFeature == null ? void 0 : selectedShipFeature.get("id"));
|
|
877
|
-
shipsSource && shipsSource.clear();
|
|
878
|
-
const o = [];
|
|
879
|
-
if (selectedShip) {
|
|
880
|
-
const l = e.filter((a) => a.id === n);
|
|
881
|
-
l.length === 0 ? e.push(selectedShip) : selectedShip = l[0];
|
|
882
|
-
}
|
|
883
|
-
const r = getZoom();
|
|
884
|
-
e.forEach((l) => {
|
|
885
|
-
if (l) {
|
|
886
|
-
const a = createShipFetature(l);
|
|
887
|
-
o.push(a), ((selectedShip == null ? void 0 : selectedShip.id) == l.id || r >= MAP_ZOOM.shipModelMin) && createLabelStyle(a);
|
|
888
|
-
}
|
|
889
|
-
}), shipsSource.addFeatures(o), handleChangeSelected();
|
|
890
|
-
}, createShipFetature = (e) => {
|
|
891
|
-
const t = (selectedShip == null ? void 0 : selectedShip.id) || (selectedShipFeature == null ? void 0 : selectedShipFeature.get("id")), n = fromLonLat([e == null ? void 0 : e.lon, e == null ? void 0 : e.lat]), o = new Feature({
|
|
892
|
-
geometry: new Point(n),
|
|
893
|
-
// 船舶数据
|
|
894
|
-
shipData: e,
|
|
895
|
-
id: e.id,
|
|
896
|
-
name: e.cnname || "未命名船舶",
|
|
897
|
-
selected: e.id === t,
|
|
898
|
-
// 图标
|
|
899
|
-
rightIcons: getRightIcons(e),
|
|
900
|
-
// 是否闪烁
|
|
901
|
-
blinking: attentionShips[e.id] || !1,
|
|
902
|
-
// 闪烁颜色
|
|
903
|
-
blinkingColor: attentionShipsColor[e.id] || "",
|
|
904
|
-
// 船舶颜色
|
|
905
|
-
color: e.fill || "#04C900",
|
|
906
|
-
// 船艏向的方向
|
|
907
|
-
direct: getShipDirectPath(e),
|
|
908
|
-
// 高亮
|
|
909
|
-
isHighlight: !1
|
|
910
|
-
});
|
|
911
|
-
return o.setStyle(createShipStyle(o)), o;
|
|
912
|
-
}, handleChangeSelected = async () => {
|
|
913
|
-
if (!selectedShip) return;
|
|
914
|
-
const e = getInstall();
|
|
915
|
-
if (!e) return;
|
|
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]));
|
|
920
|
-
} else
|
|
921
|
-
o = selectedShipStyle(selectedShip), e.addOverlay(o);
|
|
922
|
-
setTimeout(() => {
|
|
923
|
-
var r;
|
|
924
|
-
o && ((r = o.get("element")) != null && r.parentElement) && (o.get("element").parentElement.style.display = "block");
|
|
925
|
-
}, 20);
|
|
926
|
-
}, clearShipList = () => {
|
|
927
|
-
const e = getInstall();
|
|
928
|
-
if (!e || !shipsSource) return;
|
|
929
|
-
const t = (selectedShip == null ? void 0 : selectedShip.id) || "";
|
|
930
|
-
shipsSource.getFeatures().forEach((o) => {
|
|
931
|
-
o.get("shipData").shipId !== t && shipsSource.removeFeature(o);
|
|
932
|
-
});
|
|
933
|
-
const n = e.getOverlays().getArray();
|
|
934
|
-
cloneDeep(n).map((o) => {
|
|
935
|
-
(o.getId() !== "label-" + t || o.getId() !== "selected-" + t) && (o.setPosition(void 0), e.removeOverlay(o), o.dispose());
|
|
936
|
-
});
|
|
937
|
-
}, renderShipBlink = (e, t) => {
|
|
938
|
-
const n = getInstall();
|
|
939
|
-
attentionShips = e, attentionShipsColor = t;
|
|
940
|
-
const o = cloneDeep(n.getOverlays().getArray()), r = cloneDeep(shipsSource.getFeatures());
|
|
941
|
-
for (const l in attentionShips) {
|
|
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));
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
}, filterShipShow = (e) => {
|
|
950
|
-
const t = getInstall();
|
|
951
|
-
if (!t) return;
|
|
952
|
-
const n = shipsSource.getFeatures(), o = selectedShipFeature ? selectedShipFeature.get("id") : "", r = n.filter((s) => s.get("id") !== o), l = /* @__PURE__ */ new Map();
|
|
953
|
-
e.forEach((s) => {
|
|
954
|
-
l.set(s.id, !0);
|
|
955
|
-
});
|
|
956
|
-
const a = cloneDeep(t.getOverlays().getArray());
|
|
957
|
-
r.forEach((s) => {
|
|
958
|
-
const i = s.get("id"), d = a.find((u) => u.getId() === "label-" + i);
|
|
959
|
-
if (!l.has(i))
|
|
960
|
-
s.setStyle([]), d && (d.get("element").style.visibility = "hidden");
|
|
961
|
-
else {
|
|
962
|
-
d && (d.get("element").style.visibility = "visible");
|
|
963
|
-
const u = s.getStyle();
|
|
964
|
-
(u == null ? void 0 : u.length) == 0 && s.setStyle(createShipStyle(s));
|
|
965
|
-
}
|
|
966
|
-
});
|
|
967
|
-
}, renderShipSelected = (e) => {
|
|
968
|
-
if (e) {
|
|
969
|
-
console.log("选中", e);
|
|
970
|
-
const t = shipsSource.getFeatures().find((n) => n.get("id") === e.id);
|
|
971
|
-
t && (selectedShipFeature = t), selectedShip = e, handleChangeSelected();
|
|
972
|
-
} else
|
|
973
|
-
console.log("取消选中"), selectedShip = null, selectedShipFeature = null, removeSelectedOverlay();
|
|
974
|
-
}, handleShipMapEvent = debounce((e, t, n) => {
|
|
975
|
-
const o = getInstall();
|
|
976
|
-
if (e) {
|
|
977
|
-
const r = e.get("shipData"), l = e.get("id");
|
|
978
|
-
if (o.getTargetElement().style.cursor = l ? "pointer" : "", t === "click" && (renderShipSelected(r), n && n(l)), t === "hover") {
|
|
979
|
-
hoveredShipId && hoveredShipId !== l && clearHoverHight(), hoveredShipId = l;
|
|
980
|
-
const a = shipsSource.getFeatures().find((s) => s.get("id") === hoveredShipId);
|
|
981
|
-
a == null || a.set("isHighlight", !0), a == null || a.setStyle(createShipStyle(a));
|
|
982
|
-
}
|
|
983
|
-
} else
|
|
984
|
-
o.getTargetElement().style.cursor = "", clearHoverHight();
|
|
985
|
-
}, 10), clearHoverHight = () => {
|
|
986
|
-
const e = hoveredShipId ? shipsSource.getFeatures().find((t) => t.get("id") === hoveredShipId) : null;
|
|
987
|
-
hoveredShipId = null, e == null || e.set("isHighlight", !1), e == null || e.setStyle(createShipStyle(e));
|
|
988
|
-
}, removeSelectedOverlay = () => {
|
|
989
|
-
console.log("removeSelectedOverlay-------");
|
|
990
|
-
try {
|
|
991
|
-
const e = getInstall(), n = cloneDeep(e.getOverlays().getArray()).find((o) => o.get("class") == "ship-overlay-selected");
|
|
992
|
-
n && n.setPosition(void 0);
|
|
993
|
-
} catch (e) {
|
|
994
|
-
console.log(e);
|
|
995
|
-
}
|
|
996
|
-
}, PORT_LAYER_CLASS_NAME = "zh-map-port-layer";
|
|
997
|
-
let vectorLayer$3, vectorSource$3;
|
|
998
|
-
const renderPortList = (e) => {
|
|
999
|
-
var t;
|
|
1000
|
-
if (!(!e || e.length === 0)) {
|
|
1001
|
-
if (vectorSource$3 || (vectorSource$3 = new VectorSource()), vectorSource$3.clear(), selectedPortData) {
|
|
1002
|
-
const n = e.find((o) => o.id === selectedPortData.id);
|
|
1003
|
-
n ? selectedPortData = n : e.push(selectedPortData);
|
|
1004
|
-
}
|
|
1005
|
-
e.forEach((n) => {
|
|
1006
|
-
renderPortPoint$1(n);
|
|
1007
|
-
}), vectorLayer$3 || (vectorLayer$3 = new VectorLayer({
|
|
1008
|
-
className: PORT_LAYER_CLASS_NAME,
|
|
1009
|
-
source: vectorSource$3,
|
|
1010
|
-
zIndex: 100
|
|
1011
|
-
}), (t = getInstall()) == null || t.addLayer(vectorLayer$3));
|
|
1012
|
-
}
|
|
1013
|
-
}, renderPortPoint$1 = (e) => {
|
|
1014
|
-
const t = getZoom(), [n, o] = e.latLon.split(","), r = new Feature({
|
|
1015
|
-
geometry: new Point(fromLonLat([Number(n), Number(o)]))
|
|
1016
|
-
});
|
|
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) => {
|
|
1019
|
-
const o = (l) => `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
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}"/>
|
|
1021
|
-
<g clip-path="url(#clip0_10059_122082)">
|
|
1022
|
-
<path d="M34.8624 22.8687L32.5874 25.6313L33.4812 25.7125C33.4812 25.7125 30.5562 28.0687 27.9562 28.2312C25.3562 28.3937 24.1374 24.9 24.1374 24.9V19.1312H27.6312V17.425H24.2999V15.15C25.7624 14.6625 26.7374 13.2812 26.7374 11.6562C26.7374 9.625 25.1124 8 23.0812 8H22.9999C20.9687 8 19.3437 9.625 19.3437 11.6562C19.3437 13.2812 20.3999 14.6625 21.7812 15.15V17.425H18.4499V19.1312H21.9437V24.9C21.9437 24.9 20.6437 28.3125 18.0437 28.2312C15.4437 28.0687 12.5187 25.7125 12.5187 25.7125L13.4124 25.6313L11.0562 22.8687L10.2437 26.2812L11.2187 26.0375C11.2187 26.0375 13.1687 29.5313 16.1749 30.8313C19.1812 32.2125 22.1874 33.9187 22.8374 34C23.4874 33.9187 26.4937 32.2125 29.4187 30.8313C32.3437 29.45 34.3749 26.0375 34.3749 26.0375L35.3499 26.2812L34.8624 22.8687ZM23.0812 13.6875C21.9437 13.6875 21.0499 12.7937 21.0499 11.6562C21.0499 10.6 21.9437 9.70625 22.9999 9.70625H23.0812C24.1374 9.70625 25.0312 10.6 25.0312 11.6562C25.1124 12.7937 24.1374 13.6875 23.0812 13.6875Z" fill="white"/>
|
|
1023
|
-
</g>
|
|
1024
|
-
<defs>
|
|
1025
|
-
<clipPath id="clip0_10059_122082">
|
|
1026
|
-
<rect width="26" height="26" fill="white" transform="translate(10 8)"/>
|
|
1027
|
-
</clipPath>
|
|
1028
|
-
</defs>
|
|
1029
|
-
</svg>
|
|
1030
|
-
`, r = () => `data:image/svg+xml;utf8,${encodeURIComponent(o(n ? "#FF5733" : "#3370FF"))}`;
|
|
1031
|
-
return new Style({
|
|
1032
|
-
text: new Text({
|
|
1033
|
-
text: e.shortName,
|
|
1034
|
-
font: "12px sans-serif",
|
|
1035
|
-
fill: new Fill({
|
|
1036
|
-
color: n ? "#ffffff" : "#000000"
|
|
1037
|
-
}),
|
|
1038
|
-
backgroundFill: new Fill({
|
|
1039
|
-
color: n ? "#FF5733" : "#FFFFFF"
|
|
1040
|
-
}),
|
|
1041
|
-
offsetY: 30
|
|
1042
|
-
}),
|
|
1043
|
-
image: new Icon({
|
|
1044
|
-
src: r(),
|
|
1045
|
-
scale: 0.5 * t / 10
|
|
1046
|
-
})
|
|
1047
|
-
});
|
|
1048
|
-
}, clearPortList = () => {
|
|
1049
|
-
if (selectedPortFeature$1) {
|
|
1050
|
-
console.log("清除非选中的港口");
|
|
1051
|
-
const e = selectedPortFeature$1.get("portData").id;
|
|
1052
|
-
vectorSource$3.getFeatures().forEach((t) => {
|
|
1053
|
-
t.get("portData").id !== e && vectorSource$3.removeFeature(t);
|
|
1054
|
-
});
|
|
1055
|
-
} else
|
|
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;
|
|
1062
|
-
};
|
|
1063
|
-
let selectedPortFeature$1 = null, selectedPortData = null;
|
|
1064
|
-
const selectedPort = (e) => {
|
|
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));
|
|
1070
|
-
}
|
|
1071
|
-
}, addSelectedPortStyle$1 = (e) => {
|
|
1072
|
-
const t = vectorSource$3.getFeatures();
|
|
1073
|
-
selectedPortData = e, selectedPortFeature$1 = t.find((n) => n.get("portData").id === e.id);
|
|
1074
|
-
}, handlePortHover = (e) => {
|
|
1075
|
-
const t = getInstall(), n = t.forEachFeatureAtPixel(e, (o) => o);
|
|
1076
|
-
n && n.get("portData") && (t.getTargetElement().style.cursor = "pointer");
|
|
1077
|
-
}, disableDoubleClickZoom = () => {
|
|
1078
|
-
getInstall().getInteractions().forEach((t) => {
|
|
1079
|
-
t instanceof DoubleClickZoom && t.setActive(!1);
|
|
1080
|
-
});
|
|
1081
|
-
}, enableDoubleClickZoom = () => {
|
|
1082
|
-
getInstall().getInteractions().forEach((t) => {
|
|
1083
|
-
t instanceof DoubleClickZoom && t.setActive(!0);
|
|
1084
|
-
});
|
|
1085
|
-
}, props = ref(), setProps = (e) => {
|
|
1086
|
-
props.value = e;
|
|
1087
|
-
}, getProps = () => props.value, measureHistory = ref([]), unit = ref("km"), setUnit = (e) => {
|
|
1088
|
-
unit.value = e;
|
|
1089
|
-
};
|
|
1090
|
-
let helpTooltipElement$1;
|
|
1091
|
-
const state = ref(!1), open$1 = () => {
|
|
1092
|
-
initMapLayer(), disableDoubleClickZoom(), changeCursor("pointer");
|
|
1093
|
-
const e = getInstall();
|
|
1094
|
-
e.on("pointermove", pointerMoveHandler$1), e.getViewport().addEventListener("mouseout", () => {
|
|
1095
|
-
helpTooltipElement$1 && helpTooltipElement$1.classList.add("hidden");
|
|
1096
|
-
}), addInteraction(), state.value = !0;
|
|
1097
|
-
};
|
|
1098
|
-
let vectorSource$2, vectorLayer$2;
|
|
1099
|
-
const initMapLayer = () => {
|
|
1100
|
-
vectorSource$2 = new VectorSource(), vectorLayer$2 = new VectorLayer({
|
|
1101
|
-
source: vectorSource$2,
|
|
1102
|
-
zIndex: 1e3,
|
|
1103
|
-
style: {
|
|
1104
|
-
"fill-color": "rgba(255, 255, 255, 0.2)",
|
|
1105
|
-
"stroke-color": "#ffcc33",
|
|
1106
|
-
"stroke-width": 2,
|
|
1107
|
-
"circle-radius": 7,
|
|
1108
|
-
"circle-fill-color": "#ffcc33"
|
|
1109
|
-
}
|
|
1110
|
-
}), getInstall().addLayer(vectorLayer$2);
|
|
1111
|
-
};
|
|
1112
|
-
let sketch$1, helpTooltip;
|
|
1113
|
-
const pointerMoveHandler$1 = (e) => {
|
|
1114
|
-
if (e.dragging)
|
|
1115
|
-
return;
|
|
1116
|
-
let t = "点击选择起点";
|
|
1117
|
-
sketch$1 && (t = "单击继续,双击结束"), helpTooltipElement$1 && (helpTooltipElement$1.innerHTML = t, helpTooltip.setPosition(e.coordinate), helpTooltipElement$1.classList.remove("hidden"));
|
|
1118
|
-
}, changeCursor = (e) => {
|
|
1119
|
-
getInstall().getTargetElement().style.cursor = e;
|
|
1120
|
-
};
|
|
1121
|
-
let draw$1;
|
|
1122
|
-
const addInteraction = () => {
|
|
1123
|
-
draw$1 = new Draw({
|
|
1124
|
-
source: vectorSource$2,
|
|
1125
|
-
type: "LineString",
|
|
1126
|
-
style: new Style({
|
|
1127
|
-
fill: new Fill({
|
|
1128
|
-
color: "rgba(255, 255, 255, 0.2)"
|
|
1129
|
-
}),
|
|
1130
|
-
stroke: new Stroke({
|
|
1131
|
-
color: "rgba(255,204,51)",
|
|
1132
|
-
lineDash: [10, 10],
|
|
1133
|
-
width: 2
|
|
1134
|
-
}),
|
|
1135
|
-
image: new CircleStyle({
|
|
1136
|
-
radius: 5,
|
|
1137
|
-
stroke: new Stroke({
|
|
1138
|
-
color: "rgba(0, 0, 0, 0.7)"
|
|
1139
|
-
}),
|
|
1140
|
-
fill: new Fill({
|
|
1141
|
-
color: "rgba(255, 255, 255, 0.2)"
|
|
1142
|
-
})
|
|
1143
|
-
})
|
|
1144
|
-
}),
|
|
1145
|
-
// 添加条件函数,判断是否应该出发点绘制
|
|
1146
|
-
condition: (t) => t.originalEvent.target.tagName !== "DIV"
|
|
1147
|
-
}), getInstall().addInteraction(draw$1), createMeasureTooltip$1(), createHelpTooltip$1();
|
|
1148
|
-
let e;
|
|
1149
|
-
draw$1.on("drawstart", function(t) {
|
|
1150
|
-
var o;
|
|
1151
|
-
sketch$1 = t.feature, sketch$1.set("randomId", generateRandomId());
|
|
1152
|
-
let n;
|
|
1153
|
-
e = (o = sketch$1.getGeometry()) == null ? void 0 : o.on("change", function(r) {
|
|
1154
|
-
const l = r.target, a = computedDistance(l, unit.value);
|
|
1155
|
-
n = l.getLastCoordinate(), measureTooltipElement$1 && a && (measureTooltipElement$1.innerHTML = a), measureTooltip$1.setPosition(n);
|
|
1156
|
-
});
|
|
1157
|
-
}), draw$1.on("drawend", function() {
|
|
1158
|
-
var t, n, o;
|
|
1159
|
-
if (measureTooltipElement$1 && (measureTooltipElement$1.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), measureTooltipElement$1 != null && measureTooltipElement$1.innerHTML) {
|
|
1160
|
-
const r = (sketch$1 == null ? void 0 : sketch$1.get("randomId")) || generateRandomId();
|
|
1161
|
-
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>`;
|
|
1162
|
-
}
|
|
1163
|
-
(t = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || t.addEventListener("click", (r) => {
|
|
1164
|
-
var a;
|
|
1165
|
-
r.preventDefault(), r.stopPropagation();
|
|
1166
|
-
const l = (a = r.target) == null ? void 0 : a.getAttribute("data-id");
|
|
1167
|
-
l && deleteLine(l);
|
|
1168
|
-
}), 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));
|
|
1169
|
-
});
|
|
1170
|
-
}, generateRandomId = () => Math.random().toString(36).substring(2, 9);
|
|
1171
|
-
let measureTooltipElement$1, measureTooltip$1;
|
|
1172
|
-
const createMeasureTooltip$1 = () => {
|
|
1173
|
-
measureTooltipElement$1 != null && measureTooltipElement$1.parentNode && measureTooltipElement$1.parentNode.removeChild(measureTooltipElement$1), measureTooltipElement$1 = document.createElement("div"), measureTooltipElement$1.className = "ol-tooltip ol-tooltip-measure", measureTooltip$1 = new Overlay({
|
|
1174
|
-
element: measureTooltipElement$1,
|
|
1175
|
-
offset: [0, -15],
|
|
1176
|
-
positioning: "bottom-center",
|
|
1177
|
-
stopEvent: !1,
|
|
1178
|
-
insertFirst: !1
|
|
1179
|
-
}), getInstall().addOverlay(measureTooltip$1);
|
|
1180
|
-
}, createHelpTooltip$1 = () => {
|
|
1181
|
-
helpTooltipElement$1 != null && helpTooltipElement$1.parentNode && helpTooltipElement$1.parentNode.removeChild(helpTooltipElement$1), helpTooltipElement$1 = document.createElement("div"), helpTooltipElement$1.className = "ol-tooltip hidden", helpTooltip = new Overlay({
|
|
1182
|
-
element: helpTooltipElement$1,
|
|
1183
|
-
offset: [15, 0],
|
|
1184
|
-
positioning: "center-left"
|
|
1185
|
-
}), getInstall().addOverlay(helpTooltip);
|
|
1186
|
-
}, close$1 = () => {
|
|
1187
|
-
measureHistory.value.forEach((e, t) => {
|
|
1188
|
-
var r, l;
|
|
1189
|
-
const n = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1190
|
-
n[t] && ((l = (r = n[t]) == null ? void 0 : r.parentNode) == null || l.removeChild(n[t]));
|
|
1191
|
-
const o = vectorSource$2.getFeatures();
|
|
1192
|
-
o[t] && vectorSource$2.removeFeature(o[t]);
|
|
1193
|
-
}), removeInteraction(), enableDoubleClickZoom(), state.value = !1;
|
|
1194
|
-
}, deleteLine = (e) => {
|
|
1195
|
-
var n, o, r, l;
|
|
1196
|
-
const t = measureHistory.value.findIndex((a) => a.id === e);
|
|
1197
|
-
if (t !== -1) {
|
|
1198
|
-
measureHistory.value.splice(t, 1);
|
|
1199
|
-
const a = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1200
|
-
a[t] && ((o = (n = a[t]) == null ? void 0 : n.parentNode) == null || o.removeChild(a[t]));
|
|
1201
|
-
const s = vectorSource$2.getFeatures();
|
|
1202
|
-
s[t] && vectorSource$2.removeFeature(s[t]);
|
|
1203
|
-
}
|
|
1204
|
-
(r = getProps()) != null && r.lineDrawEnd && ((l = getProps()) == null || l.lineDrawEnd(measureHistory.value));
|
|
1205
|
-
}, computedDistance = (e, t) => {
|
|
1206
|
-
const o = getLength(e);
|
|
1207
|
-
let r = "";
|
|
1208
|
-
switch (t) {
|
|
1209
|
-
case "m":
|
|
1210
|
-
r = `${Math.round(o * 100) / 100} m`;
|
|
1211
|
-
break;
|
|
1212
|
-
case "km":
|
|
1213
|
-
r = `${Math.round(o / 1e3 * 100) / 100} km`;
|
|
1214
|
-
break;
|
|
1215
|
-
case "nm":
|
|
1216
|
-
r = `${Math.round(o / 1.852 * 100) / 100} nm`;
|
|
1217
|
-
break;
|
|
1218
|
-
}
|
|
1219
|
-
return r;
|
|
1220
|
-
}, removeInteraction = () => {
|
|
1221
|
-
measureHistory.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((t) => {
|
|
1222
|
-
var n;
|
|
1223
|
-
(n = t == null ? void 0 : t.parentNode) == null || n.removeChild(t);
|
|
1224
|
-
}), vectorSource$2.clear();
|
|
1225
|
-
const e = getInstall();
|
|
1226
|
-
if (draw$1) {
|
|
1227
|
-
const t = e.getInteractions().getArray().find((n) => getUid(n) === getUid(draw$1));
|
|
1228
|
-
t && e.removeInteraction(t);
|
|
1229
|
-
}
|
|
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);
|
|
1231
|
-
}, getState = () => state.value, drawLine = {
|
|
1232
|
-
open: open$1,
|
|
1233
|
-
close: close$1,
|
|
1234
|
-
deleteLine,
|
|
1235
|
-
setUnit,
|
|
1236
|
-
getState
|
|
1237
|
-
}, mapInstance = ref(), getInstall = () => mapInstance.value, getView = () => getInstall().getView(), getZoom = () => {
|
|
1238
|
-
var e;
|
|
1239
|
-
return (e = getView()) == null ? void 0 : e.getZoom();
|
|
1240
|
-
}, setZoom = (e) => {
|
|
1241
|
-
var t;
|
|
1242
|
-
(t = getView()) == null || t.setZoom(e);
|
|
1243
|
-
}, setCenter = (e, t) => {
|
|
1244
|
-
var n;
|
|
1245
|
-
(n = getView()) == null || n.setCenter(fromLonLat([e, t]));
|
|
1246
|
-
}, getCenter = () => {
|
|
1247
|
-
var t;
|
|
1248
|
-
const e = (t = getView()) == null ? void 0 : t.getCenter();
|
|
1249
|
-
return toLonLat(e);
|
|
1250
|
-
}, getSize = () => {
|
|
1251
|
-
var e;
|
|
1252
|
-
return (e = getInstall()) == null ? void 0 : e.getSize();
|
|
1253
|
-
}, BASE_LAYER_MAP = new Map$2(), initMap = (e) => {
|
|
1254
|
-
setBaseLayerMap(e);
|
|
1255
|
-
const t = {
|
|
1256
|
-
zoom: e.zoom,
|
|
1257
|
-
center: fromLonLat(e.center),
|
|
1258
|
-
minZoom: MAP_ZOOM.min,
|
|
1259
|
-
maxZoom: MAP_ZOOM.max,
|
|
1260
|
-
constrainResolution: !0,
|
|
1261
|
-
enableRotation: !1,
|
|
1262
|
-
multiWorld: !0
|
|
1263
|
-
}, n = new Map$2({
|
|
1264
|
-
target: "map",
|
|
1265
|
-
controls: defaults({
|
|
1266
|
-
zoom: !1
|
|
1267
|
-
}),
|
|
1268
|
-
layers: [
|
|
1269
|
-
BASE_LAYER_MAP.get("vectorTile"),
|
|
1270
|
-
BASE_LAYER_MAP.get("vectorTileMark"),
|
|
1271
|
-
BASE_LAYER_MAP.get("satelliteImgTile"),
|
|
1272
|
-
BASE_LAYER_MAP.get("satelliteImgTileMark")
|
|
1273
|
-
],
|
|
1274
|
-
view: new View(t)
|
|
1275
|
-
});
|
|
1276
|
-
mapInstance.value = n, setBaseMapEvent(n, e);
|
|
1277
|
-
}, setBaseLayerMap = (e) => {
|
|
1278
|
-
BASE_LAYER_MAP.set("vectorTile", new TileLayer({
|
|
1279
|
-
source: new XYZ({ url: BASE_MAP_LINK.vectorTile }),
|
|
1280
|
-
visible: e.layerType === "vector",
|
|
1281
|
-
zIndex: 0,
|
|
1282
|
-
preload: 1,
|
|
1283
|
-
className: "vector"
|
|
1284
|
-
})), BASE_LAYER_MAP.set("vectorTileMark", new TileLayer({
|
|
1285
|
-
source: new XYZ({ url: BASE_MAP_LINK.vectorTileMark }),
|
|
1286
|
-
visible: e.layerType === "vector",
|
|
1287
|
-
zIndex: 1,
|
|
1288
|
-
preload: 1,
|
|
1289
|
-
className: "vector"
|
|
1290
|
-
})), BASE_LAYER_MAP.set("satelliteImgTile", new TileLayer({
|
|
1291
|
-
source: new XYZ({ url: BASE_MAP_LINK.satelliteImgTile }),
|
|
1292
|
-
visible: e.layerType === "satellite",
|
|
1293
|
-
zIndex: 0,
|
|
1294
|
-
preload: 1,
|
|
1295
|
-
className: "satellite"
|
|
1296
|
-
})), BASE_LAYER_MAP.set("satelliteImgTileMark", new TileLayer({
|
|
1297
|
-
source: new XYZ({ url: BASE_MAP_LINK.satelliteImgTileMark }),
|
|
1298
|
-
visible: e.layerType === "satellite",
|
|
1299
|
-
zIndex: 1,
|
|
1300
|
-
preload: 1,
|
|
1301
|
-
className: "satellite"
|
|
1302
|
-
})), BASE_LAYER_MAP.set("greenMark", new TileLayer({
|
|
1303
|
-
source: new XYZ({ url: BASE_MAP_LINK.greenTile }),
|
|
1304
|
-
visible: e.showGreenLayer,
|
|
1305
|
-
zIndex: 2,
|
|
1306
|
-
className: "greenTile"
|
|
1307
|
-
}));
|
|
1308
|
-
}, setBaseMapEvent = (e, t) => {
|
|
1309
|
-
e.on("moveend", () => {
|
|
1310
|
-
var o;
|
|
1311
|
-
const n = getZoom();
|
|
1312
|
-
(o = t.mapMoveEnd) == null || o.call(t, n), reRenderTrackLine();
|
|
1313
|
-
}), e.on("pointermove", (n) => {
|
|
1314
|
-
const o = e.getEventPixel(n.originalEvent), r = e.forEachFeatureAtPixel(o, (l) => l);
|
|
1315
|
-
handleShipMapEvent(r, "hover"), handleTrackMapEvent(r, "hover", n), r && handlePortHover(o);
|
|
1316
|
-
}), e.on("movestart", () => {
|
|
1317
|
-
console.log("movestart-----------------------"), removeSelectedOverlay();
|
|
1318
|
-
}), e.on("click", debounce((n) => {
|
|
1319
|
-
if (console.log("1", drawLine.getState()), drawLine.getState()) return;
|
|
1320
|
-
const o = e.getEventPixel(n.originalEvent), r = e.forEachFeatureAtPixel(
|
|
1321
|
-
o,
|
|
1322
|
-
(l) => {
|
|
1323
|
-
if (l != null && l.get("shipData") || l != null && l.get("portData"))
|
|
1324
|
-
return l;
|
|
1325
|
-
}
|
|
1326
|
-
);
|
|
1327
|
-
if (console.log("2", r), !!r) {
|
|
1328
|
-
if (n.preventDefault(), n.stopPropagation(), r.get("shipData"))
|
|
1329
|
-
handleShipMapEvent(r, "click", t == null ? void 0 : t.selectShip);
|
|
1330
|
-
else if (r.get("portData")) {
|
|
1331
|
-
const l = r.get("portData");
|
|
1332
|
-
selectedPort(l), t == null || t.selectPort(l);
|
|
1333
|
-
}
|
|
1334
|
-
}
|
|
1335
|
-
}, 150));
|
|
1336
|
-
}, _hoisted_1$2 = { id: "scale-line-container" }, _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
1337
|
-
__name: "scaleLine",
|
|
1338
|
-
setup(e, { expose: t }) {
|
|
1339
|
-
return t({
|
|
1340
|
-
setScaleLine: (o) => {
|
|
1341
|
-
o || (o = "metric");
|
|
1342
|
-
const r = new ScaleLine$1({
|
|
1343
|
-
units: o
|
|
1344
|
-
}), l = document.getElementById("scale-line-container");
|
|
1345
|
-
l && (r.setTarget(l), getInstall().addControl(r));
|
|
1346
|
-
}
|
|
1347
|
-
}), (o, r) => (openBlock(), createElementBlock("div", _hoisted_1$2));
|
|
1348
|
-
}
|
|
1349
|
-
}), ScaleLine = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-31ff8293"]]), _hoisted_1$1 = { class: "zoom" }, _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
1350
|
-
__name: "zoomControl",
|
|
1351
|
-
setup(e) {
|
|
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);
|
|
1360
|
-
};
|
|
1361
|
-
return (o, r) => (openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
1362
|
-
createElementVNode("div", {
|
|
1363
|
-
class: "button big-button",
|
|
1364
|
-
onClick: t
|
|
1365
|
-
}, " + "),
|
|
1366
|
-
createElementVNode("div", {
|
|
1367
|
-
class: "button small-button",
|
|
1368
|
-
onClick: n
|
|
1369
|
-
}, " - ")
|
|
1370
|
-
]));
|
|
1371
|
-
}
|
|
1372
|
-
}), ZoomControl = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-2b7e25f2"]]), getLayers = () => {
|
|
1373
|
-
var e;
|
|
1374
|
-
return (e = getInstall()) == null ? void 0 : e.getLayers();
|
|
1375
|
-
}, layerType = ref("vector"), getShowLayerType = () => layerType.value, setShowLayerType = (e) => {
|
|
1376
|
-
if (e === layerType.value) return;
|
|
1377
|
-
getLayers().forEach((n) => {
|
|
1378
|
-
n.className_ === "vector" ? n.setVisible(e === "vector") : n.className_ === "satellite" && n.setVisible(e === "satellite");
|
|
1379
|
-
});
|
|
1380
|
-
}, showGreenTile = ref(), getGreenTileVisible = () => showGreenTile.value, setGreenTileVisible = (e) => {
|
|
1381
|
-
if (e !== showGreenTile.value) {
|
|
1382
|
-
if (e) {
|
|
1383
|
-
const t = getLayers();
|
|
1384
|
-
if (!t.getArray().find((o) => o.className_ === "greenTile")) {
|
|
1385
|
-
const o = new TileLayer({
|
|
1386
|
-
source: new XYZ({ url: BASE_MAP_LINK.greenTile }),
|
|
1387
|
-
visible: e,
|
|
1388
|
-
zIndex: 2,
|
|
1389
|
-
className: "greenTile"
|
|
1390
|
-
});
|
|
1391
|
-
t.push(o);
|
|
1392
|
-
}
|
|
1393
|
-
} else {
|
|
1394
|
-
const t = getLayers(), n = t.getArray().find((o) => o.className_ === "greenTile");
|
|
1395
|
-
n && t.remove(n);
|
|
1396
|
-
}
|
|
1397
|
-
showGreenTile.value = e;
|
|
1398
|
-
}
|
|
1399
|
-
};
|
|
1400
|
-
let storeFeature;
|
|
1401
|
-
const open = () => {
|
|
1402
|
-
init();
|
|
1403
|
-
}, init = () => {
|
|
1404
|
-
initLayer(), createMeasureTooltip(), createHelpTooltip(), initDraw();
|
|
1405
|
-
};
|
|
1406
|
-
let vectorLayer$1 = null, vectorSource$1 = null;
|
|
1407
|
-
const initLayer = () => {
|
|
1408
|
-
if (vectorLayer$1 || vectorSource$1) return;
|
|
1409
|
-
const e = new VectorSource(), t = new VectorLayer({
|
|
1410
|
-
source: e,
|
|
1411
|
-
style: new Style({
|
|
1412
|
-
stroke: new Stroke({
|
|
1413
|
-
color: "#fbcc33",
|
|
1414
|
-
width: 2
|
|
1415
|
-
})
|
|
1416
|
-
})
|
|
1417
|
-
});
|
|
1418
|
-
vectorLayer$1 = t, vectorSource$1 = e;
|
|
1419
|
-
const n = getInstall();
|
|
1420
|
-
n.on("pointermove", pointerMoveHandler), n.addLayer(t), n.on(["dblclick"], function(o) {
|
|
1421
|
-
draw && (o.stopPropagation(), o.preventDefault());
|
|
1422
|
-
});
|
|
1423
|
-
};
|
|
1424
|
-
let sketch;
|
|
1425
|
-
const pointerMoveHandler = (e) => {
|
|
1426
|
-
if (e.dragging) return;
|
|
1427
|
-
const t = sketch ? "单击继续,双击结束" : "点击选择起点";
|
|
1428
|
-
helpTooltipElement && (helpTooltipElement.innerHTML = t, tipOverlay.setPosition(e.coordinate));
|
|
1429
|
-
};
|
|
1430
|
-
let draw, lineLimitError = !1;
|
|
1431
|
-
const initDraw = () => {
|
|
1432
|
-
if (storeFeature) {
|
|
1433
|
-
helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement);
|
|
1434
|
-
const t = storeFeature.getGeometry();
|
|
1435
|
-
if (!t) return;
|
|
1436
|
-
const n = computedArea(t, "nm");
|
|
1437
|
-
measureTooltipElement && (measureTooltipElement.innerHTML = `
|
|
1438
|
-
<span class="text">面积:${n}${lineLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1439
|
-
`), measureTooltipElement && (measureTooltipElement.innerHTML += '<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');
|
|
1440
|
-
const o = t.getCoordinates(), r = o[0][o[0].length - 2];
|
|
1441
|
-
if (measureTooltip.setPosition(r), vectorLayer$1) {
|
|
1442
|
-
const a = vectorLayer$1.getSource();
|
|
1443
|
-
a && storeFeature && (a.clear(), a.addFeature(storeFeature));
|
|
1444
|
-
}
|
|
1445
|
-
setTimeout(() => {
|
|
1446
|
-
var a;
|
|
1447
|
-
(a = document.querySelector(".delete-icon")) == null || a.addEventListener("click", () => {
|
|
1448
|
-
var s;
|
|
1449
|
-
console.log("delete"), reset(), (s = getProps()) == null || s.areaDrawEnd([]);
|
|
1450
|
-
});
|
|
1451
|
-
}, 0);
|
|
1452
|
-
const l = getCenter$1(storeFeature.getGeometry().getExtent());
|
|
1453
|
-
getInstall().getView().setCenter(l);
|
|
1454
|
-
return;
|
|
1455
|
-
}
|
|
1456
|
-
draw = new Draw({
|
|
1457
|
-
type: "Polygon",
|
|
1458
|
-
source: vectorSource$1,
|
|
1459
|
-
trace: !0,
|
|
1460
|
-
style: [new Style({
|
|
1461
|
-
stroke: new Stroke({
|
|
1462
|
-
color: "rgba(255, 255, 255, 1)",
|
|
1463
|
-
width: 1.5,
|
|
1464
|
-
lineDash: [10, 10]
|
|
1465
|
-
}),
|
|
1466
|
-
fill: new Fill({
|
|
1467
|
-
color: "rgba(255, 255, 255, 0.25)"
|
|
1468
|
-
})
|
|
1469
|
-
}), new Style({
|
|
1470
|
-
image: new CircleStyle({
|
|
1471
|
-
radius: 5,
|
|
1472
|
-
fill: new Fill({
|
|
1473
|
-
color: "rgb(51,112,255, 1)"
|
|
1474
|
-
})
|
|
1475
|
-
}),
|
|
1476
|
-
geometry: function(t) {
|
|
1477
|
-
const n = t.getGeometry().getCoordinates();
|
|
1478
|
-
return new MultiPoint(n);
|
|
1479
|
-
}
|
|
1480
|
-
})]
|
|
1481
|
-
}), getInstall().addInteraction(draw);
|
|
1482
|
-
let e;
|
|
1483
|
-
draw.on("drawstart", (t) => {
|
|
1484
|
-
var n;
|
|
1485
|
-
sketch = t.feature, e = (n = sketch.getGeometry()) == null ? void 0 : n.on("change", (o) => {
|
|
1486
|
-
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");
|
|
1487
|
-
if (lineLimitError = Number(getLength(i) / 1e3) > 150, !l) return;
|
|
1488
|
-
const u = '<span class="error pl-4">超出可以绘画的距离</span>';
|
|
1489
|
-
measureTooltipElement && (measureTooltipElement.innerHTML = `
|
|
1490
|
-
<div class="text">
|
|
1491
|
-
面积:${l}
|
|
1492
|
-
${lineLimitError ? u : ""}
|
|
1493
|
-
</div>
|
|
1494
|
-
`), helpTooltipElement && (helpTooltipElement.innerHTML = `
|
|
1495
|
-
<div class="text">
|
|
1496
|
-
面积:${l}
|
|
1497
|
-
</div>
|
|
1498
|
-
<div class="text ${lineLimitError ? "error" : ""}">
|
|
1499
|
-
线段 ${s.length - 2}: ${d}
|
|
1500
|
-
${lineLimitError ? u : ""}
|
|
1501
|
-
|
|
1502
|
-
</div>
|
|
1503
|
-
<div>
|
|
1504
|
-
<span class="text">单击继续,双击结束</span>
|
|
1505
|
-
</div>
|
|
1506
|
-
`);
|
|
1507
|
-
});
|
|
1508
|
-
}), draw.on("drawend", (t) => {
|
|
1509
|
-
var l, a, s;
|
|
1510
|
-
if (!t.feature.getGeometry()) return;
|
|
1511
|
-
storeFeature = t.feature, measureTooltipElement && (measureTooltipElement.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), measureTooltip.setOffset([10, 0]);
|
|
1512
|
-
const n = t.feature.getGeometry(), o = n.getCoordinates(), r = o[0][o[0].length - 2];
|
|
1513
|
-
if (measureTooltip.setPosition(r), helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement), (l = getProps()) != null && l.areaDrawEnd) {
|
|
1514
|
-
n.getInteriorPoint().getCoordinates();
|
|
1515
|
-
const i = o[0].map((d) => transform(d, projection.mercator, projection.data));
|
|
1516
|
-
(a = getProps()) == null || a.areaDrawEnd(i);
|
|
1517
|
-
}
|
|
1518
|
-
draw && (draw.setActive(!1), getInstall().removeInteraction(draw), getInstall().getInteractions().forEach((d) => {
|
|
1519
|
-
d instanceof Draw && (d.setActive(!1), getInstall().removeInteraction(d));
|
|
1520
|
-
})), e && unByKey(e), (s = document.querySelector(".delete-icon")) == null || s.addEventListener("click", () => {
|
|
1521
|
-
var i;
|
|
1522
|
-
reset(), (i = getProps()) == null || i.areaDrawEnd([]);
|
|
1523
|
-
});
|
|
1524
|
-
});
|
|
1525
|
-
}, computedArea = (e, t) => {
|
|
1526
|
-
const n = getArea(e);
|
|
1527
|
-
switch (t) {
|
|
1528
|
-
case "km":
|
|
1529
|
-
return n > 1e4 ? Math.round(n / 1e6 * 100) / 100 + " km<sup>2</sup>" : Math.round(n * 100) / 100 + " m<sup>2</sup>";
|
|
1530
|
-
case "nm":
|
|
1531
|
-
return n > 1e4 ? Math.round(n / 1e6 / Math.pow(1.852, 2) * 100) / 100 + " nm<sup>2</sup>" : Math.round(n * 100) / 100 + " m<sup>2</sup>";
|
|
1532
|
-
}
|
|
1533
|
-
};
|
|
1534
|
-
let measureTooltipElement, measureTooltip;
|
|
1535
|
-
const createMeasureTooltip = () => {
|
|
1536
|
-
measureTooltipElement != null && measureTooltipElement.parentNode && measureTooltipElement.parentNode.removeChild(measureTooltipElement), measureTooltipElement = document.createElement("div"), measureTooltipElement.style.display = "flex", measureTooltipElement.className = "ol-tooltip ol-tooltip-draw-polygon", measureTooltip = new Overlay({
|
|
1537
|
-
element: measureTooltipElement,
|
|
1538
|
-
offset: [0, -15],
|
|
1539
|
-
positioning: "bottom-center",
|
|
1540
|
-
stopEvent: !1,
|
|
1541
|
-
insertFirst: !1
|
|
1542
|
-
}), getInstall().addOverlay(measureTooltip);
|
|
1543
|
-
};
|
|
1544
|
-
let helpTooltipElement, tipOverlay;
|
|
1545
|
-
const createHelpTooltip = () => {
|
|
1546
|
-
helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement), helpTooltipElement = document.createElement("div"), helpTooltipElement.className = "ol-tooltip ol-help-tooltip", tipOverlay = new Overlay({
|
|
1547
|
-
element: helpTooltipElement,
|
|
1548
|
-
offset: [15, 0],
|
|
1549
|
-
positioning: "center-left"
|
|
1550
|
-
}), getInstall().addOverlay(tipOverlay);
|
|
1551
|
-
}, reset = () => {
|
|
1552
|
-
vectorSource$1 == null || vectorSource$1.clear(), storeFeature = null, createMeasureTooltip(), createHelpTooltip(), initDraw();
|
|
1553
|
-
}, close = () => {
|
|
1554
|
-
const e = getInstall();
|
|
1555
|
-
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) => {
|
|
1556
|
-
t instanceof Draw && e.removeInteraction(t);
|
|
1557
|
-
})), helpTooltipElement != null && helpTooltipElement.parentElement && helpTooltipElement.parentElement.removeChild(helpTooltipElement), measureTooltipElement != null && measureTooltipElement.parentElement && measureTooltipElement.parentElement.removeChild(measureTooltipElement), tipOverlay && e.removeOverlay(tipOverlay), measureTooltip && e.removeOverlay(measureTooltip);
|
|
1558
|
-
}, drawPolygon = {
|
|
1559
|
-
open,
|
|
1560
|
-
close,
|
|
1561
|
-
reset
|
|
1562
|
-
};
|
|
1563
|
-
let currentTruckOverlay = null;
|
|
1564
|
-
const locationTruck = async (e) => {
|
|
1565
|
-
const t = getInstall();
|
|
1566
|
-
if (!t || (console.log("vehicleInfo", e), !(e != null && e.lon && (e != null && e.lat)))) return;
|
|
1567
|
-
const n = Math.abs(Number(e.lon)) > 180 ? convertSixHundredThousandToLatLng(e.lon, e.lat) : [e.lon, e.lat];
|
|
1568
|
-
drawTruckIcon(e, fromLonLat(n));
|
|
1569
|
-
const o = t.getView(), r = new Point(n);
|
|
1570
|
-
o.setCenter(transform(r.getCoordinates(), projection.data, projection.mercator));
|
|
1571
|
-
}, drawTruckIcon = (e, t) => {
|
|
1572
|
-
const n = getInstall(), o = `${CDN_URL}map/car-icon.gif`;
|
|
1573
|
-
currentTruckOverlay || (currentTruckOverlay = new Overlay({
|
|
1574
|
-
element: document.createElement("div"),
|
|
1575
|
-
positioning: "center-center",
|
|
1576
|
-
stopEvent: !1
|
|
1577
|
-
// 允许交互事件穿透
|
|
1578
|
-
}), n.addOverlay(currentTruckOverlay));
|
|
1579
|
-
const r = currentTruckOverlay.getElement();
|
|
1580
|
-
r.style.backgroundImage = `url(${o})`, r.style.width = "80px", r.style.height = "80px";
|
|
1581
|
-
const l = (e == null ? void 0 : e.drc) || "";
|
|
1582
|
-
r.style.transform = `rotate(${l}deg)`, r.style.backgroundSize = "cover", currentTruckOverlay == null || currentTruckOverlay.setPosition(t);
|
|
1583
|
-
}, renderTruckTrack = (e, t, n, o = 1e3) => {
|
|
1584
|
-
renderTrackLine(e, t, n, LENGTH_UNIT.KM);
|
|
1585
|
-
}, closeTruckTrack = () => {
|
|
1586
|
-
closeTrack();
|
|
1587
|
-
}, removeTruckIcon = () => {
|
|
1588
|
-
const e = currentTruckOverlay == null ? void 0 : currentTruckOverlay.getElement();
|
|
1589
|
-
e && (e.innerHTML = "");
|
|
1590
|
-
}, resetTrackView = (e) => {
|
|
1591
|
-
setTrackViewCenter(e);
|
|
1592
|
-
}, playTrack = (e, t) => {
|
|
1593
|
-
playShipTrack(e, t);
|
|
1594
|
-
}, LOCATION_LAYER_CLASS_NAME = "zh-map-location-layer";
|
|
1595
|
-
let vectorLayer, vectorSource, selectedPortFeature = null, selectedloactionData = null;
|
|
1596
|
-
const render = (e) => {
|
|
1597
|
-
var t;
|
|
1598
|
-
if (!(!e || e.length === 0)) {
|
|
1599
|
-
if (vectorSource || (vectorSource = new VectorSource()), vectorSource.clear(), selectedloactionData) {
|
|
1600
|
-
const n = e.find((o) => o.id === selectedloactionData.id);
|
|
1601
|
-
n ? selectedloactionData = n : e.push(selectedloactionData);
|
|
1602
|
-
}
|
|
1603
|
-
e.forEach((n) => {
|
|
1604
|
-
renderPortPoint(n);
|
|
1605
|
-
}), vectorLayer || (vectorLayer = new VectorLayer({
|
|
1606
|
-
className: LOCATION_LAYER_CLASS_NAME,
|
|
1607
|
-
source: vectorSource,
|
|
1608
|
-
zIndex: 100
|
|
1609
|
-
}), (t = getInstall()) == null || t.addLayer(vectorLayer));
|
|
1610
|
-
}
|
|
1611
|
-
}, renderPortPoint = (e) => {
|
|
1612
|
-
const t = getZoom(), [n, o] = e.latLon.split(","), r = new Feature({
|
|
1613
|
-
geometry: new Point(fromLonLat([Number(n), Number(o)]))
|
|
1614
|
-
});
|
|
1615
|
-
r.setStyle(setPortStyle(e, t, e.id === (selectedloactionData == null ? void 0 : selectedloactionData.id))), r.set("loactionData", e), vectorSource.addFeature(r);
|
|
1616
|
-
}, setPortStyle = (e, t, n) => {
|
|
1617
|
-
const o = {
|
|
1618
|
-
image: new Icon({
|
|
1619
|
-
src: n && e.selectedPath || e.defaultPath,
|
|
1620
|
-
scale: 0.5 * t / 10
|
|
1621
|
-
})
|
|
1622
|
-
};
|
|
1623
|
-
return e.name && (o.text = new Text({
|
|
1624
|
-
text: e.name,
|
|
1625
|
-
font: "12px sans-serif",
|
|
1626
|
-
fill: new Fill({
|
|
1627
|
-
color: "#000000"
|
|
1628
|
-
}),
|
|
1629
|
-
backgroundFill: new Fill({
|
|
1630
|
-
color: "#FFFFFF"
|
|
1631
|
-
}),
|
|
1632
|
-
offsetY: 30
|
|
1633
|
-
})), new Style(o);
|
|
1634
|
-
}, clearList = () => {
|
|
1635
|
-
if (selectedPortFeature) {
|
|
1636
|
-
const e = selectedPortFeature.get("loactionData").id;
|
|
1637
|
-
vectorSource.getFeatures().forEach((t) => {
|
|
1638
|
-
t.get("loactionData").id !== e && vectorSource.removeFeature(t);
|
|
1639
|
-
});
|
|
1640
|
-
} else
|
|
1641
|
-
vectorSource.clear();
|
|
1642
|
-
}, clearSelected = () => {
|
|
1643
|
-
const e = selectedPortFeature.get("loactionData"), t = getZoom();
|
|
1644
|
-
vectorSource.getFeatures().forEach((o) => {
|
|
1645
|
-
o.get("loactionData").id === e.id && (o == null || o.setStyle(setPortStyle(e, t, !1)));
|
|
1646
|
-
}), selectedloactionData = null, selectedPortFeature = null;
|
|
1647
|
-
}, selectedLocation = (e) => {
|
|
1648
|
-
e ? (clearPrevSelectedPort(), addSelectedPortStyle(e)) : clearSelectedPort();
|
|
1649
|
-
}, clearPrevSelectedPort = () => {
|
|
1650
|
-
if (selectedPortFeature) {
|
|
1651
|
-
const e = selectedPortFeature.get("loactionData"), t = getZoom();
|
|
1652
|
-
selectedPortFeature.setStyle(setPortStyle(e, t, !1));
|
|
1653
|
-
}
|
|
1654
|
-
}, addSelectedPortStyle = (e) => {
|
|
1655
|
-
const t = vectorSource.getFeatures();
|
|
1656
|
-
selectedloactionData = e, selectedPortFeature = t.find((n) => n.get("loactionData").id === e.id);
|
|
1657
|
-
}, position = {
|
|
1658
|
-
render,
|
|
1659
|
-
selected: selectedLocation,
|
|
1660
|
-
clearSelected,
|
|
1661
|
-
clear: clearList
|
|
1662
|
-
}, _hoisted_1 = { class: "zh-map-box" }, _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1663
|
-
__name: "Map",
|
|
1664
|
-
props: {
|
|
1665
|
-
zoom: { default: MAP_ZOOM.default },
|
|
1666
|
-
center: { default: MAP_DEFAULT_CENTER },
|
|
1667
|
-
layerType: { default: "vector" },
|
|
1668
|
-
showGreenLayer: { type: Boolean, default: !1 },
|
|
1669
|
-
showScale: { type: Boolean, default: !0 },
|
|
1670
|
-
scaleLineUnit: { default: "metric" },
|
|
1671
|
-
mapMoveEnd: { type: Function, default: () => {
|
|
1672
|
-
} },
|
|
1673
|
-
lineDrawEnd: {},
|
|
1674
|
-
areaDrawEnd: { type: Function, default: () => {
|
|
1675
|
-
} },
|
|
1676
|
-
selectShip: { type: Function, default: () => {
|
|
1677
|
-
} },
|
|
1678
|
-
selectPort: { type: Function, default: () => {
|
|
1679
|
-
} }
|
|
1680
|
-
},
|
|
1681
|
-
setup(e, { expose: t }) {
|
|
1682
|
-
const n = ref(), o = ref(), r = e;
|
|
1683
|
-
return onMounted(() => {
|
|
1684
|
-
var a;
|
|
1685
|
-
initMap(r), setProps(r), setShowLayerType(r.layerType), setGreenTileVisible(r.showGreenLayer), (a = o.value) == null || a.setScaleLine(r.scaleLineUnit);
|
|
1686
|
-
}), t({
|
|
1687
|
-
getInstall,
|
|
1688
|
-
getZoom,
|
|
1689
|
-
setZoom,
|
|
1690
|
-
getView,
|
|
1691
|
-
setCenter,
|
|
1692
|
-
getCenter,
|
|
1693
|
-
layer: {
|
|
1694
|
-
getGreenTileVisible,
|
|
1695
|
-
setGreenTileVisible,
|
|
1696
|
-
getShowLayerType,
|
|
1697
|
-
setShowLayerType
|
|
1698
|
-
},
|
|
1699
|
-
ship: {
|
|
1700
|
-
render: renderShipList,
|
|
1701
|
-
selected: renderShipSelected,
|
|
1702
|
-
filter: filterShipShow,
|
|
1703
|
-
blinking: renderShipBlink,
|
|
1704
|
-
clear: clearShipList
|
|
1705
|
-
},
|
|
1706
|
-
track: {
|
|
1707
|
-
render: renderTrackLine,
|
|
1708
|
-
remove: removeAllTrackLayer,
|
|
1709
|
-
play: playShipTrack,
|
|
1710
|
-
setCenter: setTrackViewCenter,
|
|
1711
|
-
close: closeTrack,
|
|
1712
|
-
getLength: getTrackLength
|
|
1713
|
-
},
|
|
1714
|
-
port: {
|
|
1715
|
-
render: renderPortList,
|
|
1716
|
-
clear: clearPortList,
|
|
1717
|
-
selected: selectedPort
|
|
1718
|
-
},
|
|
1719
|
-
position,
|
|
1720
|
-
drawLine,
|
|
1721
|
-
// 绘制矩形
|
|
1722
|
-
drawPolygon,
|
|
1723
|
-
carTrack: {
|
|
1724
|
-
location: locationTruck,
|
|
1725
|
-
remove: removeTruckIcon,
|
|
1726
|
-
renderTrack: renderTruckTrack,
|
|
1727
|
-
setCenter: resetTrackView,
|
|
1728
|
-
closeTrack: closeTruckTrack,
|
|
1729
|
-
playTrack
|
|
1730
|
-
},
|
|
1731
|
-
utils: {
|
|
1732
|
-
getCalculateExtent: () => {
|
|
1733
|
-
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);
|
|
1734
|
-
return [s[0], s[1], i[0], i[1]];
|
|
1735
|
-
},
|
|
1736
|
-
convertSixHundredThousandToLatLng,
|
|
1737
|
-
calculateCirclePoints
|
|
1738
|
-
}
|
|
1739
|
-
}), (a, s) => (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
1740
|
-
createElementVNode("div", {
|
|
1741
|
-
id: "map",
|
|
1742
|
-
ref_key: "zhMapRef",
|
|
1743
|
-
ref: n,
|
|
1744
|
-
class: "zh-map"
|
|
1745
|
-
}, null, 512),
|
|
1746
|
-
createVNode(ScaleLine, {
|
|
1747
|
-
ref_key: "scaleLineRef",
|
|
1748
|
-
ref: o
|
|
1749
|
-
}, null, 512),
|
|
1750
|
-
createVNode(ZoomControl, { ref: "zoomControlRef" }, null, 512)
|
|
1751
|
-
]));
|
|
1752
|
-
}
|
|
1753
|
-
}), Map$1 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-d813907c"]]), ZhMap = withInstall(Map$1);
|
|
1754
|
-
export {
|
|
1755
|
-
ZhMap as Z
|
|
1756
|
-
};
|