zhihao-ui 1.3.32 → 1.3.34
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-lEzbpRa-.js → BaseInfo-BhnEjLKF.js} +1 -1
- package/dist/es/{BaseItem-Ba9x8bVd.js → BaseItem-C4NJy1i4.js} +3 -3
- package/dist/es/{Button-BEYBRduL.js → Button-CGndQwez.js} +2 -2
- package/dist/es/{DatePicker-LYMSAOex.js → DatePicker-Dy1K1cJQ.js} +3 -3
- package/dist/es/{DetailHeader-BmAOi010.js → DetailHeader-DaabNj_4.js} +3 -3
- package/dist/es/{DetailSubTitle-BiVypTgw.js → DetailSubTitle-CzFZPXeE.js} +2 -2
- package/dist/es/{Dialog-CxVSOXNv.js → Dialog-BUW6ag1B.js} +3 -3
- package/dist/es/{DiyDataTable-Ccfx_x83.js → DiyDataTable-D-UZVciZ.js} +4 -4
- package/dist/es/{EditInfoPair-B13CtS67.js → EditInfoPair-B2f6zoGY.js} +3 -3
- package/dist/es/{FileWrapper-BS8tKD93.js → FileWrapper-D4IxJemr.js} +4 -4
- package/dist/es/{Grid-C2SGqgzr.js → Grid-DIs695lY.js} +2 -2
- package/dist/es/{InfoPair-Dh7Wmmxp.js → InfoPair-Ce7nDfxD.js} +3 -3
- package/dist/es/{Input-D2hOF2Qz.js → Input-C5X2X_YD.js} +3 -3
- package/dist/es/{Loading-D_TaBO77.js → Loading-BgoEv5qE.js} +2 -2
- package/dist/es/Map-_N_QIApR.js +2169 -0
- package/dist/es/{MessageBox-jeff4H3s.js → MessageBox-DiGH5x51.js} +2 -2
- package/dist/es/{MoneyInput-DsPqwnRE.js → MoneyInput-D0kYiOfP.js} +8 -8
- package/dist/es/{PageHeadPanel-DzTiZsrm.js → PageHeadPanel-C6IdOq6I.js} +2 -2
- package/dist/es/{Table-DVUXl407.js → Table-B_3YA1mb.js} +5 -5
- package/dist/es/{ToolTips-D6btU9GM.js → ToolTips-CiQHxGrw.js} +6 -6
- package/dist/es/index.js +22 -22
- package/dist/es/{utils-BOPMDuno.js → utils-D2wHR1YB.js} +1 -1
- package/dist/es/{vendor-DHIg4jsE.js → vendor-D2mv9LHk.js} +1226 -1227
- package/dist/index.css +1 -1
- package/dist/types/components/Map/function/label.d.ts +9 -0
- package/dist/types/components/Map/function/location.d.ts +7 -0
- package/dist/types/components/Map/function/port.d.ts +2 -2
- package/dist/types/components/Map/function/ship/index.d.ts +1 -0
- package/dist/types/components/Map/function/ship.d.ts +34 -0
- package/dist/types/components/Map/function/shipLabel.d.ts +25 -0
- package/dist/types/components/Map/interface/loaction.d.ts +7 -0
- package/dist/umd/index.css +1 -1
- package/dist/umd/index.umd.cjs +44 -46
- package/package.json +1 -1
- package/dist/es/Map-Ch5zj0xU.js +0 -2175
- package/dist/types/components/Map/utils/util.d.ts +0 -42
|
@@ -0,0 +1,2169 @@
|
|
|
1
|
+
import { defineComponent as Ye, openBlock as Be, createElementBlock as qe, createElementVNode as De, ref as I, computed as Te, h as ne, createVNode as Ae, render as Pt, reactive as St, onMounted as Nt, onUnmounted as Vt } from "vue";
|
|
2
|
+
import { S as $t, M as Ue, T as me, X as we, p as ee, V as zt, q as Ot, t as Rt, h as lt, r as He, s as Zt, u as ge, F as j, v as X, O as ce, P as le, w as ke, x as Ne, L as Pe, y as Gt, z as Ie, A as ie, B as he, C as de, D as ve, i as Dt, G as Ve, H as At, I as Oe, J as Wt, K as Yt, N as st, Q as Se, R as We, U as et, W as Bt, Y as qt, Z as Ht } from "./vendor-D2mv9LHk.js";
|
|
3
|
+
import { _ as Xe } from "./Button-CGndQwez.js";
|
|
4
|
+
import { w as Xt } from "./utils-D2wHR1YB.js";
|
|
5
|
+
const jt = { id: "scale-line-container" }, Qt = /* @__PURE__ */ Ye({
|
|
6
|
+
__name: "scaleLine",
|
|
7
|
+
setup(e, { expose: r }) {
|
|
8
|
+
return r({
|
|
9
|
+
setScaleLine: (s, i) => {
|
|
10
|
+
i || (i = "metric");
|
|
11
|
+
const o = new $t({
|
|
12
|
+
units: i
|
|
13
|
+
}), u = document.getElementById("scale-line-container");
|
|
14
|
+
u && (o.setTarget(u), s.addControl(o));
|
|
15
|
+
}
|
|
16
|
+
}), (s, i) => (Be(), qe("div", jt));
|
|
17
|
+
}
|
|
18
|
+
}), Jt = /* @__PURE__ */ Xe(Qt, [["__scopeId", "data-v-2bc5dee8"]]), Kt = { class: "zoom" }, _t = /* @__PURE__ */ Ye({
|
|
19
|
+
__name: "zoomControl",
|
|
20
|
+
props: {
|
|
21
|
+
mapInstance: {
|
|
22
|
+
type: Object,
|
|
23
|
+
default: () => null
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
setup(e) {
|
|
27
|
+
const r = e;
|
|
28
|
+
console.log("props", r);
|
|
29
|
+
const l = () => {
|
|
30
|
+
console.log("props");
|
|
31
|
+
const { setZoom: i, getZoom: o, getInstall: u } = r.mapInstance.methods;
|
|
32
|
+
if (!u()) return;
|
|
33
|
+
const t = o();
|
|
34
|
+
t && i(t + 1);
|
|
35
|
+
}, s = () => {
|
|
36
|
+
const { setZoom: i, getZoom: o, getInstall: u } = r.mapInstance.methods;
|
|
37
|
+
if (!u()) return;
|
|
38
|
+
const t = o();
|
|
39
|
+
t && i(t - 1);
|
|
40
|
+
};
|
|
41
|
+
return (i, o) => (Be(), qe("div", Kt, [
|
|
42
|
+
De("div", {
|
|
43
|
+
class: "button big-button",
|
|
44
|
+
onClick: l
|
|
45
|
+
}, " + "),
|
|
46
|
+
De("div", {
|
|
47
|
+
class: "button small-button",
|
|
48
|
+
onClick: s
|
|
49
|
+
}, " - ")
|
|
50
|
+
]));
|
|
51
|
+
}
|
|
52
|
+
}), Ut = /* @__PURE__ */ Xe(_t, [["__scopeId", "data-v-c39c3075"]]), Fe = "a6e8f78974f2581f2ca00485b40c948f", te = {
|
|
53
|
+
// 地图默认层级
|
|
54
|
+
default: 13,
|
|
55
|
+
// 地图缩放最小层级
|
|
56
|
+
min: 3,
|
|
57
|
+
// 地图缩放最大层级
|
|
58
|
+
max: 18,
|
|
59
|
+
// 船形图标最小渲染层级
|
|
60
|
+
shipModelMin: 13,
|
|
61
|
+
// 船形图标最小渲染层级
|
|
62
|
+
shipTriggleMin: 16,
|
|
63
|
+
// 船形图标最大渲染层级
|
|
64
|
+
shipModelMax: 18,
|
|
65
|
+
//根据原系统canvas图片转换svg长宽比例计算缩放值
|
|
66
|
+
scaleNum: 0.555
|
|
67
|
+
}, K = {
|
|
68
|
+
// 经纬度 源数据 地理坐标 WGS84
|
|
69
|
+
data: "EPSG:4326",
|
|
70
|
+
// 墨卡托投影坐标 渲染坐标
|
|
71
|
+
mercator: "EPSG:3857"
|
|
72
|
+
}, It = [114.84, 30.52], it = "https://static.zhihaoscm.cn/", $e = 2003750834e-2;
|
|
73
|
+
var ue = ((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=${Fe}`, 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=${Fe}`, 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=${Fe}`, 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=${Fe}`, e.greenTile = `${it}/map/tile/{z}/{x}/{y}.png`, e))(ue || {}), xe = /* @__PURE__ */ ((e) => (e[e.M = 1] = "M", e[e.KM = 2] = "KM", e[e.NM = 3] = "NM", e))(xe || {});
|
|
74
|
+
function eo() {
|
|
75
|
+
const e = I(), r = () => e.value, l = () => r().getView(), s = () => {
|
|
76
|
+
var v;
|
|
77
|
+
return (v = l()) == null ? void 0 : v.getZoom();
|
|
78
|
+
}, i = (v) => {
|
|
79
|
+
var N;
|
|
80
|
+
(N = l()) == null || N.setZoom(v);
|
|
81
|
+
}, o = (v, N) => {
|
|
82
|
+
var M;
|
|
83
|
+
(M = l()) == null || M.setCenter(ee([v, N]));
|
|
84
|
+
}, u = () => {
|
|
85
|
+
var N;
|
|
86
|
+
const v = (N = l()) == null ? void 0 : N.getCenter();
|
|
87
|
+
return Rt(v);
|
|
88
|
+
}, h = () => {
|
|
89
|
+
var v;
|
|
90
|
+
return (v = r()) == null ? void 0 : v.getSize();
|
|
91
|
+
}, t = new Ue(), n = (v, N) => {
|
|
92
|
+
m(N);
|
|
93
|
+
const M = {
|
|
94
|
+
zoom: N.zoom,
|
|
95
|
+
center: ee(N.center),
|
|
96
|
+
minZoom: te.min,
|
|
97
|
+
maxZoom: te.max,
|
|
98
|
+
constrainResolution: !0,
|
|
99
|
+
enableRotation: !1,
|
|
100
|
+
multiWorld: !0
|
|
101
|
+
};
|
|
102
|
+
let y = {
|
|
103
|
+
target: v,
|
|
104
|
+
controls: Ot({
|
|
105
|
+
zoom: !1
|
|
106
|
+
}),
|
|
107
|
+
layers: [
|
|
108
|
+
t.get("vectorTile"),
|
|
109
|
+
t.get("vectorTileMark"),
|
|
110
|
+
t.get("satelliteImgTile"),
|
|
111
|
+
t.get("satelliteImgTileMark")
|
|
112
|
+
],
|
|
113
|
+
view: new zt(M)
|
|
114
|
+
};
|
|
115
|
+
const w = new Ue(y);
|
|
116
|
+
e.value = w;
|
|
117
|
+
}, m = (v) => {
|
|
118
|
+
t.set("vectorTile", new me({
|
|
119
|
+
source: new we({ url: ue.vectorTile }),
|
|
120
|
+
visible: v.layerType === "vector",
|
|
121
|
+
zIndex: 0,
|
|
122
|
+
preload: 1,
|
|
123
|
+
className: "vector"
|
|
124
|
+
})), t.set("vectorTileMark", new me({
|
|
125
|
+
source: new we({ url: ue.vectorTileMark }),
|
|
126
|
+
visible: v.layerType === "vector",
|
|
127
|
+
zIndex: 1,
|
|
128
|
+
preload: 1,
|
|
129
|
+
className: "vector"
|
|
130
|
+
})), t.set("satelliteImgTile", new me({
|
|
131
|
+
source: new we({ url: ue.satelliteImgTile }),
|
|
132
|
+
visible: v.layerType === "satellite",
|
|
133
|
+
zIndex: 0,
|
|
134
|
+
preload: 1,
|
|
135
|
+
className: "satellite"
|
|
136
|
+
})), t.set("satelliteImgTileMark", new me({
|
|
137
|
+
source: new we({ url: ue.satelliteImgTileMark }),
|
|
138
|
+
visible: v.layerType === "satellite",
|
|
139
|
+
zIndex: 1,
|
|
140
|
+
preload: 1,
|
|
141
|
+
className: "satellite"
|
|
142
|
+
})), t.set("greenMark", new me({
|
|
143
|
+
source: new we({ url: ue.greenTile }),
|
|
144
|
+
visible: v.showGreenLayer,
|
|
145
|
+
zIndex: 2,
|
|
146
|
+
className: "greenTile"
|
|
147
|
+
}));
|
|
148
|
+
};
|
|
149
|
+
return {
|
|
150
|
+
getInstall: r,
|
|
151
|
+
getView: l,
|
|
152
|
+
getZoom: s,
|
|
153
|
+
setZoom: i,
|
|
154
|
+
setCenter: o,
|
|
155
|
+
getCenter: u,
|
|
156
|
+
getSize: h,
|
|
157
|
+
initMap: n,
|
|
158
|
+
setBaseLayerMap: m
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
const je = function(e, r) {
|
|
162
|
+
const l = Number(r) / 6e5;
|
|
163
|
+
return [Number(e) / 6e5, l];
|
|
164
|
+
}, to = (e, r) => {
|
|
165
|
+
const l = ee(e), s = r * 1e3, i = [
|
|
166
|
+
l[0] - s,
|
|
167
|
+
l[1] - s,
|
|
168
|
+
l[0] + s,
|
|
169
|
+
l[1] + s
|
|
170
|
+
], o = Zt(i, K.mercator, K.data);
|
|
171
|
+
return {
|
|
172
|
+
leftTopPoint: { lng: o[0], lat: o[3] },
|
|
173
|
+
rightTopPoint: { lng: o[2], lat: o[3] },
|
|
174
|
+
rightBottomPoint: { lng: o[2], lat: o[1] },
|
|
175
|
+
leftBottomPoint: { lng: o[0], lat: o[1] }
|
|
176
|
+
};
|
|
177
|
+
}, oo = function(e, r) {
|
|
178
|
+
const s = He(e);
|
|
179
|
+
let i = "";
|
|
180
|
+
switch (console.log(r, xe), r) {
|
|
181
|
+
case xe.M:
|
|
182
|
+
i = Math.round(s * 100) / 100 + " m";
|
|
183
|
+
break;
|
|
184
|
+
case xe.KM:
|
|
185
|
+
i = Math.round(s / 1e3 * 100) / 100 + " km";
|
|
186
|
+
break;
|
|
187
|
+
case xe.NM:
|
|
188
|
+
i = (Math.round(s / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
return i;
|
|
192
|
+
};
|
|
193
|
+
function ro(e) {
|
|
194
|
+
const r = e[0] * $e / 180;
|
|
195
|
+
let l = Math.log(Math.tan((90 + e[1]) * Math.PI / 360)) / (Math.PI / 180);
|
|
196
|
+
return l = l * $e / 180, [r, l];
|
|
197
|
+
}
|
|
198
|
+
function fe(e = "") {
|
|
199
|
+
let r = e.replace(/&?/g, "&");
|
|
200
|
+
return r = r.replace(/&#x([0-9a-fA-F]+);?/g, (l, s) => {
|
|
201
|
+
const i = parseInt(s, 16);
|
|
202
|
+
return String.fromCodePoint(i);
|
|
203
|
+
}), r;
|
|
204
|
+
}
|
|
205
|
+
const tt = (e) => {
|
|
206
|
+
const r = new ge({
|
|
207
|
+
font: "Normal 14px map-iconfont",
|
|
208
|
+
text: fe(e),
|
|
209
|
+
fill: new j({ color: "#fff" }),
|
|
210
|
+
offsetY: -14
|
|
211
|
+
});
|
|
212
|
+
return new X({
|
|
213
|
+
text: r,
|
|
214
|
+
zIndex: 100
|
|
215
|
+
});
|
|
216
|
+
}, ot = (e, r = "lonlat") => {
|
|
217
|
+
const l = { lon: 0, lat: 0 }, s = e[0] / $e * 180;
|
|
218
|
+
let i = e[1] / $e * 180;
|
|
219
|
+
return i = 180 / Math.PI * (2 * Math.atan(Math.exp(i * Math.PI / 180)) - Math.PI / 2), l.lon = s, l.lat = i, r === "lonlat" ? l : [s, i];
|
|
220
|
+
}, no = (e) => {
|
|
221
|
+
const r = lt.duration(e, "minutes"), l = Math.floor(r.asDays()), s = r.hours(), i = r.minutes();
|
|
222
|
+
let o = `${String(i).padStart(2, "0")}分`;
|
|
223
|
+
return s !== 0 && (o = `${String(s).padStart(2, "0")}时${o}`), l !== 0 && (o = `${String(l).padStart(2, "0")}天${o}`), o;
|
|
224
|
+
}, lo = (e, r) => {
|
|
225
|
+
let l = null;
|
|
226
|
+
const s = async (m) => {
|
|
227
|
+
if (!e || (console.log("vehicleInfo", m), !(m != null && m.lon && (m != null && m.lat)))) return;
|
|
228
|
+
const v = Math.abs(Number(m.lon)) > 180 ? je(m.lon, m.lat) : [m.lon, m.lat];
|
|
229
|
+
i(m, ee(v));
|
|
230
|
+
const N = e == null ? void 0 : e.getView(), M = new le(v);
|
|
231
|
+
N.setCenter(ke(M.getCoordinates(), K.data, K.mercator));
|
|
232
|
+
}, i = (m, v) => {
|
|
233
|
+
const N = `${it}map/car-icon.gif`;
|
|
234
|
+
l || (l = new ce({
|
|
235
|
+
element: document.createElement("div"),
|
|
236
|
+
positioning: "center-center",
|
|
237
|
+
stopEvent: !1
|
|
238
|
+
// 允许交互事件穿透
|
|
239
|
+
}), e.addOverlay(l));
|
|
240
|
+
const M = l.getElement();
|
|
241
|
+
M.style.backgroundImage = `url(${N})`, M.style.width = "80px", M.style.height = "80px";
|
|
242
|
+
const y = (m == null ? void 0 : m.drc) || "";
|
|
243
|
+
M.style.transform = `rotate(${y}deg)`, M.style.backgroundSize = "cover", l == null || l.setPosition(v);
|
|
244
|
+
};
|
|
245
|
+
return {
|
|
246
|
+
location: s,
|
|
247
|
+
remove: () => {
|
|
248
|
+
const m = l == null ? void 0 : l.getElement();
|
|
249
|
+
m && (m.innerHTML = "");
|
|
250
|
+
},
|
|
251
|
+
renderTrack: (m, v, N) => {
|
|
252
|
+
r.render(m, v, N, "truck", 1e3);
|
|
253
|
+
},
|
|
254
|
+
setCenter: (m) => {
|
|
255
|
+
r.setCenter(m);
|
|
256
|
+
},
|
|
257
|
+
closeTrack: () => {
|
|
258
|
+
r.close();
|
|
259
|
+
},
|
|
260
|
+
playTrack: (m, v) => {
|
|
261
|
+
r.play(m, v);
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
var ct = /* @__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))(ct || {}), oe = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.front = "front", e.up = "up", e.down = "down", e.back = "back", e))(oe || {});
|
|
266
|
+
const so = (e) => {
|
|
267
|
+
const r = /* @__PURE__ */ new Map(), l = {};
|
|
268
|
+
let s = null;
|
|
269
|
+
const i = "--";
|
|
270
|
+
let o = null;
|
|
271
|
+
const u = document.createElement("div"), h = new ce({
|
|
272
|
+
element: u,
|
|
273
|
+
positioning: "top-left",
|
|
274
|
+
className: "track-label-popup"
|
|
275
|
+
});
|
|
276
|
+
let t, n, m, v, N, M = !1, y = Date.now(), w, L = 0, C = null, x = 20;
|
|
277
|
+
const W = 8, D = [], q = (c) => {
|
|
278
|
+
var d;
|
|
279
|
+
for (D.unshift(c); D.length > W; ) {
|
|
280
|
+
const f = D.pop(), p = r.get(f);
|
|
281
|
+
p && ((d = p.getSource()) == null || d.clear(), e == null || e.removeLayer(p), r.delete(f), delete l[f]);
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
let B = "";
|
|
285
|
+
const R = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], Z = Ne(() => {
|
|
286
|
+
if (s && l[s] && r.get(s).getVisible()) {
|
|
287
|
+
console.log("reRenderTrackLine------------");
|
|
288
|
+
const c = Dt(S(s, l[s]));
|
|
289
|
+
re(s, c);
|
|
290
|
+
}
|
|
291
|
+
}, 300), S = (c, d) => {
|
|
292
|
+
let f = [];
|
|
293
|
+
const p = Math.max(1, Math.floor(d.length / x));
|
|
294
|
+
return f = d.filter((T, O) => O % p === 0).map((T, O) => {
|
|
295
|
+
if (Number(T.lon) > 180 || Number(T.lat) > 180) {
|
|
296
|
+
const [$, A] = je(T.lon, T.lat);
|
|
297
|
+
T.lon = $, T.lat = A;
|
|
298
|
+
}
|
|
299
|
+
return T.center = [T.lon, T.lat], T.centerPoint = ro(T.center), T.time = lt(T.createdAt).format("YYYY-MM-DD HH:mm:ss"), T.id = c, T.index = O, T;
|
|
300
|
+
}), f;
|
|
301
|
+
}, a = async (c, d, f, p = "ship", E = 200) => {
|
|
302
|
+
if (!e || JSON.stringify(l[c]) === JSON.stringify(d) && s === c || (d = d == null ? void 0 : d.reverse(), h && p === "ship" && (e != null && e.getOverlays().getArray().includes(h) || e.addOverlay(h)), (d == null ? void 0 : d.length) < 2))
|
|
303
|
+
return;
|
|
304
|
+
q(c), s = c, l[c] = d, x = E;
|
|
305
|
+
const T = Object.keys(l).findIndex((O) => O === c) || 0;
|
|
306
|
+
B = f || R[T > 10 ? 10 : T], await k(), await Je(s);
|
|
307
|
+
}, b = (c) => {
|
|
308
|
+
const d = new de();
|
|
309
|
+
return new he({
|
|
310
|
+
source: d,
|
|
311
|
+
visible: !1,
|
|
312
|
+
// 默认隐藏
|
|
313
|
+
className: `track-layer-${c}`,
|
|
314
|
+
renderBuffer: 1024
|
|
315
|
+
// 增大渲染缓冲区
|
|
316
|
+
});
|
|
317
|
+
}, g = (c) => {
|
|
318
|
+
r.forEach((d, f) => {
|
|
319
|
+
var E;
|
|
320
|
+
const p = f === c;
|
|
321
|
+
d.getVisible() !== p && (d.setVisible(p), e.getLayers().getArray().includes(d) || e.addLayer(d), p || (E = d.getSource()) == null || E.clear());
|
|
322
|
+
}), s = c;
|
|
323
|
+
}, k = async () => {
|
|
324
|
+
const c = s;
|
|
325
|
+
if (!r.has(c)) {
|
|
326
|
+
const T = b(c);
|
|
327
|
+
r.set(c, T);
|
|
328
|
+
}
|
|
329
|
+
await g(c);
|
|
330
|
+
const d = B || "", f = l[c] || [];
|
|
331
|
+
if (!(f && f.length > 1)) return [];
|
|
332
|
+
let p = [];
|
|
333
|
+
p = S(c, f);
|
|
334
|
+
const E = p.map((T) => T.centerPoint);
|
|
335
|
+
p.length >= 2 && await F(c, E, d);
|
|
336
|
+
}, F = (c, d, f) => {
|
|
337
|
+
const p = new Pe(d), E = r.get(c).getSource(), T = E.getFeatureById(c);
|
|
338
|
+
if (T)
|
|
339
|
+
T.setGeometry(p), T.setId(c), T.setStyle(V(f)), C = T;
|
|
340
|
+
else {
|
|
341
|
+
const O = new ie({ geometry: p });
|
|
342
|
+
O.setId(c), O.set("type", "line"), O.setStyle(V(f)), E.addFeature(O), C = O;
|
|
343
|
+
}
|
|
344
|
+
return C;
|
|
345
|
+
}, V = (c) => new X({
|
|
346
|
+
stroke: new ve({
|
|
347
|
+
color: c,
|
|
348
|
+
width: 2
|
|
349
|
+
})
|
|
350
|
+
}), G = (c, d, f) => {
|
|
351
|
+
const p = c == null ? void 0 : c.get("trackId");
|
|
352
|
+
if (c && p && d === "hover") {
|
|
353
|
+
e.getTargetElement().style.cursor = p ? "pointer" : "";
|
|
354
|
+
const E = c.get("data"), T = Q(E), O = f == null ? void 0 : f.coordinate;
|
|
355
|
+
O && (u.querySelector(".popup-content"), u.innerHTML = T, h == null || h.setPosition(O));
|
|
356
|
+
} else
|
|
357
|
+
h && h.setPosition(void 0);
|
|
358
|
+
}, Q = (c) => {
|
|
359
|
+
if (!(c != null && c.time)) return;
|
|
360
|
+
let d = "";
|
|
361
|
+
return c != null && c.stayTime && (d = `
|
|
362
|
+
<div class="item w-100">
|
|
363
|
+
<div class="item-label">停泊时间约</div>
|
|
364
|
+
<div class="item-item">${no(Number(c.stayTime))}</div>
|
|
365
|
+
</div>
|
|
366
|
+
`), `
|
|
367
|
+
<div class="track-point-popup">
|
|
368
|
+
<div class="item">
|
|
369
|
+
<div class="item-label">状态</div>
|
|
370
|
+
<div class="item-item">${c != null && c.sailStatus ? ct[c.sailStatus] : i}</div>
|
|
371
|
+
</div>
|
|
372
|
+
<div class="item">
|
|
373
|
+
<div class="item-label">航速</div>
|
|
374
|
+
<div class="item-item">${c.speed || i}</div>
|
|
375
|
+
</div>
|
|
376
|
+
<div class="item">
|
|
377
|
+
<div class="item-label">艏向</div>
|
|
378
|
+
<div class="item-item">${c.hdg || i}</div>
|
|
379
|
+
</div>
|
|
380
|
+
<div class="item">
|
|
381
|
+
<div class="item-label">航向</div>
|
|
382
|
+
<div class="item-item">${c.cog || i}</div>
|
|
383
|
+
</div>
|
|
384
|
+
<div class="item">
|
|
385
|
+
<div class="item-label">经度</div>
|
|
386
|
+
<div class="item-item">${c.lon || i}</div>
|
|
387
|
+
</div>
|
|
388
|
+
<div class="item">
|
|
389
|
+
<div class="item-label">纬度</div>
|
|
390
|
+
<div class="item-item">${c.lat || i}</div>
|
|
391
|
+
</div>
|
|
392
|
+
<div class="item w-100">
|
|
393
|
+
<div class="item-label">时间</div>
|
|
394
|
+
<div class="item-item">${c.time}</div>
|
|
395
|
+
</div>
|
|
396
|
+
${d ?? d}
|
|
397
|
+
</div>`;
|
|
398
|
+
}, z = (c) => {
|
|
399
|
+
const f = c.map(($) => {
|
|
400
|
+
const A = e.getPixelFromCoordinate(ee($.center));
|
|
401
|
+
return {
|
|
402
|
+
...$,
|
|
403
|
+
original: $,
|
|
404
|
+
pixel: A,
|
|
405
|
+
distance: 0
|
|
406
|
+
// 先初始化,后续计算
|
|
407
|
+
};
|
|
408
|
+
});
|
|
409
|
+
let p = 0;
|
|
410
|
+
f[0].distance = 0;
|
|
411
|
+
for (let $ = 1; $ < f.length; $++) {
|
|
412
|
+
const A = f[$ - 1].pixel, H = f[$].pixel, _ = H[0] - A[0], P = H[1] - A[1];
|
|
413
|
+
p += Math.sqrt(_ * _ + P * P), f[$].distance = p;
|
|
414
|
+
}
|
|
415
|
+
const E = f.filter(
|
|
416
|
+
($, A) => A === 0 || A === f.length - 1
|
|
417
|
+
), T = [];
|
|
418
|
+
for (let $ = 0; $ < E.length; $++) {
|
|
419
|
+
const A = E[$];
|
|
420
|
+
if (T.push(A), $ < E.length - 1) {
|
|
421
|
+
const H = E[$ + 1], _ = H.distance - A.distance, P = Math.floor(_ / 100);
|
|
422
|
+
for (let Y = 1; Y <= P; Y++) {
|
|
423
|
+
const J = A.distance + Y * 100;
|
|
424
|
+
if (J >= H.distance) break;
|
|
425
|
+
const U = ae(
|
|
426
|
+
f,
|
|
427
|
+
J
|
|
428
|
+
);
|
|
429
|
+
U && T.push(U);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return Array.from(
|
|
434
|
+
new Map(T.map(($) => [$.distance.toFixed(2), $])).values()
|
|
435
|
+
).map(($) => ({
|
|
436
|
+
...$.original,
|
|
437
|
+
// 优先保留原始数据
|
|
438
|
+
...$,
|
|
439
|
+
// 覆盖坐标等计算属性
|
|
440
|
+
coord: $.coord,
|
|
441
|
+
// 确保使用插值后的坐标
|
|
442
|
+
pixel: $.pixel,
|
|
443
|
+
distance: $.distance
|
|
444
|
+
}));
|
|
445
|
+
};
|
|
446
|
+
function ae(c, d) {
|
|
447
|
+
for (let f = 1; f < c.length; f++) {
|
|
448
|
+
const p = c[f - 1], E = c[f];
|
|
449
|
+
if (d >= p.distance && d <= E.distance) {
|
|
450
|
+
const T = (d - p.distance) / (E.distance - p.distance), O = p.pixel[0] + T * (E.pixel[0] - p.pixel[0]), $ = p.pixel[1] + T * (E.pixel[1] - p.pixel[1]), A = e == null ? void 0 : e.getCoordinateFromPixel([O, $]);
|
|
451
|
+
return {
|
|
452
|
+
...p,
|
|
453
|
+
// 继承前一个点的属性(可调整)
|
|
454
|
+
coord: A,
|
|
455
|
+
pixel: [O, $],
|
|
456
|
+
distance: d,
|
|
457
|
+
original: void 0
|
|
458
|
+
// 明确标记为插值生成点
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return null;
|
|
463
|
+
}
|
|
464
|
+
const re = async (c, d) => {
|
|
465
|
+
await be(), await pe(c);
|
|
466
|
+
const f = z(d), p = f.map((T) => se(T));
|
|
467
|
+
r.get(c).getSource().addFeatures(p), ht(c, f, d, B), f.forEach((T) => {
|
|
468
|
+
const O = Re(c, B, T);
|
|
469
|
+
e.addOverlay(O);
|
|
470
|
+
});
|
|
471
|
+
}, se = (c) => {
|
|
472
|
+
const d = new ie({
|
|
473
|
+
geometry: new le(c.centerPoint),
|
|
474
|
+
data: c
|
|
475
|
+
});
|
|
476
|
+
d.set("type", "track_point"), d.set("trackId", c.id), d.set("data", c);
|
|
477
|
+
let f = [
|
|
478
|
+
...ft(c, B)
|
|
479
|
+
];
|
|
480
|
+
return (c.index === 0 || c.index === l[c.id].length - 1) && (f = [...yt(c)], d.set("type", "track_begin")), c.state !== void 0 && c.state !== null && (f = [...vt(c)], d.set("type", "track_icon")), d.setStyle(f), d;
|
|
481
|
+
}, Re = (c, d, f) => {
|
|
482
|
+
const p = document.createElement("div");
|
|
483
|
+
p.className = "track-overlay-label", p.style.position = "relative", p.style.backgroundColor = "rgba(255,255,255,0.8)", p.style.border = `1px solid ${d}`, p.style.fontSize = "12px", p.innerHTML = `
|
|
484
|
+
<span>${f.time}</span>
|
|
485
|
+
<svg
|
|
486
|
+
style="position: absolute;right: -20px;top: 0;"
|
|
487
|
+
viewBox="0 0 20 20"
|
|
488
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
489
|
+
width="20"
|
|
490
|
+
height="20">
|
|
491
|
+
<line x1="-20" y1="0"
|
|
492
|
+
x2="20" y2="20"
|
|
493
|
+
stroke="${d}"
|
|
494
|
+
stroke-width="1" />
|
|
495
|
+
`;
|
|
496
|
+
const E = new ce({
|
|
497
|
+
element: p,
|
|
498
|
+
position: ee(f.center),
|
|
499
|
+
positioning: "top-right",
|
|
500
|
+
offset: [-20, -20],
|
|
501
|
+
stopEvent: !1,
|
|
502
|
+
className: "track-label-time-overlay"
|
|
503
|
+
});
|
|
504
|
+
return E.set("class", "track-label-overlay"), E.set("trackId", c), E;
|
|
505
|
+
}, be = () => {
|
|
506
|
+
const c = e == null ? void 0 : e.getOverlays().getArray(), d = c == null ? void 0 : c.filter((f) => f.get("class") === "track-label-overlay");
|
|
507
|
+
d && d.length > 0 && d.forEach((f) => {
|
|
508
|
+
f.setPosition(void 0), f.dispose();
|
|
509
|
+
});
|
|
510
|
+
}, pe = (c) => {
|
|
511
|
+
const d = r.get(c).getSource();
|
|
512
|
+
d.forEachFeature((f) => {
|
|
513
|
+
f.get("type") !== "line" && d.removeFeature(f);
|
|
514
|
+
});
|
|
515
|
+
}, ft = (c, d) => (`${c.time}`, [
|
|
516
|
+
new X({
|
|
517
|
+
// 扩大交互热区
|
|
518
|
+
image: new Ve({
|
|
519
|
+
stroke: new ve({ color: "rgba(0, 0, 0, 0.01)", width: 20 }),
|
|
520
|
+
radius: 3
|
|
521
|
+
})
|
|
522
|
+
}),
|
|
523
|
+
// 轨迹点样式
|
|
524
|
+
new X({
|
|
525
|
+
image: new Ve({
|
|
526
|
+
fill: new j({ color: d }),
|
|
527
|
+
stroke: new ve({ color: "#fff", width: 2 }),
|
|
528
|
+
radius: 3
|
|
529
|
+
})
|
|
530
|
+
})
|
|
531
|
+
// textStyle,
|
|
532
|
+
]), vt = (c) => {
|
|
533
|
+
const d = "#E31818", f = "#1890FF", p = "", E = new X({
|
|
534
|
+
text: new ge({
|
|
535
|
+
font: "Normal 22px map-iconfont",
|
|
536
|
+
text: fe(p),
|
|
537
|
+
offsetY: -10,
|
|
538
|
+
fill: new j({
|
|
539
|
+
color: Number(c.state) === 0 ? d : Number(c.state) === 1 ? f : ""
|
|
540
|
+
})
|
|
541
|
+
}),
|
|
542
|
+
zIndex: 99
|
|
543
|
+
}), O = tt(""), A = tt(""), H = [];
|
|
544
|
+
return Number(c.state) === 0 ? H.push(O) : Number(c.state) === 1 && H.push(A), H.push(E), H;
|
|
545
|
+
}, ht = (c, d, f, p) => {
|
|
546
|
+
const E = d || [], T = d.length;
|
|
547
|
+
T || (E.push(f[0]), E.push(f[f.length - 1]));
|
|
548
|
+
const O = [];
|
|
549
|
+
for (let A = 0; A < T - 1; A++) {
|
|
550
|
+
let H;
|
|
551
|
+
const _ = d[A], P = (d[A + 1].index + _.index) / 2;
|
|
552
|
+
if (P % 2 === 0)
|
|
553
|
+
H = f[P].centerPoint;
|
|
554
|
+
else {
|
|
555
|
+
const Y = f[Math.floor(P)], J = f[Math.ceil(P)];
|
|
556
|
+
if (Y && J) {
|
|
557
|
+
const [U, Ce] = Y.centerPoint, [Le, Ee] = J.centerPoint;
|
|
558
|
+
H = [(U + Le) / 2, (Ce + Ee) / 2];
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
if (H) {
|
|
562
|
+
const Y = new ie({
|
|
563
|
+
geometry: new le(H)
|
|
564
|
+
});
|
|
565
|
+
Y.set("type", "track_arrow"), Y.setStyle(
|
|
566
|
+
new X({
|
|
567
|
+
text: new ge({
|
|
568
|
+
font: "700 12px map-iconfont",
|
|
569
|
+
text: fe(""),
|
|
570
|
+
fill: new j({ color: p }),
|
|
571
|
+
// 设置箭头旋转 角度转为弧度
|
|
572
|
+
rotation: Ke(
|
|
573
|
+
d[A].center,
|
|
574
|
+
d[A + 1].center
|
|
575
|
+
) * (Math.PI / 180)
|
|
576
|
+
})
|
|
577
|
+
})
|
|
578
|
+
), O.push(Y);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
const $ = r.get(c).getSource();
|
|
582
|
+
$ == null || $.addFeatures(O);
|
|
583
|
+
}, Je = (c) => {
|
|
584
|
+
var T, O;
|
|
585
|
+
const d = e.getView(), f = (T = r == null ? void 0 : r.get(c)) == null ? void 0 : T.getSource(), p = C || (c ? f == null ? void 0 : f.getFeatureById(c) : null);
|
|
586
|
+
if (!p) return;
|
|
587
|
+
const E = (O = p == null ? void 0 : p.getGeometry()) == null ? void 0 : O.getExtent();
|
|
588
|
+
if (E != null && E.length)
|
|
589
|
+
try {
|
|
590
|
+
const $ = Gt(E, Math.max(E[2] - E[0], E[3] - E[1]) * 0.02);
|
|
591
|
+
d.fit($);
|
|
592
|
+
} catch ($) {
|
|
593
|
+
console.log($);
|
|
594
|
+
}
|
|
595
|
+
}, yt = (c) => {
|
|
596
|
+
const d = "", E = c.index === 0 ? "#fcdc3f" : "#ff0000";
|
|
597
|
+
return [new X({
|
|
598
|
+
text: new ge({
|
|
599
|
+
font: "Normal 14px map-iconfont",
|
|
600
|
+
text: fe(d),
|
|
601
|
+
fill: new j({ color: E })
|
|
602
|
+
}),
|
|
603
|
+
zIndex: 101
|
|
604
|
+
})];
|
|
605
|
+
}, mt = () => {
|
|
606
|
+
console.log("清除所有的轨迹-----"), Me(), r.forEach((d) => {
|
|
607
|
+
var f;
|
|
608
|
+
(f = d.getSource()) == null || f.clear(), e == null || e.removeLayer(d);
|
|
609
|
+
}), Object.keys(l).forEach((d) => {
|
|
610
|
+
r.delete(d), delete l[d];
|
|
611
|
+
}), isRender = !1, be();
|
|
612
|
+
}, wt = (c) => {
|
|
613
|
+
const d = r.get(c || s);
|
|
614
|
+
d == null || d.setVisible(!1);
|
|
615
|
+
const f = e.getOverlays().getArray();
|
|
616
|
+
for (let p = 0; p < f.length; ) {
|
|
617
|
+
const E = f[p];
|
|
618
|
+
E.get("class") === "track-label-overlay" ? (E.setPosition(void 0), e.removeOverlay(E)) : p++;
|
|
619
|
+
}
|
|
620
|
+
Me();
|
|
621
|
+
}, xt = (c, d = xe.NM) => {
|
|
622
|
+
const f = {
|
|
623
|
+
id: c,
|
|
624
|
+
length: "--"
|
|
625
|
+
}, E = (l[c] || []).map(
|
|
626
|
+
(O) => ke([O.lon, O.lat], K.data, K.mercator)
|
|
627
|
+
), T = new Pe(E);
|
|
628
|
+
return f.length = oo(T, d) || "--", f;
|
|
629
|
+
}, bt = (c, d) => {
|
|
630
|
+
kt(String(c), d);
|
|
631
|
+
}, kt = (c, d) => {
|
|
632
|
+
const f = l[String(c)], p = f == null ? void 0 : f.map((E) => [E.lon, E.lat]);
|
|
633
|
+
p && Ct(p, d);
|
|
634
|
+
}, Ze = new X({
|
|
635
|
+
text: new ge({
|
|
636
|
+
font: "700 20px map-iconfont",
|
|
637
|
+
text: fe(""),
|
|
638
|
+
fill: new j({ color: "#ff0000" }),
|
|
639
|
+
rotation: 0
|
|
640
|
+
// 初始旋转角度
|
|
641
|
+
})
|
|
642
|
+
}), pt = (c, d) => {
|
|
643
|
+
var P, Y;
|
|
644
|
+
const f = Number(50 * d), p = ((P = c.frameState) == null ? void 0 : P.time) ?? Date.now(), E = p - y;
|
|
645
|
+
if (L = (L + f * E / 1e6) % 2, y = p, L >= 1) {
|
|
646
|
+
Me();
|
|
647
|
+
return;
|
|
648
|
+
}
|
|
649
|
+
const T = n.getCoordinateAt(
|
|
650
|
+
L > 1 ? 2 - L : L
|
|
651
|
+
), O = n.getCoordinateAt(
|
|
652
|
+
L > 1 ? L - 0.01 : L
|
|
653
|
+
), $ = n.getCoordinateAt(
|
|
654
|
+
L > 1 ? 2 - L : L + 0.01
|
|
655
|
+
), H = Ke(
|
|
656
|
+
ot(O, "array"),
|
|
657
|
+
ot($, "array")
|
|
658
|
+
) * Math.PI / 180;
|
|
659
|
+
(Y = Ze.getText()) == null || Y.setRotation(H), v.setCoordinates(T);
|
|
660
|
+
const _ = At(c);
|
|
661
|
+
_.setStyle(Ze), _.drawGeometry(v), e == null || e.render();
|
|
662
|
+
}, Mt = () => {
|
|
663
|
+
var c;
|
|
664
|
+
M = !0, y = Date.now(), L = 0, v = ((c = m.getGeometry()) == null ? void 0 : c.clone()) || new le([0, 0]), o && (w == null || w.on("postrender", o)), N == null || N.setGeometry(void 0);
|
|
665
|
+
}, Me = () => {
|
|
666
|
+
M && (M = !1, N == null || N.setGeometry(void 0), o && w && w.un("postrender", o), w && (e == null || e.removeLayer(w)), w = null, N = null);
|
|
667
|
+
}, Ct = (c, d) => {
|
|
668
|
+
M && Me(), t = new Ie({
|
|
669
|
+
factor: 1e6
|
|
670
|
+
}).writeGeometry(new Pe(c)), n = new Ie({
|
|
671
|
+
factor: 1e6
|
|
672
|
+
}).readGeometry(t, {
|
|
673
|
+
dataProjection: K.data,
|
|
674
|
+
featureProjection: K.mercator
|
|
675
|
+
}), m = new ie({
|
|
676
|
+
type: "icon",
|
|
677
|
+
geometry: new le(n.getFirstCoordinate())
|
|
678
|
+
});
|
|
679
|
+
const f = m.getGeometry();
|
|
680
|
+
v = f ? f.clone() : new le([0, 0]), N = new ie({
|
|
681
|
+
type: "geoMarker",
|
|
682
|
+
style: Ze,
|
|
683
|
+
geometry: v
|
|
684
|
+
}), w = new he({
|
|
685
|
+
source: new de({
|
|
686
|
+
features: [N]
|
|
687
|
+
})
|
|
688
|
+
}), e == null || e.addLayer(w), o = (p) => pt(p, d), Mt();
|
|
689
|
+
}, Ke = (c, d, f) => {
|
|
690
|
+
function p(P) {
|
|
691
|
+
return 180 * (P % (2 * Math.PI)) / Math.PI;
|
|
692
|
+
}
|
|
693
|
+
function E(P) {
|
|
694
|
+
return P % 360 * Math.PI / 180;
|
|
695
|
+
}
|
|
696
|
+
function T(P) {
|
|
697
|
+
var Y;
|
|
698
|
+
if (!P) throw new Error("Coordinate is required");
|
|
699
|
+
if (!Array.isArray(P)) {
|
|
700
|
+
if ((P == null ? void 0 : P.type) === "Feature" && (P == null ? void 0 : P.geometry) !== null && ((Y = P == null ? void 0 : P.geometry) == null ? void 0 : Y.type) === "Point")
|
|
701
|
+
return P == null ? void 0 : P.geometry.coordinates;
|
|
702
|
+
if (P.type === "Point") return (P == null ? void 0 : P.coordinates) || [];
|
|
703
|
+
}
|
|
704
|
+
if (Array.isArray(P) && P.length >= 2 && !Array.isArray(P[0]) && !Array.isArray(P[1]))
|
|
705
|
+
return P;
|
|
706
|
+
throw new Error(
|
|
707
|
+
"Coordinate must be GeoJSON Point or an Array of numbers"
|
|
708
|
+
);
|
|
709
|
+
}
|
|
710
|
+
function O(P, Y, J = {}) {
|
|
711
|
+
if (J.final)
|
|
712
|
+
return function(Tt, Ft) {
|
|
713
|
+
return (O(Ft, Tt) + 180) % 360;
|
|
714
|
+
}(P, Y);
|
|
715
|
+
const U = T(P), Ce = T(Y), Le = E(U[0]), Ee = E(Ce[0]), _e = E(U[1]), Ge = E(Ce[1]), Lt = Math.sin(Ee - Le) * Math.cos(Ge), Et = Math.cos(_e) * Math.sin(Ge) - Math.sin(_e) * Math.cos(Ge) * Math.cos(Ee - Le);
|
|
716
|
+
return p(Math.atan2(Lt, Et));
|
|
717
|
+
}
|
|
718
|
+
function $(P) {
|
|
719
|
+
return !isNaN(P) && P !== null && !Array.isArray(P);
|
|
720
|
+
}
|
|
721
|
+
function A(P, Y = {}, J = {}) {
|
|
722
|
+
return P || console.log("Coordinates are required"), Array.isArray(P) || console.log("Coordinates must be an Array"), P.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (!$(P[0]) || !$(P[1])) && console.log("Coordinates must contain numbers"), H({ type: "Point", coordinates: P }, Y, J);
|
|
723
|
+
}
|
|
724
|
+
function H(P, Y = {}, J = {}) {
|
|
725
|
+
const U = {
|
|
726
|
+
type: "Feature",
|
|
727
|
+
id: "",
|
|
728
|
+
properties: {},
|
|
729
|
+
bbox: {},
|
|
730
|
+
geometry: {}
|
|
731
|
+
};
|
|
732
|
+
return J.id !== void 0 && (U.id = J.id), J.bbox && (U.bbox = J.bbox), U.properties = Y, U.geometry = P, U;
|
|
733
|
+
}
|
|
734
|
+
const _ = O(A(c), A(d), f);
|
|
735
|
+
return _ < 0 ? 360 + _ : _;
|
|
736
|
+
};
|
|
737
|
+
return {
|
|
738
|
+
render: a,
|
|
739
|
+
remove: mt,
|
|
740
|
+
play: bt,
|
|
741
|
+
setCenter: Je,
|
|
742
|
+
close: wt,
|
|
743
|
+
getLength: xt,
|
|
744
|
+
handleTrackMapEvent: G,
|
|
745
|
+
reRenderTrackLine: Z
|
|
746
|
+
};
|
|
747
|
+
};
|
|
748
|
+
function io(e) {
|
|
749
|
+
console.log("useShipOverlay", e);
|
|
750
|
+
const r = I(null), l = Te(() => ({
|
|
751
|
+
"--overlay-color": "#FFF",
|
|
752
|
+
"--bg-color1": e.colors && e.colors[0] ? e.colors[0] : "#ffffff",
|
|
753
|
+
// 默认第一个颜色
|
|
754
|
+
"--bg-color2": e.colors && e.colors[1] ? e.colors[1] : "#ffffff",
|
|
755
|
+
"--bg-color": "#ffffff",
|
|
756
|
+
position: "relative",
|
|
757
|
+
"pointer-events": "none"
|
|
758
|
+
})), s = Te(() => {
|
|
759
|
+
var u;
|
|
760
|
+
return {
|
|
761
|
+
position: "relative",
|
|
762
|
+
"border-radius": "1px",
|
|
763
|
+
"background-color": "var(--content-bg)",
|
|
764
|
+
color: "#000",
|
|
765
|
+
padding: "2px 5px 2px 0px",
|
|
766
|
+
font: "500 Normal 12px",
|
|
767
|
+
"font-size": "12px",
|
|
768
|
+
"box-shadow": "0 2px 10px rgba(0, 0, 0, 0.2)",
|
|
769
|
+
"white-space": "nowrap",
|
|
770
|
+
border: "1px solid #FFF",
|
|
771
|
+
"pointer-events": "auto",
|
|
772
|
+
// 'transition': 'background-color 0.5s ease, border 0.5s ease',
|
|
773
|
+
"z-index": "1",
|
|
774
|
+
display: "flex",
|
|
775
|
+
"align-items": "center",
|
|
776
|
+
animation: e.selected ? e.colors && ((u = e.colors) == null ? void 0 : u.length) >= 2 ? "blink-dual 2s ease-in-out infinite" : "blink-single 1.5s ease-in-out infinite" : "none"
|
|
777
|
+
// "animation": props.selected ? 'blink 1.5s ease-in-out infinite' : 'none', // 动画开关
|
|
778
|
+
};
|
|
779
|
+
}), i = Te(() => ({
|
|
780
|
+
width: "14px",
|
|
781
|
+
height: "14px",
|
|
782
|
+
margin: "1px 5px 1px 1px",
|
|
783
|
+
"background-color": "var(--attention-bg)"
|
|
784
|
+
})), o = Te(() => ({
|
|
785
|
+
position: "absolute",
|
|
786
|
+
top: "0px",
|
|
787
|
+
color: "var(--overlay-color)",
|
|
788
|
+
"pointer-events": "none",
|
|
789
|
+
transform: "translateY(-1px)",
|
|
790
|
+
"z-index": "0",
|
|
791
|
+
width: "20px",
|
|
792
|
+
height: "20px",
|
|
793
|
+
overflow: "visible",
|
|
794
|
+
left: "-20px"
|
|
795
|
+
}));
|
|
796
|
+
return () => ne("div", {
|
|
797
|
+
ref: r,
|
|
798
|
+
class: "ship-overlay-container",
|
|
799
|
+
style: l.value
|
|
800
|
+
}, [
|
|
801
|
+
ne(
|
|
802
|
+
"div",
|
|
803
|
+
{
|
|
804
|
+
class: "ship-overlay-content",
|
|
805
|
+
style: s.value
|
|
806
|
+
},
|
|
807
|
+
[
|
|
808
|
+
ne("div", {
|
|
809
|
+
style: e.selected ? i.value : {}
|
|
810
|
+
}, ""),
|
|
811
|
+
ne("div", {
|
|
812
|
+
class: "text",
|
|
813
|
+
style: {
|
|
814
|
+
fontSize: "12px",
|
|
815
|
+
fontWeight: 500,
|
|
816
|
+
fontFamily: "Arial"
|
|
817
|
+
}
|
|
818
|
+
}, e.name || "未命名船舶"),
|
|
819
|
+
ne("div", {
|
|
820
|
+
class: "icons",
|
|
821
|
+
style: {
|
|
822
|
+
color: "#3370ff"
|
|
823
|
+
}
|
|
824
|
+
}, [
|
|
825
|
+
e.existDevice ? ne("i", {
|
|
826
|
+
class: "map-iconfont icon-camera",
|
|
827
|
+
style: {
|
|
828
|
+
fontSize: "12px"
|
|
829
|
+
}
|
|
830
|
+
}) : "",
|
|
831
|
+
e.existMobile ? ne("i", {
|
|
832
|
+
class: "map-iconfont icon-tele",
|
|
833
|
+
style: {
|
|
834
|
+
fontSize: "12px"
|
|
835
|
+
}
|
|
836
|
+
}) : "",
|
|
837
|
+
e.existWaterGauge ? ne("i", {
|
|
838
|
+
class: "map-iconfont icon-ruler",
|
|
839
|
+
style: {
|
|
840
|
+
fontSize: "12px"
|
|
841
|
+
}
|
|
842
|
+
}) : ""
|
|
843
|
+
])
|
|
844
|
+
]
|
|
845
|
+
),
|
|
846
|
+
ne("svg", {
|
|
847
|
+
class: "ship-overlay-line",
|
|
848
|
+
style: o.value,
|
|
849
|
+
viewBox: "0 0 20 20",
|
|
850
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
851
|
+
}, [
|
|
852
|
+
ne("line", {
|
|
853
|
+
x1: "0",
|
|
854
|
+
y1: "20",
|
|
855
|
+
x2: "20",
|
|
856
|
+
y2: "4",
|
|
857
|
+
stroke: "white",
|
|
858
|
+
"stroke-width": "1"
|
|
859
|
+
})
|
|
860
|
+
])
|
|
861
|
+
]);
|
|
862
|
+
}
|
|
863
|
+
I([]);
|
|
864
|
+
function co(e, r, l, s) {
|
|
865
|
+
if (r) {
|
|
866
|
+
const i = new ce({
|
|
867
|
+
element: l,
|
|
868
|
+
positioning: "top-left",
|
|
869
|
+
id: "label-" + (s == null ? void 0 : s.id),
|
|
870
|
+
offset: [20, -20],
|
|
871
|
+
autoPan: !1,
|
|
872
|
+
position: r,
|
|
873
|
+
className: s.blinking ? "ship-label-overlay-blinking" : "ship-label-overlay"
|
|
874
|
+
});
|
|
875
|
+
i.set("class", "zh-map-ship-overlay"), e.addOverlay(i);
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
const ao = (e) => {
|
|
879
|
+
const { spd: r, hdg: l, cog: s } = e;
|
|
880
|
+
return r ? l !== null && +l != 511 && s !== null ? s - +l >= 3 ? oe.right : s - +l <= -3 ? oe.left : oe.front : oe.front : "";
|
|
881
|
+
}, ye = (e, r) => {
|
|
882
|
+
const { shipData: l } = r.getProperties(), s = at(e), i = Qe(e, l, s);
|
|
883
|
+
return uo(r, i, s);
|
|
884
|
+
}, at = (e) => {
|
|
885
|
+
const r = e == null ? void 0 : e.getView().getZoom();
|
|
886
|
+
return r <= te.shipModelMax && r >= te.shipTriggleMin ? "ship" : "triangle";
|
|
887
|
+
}, Qe = (e, r, l) => {
|
|
888
|
+
if (l === "ship") {
|
|
889
|
+
const { len: s, wid: i } = r, o = 97, u = 20, t = 1 / (e == null ? void 0 : e.getView().getResolution()), n = s * t / o, m = i * t / u, v = Math.min(n, m);
|
|
890
|
+
return v < 0.2 ? 0.2 : v > 2 ? 2 : v;
|
|
891
|
+
}
|
|
892
|
+
return te.scaleNum;
|
|
893
|
+
}, uo = (e, r, l) => {
|
|
894
|
+
const { color: s, direct: i, isHighlight: o, shipData: u } = e.getProperties(), h = ((u == null ? void 0 : u.cog) - 90 + 360) % 360;
|
|
895
|
+
return new X({
|
|
896
|
+
image: new Oe({
|
|
897
|
+
src: t(),
|
|
898
|
+
scale: r || te.scaleNum,
|
|
899
|
+
anchor: [0.5, 0.5],
|
|
900
|
+
rotation: h * Math.PI / 180,
|
|
901
|
+
rotateWithView: !1
|
|
902
|
+
})
|
|
903
|
+
});
|
|
904
|
+
function t() {
|
|
905
|
+
return `data:image/svg+xml;utf8,${encodeURIComponent(n())}`;
|
|
906
|
+
}
|
|
907
|
+
function n() {
|
|
908
|
+
switch (l) {
|
|
909
|
+
case "triangle":
|
|
910
|
+
return `<svg width="41" height="24" viewBox="0 0 41 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
911
|
+
<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"
|
|
912
|
+
fill="${s}" stroke="${o ? "#FF2424" : "black"}" stroke-width="${o ? "2" : "0.578947"}" />
|
|
913
|
+
<!--path船航向左边或者向前-->
|
|
914
|
+
${i === oe.left && `<path d="M30 12L40 12L40 8" stroke="${o ? "#FF2424" : "black"}" stroke-width="2"/>`}
|
|
915
|
+
<!--path船航向右边-->
|
|
916
|
+
${i === oe.right && `<path d="M30 12L40 12L40 16" stroke="${o ? "#FF2424" : "black"}" stroke-width="2"/>`}
|
|
917
|
+
<!--path黑线无左右-->
|
|
918
|
+
${i === oe.front && `<path d="M30 12L40 12" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
919
|
+
</svg>
|
|
920
|
+
`;
|
|
921
|
+
case "ship":
|
|
922
|
+
return `<svg width="97" height="20" viewBox="0 0 97 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
923
|
+
<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"
|
|
924
|
+
fill="${s}" stroke="${o ? "#FF2424" : "black"}" stroke-width="${o ? "4" : "0.578947"}"/>
|
|
925
|
+
${i === oe.left && `<path d="M86 10L96 10L96 6" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
926
|
+
${i === oe.right && `<path d="M86 10L96 10L96 14" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
927
|
+
${i === oe.front && `<path d="M86 10L96 10" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
928
|
+
</svg>
|
|
929
|
+
`;
|
|
930
|
+
default:
|
|
931
|
+
return "";
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
}, go = (e, r) => {
|
|
935
|
+
const l = dt(e, r), s = r.id, { lon: i, lat: o } = r, u = new ce({
|
|
936
|
+
element: l,
|
|
937
|
+
position: ee([i, o]),
|
|
938
|
+
id: "selected-" + s,
|
|
939
|
+
positioning: "center-center",
|
|
940
|
+
offset: [0, 5],
|
|
941
|
+
className: "ship-selected-overlay"
|
|
942
|
+
});
|
|
943
|
+
return u.set("class", "ship-overlay-selected"), u;
|
|
944
|
+
}, dt = (e, r) => {
|
|
945
|
+
const l = at(e), s = Qe(e, r, l), i = l === "ship" ? 109 : 49, o = `
|
|
946
|
+
<svg style="transform:scale(${s});" xmlns="http://www.w3.org/2000/svg" width="${i}" height="${i}" viewBox="0 0 49 49" fill="none">
|
|
947
|
+
<path d="M1.99982 46.9998L1.99982 1.99982L46.9998 1.99982L46.9998 46.9998L1.99982 46.9998Z" fill="#FF2424" fill-opacity="0.2"/>
|
|
948
|
+
<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"/>
|
|
949
|
+
</svg>
|
|
950
|
+
`, u = document.createElement("div");
|
|
951
|
+
return u.className = "ship-overlay-selected", u.innerHTML = o, u;
|
|
952
|
+
}, fo = (e, r) => {
|
|
953
|
+
const { lon: l, lat: s, blinking: i } = r, o = ut(r);
|
|
954
|
+
l && s && co(e, ee([l, s]), o, { ...r, blinking: i });
|
|
955
|
+
}, ut = (e) => {
|
|
956
|
+
const r = document.createElement("div");
|
|
957
|
+
r.className = "ship-overlay-box", r.style.position = "relative";
|
|
958
|
+
const { lon: l, lat: s, blinking: i, blinkingColors: o, name: u } = e, h = Ae({
|
|
959
|
+
setup() {
|
|
960
|
+
return io({
|
|
961
|
+
position: [l + 2e-3, s + 2e-3],
|
|
962
|
+
selected: i,
|
|
963
|
+
name: u,
|
|
964
|
+
colors: o || [],
|
|
965
|
+
existDevice: e == null ? void 0 : e.existDevice,
|
|
966
|
+
existMobile: e == null ? void 0 : e.existMobile,
|
|
967
|
+
existWaterGauge: e == null ? void 0 : e.existWaterGauge
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
});
|
|
971
|
+
return Pt(h, r), r;
|
|
972
|
+
}, rt = (e) => {
|
|
973
|
+
const r = [];
|
|
974
|
+
return e.existDevice && r.push(""), e.existMobile && r.push(""), e.existWaterGauge && r.push(""), r;
|
|
975
|
+
};
|
|
976
|
+
function vo() {
|
|
977
|
+
const e = [
|
|
978
|
+
"left-top",
|
|
979
|
+
"left-middle",
|
|
980
|
+
"left-bottom",
|
|
981
|
+
"right-top",
|
|
982
|
+
"right-middle",
|
|
983
|
+
"right-bottom"
|
|
984
|
+
];
|
|
985
|
+
return e[Math.floor(Math.random() * e.length)];
|
|
986
|
+
}
|
|
987
|
+
const ho = window.devicePixelRatio || 1;
|
|
988
|
+
function yo(e, r, l = "left-bottom", s = 2) {
|
|
989
|
+
const i = document.createElement("canvas"), o = i.getContext("2d");
|
|
990
|
+
if (!o) return "";
|
|
991
|
+
const u = 2, h = 8, t = 16, n = window.devicePixelRatio || 1, m = "500 12px Arial", v = "14px map-iconfont";
|
|
992
|
+
o.font = m;
|
|
993
|
+
const M = o.measureText(e).width;
|
|
994
|
+
o.font = v;
|
|
995
|
+
const y = r.map((k) => ({ width: o.measureText(fe(k)).width, height: 14 })), w = y.reduce((k, F) => k + F.width, 0), L = (r.length - 1) * s, C = h + M + w + L + h, x = u + 14 + u;
|
|
996
|
+
let W, D, q = 0, B = 0, R = 0, Z = 0, S = 0, a = 0;
|
|
997
|
+
switch (W = t + C, l) {
|
|
998
|
+
case "right-top":
|
|
999
|
+
D = t + x, q = 0, B = t + x, R = t, Z = 0, S = t, a = 0;
|
|
1000
|
+
break;
|
|
1001
|
+
case "right-middle":
|
|
1002
|
+
D = x, q = 0, B = x / 2, R = t, Z = x / 2, S = t, a = 0;
|
|
1003
|
+
break;
|
|
1004
|
+
case "right-bottom":
|
|
1005
|
+
D = t + x, q = 0, B = 0, R = t, Z = t, S = t, a = t;
|
|
1006
|
+
break;
|
|
1007
|
+
case "left-top":
|
|
1008
|
+
D = t + x, q = C, B = t, R = C + t, Z = x + t, S = 0, a = 0;
|
|
1009
|
+
break;
|
|
1010
|
+
case "left-middle":
|
|
1011
|
+
D = x, q = C, B = x / 2, R = C + t, Z = x / 2, S = 0, a = 0;
|
|
1012
|
+
break;
|
|
1013
|
+
case "left-bottom":
|
|
1014
|
+
D = t + x, q = C, B = x, R = C + t, Z = 0, S = 0, a = t;
|
|
1015
|
+
break;
|
|
1016
|
+
}
|
|
1017
|
+
D = D + u, i.width = Math.round(W * n), i.height = Math.round(D * n), o.scale(n, n), o.clearRect(0, 0, W, D), o.beginPath(), o.moveTo(q, B), o.lineTo(R, Z), o.strokeStyle = "#FFF", o.lineWidth = 1, o.stroke(), o.fillStyle = "#FFF", o.fillRect(S, a, C, x), o.font = m, o.textBaseline = "middle";
|
|
1018
|
+
const b = a + u + x / 2;
|
|
1019
|
+
o.strokeStyle = "#ffffff", o.lineWidth = 1, o.strokeText(e, S + h, b), o.fillStyle = "#000000", o.fillText(e, S + h, b), o.font = v, o.fillStyle = "#3370ff";
|
|
1020
|
+
let g = S + h + M + s;
|
|
1021
|
+
return r.length > 0 && r.forEach((k, F) => {
|
|
1022
|
+
const V = a + u + x / 2;
|
|
1023
|
+
o.fillText(fe(k), g, V), g += y[F].width + s;
|
|
1024
|
+
}), i.toDataURL("image/png");
|
|
1025
|
+
}
|
|
1026
|
+
const nt = (e, r) => {
|
|
1027
|
+
const { name: l, rightIcons: s, selected: i } = e.getProperties(), o = r !== 1 ? vo() : "right-top", u = yo(l, s, o);
|
|
1028
|
+
let h = [0, 0];
|
|
1029
|
+
switch (o) {
|
|
1030
|
+
case "right-top":
|
|
1031
|
+
h = [0, 1];
|
|
1032
|
+
break;
|
|
1033
|
+
case "right-middle":
|
|
1034
|
+
h = [0, 0.5];
|
|
1035
|
+
break;
|
|
1036
|
+
case "right-bottom":
|
|
1037
|
+
h = [0, 0];
|
|
1038
|
+
break;
|
|
1039
|
+
case "left-top":
|
|
1040
|
+
h = [1, 1];
|
|
1041
|
+
break;
|
|
1042
|
+
case "left-middle":
|
|
1043
|
+
h = [1, 0.5];
|
|
1044
|
+
break;
|
|
1045
|
+
case "left-bottom":
|
|
1046
|
+
h = [1, 0];
|
|
1047
|
+
break;
|
|
1048
|
+
}
|
|
1049
|
+
return new X({
|
|
1050
|
+
image: new Oe({
|
|
1051
|
+
src: u,
|
|
1052
|
+
anchor: h,
|
|
1053
|
+
displacement: [0, 0],
|
|
1054
|
+
scale: 1 / ho,
|
|
1055
|
+
anchorXUnits: "fraction",
|
|
1056
|
+
anchorYUnits: "fraction"
|
|
1057
|
+
}),
|
|
1058
|
+
zIndex: i ? 100 : 10
|
|
1059
|
+
});
|
|
1060
|
+
}, mo = (e) => {
|
|
1061
|
+
let r = null, l = null;
|
|
1062
|
+
const s = new de(), i = new Wt({
|
|
1063
|
+
source: s,
|
|
1064
|
+
className: "zh-map--ship-layer",
|
|
1065
|
+
renderBuffer: 300,
|
|
1066
|
+
zIndex: 101,
|
|
1067
|
+
hitTolerance: 10
|
|
1068
|
+
}), o = new de(), u = new he({
|
|
1069
|
+
source: o,
|
|
1070
|
+
className: "zh-map--ship-label-layer",
|
|
1071
|
+
zIndex: 102,
|
|
1072
|
+
updateWhileInteracting: !1,
|
|
1073
|
+
updateWhileAnimating: !1,
|
|
1074
|
+
declutter: !0
|
|
1075
|
+
});
|
|
1076
|
+
e == null || e.addLayer(i), e == null || e.addLayer(u);
|
|
1077
|
+
let h = null, t = "", n = {}, m = {};
|
|
1078
|
+
const v = (a) => {
|
|
1079
|
+
if (!a || !e) return;
|
|
1080
|
+
const b = (l == null ? void 0 : l.id) || (r == null ? void 0 : r.get("id"));
|
|
1081
|
+
if (l) {
|
|
1082
|
+
const g = a.filter((k) => k.id === b);
|
|
1083
|
+
g.length === 0 ? a.push(l) : l = g[0];
|
|
1084
|
+
}
|
|
1085
|
+
L(), C(!0), S(a), M();
|
|
1086
|
+
}, N = (a) => {
|
|
1087
|
+
var z;
|
|
1088
|
+
const b = (l == null ? void 0 : l.id) || (r == null ? void 0 : r.get("id")), g = ee([a == null ? void 0 : a.lon, a == null ? void 0 : a.lat]), k = ((z = m[a.id]) == null ? void 0 : z.blinkColors) || [], V = k[k.length - 1] || a.fill || "#04C900", G = ao(a), Q = new ie({
|
|
1089
|
+
geometry: new le(g),
|
|
1090
|
+
// 船舶数据
|
|
1091
|
+
shipData: a,
|
|
1092
|
+
id: a.id,
|
|
1093
|
+
name: a.cnname || a.enname || a.name || a.id || "未命名船舶",
|
|
1094
|
+
selected: a.id === b,
|
|
1095
|
+
// 图标
|
|
1096
|
+
rightIcons: rt(a),
|
|
1097
|
+
// 是否闪烁
|
|
1098
|
+
// blinking: attentionShips[ship.id] || false,
|
|
1099
|
+
// // 闪烁颜色
|
|
1100
|
+
// blinkingColor: attentionShipsColor[ship.id].blinkColors || '',
|
|
1101
|
+
// 船舶颜色
|
|
1102
|
+
color: V,
|
|
1103
|
+
// 船艏向的方向
|
|
1104
|
+
direct: G,
|
|
1105
|
+
// 高亮
|
|
1106
|
+
isHighlight: !1
|
|
1107
|
+
});
|
|
1108
|
+
return Q.set("clickGeometry", new Yt(g)), Q;
|
|
1109
|
+
}, M = async () => {
|
|
1110
|
+
if (!l || !e) return;
|
|
1111
|
+
let b = e.getOverlays().getArray().find((g) => g.get("class") == "ship-overlay-selected");
|
|
1112
|
+
if (b) {
|
|
1113
|
+
const g = dt(e, l);
|
|
1114
|
+
await b.setElement(g), await b.setPosition(ee([l.lon, l.lat]));
|
|
1115
|
+
} else
|
|
1116
|
+
b = go(e, l), b && e.addOverlay(b);
|
|
1117
|
+
setTimeout(() => {
|
|
1118
|
+
var g;
|
|
1119
|
+
b && ((g = b.get("element")) != null && g.parentElement) && (b.get("element").parentElement.style.display = "block");
|
|
1120
|
+
}, 20);
|
|
1121
|
+
}, y = (a) => {
|
|
1122
|
+
if (a === "start") {
|
|
1123
|
+
const b = () => {
|
|
1124
|
+
s.getFeatures().forEach((g) => {
|
|
1125
|
+
g.setStyle(ye(e, g));
|
|
1126
|
+
}), h = requestAnimationFrame(b);
|
|
1127
|
+
};
|
|
1128
|
+
b();
|
|
1129
|
+
}
|
|
1130
|
+
a === "end" && h && (cancelAnimationFrame(h), h = null);
|
|
1131
|
+
}, w = () => {
|
|
1132
|
+
const b = (e == null ? void 0 : e.getOverlays().getArray()).find((g) => g.get("class") == "ship-overlay-selected");
|
|
1133
|
+
if (b) {
|
|
1134
|
+
const g = b.getElement(), k = Qe(e, l, "ship"), F = g.querySelector("svg");
|
|
1135
|
+
console.log(F), F && (F.style.transform = `scale(${k})`);
|
|
1136
|
+
}
|
|
1137
|
+
}, L = () => {
|
|
1138
|
+
e && s && (s.clear(), o.clear(), C(), y("end"));
|
|
1139
|
+
}, C = (a) => {
|
|
1140
|
+
const b = e.getOverlays().getArray().filter((g) => g.get("class") == "zh-map-ship-overlay");
|
|
1141
|
+
if (b && b.length > 0) {
|
|
1142
|
+
for (let g = 0; g < b.length; g++)
|
|
1143
|
+
if (!a && b[g].get("class") !== "ship-overlay-selected") {
|
|
1144
|
+
const k = b[g];
|
|
1145
|
+
k.setPosition(void 0), e.removeOverlay(k), k.dispose();
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
}, x = (a, b) => {
|
|
1149
|
+
n = a, m = b;
|
|
1150
|
+
const g = e.getOverlays().getArray(), k = s.getFeatures();
|
|
1151
|
+
for (const F in n) {
|
|
1152
|
+
const V = n[F], G = g.find((z) => z.getId() === "label-" + F), Q = k.find((z) => F === z.get("id"));
|
|
1153
|
+
if (G && Q) {
|
|
1154
|
+
const z = b[F].blinkColors || [], { shipData: ae, name: re, color: se } = Q.getProperties();
|
|
1155
|
+
Q.set("blinking", V), z[(z == null ? void 0 : z.length) - 1] && se !== z[(z == null ? void 0 : z.length) - 1] && (Q.set("color", z[(z == null ? void 0 : z.length) - 1] || ""), Q.setStyle(ye(e, Q)));
|
|
1156
|
+
const Re = {
|
|
1157
|
+
...ae,
|
|
1158
|
+
blinking: V,
|
|
1159
|
+
blinkingColors: z || [],
|
|
1160
|
+
name: re + "(" + b[F].shipState + ")"
|
|
1161
|
+
}, be = G.getElement(), pe = ut(Re);
|
|
1162
|
+
be && be !== pe && G.setElement(pe);
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
}, W = (a) => {
|
|
1166
|
+
if (!e) return;
|
|
1167
|
+
const b = s.getFeatures(), g = o.getFeatures(), k = r ? r.get("id") : "", F = b.filter((z) => z.get("id") !== k), V = g == null ? void 0 : g.filter((z) => z.get("id") !== k), G = /* @__PURE__ */ new Map();
|
|
1168
|
+
a.forEach((z) => {
|
|
1169
|
+
G.set(z.id, !0);
|
|
1170
|
+
});
|
|
1171
|
+
const Q = e.getOverlays().getArray();
|
|
1172
|
+
F.forEach((z) => {
|
|
1173
|
+
const ae = z.get("id");
|
|
1174
|
+
if (!G.has(ae))
|
|
1175
|
+
z.setStyle([]);
|
|
1176
|
+
else {
|
|
1177
|
+
const se = z.getStyle();
|
|
1178
|
+
(se == null ? void 0 : se.length) == 0 && z.setStyle(ye(e, z));
|
|
1179
|
+
}
|
|
1180
|
+
const re = Q.find((se) => se.getId() === "label-" + ae);
|
|
1181
|
+
re && re.setPosition(void 0);
|
|
1182
|
+
}), console.log(V), V.forEach((z) => {
|
|
1183
|
+
const ae = z.get("id");
|
|
1184
|
+
if (!G.has(ae))
|
|
1185
|
+
z.setStyle([]);
|
|
1186
|
+
else {
|
|
1187
|
+
const re = z.getStyle();
|
|
1188
|
+
(re == null ? void 0 : re.length) == 0 && z.setStyle(nt(z));
|
|
1189
|
+
}
|
|
1190
|
+
});
|
|
1191
|
+
}, D = (a) => {
|
|
1192
|
+
if (a) {
|
|
1193
|
+
console.log("选中", a);
|
|
1194
|
+
const b = s.getFeatures().find((k) => k.get("id") === a.id), g = o.getFeatures().find((k) => k.get("id") === a.id);
|
|
1195
|
+
b && (r = b), g && g.set("selected", !0), l = a, M();
|
|
1196
|
+
} else
|
|
1197
|
+
console.log("取消选中"), l = null, r = null, R();
|
|
1198
|
+
}, q = Ne((a, b, g) => {
|
|
1199
|
+
try {
|
|
1200
|
+
if (a) {
|
|
1201
|
+
const k = a.get("shipData"), F = a.get("id");
|
|
1202
|
+
if (e.getTargetElement().style.cursor = F ? "pointer" : "", b === "click" && (D(k), g && g(F)), b === "hover") {
|
|
1203
|
+
t && t !== F && B(), t = F;
|
|
1204
|
+
const V = s.getFeatures().find((G) => G.get("id") === t);
|
|
1205
|
+
V == null || V.set("isHighlight", !0), V == null || V.setStyle(ye(e, V));
|
|
1206
|
+
}
|
|
1207
|
+
} else
|
|
1208
|
+
e.getTargetElement().style.cursor = "", B();
|
|
1209
|
+
} catch (k) {
|
|
1210
|
+
console.log("handleShipMapEvent", k);
|
|
1211
|
+
}
|
|
1212
|
+
}, 10), B = () => {
|
|
1213
|
+
const a = t ? s.getFeatures().find((b) => b.get("id") === t) : null;
|
|
1214
|
+
t = null, a == null || a.set("isHighlight", !1), a == null || a.setStyle(ye(e, a));
|
|
1215
|
+
}, R = () => {
|
|
1216
|
+
try {
|
|
1217
|
+
const b = e.getOverlays().getArray().find((g) => g.get("class") == "ship-overlay-selected");
|
|
1218
|
+
b && b.setPosition(void 0);
|
|
1219
|
+
} catch (a) {
|
|
1220
|
+
console.log(a);
|
|
1221
|
+
}
|
|
1222
|
+
}, Z = (a, b) => {
|
|
1223
|
+
const g = ee([a == null ? void 0 : a.lon, a == null ? void 0 : a.lat]), k = new ie({
|
|
1224
|
+
geometry: new le(g),
|
|
1225
|
+
name: a.cnname || a.enname || a.name || a.id || "未命名船舶",
|
|
1226
|
+
// 图标
|
|
1227
|
+
rightIcons: rt(a),
|
|
1228
|
+
selected: (a == null ? void 0 : a.id) === (l == null ? void 0 : l.id),
|
|
1229
|
+
shipData: a
|
|
1230
|
+
});
|
|
1231
|
+
k.set("id", a.id);
|
|
1232
|
+
const F = nt(k, b);
|
|
1233
|
+
return k.setStyle(F), k;
|
|
1234
|
+
}, S = (a) => {
|
|
1235
|
+
const b = e.getView().getZoom();
|
|
1236
|
+
a.forEach((g) => {
|
|
1237
|
+
const k = N(g);
|
|
1238
|
+
if (k.setStyle(ye(e, k)), s.addFeature(k), (l == null ? void 0 : l.id) == g.id || b >= te.shipModelMin)
|
|
1239
|
+
if (n[g.id]) {
|
|
1240
|
+
if (g.id && m[g == null ? void 0 : g.id]) {
|
|
1241
|
+
const F = m[g == null ? void 0 : g.id] || {}, V = (F == null ? void 0 : F.blinkColors) || [], G = (F == null ? void 0 : F.shipState) || "", Q = (g.cnname || g.enname || g.name || g.id || "未命名船舶") + "(" + G + ")", z = {
|
|
1242
|
+
...g,
|
|
1243
|
+
name: Q,
|
|
1244
|
+
blinking: n[g.id],
|
|
1245
|
+
blinkingColors: V || []
|
|
1246
|
+
};
|
|
1247
|
+
fo(e, z);
|
|
1248
|
+
}
|
|
1249
|
+
} else {
|
|
1250
|
+
const F = Z(g, a.length);
|
|
1251
|
+
o.addFeature(F);
|
|
1252
|
+
}
|
|
1253
|
+
});
|
|
1254
|
+
};
|
|
1255
|
+
return {
|
|
1256
|
+
render: v,
|
|
1257
|
+
selected: D,
|
|
1258
|
+
filter: W,
|
|
1259
|
+
blinking: x,
|
|
1260
|
+
clear: L,
|
|
1261
|
+
handleShipMapEvent: q,
|
|
1262
|
+
changeShipScale: y,
|
|
1263
|
+
changeSelectedScale: w
|
|
1264
|
+
};
|
|
1265
|
+
}, wo = (e) => {
|
|
1266
|
+
const r = () => e == null ? void 0 : e.getLayers(), l = I("vector"), s = () => l.value, i = (t) => {
|
|
1267
|
+
l.value = t;
|
|
1268
|
+
const n = r();
|
|
1269
|
+
n && (n == null || n.getArray().forEach((m) => {
|
|
1270
|
+
(m.className_ === "vector" || m.className_ === "satellite") && m.setVisible(m.className_ === t);
|
|
1271
|
+
}));
|
|
1272
|
+
}, o = I(!1);
|
|
1273
|
+
return {
|
|
1274
|
+
getLayers: r,
|
|
1275
|
+
getGreenTileVisible: () => o.value,
|
|
1276
|
+
setGreenTileVisible: (t) => {
|
|
1277
|
+
if (t !== o.value) {
|
|
1278
|
+
if (t) {
|
|
1279
|
+
const n = r();
|
|
1280
|
+
if (!n.getArray().find((v) => v.className_ === "greenTile")) {
|
|
1281
|
+
const v = new me({
|
|
1282
|
+
source: new we({ url: ue.greenTile }),
|
|
1283
|
+
visible: t,
|
|
1284
|
+
zIndex: 2,
|
|
1285
|
+
className: "greenTile"
|
|
1286
|
+
});
|
|
1287
|
+
n.push(v);
|
|
1288
|
+
}
|
|
1289
|
+
} else {
|
|
1290
|
+
const n = r(), m = n.getArray().find((v) => v.className_ === "greenTile");
|
|
1291
|
+
m && n.remove(m);
|
|
1292
|
+
}
|
|
1293
|
+
o.value = t;
|
|
1294
|
+
}
|
|
1295
|
+
},
|
|
1296
|
+
getShowLayerType: s,
|
|
1297
|
+
setShowLayerType: i
|
|
1298
|
+
};
|
|
1299
|
+
}, xo = () => {
|
|
1300
|
+
const e = I();
|
|
1301
|
+
return {
|
|
1302
|
+
setProps: (s) => {
|
|
1303
|
+
e.value = s;
|
|
1304
|
+
},
|
|
1305
|
+
getProps: () => e.value
|
|
1306
|
+
};
|
|
1307
|
+
}, bo = (e) => {
|
|
1308
|
+
const r = "zh-map-location-layer";
|
|
1309
|
+
let l, s, i = null, o = null;
|
|
1310
|
+
const u = (y) => {
|
|
1311
|
+
if (!(!y || y.length === 0)) {
|
|
1312
|
+
if (s || (s = new de()), s.clear(), o) {
|
|
1313
|
+
const w = y.find((L) => L.id === o.id);
|
|
1314
|
+
w ? o = w : y.push(o);
|
|
1315
|
+
}
|
|
1316
|
+
y.forEach((w) => {
|
|
1317
|
+
h(w);
|
|
1318
|
+
}), l || (l = new he({
|
|
1319
|
+
className: r,
|
|
1320
|
+
source: s,
|
|
1321
|
+
zIndex: 100
|
|
1322
|
+
}), e == null || e.addLayer(l));
|
|
1323
|
+
}
|
|
1324
|
+
}, h = (y) => {
|
|
1325
|
+
const w = e == null ? void 0 : e.getView().getZoom(), [L, C] = y.latLon.split(","), x = new ie({
|
|
1326
|
+
geometry: new le(ee([Number(L), Number(C)]))
|
|
1327
|
+
});
|
|
1328
|
+
x.setStyle(t(y, w, y.id === (o == null ? void 0 : o.id))), x.set("loactionData", y), s.addFeature(x);
|
|
1329
|
+
}, t = (y, w, L) => {
|
|
1330
|
+
const C = {
|
|
1331
|
+
image: new Oe({
|
|
1332
|
+
src: L && y.selectedPath || y.defaultPath,
|
|
1333
|
+
scale: 0.5 * w / 10
|
|
1334
|
+
})
|
|
1335
|
+
};
|
|
1336
|
+
return y.name && (C.text = new ge({
|
|
1337
|
+
text: y.name,
|
|
1338
|
+
font: "12px sans-serif",
|
|
1339
|
+
fill: new j({
|
|
1340
|
+
color: "#000000"
|
|
1341
|
+
}),
|
|
1342
|
+
backgroundFill: new j({
|
|
1343
|
+
color: "#FFFFFF"
|
|
1344
|
+
}),
|
|
1345
|
+
offsetY: 30
|
|
1346
|
+
})), new X(C);
|
|
1347
|
+
}, n = () => {
|
|
1348
|
+
if (i) {
|
|
1349
|
+
const y = i.get("loactionData").id;
|
|
1350
|
+
s.getFeatures().forEach((w) => {
|
|
1351
|
+
w.get("loactionData").id !== y && s.removeFeature(w);
|
|
1352
|
+
});
|
|
1353
|
+
} else
|
|
1354
|
+
s.clear();
|
|
1355
|
+
}, m = () => {
|
|
1356
|
+
var C;
|
|
1357
|
+
const y = i.get("loactionData"), w = (C = e == null ? void 0 : e.getView()) == null ? void 0 : C.getZoom();
|
|
1358
|
+
s.getFeatures().forEach((x) => {
|
|
1359
|
+
x.get("loactionData").id === y.id && (x == null || x.setStyle(t(y, w, !1)));
|
|
1360
|
+
}), o = null, i = null;
|
|
1361
|
+
}, v = (y) => {
|
|
1362
|
+
y ? (N(), M(y)) : clearSelectedPort();
|
|
1363
|
+
}, N = () => {
|
|
1364
|
+
var y;
|
|
1365
|
+
if (i) {
|
|
1366
|
+
const w = i.get("loactionData"), L = (y = e == null ? void 0 : e.getView()) == null ? void 0 : y.getZoom();
|
|
1367
|
+
i.setStyle(t(w, L, !1));
|
|
1368
|
+
}
|
|
1369
|
+
}, M = (y) => {
|
|
1370
|
+
const w = s.getFeatures();
|
|
1371
|
+
o = y, i = w.find((L) => L.get("loactionData").id === y.id);
|
|
1372
|
+
};
|
|
1373
|
+
return {
|
|
1374
|
+
render: u,
|
|
1375
|
+
selected: v,
|
|
1376
|
+
clearSelected: m,
|
|
1377
|
+
clear: n
|
|
1378
|
+
};
|
|
1379
|
+
}, ko = (e) => {
|
|
1380
|
+
e.getInteractions().forEach((r) => {
|
|
1381
|
+
r instanceof st && r.setActive(!1);
|
|
1382
|
+
});
|
|
1383
|
+
}, po = (e) => {
|
|
1384
|
+
e.getInteractions().forEach((r) => {
|
|
1385
|
+
r instanceof st && r.setActive(!0);
|
|
1386
|
+
});
|
|
1387
|
+
}, ze = (e, r) => {
|
|
1388
|
+
const l = e.getViewport();
|
|
1389
|
+
l && (l.style.cursor = r);
|
|
1390
|
+
}, Mo = (e, r) => {
|
|
1391
|
+
const l = I([]), s = I("km"), i = (S) => {
|
|
1392
|
+
s.value = S;
|
|
1393
|
+
};
|
|
1394
|
+
let o;
|
|
1395
|
+
const u = I(!1), h = () => {
|
|
1396
|
+
ze(e, "crosshair"), m(), ko(e), e.on("pointermove", M), e.getViewport().addEventListener("mouseout", () => {
|
|
1397
|
+
o && o.classList.add("hidden");
|
|
1398
|
+
}), w(), u.value = !0;
|
|
1399
|
+
};
|
|
1400
|
+
let t, n;
|
|
1401
|
+
const m = () => {
|
|
1402
|
+
t = new de(), n = new he({
|
|
1403
|
+
source: t,
|
|
1404
|
+
zIndex: 1e3,
|
|
1405
|
+
style: {
|
|
1406
|
+
"fill-color": "rgba(255, 255, 255, 0.2)",
|
|
1407
|
+
"stroke-color": "#ffcc33",
|
|
1408
|
+
"stroke-width": 2,
|
|
1409
|
+
"circle-radius": 7,
|
|
1410
|
+
"circle-fill-color": "#ffcc33"
|
|
1411
|
+
}
|
|
1412
|
+
}), e == null || e.addLayer(n);
|
|
1413
|
+
};
|
|
1414
|
+
let v, N;
|
|
1415
|
+
const M = (S) => {
|
|
1416
|
+
if (S.dragging)
|
|
1417
|
+
return;
|
|
1418
|
+
let a = "点击选择起点";
|
|
1419
|
+
v && (a = "单击继续,双击结束"), o && (o.innerHTML = a, N.setPosition(S.coordinate), o.classList.remove("hidden"));
|
|
1420
|
+
};
|
|
1421
|
+
let y;
|
|
1422
|
+
const w = () => {
|
|
1423
|
+
y = new Se({
|
|
1424
|
+
source: t,
|
|
1425
|
+
type: "LineString",
|
|
1426
|
+
style: new X({
|
|
1427
|
+
fill: new j({
|
|
1428
|
+
color: "rgba(255, 255, 255, 0.2)"
|
|
1429
|
+
}),
|
|
1430
|
+
stroke: new ve({
|
|
1431
|
+
color: "rgba(255,204,51)",
|
|
1432
|
+
lineDash: [10, 10],
|
|
1433
|
+
width: 2
|
|
1434
|
+
}),
|
|
1435
|
+
image: new Ve({
|
|
1436
|
+
radius: 5,
|
|
1437
|
+
stroke: new ve({
|
|
1438
|
+
color: "rgba(0, 0, 0, 0.7)"
|
|
1439
|
+
}),
|
|
1440
|
+
fill: new j({
|
|
1441
|
+
color: "rgba(255, 255, 255, 0.2)"
|
|
1442
|
+
})
|
|
1443
|
+
})
|
|
1444
|
+
}),
|
|
1445
|
+
// 添加条件函数,判断是否应该出发点绘制
|
|
1446
|
+
condition: (a) => a.originalEvent.target.tagName !== "DIV"
|
|
1447
|
+
}), e == null || e.addInteraction(y), W(), D();
|
|
1448
|
+
let S;
|
|
1449
|
+
y.on("drawstart", function(a) {
|
|
1450
|
+
var g;
|
|
1451
|
+
v = a.feature, v.set("randomId", L());
|
|
1452
|
+
let b;
|
|
1453
|
+
S = (g = v.getGeometry()) == null ? void 0 : g.on("change", function(k) {
|
|
1454
|
+
const F = k.target, V = gt(F, s.value);
|
|
1455
|
+
b = F.getLastCoordinate(), C && V && (C.innerHTML = V), x.setPosition(b);
|
|
1456
|
+
});
|
|
1457
|
+
}), y.on("drawend", function() {
|
|
1458
|
+
var a, b, g;
|
|
1459
|
+
if (C && (C.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), C != null && C.innerHTML) {
|
|
1460
|
+
const k = (v == null ? void 0 : v.get("randomId")) || L();
|
|
1461
|
+
l.value.push({ id: k, value: C == null ? void 0 : C.innerHTML }), C.innerHTML = `${C.innerHTML}<div class="ol-tooltip-delete-button" data-id="${k}"><i class="map-iconfont icon-delete"></i></div>`;
|
|
1462
|
+
}
|
|
1463
|
+
(a = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || a.addEventListener("click", (k) => {
|
|
1464
|
+
var V;
|
|
1465
|
+
k.preventDefault(), k.stopPropagation();
|
|
1466
|
+
const F = (V = k.target) == null ? void 0 : V.getAttribute("data-id");
|
|
1467
|
+
F && B(F);
|
|
1468
|
+
}), x.setOffset([0, -7]), v = null, C = null, W(), S && We(S), (g = (b = r.getProps()) == null ? void 0 : b.lineDrawEnd) == null || g.call(b, l.value);
|
|
1469
|
+
});
|
|
1470
|
+
}, L = () => Math.random().toString(36).substring(2, 9);
|
|
1471
|
+
let C, x;
|
|
1472
|
+
const W = () => {
|
|
1473
|
+
C != null && C.parentNode && C.parentNode.removeChild(C), C = document.createElement("div"), C.className = "ol-tooltip ol-tooltip-measure", x = new ce({
|
|
1474
|
+
element: C,
|
|
1475
|
+
offset: [0, -15],
|
|
1476
|
+
positioning: "bottom-center",
|
|
1477
|
+
stopEvent: !1,
|
|
1478
|
+
insertFirst: !1
|
|
1479
|
+
}), e == null || e.addOverlay(x);
|
|
1480
|
+
}, D = () => {
|
|
1481
|
+
o != null && o.parentNode && o.parentNode.removeChild(o), o = document.createElement("div"), o.className = "ol-tooltip hidden", N = new ce({
|
|
1482
|
+
element: o,
|
|
1483
|
+
offset: [15, 0],
|
|
1484
|
+
positioning: "center-left"
|
|
1485
|
+
}), e == null || e.addOverlay(N);
|
|
1486
|
+
}, q = () => {
|
|
1487
|
+
l.value.forEach((S, a) => {
|
|
1488
|
+
var k, F;
|
|
1489
|
+
const b = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1490
|
+
b[a] && ((F = (k = b[a]) == null ? void 0 : k.parentNode) == null || F.removeChild(b[a]));
|
|
1491
|
+
const g = t.getFeatures();
|
|
1492
|
+
g[a] && t.removeFeature(g[a]);
|
|
1493
|
+
}), R(), po(e), u.value = !1, ze(e, "pointer");
|
|
1494
|
+
}, B = (S) => {
|
|
1495
|
+
var b, g, k, F;
|
|
1496
|
+
const a = l.value.findIndex((V) => V.id === S);
|
|
1497
|
+
if (a !== -1) {
|
|
1498
|
+
l.value.splice(a, 1);
|
|
1499
|
+
const V = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1500
|
+
V[a] && ((g = (b = V[a]) == null ? void 0 : b.parentNode) == null || g.removeChild(V[a]));
|
|
1501
|
+
const G = t.getFeatures();
|
|
1502
|
+
G[a] && t.removeFeature(G[a]);
|
|
1503
|
+
}
|
|
1504
|
+
(F = (k = r.getProps()) == null ? void 0 : k.lineDrawEnd) == null || F.call(k, l.value);
|
|
1505
|
+
}, R = () => {
|
|
1506
|
+
if (l.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((S) => {
|
|
1507
|
+
var a;
|
|
1508
|
+
(a = S == null ? void 0 : S.parentNode) == null || a.removeChild(S);
|
|
1509
|
+
}), t == null || t.clear(), y) {
|
|
1510
|
+
const S = e.getInteractions().getArray().find((a) => et(a) === et(y));
|
|
1511
|
+
S && e.removeInteraction(S);
|
|
1512
|
+
}
|
|
1513
|
+
e.removeLayer(n), o != null && o.parentNode && o.parentNode.removeChild(o), C != null && C.parentNode && C.parentNode.removeChild(C);
|
|
1514
|
+
};
|
|
1515
|
+
return {
|
|
1516
|
+
open: h,
|
|
1517
|
+
close: q,
|
|
1518
|
+
deleteLine: B,
|
|
1519
|
+
setUnit: i,
|
|
1520
|
+
getState: () => u.value
|
|
1521
|
+
};
|
|
1522
|
+
}, gt = (e, r) => {
|
|
1523
|
+
const s = He(e);
|
|
1524
|
+
let i = "";
|
|
1525
|
+
switch (r) {
|
|
1526
|
+
case "m":
|
|
1527
|
+
i = `${Math.round(s * 100) / 100} m`;
|
|
1528
|
+
break;
|
|
1529
|
+
case "km":
|
|
1530
|
+
i = `${Math.round(s / 1e3 * 100) / 100} km`;
|
|
1531
|
+
break;
|
|
1532
|
+
case "nm":
|
|
1533
|
+
i = (Math.round(s / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
|
|
1534
|
+
break;
|
|
1535
|
+
}
|
|
1536
|
+
return i;
|
|
1537
|
+
}, Co = (e, r) => {
|
|
1538
|
+
let l, s;
|
|
1539
|
+
const i = () => {
|
|
1540
|
+
o(), ze(e, "crosshair");
|
|
1541
|
+
}, o = () => {
|
|
1542
|
+
t(), C(), D(), M();
|
|
1543
|
+
};
|
|
1544
|
+
let u = null, h = null;
|
|
1545
|
+
const t = () => {
|
|
1546
|
+
if (u && h) return;
|
|
1547
|
+
const R = new de(), Z = new he({
|
|
1548
|
+
source: R,
|
|
1549
|
+
style: new X({
|
|
1550
|
+
stroke: new ve({
|
|
1551
|
+
color: "#fbcc33",
|
|
1552
|
+
width: 2
|
|
1553
|
+
})
|
|
1554
|
+
})
|
|
1555
|
+
});
|
|
1556
|
+
u = Z, h = R, e.on("pointermove", m), e.addLayer(Z), e.on(["dblclick"], function(S) {
|
|
1557
|
+
v && (S.stopPropagation(), S.preventDefault());
|
|
1558
|
+
});
|
|
1559
|
+
};
|
|
1560
|
+
let n;
|
|
1561
|
+
const m = (R) => {
|
|
1562
|
+
if (R.dragging) return;
|
|
1563
|
+
const Z = n ? "单击继续,双击结束" : "点击选择起点";
|
|
1564
|
+
x && (x.innerHTML = Z, W.setPosition(R.coordinate));
|
|
1565
|
+
};
|
|
1566
|
+
let v, N = !1;
|
|
1567
|
+
const M = () => {
|
|
1568
|
+
if (l) {
|
|
1569
|
+
x != null && x.parentNode && x.parentNode.removeChild(x);
|
|
1570
|
+
const R = l.getGeometry();
|
|
1571
|
+
if (!R) return;
|
|
1572
|
+
const Z = y(R, "nm");
|
|
1573
|
+
w && (w.innerHTML = `
|
|
1574
|
+
<span class="text">面积:${Z}${N ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1575
|
+
`), w && (w.innerHTML += '<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');
|
|
1576
|
+
const S = R.getCoordinates(), a = S[0][S[0].length - 2];
|
|
1577
|
+
if (L.setPosition(a), u) {
|
|
1578
|
+
const g = u.getSource();
|
|
1579
|
+
g && l && (g.clear(), g.addFeature(l));
|
|
1580
|
+
}
|
|
1581
|
+
setTimeout(() => {
|
|
1582
|
+
var g;
|
|
1583
|
+
(g = document.querySelector(".delete-icon")) == null || g.addEventListener("click", () => {
|
|
1584
|
+
var k, F;
|
|
1585
|
+
console.log("delete"), q(), (F = (k = r.getProps()) == null ? void 0 : k.areaDrawEnd) == null || F.call(k, []);
|
|
1586
|
+
});
|
|
1587
|
+
}, 0);
|
|
1588
|
+
const b = qt(l.getGeometry().getExtent());
|
|
1589
|
+
e == null || e.getView().setCenter(b);
|
|
1590
|
+
return;
|
|
1591
|
+
}
|
|
1592
|
+
v = new Se({
|
|
1593
|
+
type: "Polygon",
|
|
1594
|
+
source: h,
|
|
1595
|
+
trace: !0,
|
|
1596
|
+
style: [new X({
|
|
1597
|
+
stroke: new ve({
|
|
1598
|
+
color: "rgba(255, 255, 255, 1)",
|
|
1599
|
+
width: 1.5,
|
|
1600
|
+
lineDash: [10, 10]
|
|
1601
|
+
}),
|
|
1602
|
+
fill: new j({
|
|
1603
|
+
color: "rgba(255, 255, 255, 0.25)"
|
|
1604
|
+
})
|
|
1605
|
+
}), new X({
|
|
1606
|
+
image: new Ve({
|
|
1607
|
+
radius: 5,
|
|
1608
|
+
fill: new j({
|
|
1609
|
+
color: "rgb(51,112,255, 1)"
|
|
1610
|
+
})
|
|
1611
|
+
}),
|
|
1612
|
+
geometry: function(R) {
|
|
1613
|
+
const Z = R.getGeometry().getCoordinates();
|
|
1614
|
+
return new Ht(Z);
|
|
1615
|
+
}
|
|
1616
|
+
})]
|
|
1617
|
+
}), e == null || e.addInteraction(v), v.on("drawstart", (R) => {
|
|
1618
|
+
var Z;
|
|
1619
|
+
n = R.feature, s = (Z = n.getGeometry()) == null ? void 0 : Z.on("change", (S) => {
|
|
1620
|
+
const a = S.target, b = y(a, "nm"), k = a.getCoordinates()[0], F = new Pe([k[k.length - 2], k[k.length - 1]]), V = gt(F, "nm");
|
|
1621
|
+
if (N = Number(He(F) / 1e3) > 150, !b) return;
|
|
1622
|
+
const G = '<span class="error pl-4">超出可以绘画的距离</span>';
|
|
1623
|
+
w && (w.innerHTML = `
|
|
1624
|
+
<div class="text">
|
|
1625
|
+
面积:${b}
|
|
1626
|
+
${N ? G : ""}
|
|
1627
|
+
</div>
|
|
1628
|
+
`), x && (x.innerHTML = `
|
|
1629
|
+
<div class="text">
|
|
1630
|
+
面积:${b}
|
|
1631
|
+
</div>
|
|
1632
|
+
<div class="text ${N ? "error" : ""}">
|
|
1633
|
+
线段 ${k.length - 2}: ${V}
|
|
1634
|
+
${N ? G : ""}
|
|
1635
|
+
|
|
1636
|
+
</div>
|
|
1637
|
+
<div>
|
|
1638
|
+
<span class="text">单击继续,双击结束</span>
|
|
1639
|
+
</div>
|
|
1640
|
+
`);
|
|
1641
|
+
});
|
|
1642
|
+
}), v.on("drawend", (R) => {
|
|
1643
|
+
var b, g, k, F;
|
|
1644
|
+
if (!R.feature.getGeometry()) return;
|
|
1645
|
+
w && !l && (w.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), l = R.feature, L.setOffset([10, 0]);
|
|
1646
|
+
const S = R.feature.getGeometry().getCoordinates(), a = S[0][S[0].length - 2];
|
|
1647
|
+
if (L.setPosition(a), x != null && x.parentNode && x.parentNode.removeChild(x), (b = r.getProps()) != null && b.areaDrawEnd) {
|
|
1648
|
+
const V = S[0].map((G) => ke(G, K.mercator, K.data));
|
|
1649
|
+
(k = (g = r.getProps()) == null ? void 0 : g.areaDrawEnd) == null || k.call(g, V);
|
|
1650
|
+
}
|
|
1651
|
+
v && (v.setActive(!1), e == null || e.removeInteraction(v), (e == null ? void 0 : e.getInteractions()).forEach((G) => {
|
|
1652
|
+
G instanceof Se && (G.setActive(!1), e == null || e.removeInteraction(G));
|
|
1653
|
+
})), s && We(s), (F = document.querySelector(".delete-icon")) == null || F.addEventListener("click", () => {
|
|
1654
|
+
var V, G;
|
|
1655
|
+
q(), (G = (V = r.getProps()) == null ? void 0 : V.areaDrawEnd) == null || G.call(V, []);
|
|
1656
|
+
});
|
|
1657
|
+
});
|
|
1658
|
+
}, y = (R, Z) => {
|
|
1659
|
+
const S = Bt(R);
|
|
1660
|
+
switch (Z) {
|
|
1661
|
+
case "km":
|
|
1662
|
+
return S > 1e4 ? Math.round(S / 1e6 * 100) / 100 + " km<sup>2</sup>" : Math.round(S * 100) / 100 + " m<sup>2</sup>";
|
|
1663
|
+
case "nm":
|
|
1664
|
+
return S > 1e4 ? Math.round(S / 1e6 / Math.pow(1.852, 2) * 100) / 100 + " nm<sup>2</sup>" : Math.round(S * 100) / 100 + " m<sup>2</sup>";
|
|
1665
|
+
}
|
|
1666
|
+
};
|
|
1667
|
+
let w, L;
|
|
1668
|
+
const C = () => {
|
|
1669
|
+
w != null && w.parentNode && w.parentNode.removeChild(w), w = document.createElement("div"), w.style.display = "flex", w.className = "ol-tooltip ol-tooltip-draw-polygon", L = new ce({
|
|
1670
|
+
element: w,
|
|
1671
|
+
offset: [0, -15],
|
|
1672
|
+
positioning: "bottom-center",
|
|
1673
|
+
stopEvent: !1,
|
|
1674
|
+
insertFirst: !1
|
|
1675
|
+
}), e == null || e.addOverlay(L);
|
|
1676
|
+
};
|
|
1677
|
+
let x, W;
|
|
1678
|
+
const D = () => {
|
|
1679
|
+
x != null && x.parentNode && x.parentNode.removeChild(x), x = document.createElement("div"), x.className = "ol-tooltip ol-help-tooltip", W = new ce({
|
|
1680
|
+
element: x,
|
|
1681
|
+
offset: [15, 0],
|
|
1682
|
+
positioning: "center-left"
|
|
1683
|
+
}), e == null || e.addOverlay(W);
|
|
1684
|
+
}, q = () => {
|
|
1685
|
+
h == null || h.clear(), l = null, C(), D(), M();
|
|
1686
|
+
};
|
|
1687
|
+
return {
|
|
1688
|
+
open: i,
|
|
1689
|
+
close: () => {
|
|
1690
|
+
h == null || h.clear(), h = null, u && (e.removeLayer(u), u = null), n = null, v && (v.setActive(!1), (e == null ? void 0 : e.getInteractions()).forEach((Z) => {
|
|
1691
|
+
Z instanceof Se && (Z.setActive(!1), e == null || e.removeInteraction(Z));
|
|
1692
|
+
}), v = null), s && We(s), x != null && x.parentElement && x.parentElement.removeChild(x), w != null && w.parentElement && w.parentElement.removeChild(w), W && e.removeOverlay(W), L && e.removeOverlay(L), ze(e, "pointer");
|
|
1693
|
+
},
|
|
1694
|
+
reset: q
|
|
1695
|
+
};
|
|
1696
|
+
}, Lo = "zh-map-port-layer", Eo = (e) => {
|
|
1697
|
+
const r = new de(), l = new he({
|
|
1698
|
+
className: Lo,
|
|
1699
|
+
source: r,
|
|
1700
|
+
zIndex: 100,
|
|
1701
|
+
updateWhileInteracting: !1,
|
|
1702
|
+
updateWhileAnimating: !1
|
|
1703
|
+
});
|
|
1704
|
+
e == null || e.addLayer(l);
|
|
1705
|
+
let s = null, i = null;
|
|
1706
|
+
const o = (M, y = !0) => {
|
|
1707
|
+
if (!(!M || M.length === 0)) {
|
|
1708
|
+
if (r.clear(), i) {
|
|
1709
|
+
const w = M.find((L) => L.id === i.id);
|
|
1710
|
+
w ? i = w : M.push(i);
|
|
1711
|
+
}
|
|
1712
|
+
M.forEach((w) => {
|
|
1713
|
+
u(w, y);
|
|
1714
|
+
});
|
|
1715
|
+
}
|
|
1716
|
+
}, u = (M, y = !0) => {
|
|
1717
|
+
var W;
|
|
1718
|
+
const [w, L] = M.latLon.split(","), C = new ie({
|
|
1719
|
+
geometry: new le(ee([Number(w), Number(L)])),
|
|
1720
|
+
portData: M,
|
|
1721
|
+
select: M.id === (i == null ? void 0 : i.id),
|
|
1722
|
+
showTitle: M.id === (i == null ? void 0 : i.id) || y
|
|
1723
|
+
}), x = h(C);
|
|
1724
|
+
console.log("point-styles--------", x), M.id === (i == null ? void 0 : i.id) && x && ((W = x == null ? void 0 : x.getText()) == null || W.setBackgroundFill(new j({
|
|
1725
|
+
color: "#FF5733"
|
|
1726
|
+
}))), C.setStyle(x), r.addFeature(C);
|
|
1727
|
+
}, h = (M) => {
|
|
1728
|
+
const { select: y, showTitle: w } = M.getProperties(), L = (B) => `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1729
|
+
<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="${B}"/>
|
|
1730
|
+
<g clip-path="url(#clip0_10059_122082)">
|
|
1731
|
+
<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"/>
|
|
1732
|
+
</g>
|
|
1733
|
+
<defs>
|
|
1734
|
+
<clipPath id="clip0_10059_122082">
|
|
1735
|
+
<rect width="26" height="26" fill="white" transform="translate(10 8)"/>
|
|
1736
|
+
</clipPath>
|
|
1737
|
+
</defs>
|
|
1738
|
+
</svg>
|
|
1739
|
+
`, C = () => `data:image/svg+xml;utf8,${encodeURIComponent(L(y ? "#FF5733" : "#3370FF"))}`, x = e.getView().getZoom(), W = M.get("portData"), D = {
|
|
1740
|
+
image: new Oe({
|
|
1741
|
+
src: C(),
|
|
1742
|
+
scale: 0.5 * x / 10
|
|
1743
|
+
}),
|
|
1744
|
+
zIndex: y ? 110 : 100
|
|
1745
|
+
}, q = {
|
|
1746
|
+
text: new ge({
|
|
1747
|
+
text: W.shortName,
|
|
1748
|
+
font: "12px sans-serif",
|
|
1749
|
+
fill: new j({
|
|
1750
|
+
color: y ? "#ffffff" : "#000000"
|
|
1751
|
+
}),
|
|
1752
|
+
backgroundFill: new j({
|
|
1753
|
+
color: "#FFF"
|
|
1754
|
+
}),
|
|
1755
|
+
offsetY: 30
|
|
1756
|
+
})
|
|
1757
|
+
};
|
|
1758
|
+
return !w && !y ? new X({
|
|
1759
|
+
...D
|
|
1760
|
+
}) : new X({
|
|
1761
|
+
...D,
|
|
1762
|
+
...q
|
|
1763
|
+
});
|
|
1764
|
+
}, t = () => {
|
|
1765
|
+
if (r)
|
|
1766
|
+
if (s) {
|
|
1767
|
+
console.log("清除非选中的港口");
|
|
1768
|
+
const M = s.get("portData").id;
|
|
1769
|
+
r.getFeatures().forEach((y) => {
|
|
1770
|
+
y.get("portData").id !== M && r.removeFeature(y);
|
|
1771
|
+
});
|
|
1772
|
+
} else
|
|
1773
|
+
console.log("清除所有港口", r), r == null || r.clear();
|
|
1774
|
+
}, n = (M) => {
|
|
1775
|
+
if (r) {
|
|
1776
|
+
if (!M)
|
|
1777
|
+
return m();
|
|
1778
|
+
(s == null ? void 0 : s.get("portData").id) !== M.id && (m(), v(M));
|
|
1779
|
+
}
|
|
1780
|
+
}, m = () => {
|
|
1781
|
+
var M;
|
|
1782
|
+
if (s) {
|
|
1783
|
+
const y = s == null ? void 0 : s.get("portData"), w = (M = r.getFeatures()) == null ? void 0 : M.find((L) => L.get("portData").id === y.id);
|
|
1784
|
+
if (w) {
|
|
1785
|
+
const L = h(w);
|
|
1786
|
+
w.set("select", !1), w.setStyle(L), s = null, i = null;
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
}, v = (M) => {
|
|
1790
|
+
var w;
|
|
1791
|
+
if (!r) return;
|
|
1792
|
+
const y = r.getFeatures();
|
|
1793
|
+
if (i = M, s = y.find((L) => L.get("portData").id === M.id), s) {
|
|
1794
|
+
s.set("select", !0);
|
|
1795
|
+
const L = h(s);
|
|
1796
|
+
L && ((w = L == null ? void 0 : L.getText()) == null || w.setBackgroundFill(new j({
|
|
1797
|
+
color: "#FF5733"
|
|
1798
|
+
}))), s.setStyle(L);
|
|
1799
|
+
}
|
|
1800
|
+
};
|
|
1801
|
+
return {
|
|
1802
|
+
render: o,
|
|
1803
|
+
clear: t,
|
|
1804
|
+
selected: n,
|
|
1805
|
+
handlePortHover: (M) => {
|
|
1806
|
+
const y = e == null ? void 0 : e.getTargetElement();
|
|
1807
|
+
M && M.get("portData") && y && (y.style.cursor = "pointer");
|
|
1808
|
+
}
|
|
1809
|
+
};
|
|
1810
|
+
}, To = (e, r, l, s, i, o) => {
|
|
1811
|
+
const u = e.getInstall();
|
|
1812
|
+
u.on("moveend", () => {
|
|
1813
|
+
var h, t;
|
|
1814
|
+
try {
|
|
1815
|
+
const n = e.getZoom();
|
|
1816
|
+
(t = (h = r.getProps()).mapMoveEnd) == null || t.call(h, n), l.reRenderTrackLine(), s.changeShipScale("end");
|
|
1817
|
+
} catch (n) {
|
|
1818
|
+
console.log("moveend---catch", n);
|
|
1819
|
+
}
|
|
1820
|
+
}), u.on("pointermove", (h) => {
|
|
1821
|
+
try {
|
|
1822
|
+
const t = u == null ? void 0 : u.getEventPixel(h.originalEvent);
|
|
1823
|
+
if (!t || !u) return;
|
|
1824
|
+
const n = u == null ? void 0 : u.forEachFeatureAtPixel(t, (m) => m, {
|
|
1825
|
+
layerFilter: (m) => m.getVisible()
|
|
1826
|
+
});
|
|
1827
|
+
s == null || s.handleShipMapEvent(n, "hover"), l == null || l.handleTrackMapEvent(n, "hover", h), n && (i == null || i.handlePortHover(n));
|
|
1828
|
+
} catch (t) {
|
|
1829
|
+
console.log("pointermove---catch", t);
|
|
1830
|
+
}
|
|
1831
|
+
}), u.on("movestart", () => {
|
|
1832
|
+
try {
|
|
1833
|
+
const h = u == null ? void 0 : u.getView().getZoom();
|
|
1834
|
+
h && h <= te.shipModelMax && h >= te.shipTriggleMin && s.changeShipScale("start");
|
|
1835
|
+
} catch (h) {
|
|
1836
|
+
console.log("movestart---catch", h);
|
|
1837
|
+
}
|
|
1838
|
+
}), u.on("singleclick", Ne((h) => {
|
|
1839
|
+
var t, n, m;
|
|
1840
|
+
try {
|
|
1841
|
+
if (console.log("1", o.getState()), o.getState()) return;
|
|
1842
|
+
const v = u.getFeaturesAtPixel(h.pixel);
|
|
1843
|
+
if (!v && v.length === 0) return;
|
|
1844
|
+
console.log("features------------", v);
|
|
1845
|
+
let N = null, M = null;
|
|
1846
|
+
if (v == null || v.forEach((y) => {
|
|
1847
|
+
y.get("shipData") && (N = y), y.get("portData") && (M = y);
|
|
1848
|
+
}), N)
|
|
1849
|
+
s.handleShipMapEvent(N, "click", (t = r.getProps()) == null ? void 0 : t.selectShip);
|
|
1850
|
+
else if (M) {
|
|
1851
|
+
const y = M.get("portData");
|
|
1852
|
+
i.selected(y), (m = (n = r.getProps()) == null ? void 0 : n.selectPort) == null || m.call(n, y);
|
|
1853
|
+
}
|
|
1854
|
+
h.preventDefault(), h.stopPropagation();
|
|
1855
|
+
} catch (v) {
|
|
1856
|
+
console.log("click---catch", v);
|
|
1857
|
+
}
|
|
1858
|
+
}, 150)), u.getView().on("change:resolution", Ne(() => {
|
|
1859
|
+
const h = u == null ? void 0 : u.getView().getZoom();
|
|
1860
|
+
h && h <= te.shipModelMax && h >= te.shipTriggleMin && s.changeSelectedScale("start");
|
|
1861
|
+
}, 10));
|
|
1862
|
+
}, Fo = () => {
|
|
1863
|
+
const e = St([]);
|
|
1864
|
+
return {
|
|
1865
|
+
createInstance: (s, i) => {
|
|
1866
|
+
const o = eo();
|
|
1867
|
+
o.initMap(s, i);
|
|
1868
|
+
const u = o.getInstall(), h = wo(u), t = xo();
|
|
1869
|
+
t.setProps(i), h.setShowLayerType(i.layerType), h.setGreenTileVisible(i.showGreenLayer);
|
|
1870
|
+
const n = so(u), m = lo(u, n), v = mo(u), N = bo(u), M = Mo(u, t), y = Co(u, t), w = Eo(u);
|
|
1871
|
+
To(o, t, n, v, w, M);
|
|
1872
|
+
const L = () => {
|
|
1873
|
+
const x = u.getView().calculateExtent(o.getSize()), W = ke([x[0], x[1]], K.mercator, K.data), D = ke([x[2], x[3]], K.mercator, K.data);
|
|
1874
|
+
return [W[0], W[1], D[0], D[1]];
|
|
1875
|
+
}, C = {
|
|
1876
|
+
id: Symbol("map-instance"),
|
|
1877
|
+
innerMap: null,
|
|
1878
|
+
map: o.getInstall(),
|
|
1879
|
+
destroy: () => {
|
|
1880
|
+
e.splice(e.indexOf(C), 1);
|
|
1881
|
+
},
|
|
1882
|
+
methods: {
|
|
1883
|
+
...o,
|
|
1884
|
+
layer: h,
|
|
1885
|
+
ship: v,
|
|
1886
|
+
track: n,
|
|
1887
|
+
carTrack: m,
|
|
1888
|
+
port: {
|
|
1889
|
+
render: w.render,
|
|
1890
|
+
clear: w.clear,
|
|
1891
|
+
selected: w.selected
|
|
1892
|
+
},
|
|
1893
|
+
position: N,
|
|
1894
|
+
drawLine: M,
|
|
1895
|
+
drawPolygon: y,
|
|
1896
|
+
// 子模块
|
|
1897
|
+
utils: {
|
|
1898
|
+
getCalculateExtent: L,
|
|
1899
|
+
convertSixHundredThousandToLatLng: je,
|
|
1900
|
+
calculateCirclePoints: to
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
};
|
|
1904
|
+
return e.push(C), C;
|
|
1905
|
+
},
|
|
1906
|
+
destroyInstance: (s) => {
|
|
1907
|
+
const i = e.findIndex((o) => o.id === s);
|
|
1908
|
+
i > -1 && (e[i].destroy(), e.splice(i, 1));
|
|
1909
|
+
},
|
|
1910
|
+
destroyAll: () => {
|
|
1911
|
+
e.forEach((s) => s.destroy()), e.splice(0, e.length);
|
|
1912
|
+
},
|
|
1913
|
+
getAllInstances: () => [...e]
|
|
1914
|
+
};
|
|
1915
|
+
}, Po = { class: "zh-map-box" }, So = /* @__PURE__ */ Ye({
|
|
1916
|
+
__name: "Map",
|
|
1917
|
+
props: {
|
|
1918
|
+
zoom: { default: te.default },
|
|
1919
|
+
center: { default: It },
|
|
1920
|
+
layerType: { default: "vector" },
|
|
1921
|
+
showGreenLayer: { type: Boolean, default: !1 },
|
|
1922
|
+
showScale: { type: Boolean, default: !0 },
|
|
1923
|
+
scaleLineUnit: { default: "metric" },
|
|
1924
|
+
mapMoveEnd: { type: Function, default: () => {
|
|
1925
|
+
} },
|
|
1926
|
+
lineDrawEnd: {},
|
|
1927
|
+
areaDrawEnd: { type: Function, default: () => {
|
|
1928
|
+
} },
|
|
1929
|
+
selectShip: { type: Function, default: () => {
|
|
1930
|
+
} },
|
|
1931
|
+
selectPort: { type: Function, default: () => {
|
|
1932
|
+
} }
|
|
1933
|
+
},
|
|
1934
|
+
setup(e, { expose: r }) {
|
|
1935
|
+
const l = I(), s = I(), i = Fo(), o = I(), u = e, h = I({
|
|
1936
|
+
getInstall() {
|
|
1937
|
+
}
|
|
1938
|
+
});
|
|
1939
|
+
return Nt(() => {
|
|
1940
|
+
var t;
|
|
1941
|
+
o.value = i.createInstance(l.value, u), h.value = o.value.methods, (t = s.value) == null || t.setScaleLine(o.value.map, u.scaleLineUnit);
|
|
1942
|
+
}), Vt(() => {
|
|
1943
|
+
var t, n;
|
|
1944
|
+
i.destroyInstance((t = o == null ? void 0 : o.value) == null ? void 0 : t.id), (n = o.value) == null || n.destroy();
|
|
1945
|
+
}), r({
|
|
1946
|
+
getZoom: () => {
|
|
1947
|
+
var t;
|
|
1948
|
+
return (t = o.value) == null ? void 0 : t.methods.getZoom();
|
|
1949
|
+
},
|
|
1950
|
+
setZoom: (t) => {
|
|
1951
|
+
var n;
|
|
1952
|
+
return (n = o.value) == null ? void 0 : n.methods.setZoom(t);
|
|
1953
|
+
},
|
|
1954
|
+
getInstall: () => {
|
|
1955
|
+
var t;
|
|
1956
|
+
return (t = o.value) == null ? void 0 : t.methods.getInstall();
|
|
1957
|
+
},
|
|
1958
|
+
getView: () => {
|
|
1959
|
+
var t;
|
|
1960
|
+
return (t = o.value) == null ? void 0 : t.methods.getView();
|
|
1961
|
+
},
|
|
1962
|
+
setCenter: (t, n) => {
|
|
1963
|
+
var m;
|
|
1964
|
+
return (m = o.value) == null ? void 0 : m.methods.setCenter(t, n);
|
|
1965
|
+
},
|
|
1966
|
+
getSize: () => {
|
|
1967
|
+
var t;
|
|
1968
|
+
return (t = o.value) == null ? void 0 : t.methods.getSize();
|
|
1969
|
+
},
|
|
1970
|
+
getCenter: (t, n) => {
|
|
1971
|
+
var m;
|
|
1972
|
+
return (m = o.value) == null ? void 0 : m.methods.getCenter();
|
|
1973
|
+
},
|
|
1974
|
+
layer: {
|
|
1975
|
+
setGreenTileVisible: (t) => {
|
|
1976
|
+
var n;
|
|
1977
|
+
return (n = o.value) == null ? void 0 : n.methods.layer.setGreenTileVisible(t);
|
|
1978
|
+
},
|
|
1979
|
+
getGreenTileVisible: () => {
|
|
1980
|
+
var t;
|
|
1981
|
+
return (t = o.value) == null ? void 0 : t.methods.layer.getGreenTileVisible();
|
|
1982
|
+
},
|
|
1983
|
+
getShowLayerType: () => {
|
|
1984
|
+
var t;
|
|
1985
|
+
return (t = o.value) == null ? void 0 : t.methods.layer.getShowLayerType();
|
|
1986
|
+
},
|
|
1987
|
+
setShowLayerType: (t) => {
|
|
1988
|
+
var n;
|
|
1989
|
+
return (n = o.value) == null ? void 0 : n.methods.layer.setShowLayerType(t);
|
|
1990
|
+
}
|
|
1991
|
+
},
|
|
1992
|
+
ship: {
|
|
1993
|
+
render: (...t) => {
|
|
1994
|
+
var n;
|
|
1995
|
+
return (n = o.value) == null ? void 0 : n.methods.ship.render(...t);
|
|
1996
|
+
},
|
|
1997
|
+
selected: (...t) => {
|
|
1998
|
+
var n;
|
|
1999
|
+
return (n = o.value) == null ? void 0 : n.methods.ship.selected(...t);
|
|
2000
|
+
},
|
|
2001
|
+
filter: (...t) => {
|
|
2002
|
+
var n;
|
|
2003
|
+
return (n = o.value) == null ? void 0 : n.methods.ship.filter(...t);
|
|
2004
|
+
},
|
|
2005
|
+
blinking: (...t) => {
|
|
2006
|
+
var n;
|
|
2007
|
+
return (n = o.value) == null ? void 0 : n.methods.ship.blinking(...t);
|
|
2008
|
+
},
|
|
2009
|
+
clear: () => {
|
|
2010
|
+
var t;
|
|
2011
|
+
return (t = o.value) == null ? void 0 : t.methods.ship.clear();
|
|
2012
|
+
}
|
|
2013
|
+
},
|
|
2014
|
+
track: {
|
|
2015
|
+
render: (...t) => {
|
|
2016
|
+
var n;
|
|
2017
|
+
return (n = o.value) == null ? void 0 : n.methods.track.render(...t);
|
|
2018
|
+
},
|
|
2019
|
+
remove: (...t) => {
|
|
2020
|
+
var n;
|
|
2021
|
+
return (n = o.value) == null ? void 0 : n.methods.track.remove(...t);
|
|
2022
|
+
},
|
|
2023
|
+
play: (...t) => {
|
|
2024
|
+
var n;
|
|
2025
|
+
return (n = o.value) == null ? void 0 : n.methods.track.play(...t);
|
|
2026
|
+
},
|
|
2027
|
+
setCenter: (...t) => {
|
|
2028
|
+
var n;
|
|
2029
|
+
return (n = o.value) == null ? void 0 : n.methods.track.setCenter(...t);
|
|
2030
|
+
},
|
|
2031
|
+
close: (...t) => {
|
|
2032
|
+
var n;
|
|
2033
|
+
return (n = o.value) == null ? void 0 : n.methods.track.close(...t);
|
|
2034
|
+
},
|
|
2035
|
+
getLength: (...t) => {
|
|
2036
|
+
var n;
|
|
2037
|
+
return (n = o.value) == null ? void 0 : n.methods.track.getLength(...t);
|
|
2038
|
+
}
|
|
2039
|
+
},
|
|
2040
|
+
carTrack: {
|
|
2041
|
+
location: (...t) => {
|
|
2042
|
+
var n;
|
|
2043
|
+
return (n = o.value) == null ? void 0 : n.methods.carTrack.location(...t);
|
|
2044
|
+
},
|
|
2045
|
+
remove: (...t) => {
|
|
2046
|
+
var n;
|
|
2047
|
+
return (n = o.value) == null ? void 0 : n.methods.carTrack.remove(...t);
|
|
2048
|
+
},
|
|
2049
|
+
renderTrack: (...t) => {
|
|
2050
|
+
var n;
|
|
2051
|
+
return (n = o.value) == null ? void 0 : n.methods.carTrack.renderTrack(...t);
|
|
2052
|
+
},
|
|
2053
|
+
setCenter: (...t) => {
|
|
2054
|
+
var n;
|
|
2055
|
+
return (n = o.value) == null ? void 0 : n.methods.carTrack.setCenter(...t);
|
|
2056
|
+
},
|
|
2057
|
+
closeTrack: () => {
|
|
2058
|
+
var t;
|
|
2059
|
+
return (t = o.value) == null ? void 0 : t.methods.carTrack.closeTrack();
|
|
2060
|
+
},
|
|
2061
|
+
playTrack: (...t) => {
|
|
2062
|
+
var n;
|
|
2063
|
+
return (n = o.value) == null ? void 0 : n.methods.carTrack.playTrack(...t);
|
|
2064
|
+
}
|
|
2065
|
+
},
|
|
2066
|
+
port: {
|
|
2067
|
+
render: (t, n) => {
|
|
2068
|
+
var m;
|
|
2069
|
+
return (m = o.value) == null ? void 0 : m.methods.port.render(t, n);
|
|
2070
|
+
},
|
|
2071
|
+
clear: () => {
|
|
2072
|
+
var t;
|
|
2073
|
+
return (t = o.value) == null ? void 0 : t.methods.port.clear();
|
|
2074
|
+
},
|
|
2075
|
+
selected: (t) => {
|
|
2076
|
+
var n;
|
|
2077
|
+
return (n = o.value) == null ? void 0 : n.methods.port.selected(t);
|
|
2078
|
+
}
|
|
2079
|
+
},
|
|
2080
|
+
position: {
|
|
2081
|
+
render: (...t) => {
|
|
2082
|
+
var n;
|
|
2083
|
+
return (n = o.value) == null ? void 0 : n.methods.position.render(...t);
|
|
2084
|
+
},
|
|
2085
|
+
selected: (...t) => {
|
|
2086
|
+
var n;
|
|
2087
|
+
return (n = o.value) == null ? void 0 : n.methods.position.selected(...t);
|
|
2088
|
+
},
|
|
2089
|
+
clearSelected: (...t) => {
|
|
2090
|
+
var n;
|
|
2091
|
+
return (n = o.value) == null ? void 0 : n.methods.position.clearSelected(...t);
|
|
2092
|
+
},
|
|
2093
|
+
clear: () => {
|
|
2094
|
+
var t;
|
|
2095
|
+
return (t = o.value) == null ? void 0 : t.methods.position.clear();
|
|
2096
|
+
}
|
|
2097
|
+
},
|
|
2098
|
+
drawLine: {
|
|
2099
|
+
open: () => {
|
|
2100
|
+
var t;
|
|
2101
|
+
return (t = o.value) == null ? void 0 : t.methods.drawLine.open();
|
|
2102
|
+
},
|
|
2103
|
+
close: () => {
|
|
2104
|
+
var t;
|
|
2105
|
+
return (t = o.value) == null ? void 0 : t.methods.drawLine.close();
|
|
2106
|
+
},
|
|
2107
|
+
deleteLine: (t) => {
|
|
2108
|
+
var n;
|
|
2109
|
+
return (n = o.value) == null ? void 0 : n.methods.drawLine.deleteLine(t);
|
|
2110
|
+
},
|
|
2111
|
+
setUnit: (t) => {
|
|
2112
|
+
var n;
|
|
2113
|
+
return (n = o.value) == null ? void 0 : n.methods.drawLine.setUnit(t);
|
|
2114
|
+
},
|
|
2115
|
+
getState: () => {
|
|
2116
|
+
var t;
|
|
2117
|
+
return (t = o.value) == null ? void 0 : t.methods.drawLine.getState();
|
|
2118
|
+
}
|
|
2119
|
+
},
|
|
2120
|
+
drawPolygon: {
|
|
2121
|
+
open: () => {
|
|
2122
|
+
var t;
|
|
2123
|
+
return (t = o.value) == null ? void 0 : t.methods.drawPolygon.open();
|
|
2124
|
+
},
|
|
2125
|
+
close: () => {
|
|
2126
|
+
var t;
|
|
2127
|
+
return (t = o.value) == null ? void 0 : t.methods.drawPolygon.close();
|
|
2128
|
+
},
|
|
2129
|
+
reset: () => {
|
|
2130
|
+
var t;
|
|
2131
|
+
return (t = o.value) == null ? void 0 : t.methods.drawPolygon.reset();
|
|
2132
|
+
}
|
|
2133
|
+
},
|
|
2134
|
+
// 子模块
|
|
2135
|
+
utils: {
|
|
2136
|
+
getCalculateExtent: (...t) => {
|
|
2137
|
+
var n;
|
|
2138
|
+
return (n = o.value) == null ? void 0 : n.methods.utils.getCalculateExtent(...t);
|
|
2139
|
+
},
|
|
2140
|
+
convertSixHundredThousandToLatLng: (...t) => {
|
|
2141
|
+
var n;
|
|
2142
|
+
return (n = o.value) == null ? void 0 : n.methods.utils.convertSixHundredThousandToLatLng(...t);
|
|
2143
|
+
},
|
|
2144
|
+
calculateCirclePoints: (t, n) => {
|
|
2145
|
+
var m;
|
|
2146
|
+
return (m = o.value) == null ? void 0 : m.methods.utils.calculateCirclePoints(t, n);
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
}), (t, n) => (Be(), qe("div", Po, [
|
|
2150
|
+
De("div", {
|
|
2151
|
+
id: "map",
|
|
2152
|
+
ref_key: "zhMapRef",
|
|
2153
|
+
ref: l,
|
|
2154
|
+
class: "zh-map"
|
|
2155
|
+
}, null, 512),
|
|
2156
|
+
Ae(Jt, {
|
|
2157
|
+
ref_key: "scaleLineRef",
|
|
2158
|
+
ref: s
|
|
2159
|
+
}, null, 512),
|
|
2160
|
+
Ae(Ut, {
|
|
2161
|
+
ref: "zoomControlRef",
|
|
2162
|
+
"map-instance": o.value
|
|
2163
|
+
}, null, 8, ["map-instance"])
|
|
2164
|
+
]));
|
|
2165
|
+
}
|
|
2166
|
+
}), No = /* @__PURE__ */ Xe(So, [["__scopeId", "data-v-1fa3c6fd"]]), Zo = Xt(No);
|
|
2167
|
+
export {
|
|
2168
|
+
Zo as Z
|
|
2169
|
+
};
|