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