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