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