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