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