zhihao-ui 1.3.51 → 1.3.52
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.
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { defineComponent as Ue, openBlock as Ie, createElementBlock as et, createElementVNode as _e, ref as
|
|
2
|
-
import { S as Yt, M as it, T as Pe, X as Fe, p as ie, V as Ht, q as Bt, t as Xt, h as ht, r as tt, s as qt, u as Se, F as oe, v as _, O as pe, P as te, w as Ve, x as
|
|
1
|
+
import { defineComponent as Ue, openBlock as Ie, createElementBlock as et, createElementVNode as _e, ref as se, computed as Ze, h as ae, createVNode as Qe, render as Zt, reactive as At, onMounted as Gt, onUnmounted as Wt } from "vue";
|
|
2
|
+
import { S as Yt, M as it, T as Pe, X as Fe, p as ie, V as Ht, q as Bt, t as Xt, h as ht, r as tt, s as qt, u as Se, F as oe, v as _, O as pe, P as te, w as Ve, x as yt, L as Ge, y as jt, z as ct, A as re, B as he, C as ue, D as ke, G as Ye, I as Ce, H as Kt, J as _t, K as Qt, N as Jt, Q as vt, R as We, U as Je, W as at, Y as Ut, Z as It, _ as eo } from "./vendor-Crdostgq.js";
|
|
3
3
|
import { _ as ot } from "./Button-Dp3Eoz3O.js";
|
|
4
4
|
import { w as to } from "./utils-Co2iJhr8.js";
|
|
5
5
|
const oo = { id: "scale-line-container" }, no = /* @__PURE__ */ Ue({
|
|
6
6
|
__name: "scaleLine",
|
|
7
7
|
setup(e, { expose: r }) {
|
|
8
8
|
return r({
|
|
9
|
-
setScaleLine: (l,
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
units:
|
|
9
|
+
setScaleLine: (l, d) => {
|
|
10
|
+
d || (d = "metric");
|
|
11
|
+
const a = new Yt({
|
|
12
|
+
units: d
|
|
13
13
|
}), s = document.getElementById("scale-line-container");
|
|
14
|
-
s && (
|
|
14
|
+
s && (a.setTarget(s), l.addControl(a));
|
|
15
15
|
}
|
|
16
|
-
}), (l,
|
|
16
|
+
}), (l, d) => (Ie(), et("div", oo));
|
|
17
17
|
}
|
|
18
18
|
}), ro = /* @__PURE__ */ ot(no, [["__scopeId", "data-v-2bc5dee8"]]), lo = { class: "zoom" }, so = /* @__PURE__ */ Ue({
|
|
19
19
|
__name: "zoomControl",
|
|
@@ -28,17 +28,17 @@ const oo = { id: "scale-line-container" }, no = /* @__PURE__ */ Ue({
|
|
|
28
28
|
console.log("props", r);
|
|
29
29
|
const n = () => {
|
|
30
30
|
console.log("props");
|
|
31
|
-
const { setZoom:
|
|
31
|
+
const { setZoom: d, getZoom: a, getInstall: s } = r.mapInstance.methods;
|
|
32
32
|
if (!s()) return;
|
|
33
|
-
const x =
|
|
34
|
-
x &&
|
|
33
|
+
const x = a();
|
|
34
|
+
x && d(x + 1);
|
|
35
35
|
}, l = () => {
|
|
36
|
-
const { setZoom:
|
|
36
|
+
const { setZoom: d, getZoom: a, getInstall: s } = r.mapInstance.methods;
|
|
37
37
|
if (!s()) return;
|
|
38
|
-
const x =
|
|
39
|
-
x &&
|
|
38
|
+
const x = a();
|
|
39
|
+
x && d(x - 1);
|
|
40
40
|
};
|
|
41
|
-
return (
|
|
41
|
+
return (d, a) => (Ie(), et("div", lo, [
|
|
42
42
|
_e("div", {
|
|
43
43
|
class: "button big-button",
|
|
44
44
|
onClick: n
|
|
@@ -72,13 +72,13 @@ const oo = { id: "scale-line-container" }, no = /* @__PURE__ */ Ue({
|
|
|
72
72
|
}, co = [114.84, 30.52], mt = "https://static.zhihaoscm.cn/", He = 2003750834e-2;
|
|
73
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=${Ae}`, 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=${Ae}`, 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=${Ae}`, 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=${Ae}`, e.greenTile = `${mt}/map/tile/{z}/{x}/{y}.png`, e))(xe || {}), Ne = /* @__PURE__ */ ((e) => (e[e.M = 1] = "M", e[e.KM = 2] = "KM", e[e.NM = 3] = "NM", e))(Ne || {}), I = /* @__PURE__ */ ((e) => (e.PORT = "port", e.SHIP = "ship", e.TRACK = "track", e))(I || {});
|
|
74
74
|
function ao() {
|
|
75
|
-
const e =
|
|
75
|
+
const e = se(), r = () => e.value, n = () => r().getView(), l = () => {
|
|
76
76
|
var g;
|
|
77
77
|
return (g = n()) == null ? void 0 : g.getZoom();
|
|
78
|
-
},
|
|
78
|
+
}, d = (g) => {
|
|
79
79
|
var k;
|
|
80
80
|
(k = n()) == null || k.setZoom(g);
|
|
81
|
-
},
|
|
81
|
+
}, a = (g, k) => {
|
|
82
82
|
var $;
|
|
83
83
|
($ = n()) == null || $.setCenter(ie([g, k]));
|
|
84
84
|
}, s = () => {
|
|
@@ -150,8 +150,8 @@ function ao() {
|
|
|
150
150
|
getInstall: r,
|
|
151
151
|
getView: n,
|
|
152
152
|
getZoom: l,
|
|
153
|
-
setZoom:
|
|
154
|
-
setCenter:
|
|
153
|
+
setZoom: d,
|
|
154
|
+
setCenter: a,
|
|
155
155
|
getCenter: s,
|
|
156
156
|
getSize: h,
|
|
157
157
|
initMap: t,
|
|
@@ -162,33 +162,33 @@ const nt = function(e, r) {
|
|
|
162
162
|
const n = Number(r) / 6e5;
|
|
163
163
|
return [Number(e) / 6e5, n];
|
|
164
164
|
}, uo = (e, r) => {
|
|
165
|
-
const n = ie(e), l = r * 1e3,
|
|
165
|
+
const n = ie(e), l = r * 1e3, d = [
|
|
166
166
|
n[0] - l,
|
|
167
167
|
n[1] - l,
|
|
168
168
|
n[0] + l,
|
|
169
169
|
n[1] + l
|
|
170
|
-
],
|
|
170
|
+
], a = qt(d, ee.mercator, ee.data);
|
|
171
171
|
return {
|
|
172
|
-
leftTopPoint: { lng:
|
|
173
|
-
rightTopPoint: { lng:
|
|
174
|
-
rightBottomPoint: { lng:
|
|
175
|
-
leftBottomPoint: { lng:
|
|
172
|
+
leftTopPoint: { lng: a[0], lat: a[3] },
|
|
173
|
+
rightTopPoint: { lng: a[2], lat: a[3] },
|
|
174
|
+
rightBottomPoint: { lng: a[2], lat: a[1] },
|
|
175
|
+
leftBottomPoint: { lng: a[0], lat: a[1] }
|
|
176
176
|
};
|
|
177
177
|
}, go = function(e, r) {
|
|
178
178
|
const l = tt(e);
|
|
179
|
-
let
|
|
179
|
+
let d = "";
|
|
180
180
|
switch (console.log(r, Ne), r) {
|
|
181
181
|
case Ne.M:
|
|
182
|
-
|
|
182
|
+
d = Math.round(l * 100) / 100 + " m";
|
|
183
183
|
break;
|
|
184
184
|
case Ne.KM:
|
|
185
|
-
|
|
185
|
+
d = Math.round(l / 1e3 * 100) / 100 + " km";
|
|
186
186
|
break;
|
|
187
187
|
case Ne.NM:
|
|
188
|
-
|
|
188
|
+
d = (Math.round(l / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
|
|
189
189
|
break;
|
|
190
190
|
}
|
|
191
|
-
return
|
|
191
|
+
return d;
|
|
192
192
|
};
|
|
193
193
|
function fo(e) {
|
|
194
194
|
const r = e[0] * He / 180;
|
|
@@ -198,8 +198,8 @@ function fo(e) {
|
|
|
198
198
|
function be(e = "") {
|
|
199
199
|
let r = e.replace(/&?/g, "&");
|
|
200
200
|
return r = r.replace(/&#x([0-9a-fA-F]+);?/g, (n, l) => {
|
|
201
|
-
const
|
|
202
|
-
return String.fromCodePoint(
|
|
201
|
+
const d = parseInt(l, 16);
|
|
202
|
+
return String.fromCodePoint(d);
|
|
203
203
|
}), r;
|
|
204
204
|
}
|
|
205
205
|
const dt = (e) => {
|
|
@@ -215,21 +215,21 @@ const dt = (e) => {
|
|
|
215
215
|
});
|
|
216
216
|
}, ut = (e, r = "lonlat") => {
|
|
217
217
|
const n = { lon: 0, lat: 0 }, l = e[0] / He * 180;
|
|
218
|
-
let
|
|
219
|
-
return
|
|
218
|
+
let d = e[1] / He * 180;
|
|
219
|
+
return d = 180 / Math.PI * (2 * Math.atan(Math.exp(d * Math.PI / 180)) - Math.PI / 2), n.lon = l, n.lat = d, r === "lonlat" ? n : [l, d];
|
|
220
220
|
}, ho = (e) => {
|
|
221
|
-
const r = ht.duration(e, "minutes"), n = Math.floor(r.asDays()), l = r.hours(),
|
|
222
|
-
let
|
|
223
|
-
return l !== 0 && (
|
|
224
|
-
},
|
|
221
|
+
const r = ht.duration(e, "minutes"), n = Math.floor(r.asDays()), l = r.hours(), d = r.minutes();
|
|
222
|
+
let a = `${String(d).padStart(2, "0")}分`;
|
|
223
|
+
return l !== 0 && (a = `${String(l).padStart(2, "0")}时${a}`), n !== 0 && (a = `${String(n).padStart(2, "0")}天${a}`), a;
|
|
224
|
+
}, yo = (e, r) => {
|
|
225
225
|
let n = null;
|
|
226
226
|
const l = async (o) => {
|
|
227
227
|
if (!e || (console.log("vehicleInfo", o), !(o != null && o.lon && (o != null && o.lat)))) return;
|
|
228
228
|
const g = Math.abs(Number(o.lon)) > 180 ? nt(o.lon, o.lat) : [o.lon, o.lat];
|
|
229
|
-
|
|
229
|
+
d(o, ie(g));
|
|
230
230
|
const k = e == null ? void 0 : e.getView(), $ = new te(g);
|
|
231
231
|
k.setCenter(Ve($.getCoordinates(), ee.data, ee.mercator));
|
|
232
|
-
},
|
|
232
|
+
}, d = (o, g) => {
|
|
233
233
|
const k = `${mt}map/car-icon.gif`;
|
|
234
234
|
n || (n = new pe({
|
|
235
235
|
element: document.createElement("div"),
|
|
@@ -262,12 +262,12 @@ const dt = (e) => {
|
|
|
262
262
|
}
|
|
263
263
|
};
|
|
264
264
|
};
|
|
265
|
-
var wt = /* @__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))(wt || {}),
|
|
266
|
-
const
|
|
265
|
+
var wt = /* @__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))(wt || {}), le = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.front = "front", e.up = "up", e.down = "down", e.back = "back", e))(le || {});
|
|
266
|
+
const vo = (e) => {
|
|
267
267
|
const r = /* @__PURE__ */ new Map(), n = {};
|
|
268
268
|
let l = null;
|
|
269
|
-
const
|
|
270
|
-
let
|
|
269
|
+
const d = "--";
|
|
270
|
+
let a = null;
|
|
271
271
|
const s = document.createElement("div"), h = new pe({
|
|
272
272
|
element: s,
|
|
273
273
|
positioning: "top-left",
|
|
@@ -277,37 +277,37 @@ const yo = (e) => {
|
|
|
277
277
|
const b = 8, V = [], X = (c) => {
|
|
278
278
|
var f;
|
|
279
279
|
for (V.unshift(c); V.length > b; ) {
|
|
280
|
-
const
|
|
281
|
-
p && ((f = p.getSource()) == null || f.clear(), e == null || e.removeLayer(p), r.delete(
|
|
280
|
+
const y = V.pop(), p = r.get(y);
|
|
281
|
+
p && ((f = p.getSource()) == null || f.clear(), e == null || e.removeLayer(p), r.delete(y), delete n[y]);
|
|
282
282
|
}
|
|
283
283
|
};
|
|
284
284
|
let G = "";
|
|
285
|
-
const q = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], K =
|
|
285
|
+
const q = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], K = yt(async () => {
|
|
286
286
|
if (l && n[l] && r.get(l).getVisible()) {
|
|
287
287
|
console.log("reRenderTrackLine------------"), await Lt(l);
|
|
288
288
|
const c = M(l, n[l]);
|
|
289
289
|
ce(l, c);
|
|
290
290
|
}
|
|
291
291
|
}, 100), N = () => l && n[l] && r.get(l).getVisible(), M = (c, f) => {
|
|
292
|
-
let
|
|
292
|
+
let y = [];
|
|
293
293
|
const p = Math.max(1, Math.floor(f.length / P));
|
|
294
|
-
return
|
|
294
|
+
return y = f.filter((R, S) => S % p === 0).map((R, S) => {
|
|
295
295
|
if (Number(R.lon) > 180 || Number(R.lat) > 180) {
|
|
296
296
|
const [A, Y] = nt(R.lon, R.lat);
|
|
297
297
|
R.lon = A, R.lat = Y;
|
|
298
298
|
}
|
|
299
299
|
return R.center = [R.lon, R.lat], R.centerPoint = fo(R.center), R.time = ht(R.createdAt).format("YYYY-MM-DD HH:mm:ss"), R.id = c, R.index = S, R;
|
|
300
|
-
}),
|
|
300
|
+
}), y.filter(
|
|
301
301
|
(R, S, A) => S === A.findIndex(
|
|
302
302
|
(Y) => Math.abs(Y.lon - R.lon) < 1e-6 && Math.abs(Y.lat - R.lat) < 1e-6
|
|
303
303
|
)
|
|
304
304
|
);
|
|
305
|
-
}, i = async (c, f,
|
|
305
|
+
}, i = async (c, f, y, p = "ship", v = 200) => {
|
|
306
306
|
if (!e || JSON.stringify(n[c]) === JSON.stringify(f) && l === c || (f = f == null ? void 0 : f.reverse(), h && p === "ship" && (e != null && e.getOverlays().getArray().includes(h) || e.addOverlay(h)), (f == null ? void 0 : f.length) < 2))
|
|
307
307
|
return;
|
|
308
|
-
X(c), l = c, n[c] = f, P =
|
|
308
|
+
X(c), l = c, n[c] = f, P = v;
|
|
309
309
|
const D = Object.keys(n).findIndex((R) => R === c) || 0;
|
|
310
|
-
G =
|
|
310
|
+
G = y || q[D > 10 ? 10 : D], await L(), await rt(l);
|
|
311
311
|
}, T = (c) => {
|
|
312
312
|
const f = new ue();
|
|
313
313
|
return new he({
|
|
@@ -320,10 +320,10 @@ const yo = (e) => {
|
|
|
320
320
|
zIndex: 10
|
|
321
321
|
});
|
|
322
322
|
}, w = (c) => {
|
|
323
|
-
r.forEach((f,
|
|
324
|
-
var
|
|
325
|
-
const p =
|
|
326
|
-
f.getVisible() !== p && (f.setVisible(p), e.getLayers().getArray().includes(f) || e.addLayer(f), p || (
|
|
323
|
+
r.forEach((f, y) => {
|
|
324
|
+
var v;
|
|
325
|
+
const p = y === c;
|
|
326
|
+
f.getVisible() !== p && (f.setVisible(p), e.getLayers().getArray().includes(f) || e.addLayer(f), p || (v = f.getSource()) == null || v.clear());
|
|
327
327
|
}), l = c;
|
|
328
328
|
}, L = async () => {
|
|
329
329
|
const c = l;
|
|
@@ -332,19 +332,19 @@ const yo = (e) => {
|
|
|
332
332
|
r.set(c, D);
|
|
333
333
|
}
|
|
334
334
|
await w(c);
|
|
335
|
-
const f = G || "",
|
|
336
|
-
if (!(
|
|
335
|
+
const f = G || "", y = n[c] || [];
|
|
336
|
+
if (!(y && y.length > 1)) return [];
|
|
337
337
|
let p = [];
|
|
338
|
-
p = M(c,
|
|
339
|
-
const
|
|
340
|
-
p.length >= 2 && await F(c,
|
|
341
|
-
}, F = (c, f,
|
|
342
|
-
const p = new Ge(f),
|
|
338
|
+
p = M(c, y);
|
|
339
|
+
const v = p.map((D) => D.centerPoint);
|
|
340
|
+
p.length >= 2 && await F(c, v, f);
|
|
341
|
+
}, F = (c, f, y) => {
|
|
342
|
+
const p = new Ge(f), v = r.get(c).getSource(), D = v.getFeatureById(c);
|
|
343
343
|
if (D)
|
|
344
|
-
D.setGeometry(p), D.setId(c), D.setStyle(Z(
|
|
344
|
+
D.setGeometry(p), D.setId(c), D.setStyle(Z(y)), m = D;
|
|
345
345
|
else {
|
|
346
|
-
const R = new
|
|
347
|
-
R.setId(c), R.set("type", "line"), R.setStyle(Z(
|
|
346
|
+
const R = new re({ geometry: p });
|
|
347
|
+
R.setId(c), R.set("type", "line"), R.setStyle(Z(y)), v.addFeature(R), m = R;
|
|
348
348
|
}
|
|
349
349
|
return m;
|
|
350
350
|
}, Z = (c) => new _({
|
|
@@ -352,13 +352,13 @@ const yo = (e) => {
|
|
|
352
352
|
color: c,
|
|
353
353
|
width: 2
|
|
354
354
|
})
|
|
355
|
-
}), W = (c, f,
|
|
355
|
+
}), W = (c, f, y) => {
|
|
356
356
|
try {
|
|
357
357
|
const p = c == null ? void 0 : c.get("data");
|
|
358
358
|
if (c && p && f === "hover") {
|
|
359
359
|
e.getTargetElement().style.cursor = p ? "pointer" : "";
|
|
360
|
-
const
|
|
361
|
-
D && (s.querySelector(".popup-content"), s.innerHTML =
|
|
360
|
+
const v = H(p), D = y == null ? void 0 : y.coordinate;
|
|
361
|
+
D && (s.querySelector(".popup-content"), s.innerHTML = v, h == null || h.setPosition(D));
|
|
362
362
|
} else
|
|
363
363
|
h && h.setPosition(void 0);
|
|
364
364
|
} catch (p) {
|
|
@@ -376,27 +376,27 @@ const yo = (e) => {
|
|
|
376
376
|
<div class="track-point-popup">
|
|
377
377
|
<div class="item">
|
|
378
378
|
<div class="item-label">状态</div>
|
|
379
|
-
<div class="item-item">${c != null && c.sailStatus ? wt[c.sailStatus] :
|
|
379
|
+
<div class="item-item">${c != null && c.sailStatus ? wt[c.sailStatus] : d}</div>
|
|
380
380
|
</div>
|
|
381
381
|
<div class="item">
|
|
382
382
|
<div class="item-label">航速</div>
|
|
383
|
-
<div class="item-item">${c.speed ||
|
|
383
|
+
<div class="item-item">${c.speed || d}</div>
|
|
384
384
|
</div>
|
|
385
385
|
<div class="item">
|
|
386
386
|
<div class="item-label">艏向</div>
|
|
387
|
-
<div class="item-item">${c.hdg ||
|
|
387
|
+
<div class="item-item">${c.hdg || d}</div>
|
|
388
388
|
</div>
|
|
389
389
|
<div class="item">
|
|
390
390
|
<div class="item-label">航向</div>
|
|
391
|
-
<div class="item-item">${c.cog ||
|
|
391
|
+
<div class="item-item">${c.cog || d}</div>
|
|
392
392
|
</div>
|
|
393
393
|
<div class="item">
|
|
394
394
|
<div class="item-label">经度</div>
|
|
395
|
-
<div class="item-item">${c.lon ||
|
|
395
|
+
<div class="item-item">${c.lon || d}</div>
|
|
396
396
|
</div>
|
|
397
397
|
<div class="item">
|
|
398
398
|
<div class="item-label">纬度</div>
|
|
399
|
-
<div class="item-item">${c.lat ||
|
|
399
|
+
<div class="item-item">${c.lat || d}</div>
|
|
400
400
|
</div>
|
|
401
401
|
<div class="item w-100">
|
|
402
402
|
<div class="item-label">时间</div>
|
|
@@ -405,7 +405,7 @@ const yo = (e) => {
|
|
|
405
405
|
${f ?? f}
|
|
406
406
|
</div>`;
|
|
407
407
|
}, O = (c) => {
|
|
408
|
-
const
|
|
408
|
+
const y = c.map((S) => {
|
|
409
409
|
const A = e.getPixelFromCoordinate(ie(S.center));
|
|
410
410
|
return {
|
|
411
411
|
...S,
|
|
@@ -416,23 +416,23 @@ const yo = (e) => {
|
|
|
416
416
|
};
|
|
417
417
|
});
|
|
418
418
|
let p = 0;
|
|
419
|
-
|
|
420
|
-
for (let S = 1; S <
|
|
421
|
-
const A =
|
|
422
|
-
p += Math.sqrt(J * J + E * E),
|
|
419
|
+
y[0].distance = 0;
|
|
420
|
+
for (let S = 1; S < y.length; S++) {
|
|
421
|
+
const A = y[S - 1].pixel, Y = y[S].pixel, J = Y[0] - A[0], E = Y[1] - A[1];
|
|
422
|
+
p += Math.sqrt(J * J + E * E), y[S].distance = p;
|
|
423
423
|
}
|
|
424
|
-
const
|
|
425
|
-
(S, A) => A === 0 || A ===
|
|
424
|
+
const v = y.filter(
|
|
425
|
+
(S, A) => A === 0 || A === y.length - 1
|
|
426
426
|
), D = [];
|
|
427
|
-
for (let S = 0; S <
|
|
428
|
-
const A =
|
|
429
|
-
if (D.push(A), S <
|
|
430
|
-
const Y =
|
|
427
|
+
for (let S = 0; S < v.length; S++) {
|
|
428
|
+
const A = v[S];
|
|
429
|
+
if (D.push(A), S < v.length - 1) {
|
|
430
|
+
const Y = v[S + 1], J = Y.distance - A.distance, E = Math.floor(J / 100);
|
|
431
431
|
for (let B = 1; B <= E; B++) {
|
|
432
432
|
const j = A.distance + B * 100;
|
|
433
433
|
if (j >= Y.distance) break;
|
|
434
|
-
const Q =
|
|
435
|
-
|
|
434
|
+
const Q = ne(
|
|
435
|
+
y,
|
|
436
436
|
j
|
|
437
437
|
);
|
|
438
438
|
Q && D.push(Q);
|
|
@@ -452,11 +452,11 @@ const yo = (e) => {
|
|
|
452
452
|
distance: S.distance
|
|
453
453
|
}));
|
|
454
454
|
};
|
|
455
|
-
function
|
|
456
|
-
for (let
|
|
457
|
-
const p = c[
|
|
458
|
-
if (f >= p.distance && f <=
|
|
459
|
-
const D = (f - p.distance) / (
|
|
455
|
+
function ne(c, f) {
|
|
456
|
+
for (let y = 1; y < c.length; y++) {
|
|
457
|
+
const p = c[y - 1], v = c[y];
|
|
458
|
+
if (f >= p.distance && f <= v.distance) {
|
|
459
|
+
const D = (f - p.distance) / (v.distance - p.distance), R = p.pixel[0] + D * (v.pixel[0] - p.pixel[0]), S = p.pixel[1] + D * (v.pixel[1] - p.pixel[1]), A = e == null ? void 0 : e.getCoordinateFromPixel([R, S]);
|
|
460
460
|
return {
|
|
461
461
|
...p,
|
|
462
462
|
// 继承前一个点的属性(可调整)
|
|
@@ -471,26 +471,26 @@ const yo = (e) => {
|
|
|
471
471
|
return null;
|
|
472
472
|
}
|
|
473
473
|
const ce = async (c, f) => {
|
|
474
|
-
const
|
|
475
|
-
console.log("simplifiedPoints",
|
|
476
|
-
const p =
|
|
477
|
-
r.get(c).getSource().addFeatures([...p, ...
|
|
474
|
+
const y = O(f);
|
|
475
|
+
console.log("simplifiedPoints", y.length, "list", f.length);
|
|
476
|
+
const p = y.map((S) => de(S)), v = y.map((S) => Mt(S, G)), D = Pt(c, y, f, G);
|
|
477
|
+
r.get(c).getSource().addFeatures([...p, ...v, ...D]);
|
|
478
478
|
}, de = (c) => {
|
|
479
|
-
const f = new
|
|
479
|
+
const f = new re({
|
|
480
480
|
geometry: new te(c.centerPoint),
|
|
481
481
|
data: c
|
|
482
482
|
});
|
|
483
483
|
f.set("type", "track_point"), f.set("trackId", c.id), f.set("data", c);
|
|
484
|
-
let
|
|
484
|
+
let y = [
|
|
485
485
|
...Tt(c, G)
|
|
486
486
|
];
|
|
487
|
-
return (c.index === 0 || c.index === n[c.id].length - 1) && (
|
|
487
|
+
return (c.index === 0 || c.index === n[c.id].length - 1) && (y = [...Ft(c)], f.set("type", "track_begin")), c.state !== void 0 && c.state !== null && (y = [...Et(c)], f.set("type", "track_icon")), f.setStyle(y), f;
|
|
488
488
|
}, Be = window.devicePixelRatio || 1, Me = /* @__PURE__ */ new Map();
|
|
489
489
|
let ge = null, Xe = null;
|
|
490
490
|
function Ct(c, f) {
|
|
491
|
-
const
|
|
492
|
-
if (Me.has(
|
|
493
|
-
return Me.get(
|
|
491
|
+
const y = `${c}`;
|
|
492
|
+
if (Me.has(y))
|
|
493
|
+
return Me.get(y);
|
|
494
494
|
if (!ge) {
|
|
495
495
|
ge = document.createElement("canvas");
|
|
496
496
|
try {
|
|
@@ -501,28 +501,28 @@ const yo = (e) => {
|
|
|
501
501
|
console.log("e", st), Xe = ge.getContext("2d");
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
|
-
const p = ge,
|
|
505
|
-
if (!
|
|
504
|
+
const p = ge, v = Xe;
|
|
505
|
+
if (!v) return "";
|
|
506
506
|
p.width = 0, p.height = 0;
|
|
507
507
|
const D = 2, R = 8, S = 16, A = window.devicePixelRatio || 1, Y = "500 12px Arial";
|
|
508
|
-
|
|
509
|
-
const E =
|
|
510
|
-
let Q = 0, fe = 0,
|
|
511
|
-
Q = S + B, fe = S + j,
|
|
508
|
+
v.font = Y;
|
|
509
|
+
const E = v.measureText(c).width, B = R + E + R, j = D + 14 + D;
|
|
510
|
+
let Q = 0, fe = 0, ve = 0, me = 0, Re = 0, Le = 0, we = 0, Te = 0;
|
|
511
|
+
Q = S + B, fe = S + j, ve = B, me = j, Re = B + S, Le = 0, we = 0, Te = S, p.width = Math.round(Q * A), p.height = Math.round(fe * A), v.scale(A, A), v.clearRect(0, 0, Q, fe), v.beginPath(), v.moveTo(ve, me), v.lineTo(Re, Le), v.strokeStyle = f || "#FFF", v.lineWidth = 1, v.stroke(), v.fillStyle = "#FFF", v.fillRect(we, Te, B, j), v.strokeStyle = f || "#FFF", v.lineWidth = 1, v.strokeRect(we, Te, B, j), v.font = Y, v.textBaseline = "middle";
|
|
512
512
|
const Oe = Te + D / 2 + j / 2;
|
|
513
|
-
|
|
513
|
+
v.strokeStyle = "#ffffff", v.lineWidth = 1, v.strokeText(c, we + R, Oe), v.fillStyle = "#000000", v.fillText(c, we + R, Oe);
|
|
514
514
|
const De = p.toDataURL("image/png");
|
|
515
|
-
return Me.set(
|
|
515
|
+
return Me.set(y, De), De;
|
|
516
516
|
}
|
|
517
517
|
const Mt = (c, f) => {
|
|
518
|
-
const
|
|
518
|
+
const y = Ct(c.time, f), p = new re({
|
|
519
519
|
geometry: new te(c.centerPoint),
|
|
520
520
|
data: c
|
|
521
521
|
});
|
|
522
522
|
p.set("type", "track_point_label");
|
|
523
|
-
const
|
|
523
|
+
const v = new _({
|
|
524
524
|
image: new Ce({
|
|
525
|
-
src:
|
|
525
|
+
src: y,
|
|
526
526
|
anchor: [1, 0],
|
|
527
527
|
displacement: [0, 0],
|
|
528
528
|
scale: 1 / Be,
|
|
@@ -531,11 +531,11 @@ const yo = (e) => {
|
|
|
531
531
|
}),
|
|
532
532
|
zIndex: 100
|
|
533
533
|
});
|
|
534
|
-
return p.setStyle(
|
|
534
|
+
return p.setStyle(v), p;
|
|
535
535
|
}, Lt = (c) => {
|
|
536
536
|
const f = r.get(c).getSource();
|
|
537
|
-
f.forEachFeature((
|
|
538
|
-
|
|
537
|
+
f.forEachFeature((y) => {
|
|
538
|
+
y.get("type") !== "line" && f.removeFeature(y);
|
|
539
539
|
});
|
|
540
540
|
}, Tt = (c, f) => [
|
|
541
541
|
new _({
|
|
@@ -555,38 +555,38 @@ const yo = (e) => {
|
|
|
555
555
|
})
|
|
556
556
|
// textStyle,
|
|
557
557
|
], Et = (c) => {
|
|
558
|
-
const f = "#E31818",
|
|
558
|
+
const f = "#E31818", y = "#1890FF", p = "", v = new _({
|
|
559
559
|
text: new Se({
|
|
560
560
|
font: "Normal 22px map-iconfont",
|
|
561
561
|
text: be(p),
|
|
562
562
|
offsetY: -10,
|
|
563
563
|
fill: new oe({
|
|
564
|
-
color: Number(c.state) === 0 ? f : Number(c.state) === 1 ?
|
|
564
|
+
color: Number(c.state) === 0 ? f : Number(c.state) === 1 ? y : ""
|
|
565
565
|
})
|
|
566
566
|
}),
|
|
567
567
|
zIndex: 99
|
|
568
568
|
}), R = dt(""), A = dt(""), Y = [];
|
|
569
|
-
return Number(c.state) === 0 ? Y.push(R) : Number(c.state) === 1 && Y.push(A), Y.push(
|
|
570
|
-
}, Pt = (c, f,
|
|
571
|
-
const
|
|
572
|
-
D || (
|
|
569
|
+
return Number(c.state) === 0 ? Y.push(R) : Number(c.state) === 1 && Y.push(A), Y.push(v), Y;
|
|
570
|
+
}, Pt = (c, f, y, p) => {
|
|
571
|
+
const v = f || [], D = f.length;
|
|
572
|
+
D || (v.push(y[0]), v.push(y[y.length - 1]));
|
|
573
573
|
const R = new Set(f.map((A) => `${A.centerPoint[0]},${A.centerPoint[1]}`)), S = [];
|
|
574
574
|
for (let A = 0; A < D - 1; A++) {
|
|
575
575
|
let Y;
|
|
576
576
|
const J = f[A], E = (f[A + 1].index + J.index) / 2;
|
|
577
577
|
if (E % 2 === 0)
|
|
578
|
-
Y =
|
|
578
|
+
Y = y[E].centerPoint;
|
|
579
579
|
else {
|
|
580
|
-
const B =
|
|
580
|
+
const B = y[Math.floor(E)], j = y[Math.ceil(E)];
|
|
581
581
|
if (B && j) {
|
|
582
|
-
const [Q, fe] = B.centerPoint, [
|
|
583
|
-
Y = [(Q +
|
|
582
|
+
const [Q, fe] = B.centerPoint, [ve, me] = j.centerPoint;
|
|
583
|
+
Y = [(Q + ve) / 2, (fe + me) / 2];
|
|
584
584
|
}
|
|
585
585
|
}
|
|
586
586
|
if (Y) {
|
|
587
587
|
const B = `${Y[0]},${Y[1]}`;
|
|
588
588
|
if (!R.has(B)) {
|
|
589
|
-
const j = new
|
|
589
|
+
const j = new re({
|
|
590
590
|
geometry: new te(Y)
|
|
591
591
|
});
|
|
592
592
|
j.set("type", "track_arrow"), j.setStyle(
|
|
@@ -608,21 +608,21 @@ const yo = (e) => {
|
|
|
608
608
|
return S;
|
|
609
609
|
}, rt = (c) => {
|
|
610
610
|
var D, R;
|
|
611
|
-
const f = e.getView(),
|
|
611
|
+
const f = e.getView(), y = (D = r == null ? void 0 : r.get(c)) == null ? void 0 : D.getSource(), p = m || (c ? y == null ? void 0 : y.getFeatureById(c) : null);
|
|
612
612
|
if (!p) return;
|
|
613
|
-
const
|
|
614
|
-
if (!
|
|
613
|
+
const v = (R = p == null ? void 0 : p.getGeometry()) == null ? void 0 : R.getExtent();
|
|
614
|
+
if (!v || v[0] === v[2] || v[1] === v[3]) {
|
|
615
615
|
console.warn("Invalid track extent");
|
|
616
616
|
return;
|
|
617
617
|
}
|
|
618
618
|
try {
|
|
619
|
-
const S =
|
|
619
|
+
const S = v[2] - v[0], A = v[3] - v[1], Y = 1e-4;
|
|
620
620
|
if (S < Y || A < Y) {
|
|
621
|
-
const E = [(
|
|
621
|
+
const E = [(v[0] + v[2]) / 2, (v[1] + v[3]) / 2];
|
|
622
622
|
f.setCenter(E);
|
|
623
623
|
return;
|
|
624
624
|
}
|
|
625
|
-
const J = jt(
|
|
625
|
+
const J = jt(v, Math.max(S, A) * 0.1);
|
|
626
626
|
f.fit(J, {
|
|
627
627
|
maxZoom: U.max,
|
|
628
628
|
padding: [30, 30, 30, 30]
|
|
@@ -632,43 +632,43 @@ const yo = (e) => {
|
|
|
632
632
|
console.error("setTrackViewCenter error:", S);
|
|
633
633
|
}
|
|
634
634
|
}, Ft = (c) => {
|
|
635
|
-
const f = "",
|
|
635
|
+
const f = "", v = c.index === 0 ? "#fcdc3f" : "#ff0000";
|
|
636
636
|
return [new _({
|
|
637
637
|
text: new Se({
|
|
638
638
|
font: "Normal 14px map-iconfont",
|
|
639
639
|
text: be(f),
|
|
640
|
-
fill: new oe({ color:
|
|
640
|
+
fill: new oe({ color: v })
|
|
641
641
|
}),
|
|
642
642
|
zIndex: 101
|
|
643
643
|
})];
|
|
644
644
|
}, St = () => {
|
|
645
645
|
console.log("清除所有的轨迹-----"), ze(), r.forEach((f) => {
|
|
646
|
-
var
|
|
647
|
-
(
|
|
646
|
+
var y;
|
|
647
|
+
(y = f.getSource()) == null || y.clear(), e == null || e.removeLayer(f);
|
|
648
648
|
}), Object.keys(n).forEach((f) => {
|
|
649
649
|
r.delete(f), delete n[f];
|
|
650
650
|
});
|
|
651
651
|
}, Nt = (c) => {
|
|
652
652
|
const f = r.get(c || l);
|
|
653
653
|
f == null || f.setVisible(!1);
|
|
654
|
-
const
|
|
655
|
-
for (let p = 0; p <
|
|
656
|
-
const
|
|
657
|
-
|
|
654
|
+
const y = e.getOverlays().getArray();
|
|
655
|
+
for (let p = 0; p < y.length; ) {
|
|
656
|
+
const v = y[p];
|
|
657
|
+
v.get("class") === "track-label-overlay" ? (v.setPosition(void 0), v.dispose()) : p++;
|
|
658
658
|
}
|
|
659
659
|
ze();
|
|
660
660
|
}, Rt = (c, f = Ne.NM) => {
|
|
661
|
-
const
|
|
661
|
+
const y = {
|
|
662
662
|
id: c,
|
|
663
663
|
length: "--"
|
|
664
|
-
},
|
|
664
|
+
}, v = (n[c] || []).map(
|
|
665
665
|
(R) => Ve([R.lon, R.lat], ee.data, ee.mercator)
|
|
666
|
-
), D = new Ge(
|
|
667
|
-
return
|
|
666
|
+
), D = new Ge(v);
|
|
667
|
+
return y.length = go(D, f) || "--", y;
|
|
668
668
|
}, $t = (c, f) => {
|
|
669
669
|
Vt(String(c), f);
|
|
670
670
|
}, Vt = (c, f) => {
|
|
671
|
-
const
|
|
671
|
+
const y = n[String(c)], p = y == null ? void 0 : y.map((v) => [v.lon, v.lat]);
|
|
672
672
|
p && Dt(p, f);
|
|
673
673
|
}, qe = new _({
|
|
674
674
|
text: new Se({
|
|
@@ -680,8 +680,8 @@ const yo = (e) => {
|
|
|
680
680
|
})
|
|
681
681
|
}), zt = (c, f) => {
|
|
682
682
|
var E, B;
|
|
683
|
-
const
|
|
684
|
-
if (u = (u +
|
|
683
|
+
const y = Number(50 * f), p = ((E = c.frameState) == null ? void 0 : E.time) ?? Date.now(), v = p - C;
|
|
684
|
+
if (u = (u + y * v / 1e6) % 2, C = p, u >= 1) {
|
|
685
685
|
ze();
|
|
686
686
|
return;
|
|
687
687
|
}
|
|
@@ -700,9 +700,9 @@ const yo = (e) => {
|
|
|
700
700
|
J.setStyle(qe), J.drawGeometry(g), e == null || e.render();
|
|
701
701
|
}, Ot = () => {
|
|
702
702
|
var c;
|
|
703
|
-
$ = !0, C = Date.now(), u = 0, g = ((c = o.getGeometry()) == null ? void 0 : c.clone()) || new te([0, 0]),
|
|
703
|
+
$ = !0, C = Date.now(), u = 0, g = ((c = o.getGeometry()) == null ? void 0 : c.clone()) || new te([0, 0]), a && (z == null || z.on("postrender", a)), k == null || k.setGeometry(void 0);
|
|
704
704
|
}, ze = () => {
|
|
705
|
-
$ && ($ = !1, k == null || k.setGeometry(void 0),
|
|
705
|
+
$ && ($ = !1, k == null || k.setGeometry(void 0), a && z && z.un("postrender", a), z && (e == null || e.removeLayer(z)), z = null, k = null);
|
|
706
706
|
}, Dt = (c, f) => {
|
|
707
707
|
$ && ze(), x = new ct({
|
|
708
708
|
factor: 1e6
|
|
@@ -711,12 +711,12 @@ const yo = (e) => {
|
|
|
711
711
|
}).readGeometry(x, {
|
|
712
712
|
dataProjection: ee.data,
|
|
713
713
|
featureProjection: ee.mercator
|
|
714
|
-
}), o = new
|
|
714
|
+
}), o = new re({
|
|
715
715
|
type: "icon",
|
|
716
716
|
geometry: new te(t.getFirstCoordinate())
|
|
717
717
|
});
|
|
718
|
-
const
|
|
719
|
-
g =
|
|
718
|
+
const y = o.getGeometry();
|
|
719
|
+
g = y ? y.clone() : new te([0, 0]), k = new re({
|
|
720
720
|
type: "geoMarker",
|
|
721
721
|
style: qe,
|
|
722
722
|
geometry: g
|
|
@@ -724,12 +724,12 @@ const yo = (e) => {
|
|
|
724
724
|
source: new ue({
|
|
725
725
|
features: [k]
|
|
726
726
|
})
|
|
727
|
-
}), e == null || e.addLayer(z),
|
|
728
|
-
}, lt = (c, f,
|
|
727
|
+
}), e == null || e.addLayer(z), a = (p) => zt(p, f), Ot();
|
|
728
|
+
}, lt = (c, f, y) => {
|
|
729
729
|
function p(E) {
|
|
730
730
|
return 180 * (E % (2 * Math.PI)) / Math.PI;
|
|
731
731
|
}
|
|
732
|
-
function
|
|
732
|
+
function v(E) {
|
|
733
733
|
return E % 360 * Math.PI / 180;
|
|
734
734
|
}
|
|
735
735
|
function D(E) {
|
|
@@ -751,7 +751,7 @@ const yo = (e) => {
|
|
|
751
751
|
return function(Oe, De) {
|
|
752
752
|
return (R(De, Oe) + 180) % 360;
|
|
753
753
|
}(E, B);
|
|
754
|
-
const Q = D(E), fe = D(B),
|
|
754
|
+
const Q = D(E), fe = D(B), ve = v(Q[0]), me = v(fe[0]), Re = v(Q[1]), Le = v(fe[1]), we = Math.sin(me - ve) * Math.cos(Le), Te = Math.cos(Re) * Math.sin(Le) - Math.sin(Re) * Math.cos(Le) * Math.cos(me - ve);
|
|
755
755
|
return p(Math.atan2(we, Te));
|
|
756
756
|
}
|
|
757
757
|
function S(E) {
|
|
@@ -770,7 +770,7 @@ const yo = (e) => {
|
|
|
770
770
|
};
|
|
771
771
|
return j.id !== void 0 && (Q.id = j.id), j.bbox && (Q.bbox = j.bbox), Q.properties = B, Q.geometry = E, Q;
|
|
772
772
|
}
|
|
773
|
-
const J = R(A(c), A(f),
|
|
773
|
+
const J = R(A(c), A(f), y);
|
|
774
774
|
return J < 0 ? 360 + J : J;
|
|
775
775
|
};
|
|
776
776
|
return {
|
|
@@ -787,7 +787,7 @@ const yo = (e) => {
|
|
|
787
787
|
};
|
|
788
788
|
function mo(e) {
|
|
789
789
|
console.log("useShipOverlay", e);
|
|
790
|
-
const r =
|
|
790
|
+
const r = se(null), n = Ze(() => ({
|
|
791
791
|
"--overlay-color": "#FFF",
|
|
792
792
|
"--bg-color1": e.colors && e.colors[0] ? e.colors[0] : "#ffffff",
|
|
793
793
|
// 默认第一个颜色
|
|
@@ -816,12 +816,12 @@ function mo(e) {
|
|
|
816
816
|
animation: e.selected ? e.colors && ((s = e.colors) == null ? void 0 : s.length) >= 2 ? "blink-dual 2s ease-in-out infinite" : "blink-single 1.5s ease-in-out infinite" : "none"
|
|
817
817
|
// "animation": props.selected ? 'blink 1.5s ease-in-out infinite' : 'none', // 动画开关
|
|
818
818
|
};
|
|
819
|
-
}),
|
|
819
|
+
}), d = Ze(() => ({
|
|
820
820
|
width: "14px",
|
|
821
821
|
height: "14px",
|
|
822
822
|
margin: "1px 5px 1px 1px",
|
|
823
823
|
"background-color": "var(--attention-bg)"
|
|
824
|
-
})),
|
|
824
|
+
})), a = Ze(() => ({
|
|
825
825
|
position: "absolute",
|
|
826
826
|
top: "0px",
|
|
827
827
|
color: "var(--overlay-color)",
|
|
@@ -846,7 +846,7 @@ function mo(e) {
|
|
|
846
846
|
},
|
|
847
847
|
[
|
|
848
848
|
ae("div", {
|
|
849
|
-
style: e.selected ?
|
|
849
|
+
style: e.selected ? d.value : {}
|
|
850
850
|
}, ""),
|
|
851
851
|
ae("div", {
|
|
852
852
|
class: "text",
|
|
@@ -885,7 +885,7 @@ function mo(e) {
|
|
|
885
885
|
),
|
|
886
886
|
ae("svg", {
|
|
887
887
|
class: "ship-overlay-line",
|
|
888
|
-
style:
|
|
888
|
+
style: a.value,
|
|
889
889
|
viewBox: "0 0 20 20",
|
|
890
890
|
xmlns: "http://www.w3.org/2000/svg"
|
|
891
891
|
}, [
|
|
@@ -902,21 +902,21 @@ function mo(e) {
|
|
|
902
902
|
}
|
|
903
903
|
const wo = (e) => {
|
|
904
904
|
const { spd: r, hdg: n, cog: l } = e;
|
|
905
|
-
return r ? n !== null && +n != 511 && l !== null ? l - +n >= 3 ?
|
|
905
|
+
return r ? n !== null && +n != 511 && l !== null ? l - +n >= 3 ? le.right : l - +n <= -3 ? le.left : le.front : le.front : "";
|
|
906
906
|
}, Ee = (e, r) => {
|
|
907
|
-
const { shipData: n } = r.getProperties(), l = xt(e),
|
|
908
|
-
return xo(r,
|
|
907
|
+
const { shipData: n } = r.getProperties(), l = xt(e), d = bt(e, n, l);
|
|
908
|
+
return xo(r, d, l);
|
|
909
909
|
}, xt = (e) => {
|
|
910
910
|
const r = e == null ? void 0 : e.getView().getZoom();
|
|
911
911
|
return r && r <= U.shipModelMax && r >= U.shipTriggleMin ? "ship" : "triangle";
|
|
912
912
|
}, bt = (e, r, n) => {
|
|
913
913
|
if (n === "ship") {
|
|
914
|
-
const { len: l, wid:
|
|
914
|
+
const { len: l, wid: d } = r, a = 97, s = 20, x = 1 / (e == null ? void 0 : e.getView().getResolution()), t = l * x / a, o = d * x / s, g = Math.min(t, o);
|
|
915
915
|
return g < 0.2 ? 0.2 : g > 2 ? 2 : g;
|
|
916
916
|
}
|
|
917
917
|
return U.scaleNum;
|
|
918
918
|
}, xo = (e, r, n) => {
|
|
919
|
-
const { color: l, direct:
|
|
919
|
+
const { color: l, direct: d, isHighlight: a, shipData: s } = e.getProperties(), h = ((s == null ? void 0 : s.cog) - 90 + 360) % 360;
|
|
920
920
|
return new _({
|
|
921
921
|
image: new Ce({
|
|
922
922
|
src: x(),
|
|
@@ -934,22 +934,22 @@ const wo = (e) => {
|
|
|
934
934
|
case "triangle":
|
|
935
935
|
return `<svg width="41" height="24" viewBox="0 0 41 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
936
936
|
<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"
|
|
937
|
-
fill="${l}" stroke="${
|
|
937
|
+
fill="${l}" stroke="${a ? "#FF2424" : "black"}" stroke-width="${a ? "2" : "0.578947"}" />
|
|
938
938
|
<!--path船航向左边或者向前-->
|
|
939
|
-
${
|
|
939
|
+
${d === le.left && `<path d="M30 12L40 12L40 8" stroke="${a ? "#FF2424" : "black"}" stroke-width="2"/>`}
|
|
940
940
|
<!--path船航向右边-->
|
|
941
|
-
${
|
|
941
|
+
${d === le.right && `<path d="M30 12L40 12L40 16" stroke="${a ? "#FF2424" : "black"}" stroke-width="2"/>`}
|
|
942
942
|
<!--path黑线无左右-->
|
|
943
|
-
${
|
|
943
|
+
${d === le.front && `<path d="M30 12L40 12" stroke="${a ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
944
944
|
</svg>
|
|
945
945
|
`;
|
|
946
946
|
case "ship":
|
|
947
947
|
return `<svg width="97" height="20" viewBox="0 0 97 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
948
948
|
<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"
|
|
949
|
-
fill="${l}" stroke="${
|
|
950
|
-
${
|
|
951
|
-
${
|
|
952
|
-
${
|
|
949
|
+
fill="${l}" stroke="${a ? "#FF2424" : "black"}" stroke-width="${a ? "4" : "0.578947"}"/>
|
|
950
|
+
${d === le.left && `<path d="M86 10L96 10L96 6" stroke="${a ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
951
|
+
${d === le.right && `<path d="M86 10L96 10L96 14" stroke="${a ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
952
|
+
${d === le.front && `<path d="M86 10L96 10" stroke="${a ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
953
953
|
</svg>
|
|
954
954
|
`;
|
|
955
955
|
default:
|
|
@@ -957,15 +957,15 @@ const wo = (e) => {
|
|
|
957
957
|
}
|
|
958
958
|
}
|
|
959
959
|
}, bo = (e, r) => {
|
|
960
|
-
const n = xt(e), l = bt(e, r, n),
|
|
961
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="${
|
|
960
|
+
const n = xt(e), l = bt(e, r, n), d = n === "ship" ? 109 : 49, a = `
|
|
961
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="${d}" height="${d}" viewBox="0 0 49 49" fill="none">
|
|
962
962
|
<path d="M1.99982 46.9998L1.99982 1.99982L46.9998 1.99982L46.9998 46.9998L1.99982 46.9998Z" fill="#FF2424" fill-opacity="0.2"/>
|
|
963
963
|
<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"/>
|
|
964
964
|
</svg>
|
|
965
965
|
`;
|
|
966
966
|
return new _({
|
|
967
967
|
image: new Ce({
|
|
968
|
-
src: `data:image/svg+xml;utf8,${encodeURIComponent(
|
|
968
|
+
src: `data:image/svg+xml;utf8,${encodeURIComponent(a)}`,
|
|
969
969
|
scale: l,
|
|
970
970
|
anchorXUnits: "fraction",
|
|
971
971
|
anchorYUnits: "fraction"
|
|
@@ -974,7 +974,7 @@ const wo = (e) => {
|
|
|
974
974
|
};
|
|
975
975
|
function ko(e, r, n, l) {
|
|
976
976
|
if (r) {
|
|
977
|
-
const
|
|
977
|
+
const d = new pe({
|
|
978
978
|
element: n,
|
|
979
979
|
positioning: "top-left",
|
|
980
980
|
id: "label-" + (l == null ? void 0 : l.id),
|
|
@@ -983,22 +983,22 @@ function ko(e, r, n, l) {
|
|
|
983
983
|
position: r,
|
|
984
984
|
className: l != null && l.blinking ? "ship-label-overlay-blinking" : "ship-label-overlay"
|
|
985
985
|
});
|
|
986
|
-
|
|
986
|
+
d.set("class", "zh-map-ship-overlay"), e.addOverlay(d);
|
|
987
987
|
}
|
|
988
988
|
}
|
|
989
989
|
const po = (e, r) => {
|
|
990
|
-
const { lon: n, lat: l, blinking:
|
|
991
|
-
n && l && ko(e, ie([n, l]),
|
|
990
|
+
const { lon: n, lat: l, blinking: d } = r, a = kt(r);
|
|
991
|
+
n && l && ko(e, ie([n, l]), a, { ...r, blinking: d });
|
|
992
992
|
}, kt = (e) => {
|
|
993
993
|
const r = document.createElement("div");
|
|
994
994
|
r.className = "ship-overlay-box", r.style.position = "relative";
|
|
995
|
-
const { lon: n, lat: l, blinking:
|
|
995
|
+
const { lon: n, lat: l, blinking: d, blinkingColors: a, name: s } = e, h = Qe({
|
|
996
996
|
setup() {
|
|
997
997
|
return mo({
|
|
998
998
|
position: [n + 2e-3, l + 2e-3],
|
|
999
|
-
selected:
|
|
999
|
+
selected: d,
|
|
1000
1000
|
name: s,
|
|
1001
|
-
colors:
|
|
1001
|
+
colors: a || [],
|
|
1002
1002
|
existDevice: e == null ? void 0 : e.existDevice,
|
|
1003
1003
|
existMobile: e == null ? void 0 : e.existMobile,
|
|
1004
1004
|
existWaterGauge: e == null ? void 0 : e.existWaterGauge
|
|
@@ -1024,9 +1024,9 @@ function Co() {
|
|
|
1024
1024
|
const Mo = window.devicePixelRatio || 1, je = /* @__PURE__ */ new Map();
|
|
1025
1025
|
let $e = null, Ke = null;
|
|
1026
1026
|
function Lo(e, r, n = "left-bottom", l = 10) {
|
|
1027
|
-
const
|
|
1028
|
-
if (je.has(
|
|
1029
|
-
return je.get(
|
|
1027
|
+
const d = `${e}-${r.join(",")}-${n}-${l}`;
|
|
1028
|
+
if (je.has(d))
|
|
1029
|
+
return je.get(d);
|
|
1030
1030
|
if (!$e) {
|
|
1031
1031
|
$e = document.createElement("canvas");
|
|
1032
1032
|
try {
|
|
@@ -1037,9 +1037,9 @@ function Lo(e, r, n = "left-bottom", l = 10) {
|
|
|
1037
1037
|
console.log("e", Z), Ke = $e.getContext("2d");
|
|
1038
1038
|
}
|
|
1039
1039
|
}
|
|
1040
|
-
const
|
|
1040
|
+
const a = $e, s = Ke;
|
|
1041
1041
|
if (!s) return "";
|
|
1042
|
-
|
|
1042
|
+
a.width = 0, a.height = 0;
|
|
1043
1043
|
const h = 2, x = 4, t = 16, o = window.devicePixelRatio || 1, g = "500 12px Arial", k = "12px map-iconfont";
|
|
1044
1044
|
s.font = g;
|
|
1045
1045
|
const C = s.measureText(e).width;
|
|
@@ -1066,7 +1066,7 @@ function Lo(e, r, n = "left-bottom", l = 10) {
|
|
|
1066
1066
|
X = t + b, G = P, q = b, K = P + t, N = 0, M = 0, i = t;
|
|
1067
1067
|
break;
|
|
1068
1068
|
}
|
|
1069
|
-
X = X + h,
|
|
1069
|
+
X = X + h, a.width = Math.round(V * o), a.height = Math.round(X * o), s.scale(o, o), s.clearRect(0, 0, V, X), s.beginPath(), s.moveTo(G, q), s.lineTo(K, N), s.strokeStyle = "#FFF", s.lineWidth = 1, s.stroke(), s.fillStyle = "#FFF", s.fillRect(M, i, P, b), s.font = g, s.textBaseline = "middle";
|
|
1070
1070
|
const T = i + h / 2 + b / 2;
|
|
1071
1071
|
s.strokeStyle = "#ffffff", s.lineWidth = 1, s.strokeText(e, M + x, T), s.fillStyle = "#000000", s.fillText(e, M + x, T), s.font = k, s.fillStyle = "#3370ff";
|
|
1072
1072
|
let w = M + x + C + l;
|
|
@@ -1074,13 +1074,13 @@ function Lo(e, r, n = "left-bottom", l = 10) {
|
|
|
1074
1074
|
r.length > 0 && r.forEach((Z, W) => {
|
|
1075
1075
|
s.fillText(be(Z), w, L), w += z[W].width + l;
|
|
1076
1076
|
});
|
|
1077
|
-
const F =
|
|
1078
|
-
return je.set(
|
|
1077
|
+
const F = a.toDataURL("image/png");
|
|
1078
|
+
return je.set(d, F), F;
|
|
1079
1079
|
}
|
|
1080
1080
|
const ft = (e, r) => {
|
|
1081
|
-
const { name: n, rightIcons: l, selected:
|
|
1081
|
+
const { name: n, rightIcons: l, selected: d } = e.getProperties(), a = r !== 1 ? Co() : "right-top", s = Lo(n, l, a);
|
|
1082
1082
|
let h = [0, 0];
|
|
1083
|
-
switch (
|
|
1083
|
+
switch (a) {
|
|
1084
1084
|
case "right-top":
|
|
1085
1085
|
h = [0, 1];
|
|
1086
1086
|
break;
|
|
@@ -1109,18 +1109,18 @@ const ft = (e, r) => {
|
|
|
1109
1109
|
anchorXUnits: "fraction",
|
|
1110
1110
|
anchorYUnits: "fraction"
|
|
1111
1111
|
}),
|
|
1112
|
-
zIndex:
|
|
1112
|
+
zIndex: d ? 100 : 10
|
|
1113
1113
|
});
|
|
1114
1114
|
}, To = (e) => {
|
|
1115
1115
|
let r = null, n = null;
|
|
1116
|
-
const l = new ue(),
|
|
1116
|
+
const l = new ue(), d = new _t({
|
|
1117
1117
|
source: l,
|
|
1118
1118
|
className: "zh-map--ship-layer",
|
|
1119
1119
|
renderBuffer: 300,
|
|
1120
1120
|
zIndex: 101,
|
|
1121
1121
|
properties: { layerType: I.SHIP }
|
|
1122
|
-
}),
|
|
1123
|
-
source:
|
|
1122
|
+
}), a = new ue(), s = new he({
|
|
1123
|
+
source: a,
|
|
1124
1124
|
className: "zh-map--ship-label-layer",
|
|
1125
1125
|
zIndex: 102,
|
|
1126
1126
|
updateWhileInteracting: !1,
|
|
@@ -1132,7 +1132,7 @@ const ft = (e, r) => {
|
|
|
1132
1132
|
className: "zh-map--ship-selected-layer",
|
|
1133
1133
|
zIndex: 999
|
|
1134
1134
|
});
|
|
1135
|
-
e == null || e.addLayer(
|
|
1135
|
+
e == null || e.addLayer(d), e == null || e.addLayer(s), e == null || e.addLayer(x);
|
|
1136
1136
|
let t = null, o = "", g = {}, k = {};
|
|
1137
1137
|
const $ = (i) => {
|
|
1138
1138
|
if (!i || !e) return;
|
|
@@ -1144,7 +1144,7 @@ const ft = (e, r) => {
|
|
|
1144
1144
|
m(), M(i), z();
|
|
1145
1145
|
}, C = (i) => {
|
|
1146
1146
|
var O;
|
|
1147
|
-
const T = (n == null ? void 0 : n.id) || (r == null ? void 0 : r.get("id")), w = ie([i == null ? void 0 : i.lon, i == null ? void 0 : i.lat]), L = ((O = k[i.id]) == null ? void 0 : O.blinkColors) || [], Z = L[L.length - 1] || i.fill || "#04C900", W = wo(i), H = new
|
|
1147
|
+
const T = (n == null ? void 0 : n.id) || (r == null ? void 0 : r.get("id")), w = ie([i == null ? void 0 : i.lon, i == null ? void 0 : i.lat]), L = ((O = k[i.id]) == null ? void 0 : O.blinkColors) || [], Z = L[L.length - 1] || i.fill || "#04C900", W = wo(i), H = new re({
|
|
1148
1148
|
geometry: new te(w),
|
|
1149
1149
|
// 船舶数据
|
|
1150
1150
|
shipData: i,
|
|
@@ -1164,7 +1164,7 @@ const ft = (e, r) => {
|
|
|
1164
1164
|
}, z = () => {
|
|
1165
1165
|
if (n && e && n) {
|
|
1166
1166
|
h.getFeatures().length > 0 && h.clear();
|
|
1167
|
-
const i = ie([n == null ? void 0 : n.lon, n == null ? void 0 : n.lat]), T = new
|
|
1167
|
+
const i = ie([n == null ? void 0 : n.lon, n == null ? void 0 : n.lat]), T = new re({
|
|
1168
1168
|
geometry: new te(i),
|
|
1169
1169
|
id: n.id
|
|
1170
1170
|
});
|
|
@@ -1180,8 +1180,8 @@ const ft = (e, r) => {
|
|
|
1180
1180
|
if (L.setStyle(F), L.get("id") === (n == null ? void 0 : n.id) && w && w[0]) {
|
|
1181
1181
|
const H = w[0], O = H == null ? void 0 : H.getStyle();
|
|
1182
1182
|
if (O && (O != null && O.getImage())) {
|
|
1183
|
-
const
|
|
1184
|
-
|
|
1183
|
+
const ne = (Z = F.getImage()) == null ? void 0 : Z.getScale();
|
|
1184
|
+
ne && ((W = O.getImage()) == null || W.setScale(ne));
|
|
1185
1185
|
}
|
|
1186
1186
|
}
|
|
1187
1187
|
}), t = requestAnimationFrame(T);
|
|
@@ -1190,7 +1190,7 @@ const ft = (e, r) => {
|
|
|
1190
1190
|
}
|
|
1191
1191
|
i === "end" && t && (cancelAnimationFrame(t), t = null);
|
|
1192
1192
|
}, m = () => {
|
|
1193
|
-
e && l && (P(), l.clear(),
|
|
1193
|
+
e && l && (P(), l.clear(), a.clear(), h.clear(), u("end"));
|
|
1194
1194
|
}, P = (i) => {
|
|
1195
1195
|
const T = e.getOverlays().getArray().filter((w) => w.get("class") == "zh-map-ship-overlay");
|
|
1196
1196
|
if (T && T.length > 0) {
|
|
@@ -1206,10 +1206,10 @@ const ft = (e, r) => {
|
|
|
1206
1206
|
for (const F in g) {
|
|
1207
1207
|
const Z = g[F], W = w.find((O) => (O == null ? void 0 : O.getId()) === "label-" + F), H = L.find((O) => F === O.get("id"));
|
|
1208
1208
|
if (W && H) {
|
|
1209
|
-
const O = T[F].blinkColors || [], { shipData:
|
|
1209
|
+
const O = T[F].blinkColors || [], { shipData: ne, name: ce, color: de } = H.getProperties();
|
|
1210
1210
|
H.set("blinking", Z), O[(O == null ? void 0 : O.length) - 1] && de !== O[(O == null ? void 0 : O.length) - 1] && (H.set("color", O[(O == null ? void 0 : O.length) - 1] || ""), H.setStyle(Ee(e, H)));
|
|
1211
1211
|
const Be = {
|
|
1212
|
-
...
|
|
1212
|
+
...ne,
|
|
1213
1213
|
blinking: Z,
|
|
1214
1214
|
blinkingColors: O || [],
|
|
1215
1215
|
name: ce + "(" + T[F].shipState + ")"
|
|
@@ -1219,24 +1219,24 @@ const ft = (e, r) => {
|
|
|
1219
1219
|
}
|
|
1220
1220
|
}, V = (i) => {
|
|
1221
1221
|
if (!e) return;
|
|
1222
|
-
const T = l.getFeatures(), w =
|
|
1222
|
+
const T = l.getFeatures(), w = a.getFeatures(), L = r ? r.get("id") : "", F = T.filter((O) => O.get("id") !== L), Z = w == null ? void 0 : w.filter((O) => O.get("id") !== L), W = /* @__PURE__ */ new Map();
|
|
1223
1223
|
i.forEach((O) => {
|
|
1224
1224
|
W.set(O.id, !0);
|
|
1225
1225
|
});
|
|
1226
1226
|
const H = e.getOverlays().getArray();
|
|
1227
1227
|
F.forEach((O) => {
|
|
1228
|
-
const
|
|
1229
|
-
if (!W.has(
|
|
1228
|
+
const ne = O.get("id");
|
|
1229
|
+
if (!W.has(ne))
|
|
1230
1230
|
O.setStyle([]);
|
|
1231
1231
|
else {
|
|
1232
1232
|
const de = O.getStyle();
|
|
1233
1233
|
(de == null ? void 0 : de.length) == 0 && O.setStyle(Ee(e, O));
|
|
1234
1234
|
}
|
|
1235
|
-
const ce = H.find((de) => de.getId() === "label-" +
|
|
1235
|
+
const ce = H.find((de) => de.getId() === "label-" + ne);
|
|
1236
1236
|
ce && ce.setPosition(void 0);
|
|
1237
1237
|
}), Z.forEach((O) => {
|
|
1238
|
-
const
|
|
1239
|
-
if (!W.has(
|
|
1238
|
+
const ne = O.get("id");
|
|
1239
|
+
if (!W.has(ne))
|
|
1240
1240
|
O.setStyle([]);
|
|
1241
1241
|
else {
|
|
1242
1242
|
const ce = O.getStyle();
|
|
@@ -1246,7 +1246,7 @@ const ft = (e, r) => {
|
|
|
1246
1246
|
}, X = (i) => {
|
|
1247
1247
|
if (i) {
|
|
1248
1248
|
console.log("选中", i);
|
|
1249
|
-
const T = l.getFeatures().find((L) => L.get("id") === i.id), w =
|
|
1249
|
+
const T = l.getFeatures().find((L) => L.get("id") === i.id), w = a.getFeatures().find((L) => L.get("id") === i.id);
|
|
1250
1250
|
T && (r = T), w && w.set("selected", !0), n = i, z();
|
|
1251
1251
|
} else
|
|
1252
1252
|
console.log("取消选中"), n = null, r = null, K();
|
|
@@ -1274,7 +1274,7 @@ const ft = (e, r) => {
|
|
|
1274
1274
|
console.log(i);
|
|
1275
1275
|
}
|
|
1276
1276
|
}, N = (i, T) => {
|
|
1277
|
-
const w = ie([i == null ? void 0 : i.lon, i == null ? void 0 : i.lat]), L = new
|
|
1277
|
+
const w = ie([i == null ? void 0 : i.lon, i == null ? void 0 : i.lat]), L = new re({
|
|
1278
1278
|
geometry: new te(w),
|
|
1279
1279
|
name: i.cnname || i.enname || i.name || i.id || "未命名船舶",
|
|
1280
1280
|
// 图标
|
|
@@ -1302,7 +1302,7 @@ const ft = (e, r) => {
|
|
|
1302
1302
|
}
|
|
1303
1303
|
} else {
|
|
1304
1304
|
const F = N(w, i.length);
|
|
1305
|
-
|
|
1305
|
+
a.addFeature(F);
|
|
1306
1306
|
}
|
|
1307
1307
|
});
|
|
1308
1308
|
};
|
|
@@ -1316,18 +1316,18 @@ const ft = (e, r) => {
|
|
|
1316
1316
|
changeShipScale: u
|
|
1317
1317
|
};
|
|
1318
1318
|
}, Eo = (e) => {
|
|
1319
|
-
const r = () => e == null ? void 0 : e.getLayers(), n =
|
|
1319
|
+
const r = () => e == null ? void 0 : e.getLayers(), n = se("vector"), l = () => n.value, d = (x) => {
|
|
1320
1320
|
n.value = x;
|
|
1321
1321
|
const t = r();
|
|
1322
1322
|
t && (t == null || t.getArray().forEach((o) => {
|
|
1323
1323
|
(o.className_ === "vector" || o.className_ === "satellite") && o.setVisible(o.className_ === x);
|
|
1324
1324
|
}));
|
|
1325
|
-
},
|
|
1325
|
+
}, a = se(!1);
|
|
1326
1326
|
return {
|
|
1327
1327
|
getLayers: r,
|
|
1328
|
-
getGreenTileVisible: () =>
|
|
1328
|
+
getGreenTileVisible: () => a.value,
|
|
1329
1329
|
setGreenTileVisible: (x) => {
|
|
1330
|
-
if (x !==
|
|
1330
|
+
if (x !== a.value) {
|
|
1331
1331
|
if (x) {
|
|
1332
1332
|
const t = r();
|
|
1333
1333
|
if (!t.getArray().find((g) => g.className_ === "greenTile")) {
|
|
@@ -1343,14 +1343,14 @@ const ft = (e, r) => {
|
|
|
1343
1343
|
const t = r(), o = t.getArray().find((g) => g.className_ === "greenTile");
|
|
1344
1344
|
o && t.remove(o);
|
|
1345
1345
|
}
|
|
1346
|
-
|
|
1346
|
+
a.value = x;
|
|
1347
1347
|
}
|
|
1348
1348
|
},
|
|
1349
1349
|
getShowLayerType: l,
|
|
1350
|
-
setShowLayerType:
|
|
1350
|
+
setShowLayerType: d
|
|
1351
1351
|
};
|
|
1352
1352
|
}, Po = () => {
|
|
1353
|
-
const e =
|
|
1353
|
+
const e = se();
|
|
1354
1354
|
return {
|
|
1355
1355
|
setProps: (l) => {
|
|
1356
1356
|
e.value = l;
|
|
@@ -1359,12 +1359,12 @@ const ft = (e, r) => {
|
|
|
1359
1359
|
};
|
|
1360
1360
|
}, Fo = (e) => {
|
|
1361
1361
|
const r = "zh-map-location-layer";
|
|
1362
|
-
let n, l,
|
|
1362
|
+
let n, l, d = null, a = null;
|
|
1363
1363
|
const s = (C) => {
|
|
1364
1364
|
if (!(!C || C.length === 0)) {
|
|
1365
|
-
if (l || (l = new ue()), l.clear(),
|
|
1366
|
-
const z = C.find((u) => u.id ===
|
|
1367
|
-
z ?
|
|
1365
|
+
if (l || (l = new ue()), l.clear(), a) {
|
|
1366
|
+
const z = C.find((u) => u.id === a.id);
|
|
1367
|
+
z ? a = z : C.push(a);
|
|
1368
1368
|
}
|
|
1369
1369
|
C.forEach((z) => {
|
|
1370
1370
|
h(z);
|
|
@@ -1375,10 +1375,10 @@ const ft = (e, r) => {
|
|
|
1375
1375
|
}), e == null || e.addLayer(n));
|
|
1376
1376
|
}
|
|
1377
1377
|
}, h = (C) => {
|
|
1378
|
-
const z = e == null ? void 0 : e.getView().getZoom(), [u, m] = C.latLon.split(","), P = new
|
|
1378
|
+
const z = e == null ? void 0 : e.getView().getZoom(), [u, m] = C.latLon.split(","), P = new re({
|
|
1379
1379
|
geometry: new te(ie([Number(u), Number(m)]))
|
|
1380
1380
|
});
|
|
1381
|
-
P.setStyle(x(C, z, C.id === (
|
|
1381
|
+
P.setStyle(x(C, z, C.id === (a == null ? void 0 : a.id))), P.set("loactionData", C), l.addFeature(P);
|
|
1382
1382
|
}, x = (C, z, u) => {
|
|
1383
1383
|
const m = {
|
|
1384
1384
|
image: new Ce({
|
|
@@ -1398,8 +1398,8 @@ const ft = (e, r) => {
|
|
|
1398
1398
|
offsetY: 30
|
|
1399
1399
|
})), new _(m);
|
|
1400
1400
|
}, t = () => {
|
|
1401
|
-
if (
|
|
1402
|
-
const C =
|
|
1401
|
+
if (d) {
|
|
1402
|
+
const C = d.get("loactionData").id;
|
|
1403
1403
|
l.getFeatures().forEach((z) => {
|
|
1404
1404
|
z.get("loactionData").id !== C && l.removeFeature(z);
|
|
1405
1405
|
});
|
|
@@ -1407,21 +1407,21 @@ const ft = (e, r) => {
|
|
|
1407
1407
|
l.clear();
|
|
1408
1408
|
}, o = () => {
|
|
1409
1409
|
var m;
|
|
1410
|
-
const C =
|
|
1410
|
+
const C = d.get("loactionData"), z = (m = e == null ? void 0 : e.getView()) == null ? void 0 : m.getZoom();
|
|
1411
1411
|
l.getFeatures().forEach((P) => {
|
|
1412
1412
|
P.get("loactionData").id === C.id && (P == null || P.setStyle(x(C, z, !1)));
|
|
1413
|
-
}),
|
|
1413
|
+
}), a = null, d = null;
|
|
1414
1414
|
}, g = (C) => {
|
|
1415
1415
|
C ? (k(), $(C)) : clearSelectedPort();
|
|
1416
1416
|
}, k = () => {
|
|
1417
1417
|
var C;
|
|
1418
|
-
if (
|
|
1419
|
-
const z =
|
|
1420
|
-
|
|
1418
|
+
if (d) {
|
|
1419
|
+
const z = d.get("loactionData"), u = (C = e == null ? void 0 : e.getView()) == null ? void 0 : C.getZoom();
|
|
1420
|
+
d.setStyle(x(z, u, !1));
|
|
1421
1421
|
}
|
|
1422
1422
|
}, $ = (C) => {
|
|
1423
1423
|
const z = l.getFeatures();
|
|
1424
|
-
|
|
1424
|
+
a = C, d = z.find((u) => u.get("loactionData").id === C.id);
|
|
1425
1425
|
};
|
|
1426
1426
|
return {
|
|
1427
1427
|
render: s,
|
|
@@ -1431,24 +1431,24 @@ const ft = (e, r) => {
|
|
|
1431
1431
|
};
|
|
1432
1432
|
}, So = (e) => {
|
|
1433
1433
|
e.getInteractions().forEach((r) => {
|
|
1434
|
-
r instanceof
|
|
1434
|
+
r instanceof vt && r.setActive(!1);
|
|
1435
1435
|
});
|
|
1436
1436
|
}, No = (e) => {
|
|
1437
1437
|
e.getInteractions().forEach((r) => {
|
|
1438
|
-
r instanceof
|
|
1438
|
+
r instanceof vt && r.setActive(!0);
|
|
1439
1439
|
});
|
|
1440
|
-
},
|
|
1440
|
+
}, ye = (e, r) => {
|
|
1441
1441
|
const n = e.getViewport();
|
|
1442
1442
|
n && (n.style.cursor = r);
|
|
1443
1443
|
}, Ro = (e, r) => {
|
|
1444
|
-
const n =
|
|
1444
|
+
const n = se([]), l = se("km"), d = (N) => {
|
|
1445
1445
|
l.value = N;
|
|
1446
1446
|
};
|
|
1447
|
-
let
|
|
1448
|
-
const
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
}), z(), s
|
|
1447
|
+
let a, s = "close";
|
|
1448
|
+
const h = () => {
|
|
1449
|
+
ye(e, "crosshair"), o(), So(e), e.on("pointermove", $), e.getViewport().addEventListener("mouseout", () => {
|
|
1450
|
+
a && a.classList.add("hidden");
|
|
1451
|
+
}), z(), s = "open";
|
|
1452
1452
|
};
|
|
1453
1453
|
let x, t;
|
|
1454
1454
|
const o = () => {
|
|
@@ -1469,7 +1469,7 @@ const ft = (e, r) => {
|
|
|
1469
1469
|
if (N.dragging)
|
|
1470
1470
|
return;
|
|
1471
1471
|
let M = "点击选择起点";
|
|
1472
|
-
g && (M = "单击继续,双击结束"),
|
|
1472
|
+
g && (M = "单击继续,双击结束"), a && (a.innerHTML = M, k.setPosition(N.coordinate), a.classList.remove("hidden"));
|
|
1473
1473
|
};
|
|
1474
1474
|
let C;
|
|
1475
1475
|
const z = () => {
|
|
@@ -1531,8 +1531,8 @@ const ft = (e, r) => {
|
|
|
1531
1531
|
insertFirst: !1
|
|
1532
1532
|
}), e == null || e.addOverlay(P);
|
|
1533
1533
|
}, V = () => {
|
|
1534
|
-
|
|
1535
|
-
element:
|
|
1534
|
+
a != null && a.parentNode && a.parentNode.removeChild(a), a = document.createElement("div"), a.className = "ol-tooltip hidden", k = new pe({
|
|
1535
|
+
element: a,
|
|
1536
1536
|
offset: [15, 0],
|
|
1537
1537
|
positioning: "center-left"
|
|
1538
1538
|
}), e == null || e.addOverlay(k);
|
|
@@ -1543,7 +1543,7 @@ const ft = (e, r) => {
|
|
|
1543
1543
|
i[M] && ((L = (w = i[M]) == null ? void 0 : w.parentNode) == null || L.removeChild(i[M]));
|
|
1544
1544
|
const T = x.getFeatures();
|
|
1545
1545
|
T[M] && x.removeFeature(T[M]);
|
|
1546
|
-
}), q(), No(e), s
|
|
1546
|
+
}), q(), No(e), s = "close", ye(e, "grab");
|
|
1547
1547
|
}, G = (N) => {
|
|
1548
1548
|
var i, T, w, L;
|
|
1549
1549
|
const M = n.value.findIndex((F) => F.id === N);
|
|
@@ -1563,34 +1563,34 @@ const ft = (e, r) => {
|
|
|
1563
1563
|
const N = e.getInteractions().getArray().find((M) => at(M) === at(C));
|
|
1564
1564
|
N && e.removeInteraction(N);
|
|
1565
1565
|
}
|
|
1566
|
-
e.removeLayer(t),
|
|
1566
|
+
e.removeLayer(t), a != null && a.parentNode && a.parentNode.removeChild(a), m != null && m.parentNode && m.parentNode.removeChild(m);
|
|
1567
1567
|
};
|
|
1568
1568
|
return {
|
|
1569
1569
|
open: h,
|
|
1570
1570
|
close: X,
|
|
1571
1571
|
deleteLine: G,
|
|
1572
|
-
setUnit:
|
|
1573
|
-
getState: () => s
|
|
1572
|
+
setUnit: d,
|
|
1573
|
+
getState: () => s
|
|
1574
1574
|
};
|
|
1575
1575
|
}, pt = (e, r) => {
|
|
1576
1576
|
const l = tt(e);
|
|
1577
|
-
let
|
|
1577
|
+
let d = "";
|
|
1578
1578
|
switch (r) {
|
|
1579
1579
|
case "m":
|
|
1580
|
-
|
|
1580
|
+
d = `${Math.round(l * 100) / 100} m`;
|
|
1581
1581
|
break;
|
|
1582
1582
|
case "km":
|
|
1583
|
-
|
|
1583
|
+
d = `${Math.round(l / 1e3 * 100) / 100} km`;
|
|
1584
1584
|
break;
|
|
1585
1585
|
case "nm":
|
|
1586
|
-
|
|
1586
|
+
d = (Math.round(l / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
|
|
1587
1587
|
break;
|
|
1588
1588
|
}
|
|
1589
|
-
return
|
|
1589
|
+
return d;
|
|
1590
1590
|
}, $o = (e, r) => {
|
|
1591
|
-
let n, l,
|
|
1592
|
-
const
|
|
1593
|
-
q(),
|
|
1591
|
+
let n, l, d = "close";
|
|
1592
|
+
const a = () => {
|
|
1593
|
+
q(), d = "open", s(), ye(e, "crosshair");
|
|
1594
1594
|
}, s = () => {
|
|
1595
1595
|
t(), P(), X(), C();
|
|
1596
1596
|
};
|
|
@@ -1736,17 +1736,17 @@ const ft = (e, r) => {
|
|
|
1736
1736
|
positioning: "center-left"
|
|
1737
1737
|
}), e == null || e.addOverlay(V);
|
|
1738
1738
|
}, G = () => {
|
|
1739
|
-
n = null,
|
|
1739
|
+
n = null, a();
|
|
1740
1740
|
}, q = () => {
|
|
1741
|
-
|
|
1741
|
+
d = "close", e.un("pointermove", g), o = null, k && (k.abortDrawing(), console.log("abortDrawing"), k.setActive(!1), (e == null ? void 0 : e.getInteractions()).forEach((M) => {
|
|
1742
1742
|
M instanceof We && (M.setActive(!1), e == null || e.removeInteraction(M));
|
|
1743
|
-
}), k = null), l && Je(l), l = void 0, x == null || x.clear(), x = null, h && e.getAllLayers().includes(h) && (e.removeLayer(h), h = null), b != null && b.parentElement && (b.innerHTML = "", b.parentElement.removeChild(b), b = null), u != null && u.parentElement && (u.innerHTML = "", u.parentElement.removeChild(u), u = null), V && e.removeOverlay(V), m && e.removeOverlay(m),
|
|
1743
|
+
}), k = null), l && Je(l), l = void 0, x == null || x.clear(), x = null, h && e.getAllLayers().includes(h) && (e.removeLayer(h), h = null), b != null && b.parentElement && (b.innerHTML = "", b.parentElement.removeChild(b), b = null), u != null && u.parentElement && (u.innerHTML = "", u.parentElement.removeChild(u), u = null), V && e.removeOverlay(V), m && e.removeOverlay(m), ye(e, "grab");
|
|
1744
1744
|
};
|
|
1745
1745
|
return {
|
|
1746
|
-
open:
|
|
1746
|
+
open: a,
|
|
1747
1747
|
close: q,
|
|
1748
1748
|
reset: G,
|
|
1749
|
-
getState: () =>
|
|
1749
|
+
getState: () => d
|
|
1750
1750
|
};
|
|
1751
1751
|
}, Vo = "zh-map-port-layer", zo = (e) => {
|
|
1752
1752
|
const r = new ue(), n = new he({
|
|
@@ -1758,21 +1758,21 @@ const ft = (e, r) => {
|
|
|
1758
1758
|
properties: { layerType: I.PORT }
|
|
1759
1759
|
});
|
|
1760
1760
|
e == null || e.addLayer(n);
|
|
1761
|
-
let l = null,
|
|
1762
|
-
const
|
|
1761
|
+
let l = null, d = null;
|
|
1762
|
+
const a = (u, m = !0) => {
|
|
1763
1763
|
if (!u || u.length === 0) return;
|
|
1764
|
-
if (r.clear(),
|
|
1765
|
-
const b = u.find((V) => V.id === (
|
|
1766
|
-
b ?
|
|
1764
|
+
if (r.clear(), d) {
|
|
1765
|
+
const b = u.find((V) => V.id === (d == null ? void 0 : d.id));
|
|
1766
|
+
b ? d = b : u.push(d);
|
|
1767
1767
|
}
|
|
1768
1768
|
const P = [];
|
|
1769
1769
|
u.forEach((b) => {
|
|
1770
|
-
const [V, X] = b.latLon.split(","), G = new
|
|
1770
|
+
const [V, X] = b.latLon.split(","), G = new re({
|
|
1771
1771
|
geometry: new te(ie([Number(V), Number(X)])),
|
|
1772
1772
|
portData: b,
|
|
1773
1773
|
id: b.id,
|
|
1774
|
-
select: b.id === (
|
|
1775
|
-
showTitle: b.id === (
|
|
1774
|
+
select: b.id === (d == null ? void 0 : d.id),
|
|
1775
|
+
showTitle: b.id === (d == null ? void 0 : d.id) || m
|
|
1776
1776
|
}), q = o(G);
|
|
1777
1777
|
G.setStyle(q), P.push(G);
|
|
1778
1778
|
}), r.addFeatures(P);
|
|
@@ -1857,22 +1857,22 @@ const ft = (e, r) => {
|
|
|
1857
1857
|
var u;
|
|
1858
1858
|
if (l) {
|
|
1859
1859
|
const m = l == null ? void 0 : l.get("portData"), P = (u = r.getFeatures()) == null ? void 0 : u.find((b) => b.get("portData").id === m.id);
|
|
1860
|
-
P && (P.set("select", !1), P.setStyle(o(P)), l = null,
|
|
1860
|
+
P && (P.set("select", !1), P.setStyle(o(P)), l = null, d = null);
|
|
1861
1861
|
}
|
|
1862
1862
|
}, C = (u) => {
|
|
1863
1863
|
if (!r) return;
|
|
1864
1864
|
const m = r.getFeatures();
|
|
1865
|
-
|
|
1865
|
+
d = u, l = m.find((P) => P.get("portData").id === u.id), l && (l.set("select", !0), l.setStyle(o(l)));
|
|
1866
1866
|
};
|
|
1867
1867
|
return {
|
|
1868
|
-
render:
|
|
1868
|
+
render: a,
|
|
1869
1869
|
clear: g,
|
|
1870
1870
|
selected: k,
|
|
1871
1871
|
handlePortHover: (u) => {
|
|
1872
|
-
u && u.get("portData") ?
|
|
1872
|
+
u && u.get("portData") ? ye(e, "pointer") : ye(e, "grab");
|
|
1873
1873
|
}
|
|
1874
1874
|
};
|
|
1875
|
-
}, Oo = (e, r, n, l,
|
|
1875
|
+
}, Oo = (e, r, n, l, d, a, s) => {
|
|
1876
1876
|
const h = e.getInstall();
|
|
1877
1877
|
h.on("moveend", () => {
|
|
1878
1878
|
var g, k;
|
|
@@ -1888,7 +1888,7 @@ const ft = (e, r) => {
|
|
|
1888
1888
|
[I.SHIP]: null,
|
|
1889
1889
|
[I.TRACK]: null
|
|
1890
1890
|
}, t = (g, k, $) => {
|
|
1891
|
-
switch (
|
|
1891
|
+
switch (ye(h, "pointer"), g) {
|
|
1892
1892
|
case I.SHIP:
|
|
1893
1893
|
l == null || l.handleShipMapEvent(k, "hover");
|
|
1894
1894
|
break;
|
|
@@ -1899,7 +1899,7 @@ const ft = (e, r) => {
|
|
|
1899
1899
|
break;
|
|
1900
1900
|
}
|
|
1901
1901
|
}, o = (g) => {
|
|
1902
|
-
switch (
|
|
1902
|
+
switch (ye(h, "grab"), g) {
|
|
1903
1903
|
case I.PORT:
|
|
1904
1904
|
break;
|
|
1905
1905
|
case I.SHIP:
|
|
@@ -1911,7 +1911,7 @@ const ft = (e, r) => {
|
|
|
1911
1911
|
}
|
|
1912
1912
|
};
|
|
1913
1913
|
h.on("pointermove", (g) => {
|
|
1914
|
-
if (s.getState() !== "open" && !h.getView().getAnimating())
|
|
1914
|
+
if (s.getState() !== "open" && a.getState() !== "open" && !h.getView().getAnimating())
|
|
1915
1915
|
try {
|
|
1916
1916
|
let k = !1;
|
|
1917
1917
|
const $ = h.getLayers().getArray().filter((C) => C.get("layerType"));
|
|
@@ -1934,8 +1934,8 @@ const ft = (e, r) => {
|
|
|
1934
1934
|
} catch (g) {
|
|
1935
1935
|
console.log("movestart---catch", g);
|
|
1936
1936
|
}
|
|
1937
|
-
}), h.on("click",
|
|
1938
|
-
if (s.getState() !== "open" && !h.getView().getAnimating())
|
|
1937
|
+
}), h.on("click", yt((g) => {
|
|
1938
|
+
if (s.getState() !== "open" && a.getState() !== "open" && !h.getView().getAnimating())
|
|
1939
1939
|
try {
|
|
1940
1940
|
let k = !1;
|
|
1941
1941
|
const $ = h.getLayers().getArray().filter((C) => C.get("layerType"));
|
|
@@ -1955,7 +1955,7 @@ const ft = (e, r) => {
|
|
|
1955
1955
|
console.log("trackManager.getTrackStatus()---", n.getTrackStatus()), n.getTrackStatus() || l.handleShipMapEvent(u, "click", (m = r.getProps()) == null ? void 0 : m.selectShip);
|
|
1956
1956
|
else if (u != null && u.get("portData")) {
|
|
1957
1957
|
const V = u == null ? void 0 : u.get("portData");
|
|
1958
|
-
|
|
1958
|
+
d.selected(V), (b = (P = r.getProps()) == null ? void 0 : P.selectPort) == null || b.call(P, V);
|
|
1959
1959
|
}
|
|
1960
1960
|
k = !0, g.preventDefault(), g.stopPropagation();
|
|
1961
1961
|
}
|
|
@@ -1967,25 +1967,25 @@ const ft = (e, r) => {
|
|
|
1967
1967
|
}, Do = () => {
|
|
1968
1968
|
const e = At([]);
|
|
1969
1969
|
return {
|
|
1970
|
-
createInstance: (l,
|
|
1971
|
-
const
|
|
1972
|
-
|
|
1973
|
-
const s =
|
|
1974
|
-
x.setProps(
|
|
1975
|
-
const t =
|
|
1976
|
-
Oo(
|
|
1970
|
+
createInstance: (l, d) => {
|
|
1971
|
+
const a = ao();
|
|
1972
|
+
a.initMap(l, d);
|
|
1973
|
+
const s = a.getInstall(), h = Eo(s), x = Po();
|
|
1974
|
+
x.setProps(d), h.setShowLayerType(d.layerType), h.setGreenTileVisible(d.showGreenLayer);
|
|
1975
|
+
const t = vo(s), o = yo(s, t), g = To(s), k = Fo(s), $ = Ro(s, x), C = $o(s, x), z = zo(s);
|
|
1976
|
+
Oo(a, x, t, g, z, $, C);
|
|
1977
1977
|
const u = () => {
|
|
1978
|
-
const P = s.getView().calculateExtent(
|
|
1978
|
+
const P = s.getView().calculateExtent(a.getSize()), b = Ve([P[0], P[1]], ee.mercator, ee.data), V = Ve([P[2], P[3]], ee.mercator, ee.data);
|
|
1979
1979
|
return [b[0], b[1], V[0], V[1]];
|
|
1980
1980
|
}, m = {
|
|
1981
1981
|
id: Symbol("map-instance"),
|
|
1982
1982
|
innerMap: null,
|
|
1983
|
-
map:
|
|
1983
|
+
map: a.getInstall(),
|
|
1984
1984
|
destroy: () => {
|
|
1985
1985
|
e.splice(e.indexOf(m), 1);
|
|
1986
1986
|
},
|
|
1987
1987
|
methods: {
|
|
1988
|
-
...
|
|
1988
|
+
...a,
|
|
1989
1989
|
layer: h,
|
|
1990
1990
|
ship: g,
|
|
1991
1991
|
track: t,
|
|
@@ -2009,8 +2009,8 @@ const ft = (e, r) => {
|
|
|
2009
2009
|
return e.push(m), m;
|
|
2010
2010
|
},
|
|
2011
2011
|
destroyInstance: (l) => {
|
|
2012
|
-
const
|
|
2013
|
-
|
|
2012
|
+
const d = e.findIndex((a) => a.id === l);
|
|
2013
|
+
d > -1 && (e[d].destroy(), e.splice(d, 1));
|
|
2014
2014
|
},
|
|
2015
2015
|
destroyAll: () => {
|
|
2016
2016
|
e.forEach((l) => l.destroy()), e.splice(0, e.length);
|
|
@@ -2043,16 +2043,16 @@ const ft = (e, r) => {
|
|
|
2043
2043
|
});
|
|
2044
2044
|
}
|
|
2045
2045
|
n();
|
|
2046
|
-
const l =
|
|
2046
|
+
const l = se(), d = se(), a = Do(), s = se(), h = e, x = se({
|
|
2047
2047
|
getInstall() {
|
|
2048
2048
|
}
|
|
2049
2049
|
});
|
|
2050
2050
|
return Gt(() => {
|
|
2051
2051
|
var t;
|
|
2052
|
-
s.value =
|
|
2052
|
+
s.value = a.createInstance(l.value, h), x.value = s.value.methods, (t = d.value) == null || t.setScaleLine(s.value.map, h.scaleLineUnit);
|
|
2053
2053
|
}), Wt(() => {
|
|
2054
2054
|
var t, o;
|
|
2055
|
-
|
|
2055
|
+
a.destroyInstance((t = s == null ? void 0 : s.value) == null ? void 0 : t.id), (o = s.value) == null || o.destroy();
|
|
2056
2056
|
}), r({
|
|
2057
2057
|
getZoom: () => {
|
|
2058
2058
|
var t;
|
|
@@ -2266,7 +2266,7 @@ const ft = (e, r) => {
|
|
|
2266
2266
|
}, null, 512),
|
|
2267
2267
|
Qe(ro, {
|
|
2268
2268
|
ref_key: "scaleLineRef",
|
|
2269
|
-
ref:
|
|
2269
|
+
ref: d
|
|
2270
2270
|
}, null, 512),
|
|
2271
2271
|
Qe(io, {
|
|
2272
2272
|
ref: "zoomControlRef",
|