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