zhihao-ui 1.3.60-alpha.2 → 1.3.61
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,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as ft, openBlock as ht, createElementBlock as vt, createElementVNode as dt, ref as ge, computed as Je, h as we, createVNode as ut, render as Yt, reactive as Bt, onMounted as
|
|
2
|
-
import { S as _t, M as Ct, T as ze, X as Ve, t as fe, V as Kt, u as jt, D as mt, v as Qt, j as
|
|
1
|
+
import { defineComponent as ft, openBlock as ht, createElementBlock as vt, createElementVNode as dt, ref as ge, computed as Je, h as we, createVNode as ut, render as Yt, reactive as Bt, onMounted as Xt, onUnmounted as qt } from "vue";
|
|
2
|
+
import { S as _t, M as Ct, T as ze, X as Ve, t as fe, V as Kt, u as jt, D as mt, v as Qt, j as Nt, w as yt, x as Jt, y as Oe, F as ue, z as oe, O as Ce, A as Rt, B as Xe, L as Ge, G as Ut, P as pt, H as me, I as de, J as pe, K as be, N as Pe, Q as et, R as Fe, U as It, W as Ie, Y as gt, Z as Mt, _ as eo, $ as to, a0 as oo, a1 as no, a2 as ro, a3 as lo } from "./vendor-CbeG2C4c.js";
|
|
3
3
|
import { _ as wt } from "./Button-BFA52ivn.js";
|
|
4
4
|
import { w as io } from "./utils-COxKH46Q.js";
|
|
5
5
|
const so = { id: "scale-line-container" }, co = /* @__PURE__ */ ft({
|
|
@@ -30,13 +30,13 @@ const so = { id: "scale-line-container" }, co = /* @__PURE__ */ ft({
|
|
|
30
30
|
console.log("props");
|
|
31
31
|
const { setZoom: d, getZoom: s, getInstall: o } = l.mapInstance.methods;
|
|
32
32
|
if (!o()) return;
|
|
33
|
-
const
|
|
34
|
-
|
|
33
|
+
const b = s();
|
|
34
|
+
b && d(b + 1);
|
|
35
35
|
}, r = () => {
|
|
36
36
|
const { setZoom: d, getZoom: s, getInstall: o } = l.mapInstance.methods;
|
|
37
37
|
if (!o()) return;
|
|
38
|
-
const
|
|
39
|
-
|
|
38
|
+
const b = s();
|
|
39
|
+
b && d(b - 1);
|
|
40
40
|
};
|
|
41
41
|
return (d, s) => (ht(), vt("div", uo, [
|
|
42
42
|
dt("div", {
|
|
@@ -72,30 +72,30 @@ const so = { id: "scale-line-container" }, co = /* @__PURE__ */ ft({
|
|
|
72
72
|
}, ho = [114.84, 30.52], $t = "https://static.zhihaoscm.cn/", tt = 2003750834e-2;
|
|
73
73
|
var Ee = ((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=${Ue}`, 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=${Ue}`, 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=${Ue}`, 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=${Ue}`, e.greenTile = `${$t}/map/tile/{z}/{x}/{y}.png`, e))(Ee || {}), Ae = /* @__PURE__ */ ((e) => (e[e.M = 1] = "M", e[e.KM = 2] = "KM", e[e.NM = 3] = "NM", e))(Ae || {}), le = /* @__PURE__ */ ((e) => (e.PORT = "port", e.SHIP = "ship", e.TRACK = "track", e.DELETE = "delete", e.PATH = "path", e))(le || {});
|
|
74
74
|
function vo() {
|
|
75
|
-
const e = ge(), l = ge(!0), c = () => e.value, r = () => c().getView(), d = (
|
|
76
|
-
l.value =
|
|
75
|
+
const e = ge(), l = ge(!0), c = () => e.value, r = () => c().getView(), d = (C) => {
|
|
76
|
+
l.value = C;
|
|
77
77
|
}, s = () => l.value, o = () => {
|
|
78
|
-
var
|
|
79
|
-
return (
|
|
80
|
-
},
|
|
78
|
+
var C;
|
|
79
|
+
return (C = r()) == null ? void 0 : C.getZoom();
|
|
80
|
+
}, h = (C) => {
|
|
81
81
|
var i;
|
|
82
|
-
(i = r()) == null || i.setZoom(
|
|
83
|
-
},
|
|
84
|
-
var
|
|
85
|
-
(
|
|
86
|
-
},
|
|
82
|
+
(i = r()) == null || i.setZoom(C);
|
|
83
|
+
}, b = (C, i) => {
|
|
84
|
+
var u;
|
|
85
|
+
(u = r()) == null || u.setCenter(fe([C, i]));
|
|
86
|
+
}, M = () => {
|
|
87
87
|
var i;
|
|
88
|
-
const
|
|
89
|
-
return Qt(
|
|
88
|
+
const C = (i = r()) == null ? void 0 : i.getCenter();
|
|
89
|
+
return Qt(C);
|
|
90
90
|
}, t = () => {
|
|
91
|
-
var
|
|
92
|
-
return (
|
|
91
|
+
var C;
|
|
92
|
+
return (C = c()) == null ? void 0 : C.getSize();
|
|
93
93
|
}, n = () => {
|
|
94
|
-
const
|
|
95
|
-
return i && (
|
|
96
|
-
},
|
|
94
|
+
const C = window.navigator.userAgent, i = /iPad|iPhone|iPod/.test(C), u = /Safari/.test(C) && !/CriOS/.test(C), k = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(C);
|
|
95
|
+
return i && (u || k);
|
|
96
|
+
}, y = new Ct(), F = (C, i) => {
|
|
97
97
|
Z(i);
|
|
98
|
-
const
|
|
98
|
+
const u = {
|
|
99
99
|
zoom: i.zoom,
|
|
100
100
|
center: fe(i.center),
|
|
101
101
|
minZoom: ce.min,
|
|
@@ -104,62 +104,62 @@ function vo() {
|
|
|
104
104
|
enableRotation: !1,
|
|
105
105
|
multiWorld: !0
|
|
106
106
|
};
|
|
107
|
-
let
|
|
108
|
-
target:
|
|
107
|
+
let k = {
|
|
108
|
+
target: C,
|
|
109
109
|
controls: jt({
|
|
110
110
|
zoom: !1
|
|
111
111
|
}),
|
|
112
112
|
layers: [
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
y.get("vectorTile"),
|
|
114
|
+
y.get("vectorTileMark"),
|
|
115
|
+
y.get("satelliteImgTile"),
|
|
116
|
+
y.get("satelliteImgTileMark")
|
|
117
117
|
],
|
|
118
|
-
view: new Kt(
|
|
118
|
+
view: new Kt(u)
|
|
119
119
|
};
|
|
120
|
-
const f = new Ct(
|
|
120
|
+
const f = new Ct(k);
|
|
121
121
|
if (n()) {
|
|
122
|
-
const
|
|
123
|
-
handleEvent: function(
|
|
124
|
-
if (
|
|
125
|
-
console.log("IOS Browser---dblclick"),
|
|
126
|
-
const z = f.getView(),
|
|
127
|
-
return z.setZoom(
|
|
122
|
+
const L = new mt({
|
|
123
|
+
handleEvent: function(A) {
|
|
124
|
+
if (A.type === "dblclick") {
|
|
125
|
+
console.log("IOS Browser---dblclick"), A.originalEvent.preventDefault();
|
|
126
|
+
const z = f.getView(), q = z.getZoom();
|
|
127
|
+
return z.setZoom(q + 1), !1;
|
|
128
128
|
}
|
|
129
129
|
return !0;
|
|
130
130
|
}
|
|
131
131
|
});
|
|
132
|
-
f.addInteraction(
|
|
132
|
+
f.addInteraction(L);
|
|
133
133
|
}
|
|
134
134
|
e.value = f;
|
|
135
|
-
}, Z = (
|
|
136
|
-
|
|
135
|
+
}, Z = (C) => {
|
|
136
|
+
y.set("vectorTile", new ze({
|
|
137
137
|
source: new Ve({ url: Ee.vectorTile }),
|
|
138
|
-
visible:
|
|
138
|
+
visible: C.layerType === "vector",
|
|
139
139
|
zIndex: 0,
|
|
140
140
|
preload: 1,
|
|
141
141
|
className: "vector"
|
|
142
|
-
})),
|
|
142
|
+
})), y.set("vectorTileMark", new ze({
|
|
143
143
|
source: new Ve({ url: Ee.vectorTileMark }),
|
|
144
|
-
visible:
|
|
144
|
+
visible: C.layerType === "vector",
|
|
145
145
|
zIndex: 1,
|
|
146
146
|
preload: 1,
|
|
147
147
|
className: "vector"
|
|
148
|
-
})),
|
|
148
|
+
})), y.set("satelliteImgTile", new ze({
|
|
149
149
|
source: new Ve({ url: Ee.satelliteImgTile }),
|
|
150
|
-
visible:
|
|
150
|
+
visible: C.layerType === "satellite",
|
|
151
151
|
zIndex: 0,
|
|
152
152
|
preload: 1,
|
|
153
153
|
className: "satellite"
|
|
154
|
-
})),
|
|
154
|
+
})), y.set("satelliteImgTileMark", new ze({
|
|
155
155
|
source: new Ve({ url: Ee.satelliteImgTileMark }),
|
|
156
|
-
visible:
|
|
156
|
+
visible: C.layerType === "satellite",
|
|
157
157
|
zIndex: 1,
|
|
158
158
|
preload: 1,
|
|
159
159
|
className: "satellite"
|
|
160
|
-
})),
|
|
160
|
+
})), y.set("greenMark", new ze({
|
|
161
161
|
source: new Ve({ url: Ee.greenTile }),
|
|
162
|
-
visible:
|
|
162
|
+
visible: C.showGreenLayer,
|
|
163
163
|
zIndex: 2,
|
|
164
164
|
className: "greenTile"
|
|
165
165
|
}));
|
|
@@ -168,11 +168,11 @@ function vo() {
|
|
|
168
168
|
getInstall: c,
|
|
169
169
|
getView: r,
|
|
170
170
|
getZoom: o,
|
|
171
|
-
setZoom:
|
|
172
|
-
setCenter:
|
|
173
|
-
getCenter:
|
|
171
|
+
setZoom: h,
|
|
172
|
+
setCenter: b,
|
|
173
|
+
getCenter: M,
|
|
174
174
|
getSize: t,
|
|
175
|
-
initMap:
|
|
175
|
+
initMap: F,
|
|
176
176
|
setBaseLayerMap: Z,
|
|
177
177
|
setMapClick: d,
|
|
178
178
|
getMapClick: s
|
|
@@ -229,7 +229,7 @@ const Lt = (e) => {
|
|
|
229
229
|
fill: new ue({ color: "#fff" }),
|
|
230
230
|
offsetY: -14
|
|
231
231
|
});
|
|
232
|
-
return new
|
|
232
|
+
return new oe({
|
|
233
233
|
text: l,
|
|
234
234
|
zIndex: 100
|
|
235
235
|
});
|
|
@@ -238,7 +238,7 @@ const Lt = (e) => {
|
|
|
238
238
|
let d = e[1] / tt * 180;
|
|
239
239
|
return d = 180 / Math.PI * (2 * Math.atan(Math.exp(d * Math.PI / 180)) - Math.PI / 2), c.lon = r, c.lat = d, l === "lonlat" ? c : [r, d];
|
|
240
240
|
}, xo = (e) => {
|
|
241
|
-
const l =
|
|
241
|
+
const l = Nt.duration(e, "minutes"), c = Math.floor(l.asDays()), r = l.hours(), d = l.minutes();
|
|
242
242
|
let s = `${String(d).padStart(2, "0")}分`;
|
|
243
243
|
return r !== 0 && (s = `${String(r).padStart(2, "0")}时${s}`), c !== 0 && (s = `${String(c).padStart(2, "0")}天${s}`), s;
|
|
244
244
|
};
|
|
@@ -248,50 +248,50 @@ const bo = (e) => {
|
|
|
248
248
|
let r = null;
|
|
249
249
|
const d = "--";
|
|
250
250
|
let s = null;
|
|
251
|
-
const o = document.createElement("div"),
|
|
251
|
+
const o = document.createElement("div"), h = new Ce({
|
|
252
252
|
element: o,
|
|
253
253
|
positioning: "top-left",
|
|
254
254
|
className: "track-label-popup"
|
|
255
255
|
});
|
|
256
|
-
let
|
|
257
|
-
const f = 8,
|
|
258
|
-
var
|
|
259
|
-
for (
|
|
260
|
-
const
|
|
261
|
-
x && ((
|
|
256
|
+
let b, M, t, n, y, F = !1, Z = Date.now(), C, i = 0, u = null, k = 20;
|
|
257
|
+
const f = 8, L = [], A = (a) => {
|
|
258
|
+
var m;
|
|
259
|
+
for (L.unshift(a); L.length > f; ) {
|
|
260
|
+
const w = L.pop(), x = l.get(w);
|
|
261
|
+
x && ((m = x.getSource()) == null || m.clear(), e == null || e.removeLayer(x), l.delete(w), delete c[w]);
|
|
262
262
|
}
|
|
263
263
|
};
|
|
264
264
|
let z = "";
|
|
265
|
-
const
|
|
265
|
+
const q = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], te = Rt(async () => {
|
|
266
266
|
if (r && c[r] && l.get(r).getVisible()) {
|
|
267
|
-
console.log("reRenderTrackLine------------"), await
|
|
268
|
-
const a =
|
|
267
|
+
console.log("reRenderTrackLine------------"), await ee(r);
|
|
268
|
+
const a = p(r, c[r]);
|
|
269
269
|
rt(r, a);
|
|
270
270
|
}
|
|
271
|
-
}, 100),
|
|
272
|
-
let
|
|
273
|
-
const x = Math.max(1, Math.floor(
|
|
274
|
-
return
|
|
275
|
-
if (Number(
|
|
276
|
-
const [
|
|
277
|
-
|
|
271
|
+
}, 100), V = () => r && c[r] && l.get(r).getVisible(), p = (a, m) => {
|
|
272
|
+
let w = [];
|
|
273
|
+
const x = Math.max(1, Math.floor(m.length / k));
|
|
274
|
+
return w = m.filter((E, T) => T % x === 0).map((E, T) => {
|
|
275
|
+
if (Number(E.lon) > 180 || Number(E.lat) > 180) {
|
|
276
|
+
const [W, K] = xt(E.lon, E.lat);
|
|
277
|
+
E.lon = W, E.lat = K;
|
|
278
278
|
}
|
|
279
|
-
return
|
|
280
|
-
}),
|
|
281
|
-
(
|
|
282
|
-
(K) => Math.abs(K.lon -
|
|
279
|
+
return E.center = [E.lon, E.lat], E.centerPoint = wo(E.center), E.time = Nt(E.createdAt).format("YYYY-MM-DD HH:mm:ss"), E.id = a, E.index = T, E;
|
|
280
|
+
}), w.filter(
|
|
281
|
+
(E, T, W) => T === W.findIndex(
|
|
282
|
+
(K) => Math.abs(K.lon - E.lon) < 1e-6 && Math.abs(K.lat - E.lat) < 1e-6
|
|
283
283
|
)
|
|
284
284
|
);
|
|
285
|
-
},
|
|
286
|
-
if (!e || JSON.stringify(c[a]) === JSON.stringify(
|
|
285
|
+
}, S = async (a, m, w, x = "ship", v = 200) => {
|
|
286
|
+
if (!e || JSON.stringify(c[a]) === JSON.stringify(m) && r === a || (x === "ship" && (m = m == null ? void 0 : m.reverse()), h && x === "ship" && (e != null && e.getOverlays().getArray().includes(h) || e.addOverlay(h)), (m == null ? void 0 : m.length) < 2))
|
|
287
287
|
return;
|
|
288
|
-
|
|
289
|
-
const
|
|
290
|
-
z =
|
|
291
|
-
},
|
|
292
|
-
const
|
|
288
|
+
A(a), r = a, c[a] = m, k = v;
|
|
289
|
+
const O = Object.keys(c).findIndex((E) => E === a) || 0;
|
|
290
|
+
z = w || q[O > 10 ? 10 : O], await _(), await ve(r);
|
|
291
|
+
}, G = (a) => {
|
|
292
|
+
const m = new be();
|
|
293
293
|
return new pe({
|
|
294
|
-
source:
|
|
294
|
+
source: m,
|
|
295
295
|
visible: !1,
|
|
296
296
|
// 默认隐藏
|
|
297
297
|
className: `track-layer-${a}`,
|
|
@@ -299,55 +299,55 @@ const bo = (e) => {
|
|
|
299
299
|
properties: { layerType: le.TRACK },
|
|
300
300
|
zIndex: 10
|
|
301
301
|
});
|
|
302
|
-
},
|
|
303
|
-
l.forEach((
|
|
304
|
-
var
|
|
305
|
-
const x =
|
|
306
|
-
|
|
302
|
+
}, H = (a) => {
|
|
303
|
+
l.forEach((m, w) => {
|
|
304
|
+
var v;
|
|
305
|
+
const x = w === a;
|
|
306
|
+
m.getVisible() !== x && (m.setVisible(x), e.getLayers().getArray().includes(m) || e.addLayer(m), x || (v = m.getSource()) == null || v.clear());
|
|
307
307
|
}), r = a;
|
|
308
|
-
},
|
|
308
|
+
}, _ = async () => {
|
|
309
309
|
const a = r;
|
|
310
310
|
if (!l.has(a)) {
|
|
311
|
-
const
|
|
312
|
-
l.set(a,
|
|
311
|
+
const O = G(a);
|
|
312
|
+
l.set(a, O);
|
|
313
313
|
}
|
|
314
|
-
await
|
|
315
|
-
const
|
|
316
|
-
if (!(
|
|
314
|
+
await H(a);
|
|
315
|
+
const m = z || "", w = c[a] || [];
|
|
316
|
+
if (!(w && w.length > 1)) return [];
|
|
317
317
|
let x = [];
|
|
318
|
-
x =
|
|
319
|
-
const
|
|
320
|
-
x.length >= 2 && await
|
|
321
|
-
},
|
|
322
|
-
const x = new Ge(
|
|
323
|
-
if (
|
|
324
|
-
|
|
318
|
+
x = p(a, w);
|
|
319
|
+
const v = x.map((O) => O.centerPoint);
|
|
320
|
+
x.length >= 2 && await X(a, v, m);
|
|
321
|
+
}, X = (a, m, w) => {
|
|
322
|
+
const x = new Ge(m), v = l.get(a).getSource(), O = v.getFeatureById(a);
|
|
323
|
+
if (O)
|
|
324
|
+
O.setGeometry(x), O.setId(a), O.setStyle(B(w)), u = O;
|
|
325
325
|
else {
|
|
326
|
-
const
|
|
327
|
-
|
|
326
|
+
const E = new me({ geometry: x });
|
|
327
|
+
E.setId(a), E.set("type", "line"), E.setStyle(B(w)), v.addFeature(E), u = E;
|
|
328
328
|
}
|
|
329
|
-
return
|
|
330
|
-
},
|
|
329
|
+
return u;
|
|
330
|
+
}, B = (a) => new oe({
|
|
331
331
|
stroke: new Pe({
|
|
332
332
|
color: a,
|
|
333
333
|
width: 2
|
|
334
334
|
})
|
|
335
|
-
}),
|
|
335
|
+
}), ne = (a, m, w) => {
|
|
336
336
|
try {
|
|
337
337
|
const x = a == null ? void 0 : a.get("data");
|
|
338
|
-
if (a && x &&
|
|
338
|
+
if (a && x && m === "hover") {
|
|
339
339
|
e.getTargetElement().style.cursor = x ? "pointer" : "";
|
|
340
|
-
const
|
|
341
|
-
|
|
340
|
+
const v = ke(x), O = w == null ? void 0 : w.coordinate;
|
|
341
|
+
O && (o.querySelector(".popup-content"), o.innerHTML = v, h == null || h.setPosition(O));
|
|
342
342
|
} else
|
|
343
|
-
|
|
343
|
+
h && h.setPosition(void 0);
|
|
344
344
|
} catch (x) {
|
|
345
345
|
console.error("handleTrackMapEvent", x);
|
|
346
346
|
}
|
|
347
347
|
}, ke = (a) => {
|
|
348
348
|
if (!(a != null && a.time)) return;
|
|
349
|
-
let
|
|
350
|
-
return a != null && a.stayTime && (
|
|
349
|
+
let m = "";
|
|
350
|
+
return a != null && a.stayTime && (m = `
|
|
351
351
|
<div class="item w-100">
|
|
352
352
|
<div class="item-label">停泊时间约</div>
|
|
353
353
|
<div class="item-item">${xo(Number(a.stayTime))}</div>
|
|
@@ -382,67 +382,67 @@ const bo = (e) => {
|
|
|
382
382
|
<div class="item-label">时间</div>
|
|
383
383
|
<div class="item-item">${a.time}</div>
|
|
384
384
|
</div>
|
|
385
|
-
${
|
|
385
|
+
${m ?? m}
|
|
386
386
|
</div>`;
|
|
387
387
|
}, ie = (a) => {
|
|
388
|
-
const
|
|
389
|
-
const
|
|
388
|
+
const w = a.map((T) => {
|
|
389
|
+
const W = e.getPixelFromCoordinate(fe(T.center));
|
|
390
390
|
return {
|
|
391
|
-
...
|
|
392
|
-
original:
|
|
393
|
-
pixel:
|
|
391
|
+
...T,
|
|
392
|
+
original: T,
|
|
393
|
+
pixel: W,
|
|
394
394
|
distance: 0
|
|
395
395
|
// 先初始化,后续计算
|
|
396
396
|
};
|
|
397
397
|
});
|
|
398
398
|
let x = 0;
|
|
399
|
-
|
|
400
|
-
for (let
|
|
401
|
-
const
|
|
402
|
-
x += Math.sqrt(re * re +
|
|
399
|
+
w[0].distance = 0;
|
|
400
|
+
for (let T = 1; T < w.length; T++) {
|
|
401
|
+
const W = w[T - 1].pixel, K = w[T].pixel, re = K[0] - W[0], P = K[1] - W[1];
|
|
402
|
+
x += Math.sqrt(re * re + P * P), w[T].distance = x;
|
|
403
403
|
}
|
|
404
|
-
const
|
|
405
|
-
(
|
|
406
|
-
),
|
|
407
|
-
for (let
|
|
408
|
-
const
|
|
409
|
-
if (
|
|
410
|
-
const K =
|
|
411
|
-
for (let j = 1; j <=
|
|
412
|
-
const I =
|
|
404
|
+
const v = w.filter(
|
|
405
|
+
(T, W) => W === 0 || W === w.length - 1
|
|
406
|
+
), O = [];
|
|
407
|
+
for (let T = 0; T < v.length; T++) {
|
|
408
|
+
const W = v[T];
|
|
409
|
+
if (O.push(W), T < v.length - 1) {
|
|
410
|
+
const K = v[T + 1], re = K.distance - W.distance, P = Math.floor(re / 100);
|
|
411
|
+
for (let j = 1; j <= P; j++) {
|
|
412
|
+
const I = W.distance + j * 100;
|
|
413
413
|
if (I >= K.distance) break;
|
|
414
414
|
const Q = ae(
|
|
415
|
-
|
|
415
|
+
w,
|
|
416
416
|
I
|
|
417
417
|
);
|
|
418
|
-
Q &&
|
|
418
|
+
Q && O.push(Q);
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
422
|
return Array.from(
|
|
423
|
-
new Map(
|
|
424
|
-
).map((
|
|
425
|
-
...
|
|
423
|
+
new Map(O.map((T) => [T.distance.toFixed(2), T])).values()
|
|
424
|
+
).map((T) => ({
|
|
425
|
+
...T.original,
|
|
426
426
|
// 优先保留原始数据
|
|
427
|
-
...
|
|
427
|
+
...T,
|
|
428
428
|
// 覆盖坐标等计算属性
|
|
429
|
-
coord:
|
|
429
|
+
coord: T.coord,
|
|
430
430
|
// 确保使用插值后的坐标
|
|
431
|
-
pixel:
|
|
432
|
-
distance:
|
|
431
|
+
pixel: T.pixel,
|
|
432
|
+
distance: T.distance
|
|
433
433
|
}));
|
|
434
434
|
};
|
|
435
|
-
function ae(a,
|
|
436
|
-
for (let
|
|
437
|
-
const x = a[
|
|
438
|
-
if (
|
|
439
|
-
const
|
|
435
|
+
function ae(a, m) {
|
|
436
|
+
for (let w = 1; w < a.length; w++) {
|
|
437
|
+
const x = a[w - 1], v = a[w];
|
|
438
|
+
if (m >= x.distance && m <= v.distance) {
|
|
439
|
+
const O = (m - x.distance) / (v.distance - x.distance), E = x.pixel[0] + O * (v.pixel[0] - x.pixel[0]), T = x.pixel[1] + O * (v.pixel[1] - x.pixel[1]), W = e == null ? void 0 : e.getCoordinateFromPixel([E, T]);
|
|
440
440
|
return {
|
|
441
441
|
...x,
|
|
442
442
|
// 继承前一个点的属性(可调整)
|
|
443
|
-
coord:
|
|
444
|
-
pixel: [
|
|
445
|
-
distance:
|
|
443
|
+
coord: W,
|
|
444
|
+
pixel: [E, T],
|
|
445
|
+
distance: m,
|
|
446
446
|
original: void 0
|
|
447
447
|
// 明确标记为插值生成点
|
|
448
448
|
};
|
|
@@ -450,62 +450,62 @@ const bo = (e) => {
|
|
|
450
450
|
}
|
|
451
451
|
return null;
|
|
452
452
|
}
|
|
453
|
-
const rt = async (a,
|
|
454
|
-
if (!
|
|
455
|
-
const
|
|
456
|
-
|
|
457
|
-
const
|
|
458
|
-
|
|
459
|
-
const
|
|
460
|
-
|
|
453
|
+
const rt = async (a, m) => {
|
|
454
|
+
if (!m || m.length === 0) return [];
|
|
455
|
+
const w = ie(m), x = l.get(a).getSource(), v = w.map((T) => lt(T));
|
|
456
|
+
v && v.length > 0 && x.addFeatures(v);
|
|
457
|
+
const O = w.map((T) => U(T, z));
|
|
458
|
+
O && O.length > 0 && x.addFeatures(O);
|
|
459
|
+
const E = he(w, m, z);
|
|
460
|
+
E && E.length > 0 && x.addFeatures(E);
|
|
461
461
|
}, lt = (a) => {
|
|
462
|
-
const
|
|
462
|
+
const m = new me({
|
|
463
463
|
geometry: new de(a.centerPoint),
|
|
464
464
|
data: a
|
|
465
465
|
});
|
|
466
|
-
|
|
467
|
-
let
|
|
466
|
+
m.set("type", "track_point"), m.set("trackId", a.id), m.set("data", a);
|
|
467
|
+
let w = [
|
|
468
468
|
...Y(z)
|
|
469
469
|
];
|
|
470
|
-
return (a.index === 0 || a.index === c[a.id].length - 1) && (
|
|
471
|
-
}, g = window.devicePixelRatio || 1,
|
|
472
|
-
let
|
|
473
|
-
function J(a,
|
|
474
|
-
const
|
|
475
|
-
if (
|
|
476
|
-
return
|
|
477
|
-
if (!
|
|
478
|
-
|
|
470
|
+
return (a.index === 0 || a.index === c[a.id].length - 1) && (w = [...xe(a)], m.set("type", "track_begin")), a.state !== void 0 && a.state !== null && (w = [...$(a)], m.set("type", "track_icon")), m.setStyle(w), m;
|
|
471
|
+
}, g = window.devicePixelRatio || 1, R = /* @__PURE__ */ new Map();
|
|
472
|
+
let N = null, D = null;
|
|
473
|
+
function J(a, m) {
|
|
474
|
+
const w = `${a}`;
|
|
475
|
+
if (R.has(w))
|
|
476
|
+
return R.get(w);
|
|
477
|
+
if (!N) {
|
|
478
|
+
N = document.createElement("canvas");
|
|
479
479
|
try {
|
|
480
|
-
|
|
480
|
+
D = N.getContext("2d", {
|
|
481
481
|
willReadFrequently: !0
|
|
482
482
|
});
|
|
483
483
|
} catch (kt) {
|
|
484
|
-
console.log("e", kt),
|
|
484
|
+
console.log("e", kt), D = N.getContext("2d");
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
|
-
const x =
|
|
488
|
-
if (!
|
|
487
|
+
const x = N, v = D;
|
|
488
|
+
if (!v) return "";
|
|
489
489
|
x.width = 0, x.height = 0;
|
|
490
|
-
const
|
|
491
|
-
|
|
492
|
-
const
|
|
493
|
-
let Q = 0, Se = 0, Ze = 0, De = 0, He = 0,
|
|
494
|
-
Q =
|
|
495
|
-
const je =
|
|
496
|
-
|
|
490
|
+
const O = 2, E = 8, T = 16, W = window.devicePixelRatio || 1, K = "500 12px Arial";
|
|
491
|
+
v.font = K;
|
|
492
|
+
const P = v.measureText(a).width, j = E + P + E, I = O + 14 + O;
|
|
493
|
+
let Q = 0, Se = 0, Ze = 0, De = 0, He = 0, Ne = 0, Le = 0, Re = 0;
|
|
494
|
+
Q = T + j, Se = T + I, Ze = j, De = I, He = j + T, Ne = 0, Le = 0, Re = T, x.width = Math.round(Q * W), x.height = Math.round(Se * W), v.scale(W, W), v.clearRect(0, 0, Q, Se), v.beginPath(), v.moveTo(Ze, De), v.lineTo(He, Ne), v.strokeStyle = m || "#FFF", v.lineWidth = 1, v.stroke(), v.fillStyle = "#FFF", v.fillRect(Le, Re, j, I), v.strokeStyle = m || "#FFF", v.lineWidth = 1, v.strokeRect(Le, Re, j, I), v.font = K, v.textBaseline = "middle";
|
|
495
|
+
const je = Re + O / 2 + I / 2;
|
|
496
|
+
v.strokeStyle = "#ffffff", v.lineWidth = 1, v.strokeText(a, Le + E, je), v.fillStyle = "#000000", v.fillText(a, Le + E, je);
|
|
497
497
|
const Qe = x.toDataURL("image/png");
|
|
498
|
-
return
|
|
498
|
+
return R.set(w, Qe), Qe;
|
|
499
499
|
}
|
|
500
|
-
const U = (a,
|
|
501
|
-
const
|
|
500
|
+
const U = (a, m) => {
|
|
501
|
+
const w = J(a.time, m), x = new me({
|
|
502
502
|
geometry: new de(a.centerPoint),
|
|
503
503
|
data: a
|
|
504
504
|
});
|
|
505
505
|
x.set("type", "track_point_label");
|
|
506
|
-
const
|
|
506
|
+
const v = new oe({
|
|
507
507
|
image: new Fe({
|
|
508
|
-
src:
|
|
508
|
+
src: w,
|
|
509
509
|
anchor: [1, 0],
|
|
510
510
|
displacement: [0, 0],
|
|
511
511
|
scale: 1 / g,
|
|
@@ -514,14 +514,14 @@ const bo = (e) => {
|
|
|
514
514
|
}),
|
|
515
515
|
zIndex: 100
|
|
516
516
|
});
|
|
517
|
-
return x.setStyle(
|
|
518
|
-
},
|
|
519
|
-
const
|
|
520
|
-
|
|
521
|
-
|
|
517
|
+
return x.setStyle(v), x;
|
|
518
|
+
}, ee = (a) => {
|
|
519
|
+
const m = l.get(a).getSource();
|
|
520
|
+
m.forEachFeature((w) => {
|
|
521
|
+
w.get("type") !== "line" && m.removeFeature(w);
|
|
522
522
|
});
|
|
523
523
|
}, Y = (a) => [
|
|
524
|
-
new
|
|
524
|
+
new oe({
|
|
525
525
|
// 扩大交互热区
|
|
526
526
|
image: new et({
|
|
527
527
|
stroke: new Pe({ color: "rgba(0, 0, 0, 0.01)", width: 20 }),
|
|
@@ -529,7 +529,7 @@ const bo = (e) => {
|
|
|
529
529
|
})
|
|
530
530
|
}),
|
|
531
531
|
// 轨迹点样式
|
|
532
|
-
new
|
|
532
|
+
new oe({
|
|
533
533
|
image: new et({
|
|
534
534
|
fill: new ue({ color: a }),
|
|
535
535
|
stroke: new Pe({ color: "#fff", width: 2 }),
|
|
@@ -537,115 +537,115 @@ const bo = (e) => {
|
|
|
537
537
|
})
|
|
538
538
|
})
|
|
539
539
|
], $ = (a) => {
|
|
540
|
-
const
|
|
540
|
+
const m = "#E31818", w = "#1890FF", x = "", v = new oe({
|
|
541
541
|
text: new Oe({
|
|
542
542
|
font: "Normal 22px map-iconfont",
|
|
543
543
|
text: Te(x),
|
|
544
544
|
offsetY: -10,
|
|
545
545
|
fill: new ue({
|
|
546
|
-
color: Number(a.state) === 0 ?
|
|
546
|
+
color: Number(a.state) === 0 ? m : Number(a.state) === 1 ? w : ""
|
|
547
547
|
})
|
|
548
548
|
}),
|
|
549
549
|
zIndex: 99
|
|
550
|
-
}),
|
|
551
|
-
return Number(a.state) === 0 ? K.push(
|
|
552
|
-
}, he = (a,
|
|
550
|
+
}), E = Lt(""), W = Lt(""), K = [];
|
|
551
|
+
return Number(a.state) === 0 ? K.push(E) : Number(a.state) === 1 && K.push(W), K.push(v), K;
|
|
552
|
+
}, he = (a, m, w) => {
|
|
553
553
|
const x = [];
|
|
554
554
|
if (a.length < 2)
|
|
555
555
|
return x;
|
|
556
|
-
for (let
|
|
556
|
+
for (let v = 0; v < a.length - 1; v++)
|
|
557
557
|
try {
|
|
558
|
-
const
|
|
559
|
-
(Q) => Q.lon ===
|
|
560
|
-
),
|
|
561
|
-
(Q) => Q.lon ===
|
|
558
|
+
const O = a[v], E = a[v + 1], T = m.findIndex(
|
|
559
|
+
(Q) => Q.lon === O.lon && Q.lat === O.lat
|
|
560
|
+
), W = m.findIndex(
|
|
561
|
+
(Q) => Q.lon === E.lon && Q.lat === E.lat
|
|
562
562
|
);
|
|
563
|
-
if (
|
|
563
|
+
if (T === -1 || W === -1 || T >= W)
|
|
564
564
|
continue;
|
|
565
|
-
const K =
|
|
566
|
-
geometry: new de(
|
|
565
|
+
const K = m.slice(T, W + 1).map((Q) => Q.centerPoint), P = new Ge(K).getCoordinateAt(0.5), j = bt(a[v].center, a[v + 1].center) * (Math.PI / 180), I = new me({
|
|
566
|
+
geometry: new de(P)
|
|
567
567
|
});
|
|
568
568
|
I.set("type", "track_arrow"), I.setStyle(
|
|
569
|
-
new
|
|
569
|
+
new oe({
|
|
570
570
|
text: new Oe({
|
|
571
571
|
font: "700 12px map-iconfont",
|
|
572
572
|
text: Te(""),
|
|
573
|
-
fill: new ue({ color:
|
|
573
|
+
fill: new ue({ color: w }),
|
|
574
574
|
rotation: j,
|
|
575
575
|
offsetX: 0,
|
|
576
576
|
offsetY: 0
|
|
577
577
|
})
|
|
578
578
|
})
|
|
579
579
|
), x.push(I);
|
|
580
|
-
} catch (
|
|
581
|
-
console.warn("Failed to create arrow at distance",
|
|
580
|
+
} catch (O) {
|
|
581
|
+
console.warn("Failed to create arrow at distance", O);
|
|
582
582
|
}
|
|
583
583
|
return x;
|
|
584
584
|
}, ve = (a) => {
|
|
585
|
-
var
|
|
586
|
-
const
|
|
585
|
+
var O, E;
|
|
586
|
+
const m = e.getView(), w = (O = l == null ? void 0 : l.get(a)) == null ? void 0 : O.getSource(), x = u || (a ? w == null ? void 0 : w.getFeatureById(a) : null);
|
|
587
587
|
if (!x) return;
|
|
588
|
-
const
|
|
589
|
-
if (!
|
|
588
|
+
const v = (E = x == null ? void 0 : x.getGeometry()) == null ? void 0 : E.getExtent();
|
|
589
|
+
if (!v || v[0] === v[2] || v[1] === v[3]) {
|
|
590
590
|
console.warn("Invalid track extent");
|
|
591
591
|
return;
|
|
592
592
|
}
|
|
593
593
|
try {
|
|
594
|
-
const
|
|
595
|
-
if (
|
|
596
|
-
const
|
|
597
|
-
|
|
594
|
+
const T = v[2] - v[0], W = v[3] - v[1], K = 1e-4;
|
|
595
|
+
if (T < K || W < K) {
|
|
596
|
+
const P = [(v[0] + v[2]) / 2, (v[1] + v[3]) / 2];
|
|
597
|
+
m.setCenter(P);
|
|
598
598
|
return;
|
|
599
599
|
}
|
|
600
|
-
const re = Ut(
|
|
601
|
-
|
|
600
|
+
const re = Ut(v, Math.max(T, W) * 0.1);
|
|
601
|
+
m.fit(re, {
|
|
602
602
|
maxZoom: ce.max,
|
|
603
603
|
padding: [30, 30, 30, 30]
|
|
604
604
|
// 添加边距
|
|
605
605
|
});
|
|
606
|
-
} catch (
|
|
607
|
-
console.error("setTrackViewCenter error:",
|
|
606
|
+
} catch (T) {
|
|
607
|
+
console.error("setTrackViewCenter error:", T);
|
|
608
608
|
}
|
|
609
609
|
}, xe = (a) => {
|
|
610
|
-
const
|
|
611
|
-
return [new
|
|
610
|
+
const m = "", v = a.index === 0 ? "#fcdc3f" : "#ff0000";
|
|
611
|
+
return [new oe({
|
|
612
612
|
text: new Oe({
|
|
613
613
|
font: "Normal 14px map-iconfont",
|
|
614
|
-
text: Te(
|
|
615
|
-
fill: new ue({ color:
|
|
614
|
+
text: Te(m),
|
|
615
|
+
fill: new ue({ color: v })
|
|
616
616
|
}),
|
|
617
617
|
zIndex: 101
|
|
618
618
|
})];
|
|
619
619
|
}, it = () => {
|
|
620
|
-
console.log("清除所有的轨迹-----"), Ke(), l.forEach((
|
|
621
|
-
var
|
|
622
|
-
(
|
|
623
|
-
}), Object.keys(c).forEach((
|
|
624
|
-
l.delete(
|
|
620
|
+
console.log("清除所有的轨迹-----"), Ke(), l.forEach((m) => {
|
|
621
|
+
var w;
|
|
622
|
+
(w = m.getSource()) == null || w.clear(), e == null || e.removeLayer(m);
|
|
623
|
+
}), Object.keys(c).forEach((m) => {
|
|
624
|
+
l.delete(m), delete c[m];
|
|
625
625
|
});
|
|
626
|
-
},
|
|
627
|
-
const
|
|
628
|
-
|
|
629
|
-
const
|
|
630
|
-
for (let x = 0; x <
|
|
631
|
-
const
|
|
632
|
-
|
|
626
|
+
}, qe = (a) => {
|
|
627
|
+
const m = l.get(a || r);
|
|
628
|
+
m == null || m.setVisible(!1);
|
|
629
|
+
const w = e.getOverlays().getArray();
|
|
630
|
+
for (let x = 0; x < w.length; ) {
|
|
631
|
+
const v = w[x];
|
|
632
|
+
v.get("class") === "track-label-overlay" ? (v.setPosition(void 0), v.dispose()) : x++;
|
|
633
633
|
}
|
|
634
634
|
Ke();
|
|
635
|
-
}, _e = (a,
|
|
636
|
-
const
|
|
635
|
+
}, _e = (a, m = Ae.NM) => {
|
|
636
|
+
const w = {
|
|
637
637
|
id: a,
|
|
638
638
|
length: "--"
|
|
639
|
-
},
|
|
640
|
-
(
|
|
641
|
-
),
|
|
642
|
-
return
|
|
643
|
-
}, Zt = (a,
|
|
644
|
-
Dt(String(a),
|
|
645
|
-
}, Dt = (a,
|
|
646
|
-
const
|
|
647
|
-
x && Gt(x,
|
|
648
|
-
}, st = new
|
|
639
|
+
}, v = (c[a] || []).map(
|
|
640
|
+
(E) => Xe([E.lon, E.lat], se.data, se.mercator)
|
|
641
|
+
), O = new Ge(v);
|
|
642
|
+
return w.length = yo(O, m) || "--", w;
|
|
643
|
+
}, Zt = (a, m) => {
|
|
644
|
+
Dt(String(a), m);
|
|
645
|
+
}, Dt = (a, m) => {
|
|
646
|
+
const w = c[String(a)], x = w == null ? void 0 : w.map((v) => [v.lon, v.lat]);
|
|
647
|
+
x && Gt(x, m);
|
|
648
|
+
}, st = new oe({
|
|
649
649
|
text: new Oe({
|
|
650
650
|
font: "700 20px map-iconfont",
|
|
651
651
|
text: Te(""),
|
|
@@ -653,89 +653,89 @@ const bo = (e) => {
|
|
|
653
653
|
rotation: 0
|
|
654
654
|
// 初始旋转角度
|
|
655
655
|
})
|
|
656
|
-
}), Ht = (a,
|
|
657
|
-
var
|
|
658
|
-
const
|
|
659
|
-
if (i = (i +
|
|
656
|
+
}), Ht = (a, m) => {
|
|
657
|
+
var P, j;
|
|
658
|
+
const w = Number(50 * m), x = ((P = a.frameState) == null ? void 0 : P.time) ?? Date.now(), v = x - Z;
|
|
659
|
+
if (i = (i + w * v / 1e6) % 2, Z = x, i >= 1) {
|
|
660
660
|
Ke();
|
|
661
661
|
return;
|
|
662
662
|
}
|
|
663
|
-
const
|
|
663
|
+
const O = M.getCoordinateAt(
|
|
664
664
|
i > 1 ? 2 - i : i
|
|
665
|
-
),
|
|
665
|
+
), E = M.getCoordinateAt(
|
|
666
666
|
i > 1 ? i - 0.01 : i
|
|
667
|
-
),
|
|
667
|
+
), T = M.getCoordinateAt(
|
|
668
668
|
i > 1 ? 2 - i : i + 0.01
|
|
669
669
|
), K = bt(
|
|
670
|
-
Et(
|
|
671
|
-
Et(
|
|
670
|
+
Et(E, "array"),
|
|
671
|
+
Et(T, "array")
|
|
672
672
|
) * Math.PI / 180;
|
|
673
|
-
(j = st.getText()) == null || j.setRotation(K), n.setCoordinates(
|
|
673
|
+
(j = st.getText()) == null || j.setRotation(K), n.setCoordinates(O);
|
|
674
674
|
const re = It(a);
|
|
675
675
|
re.setStyle(st), re.drawGeometry(n), e == null || e.render();
|
|
676
676
|
}, Wt = () => {
|
|
677
677
|
var a;
|
|
678
|
-
|
|
678
|
+
F = !0, Z = Date.now(), i = 0, n = ((a = t.getGeometry()) == null ? void 0 : a.clone()) || new de([0, 0]), s && (C == null || C.on("postrender", s)), y == null || y.setGeometry(void 0);
|
|
679
679
|
}, Ke = () => {
|
|
680
|
-
|
|
681
|
-
}, Gt = (a,
|
|
682
|
-
|
|
680
|
+
F && (F = !1, y == null || y.setGeometry(void 0), s && C && C.un("postrender", s), C && (e == null || e.removeLayer(C)), C = null, y = null);
|
|
681
|
+
}, Gt = (a, m) => {
|
|
682
|
+
F && Ke(), b = new pt({
|
|
683
683
|
factor: 1e6
|
|
684
|
-
}).writeGeometry(new Ge(a)),
|
|
684
|
+
}).writeGeometry(new Ge(a)), M = new pt({
|
|
685
685
|
factor: 1e6
|
|
686
|
-
}).readGeometry(
|
|
686
|
+
}).readGeometry(b, {
|
|
687
687
|
dataProjection: se.data,
|
|
688
688
|
featureProjection: se.mercator
|
|
689
689
|
}), t = new me({
|
|
690
690
|
type: "icon",
|
|
691
|
-
geometry: new de(
|
|
691
|
+
geometry: new de(M.getFirstCoordinate())
|
|
692
692
|
});
|
|
693
|
-
const
|
|
694
|
-
n =
|
|
693
|
+
const w = t.getGeometry();
|
|
694
|
+
n = w ? w.clone() : new de([0, 0]), y = new me({
|
|
695
695
|
type: "geoMarker",
|
|
696
696
|
style: st,
|
|
697
697
|
geometry: n
|
|
698
|
-
}),
|
|
698
|
+
}), C = new pe({
|
|
699
699
|
source: new be({
|
|
700
|
-
features: [
|
|
700
|
+
features: [y]
|
|
701
701
|
})
|
|
702
|
-
}), e == null || e.addLayer(
|
|
703
|
-
}, bt = (a,
|
|
704
|
-
function x(
|
|
705
|
-
return 180 * (
|
|
702
|
+
}), e == null || e.addLayer(C), s = (x) => Ht(x, m), Wt();
|
|
703
|
+
}, bt = (a, m, w) => {
|
|
704
|
+
function x(P) {
|
|
705
|
+
return 180 * (P % (2 * Math.PI)) / Math.PI;
|
|
706
706
|
}
|
|
707
|
-
function
|
|
708
|
-
return
|
|
707
|
+
function v(P) {
|
|
708
|
+
return P % 360 * Math.PI / 180;
|
|
709
709
|
}
|
|
710
|
-
function
|
|
710
|
+
function O(P) {
|
|
711
711
|
var j;
|
|
712
|
-
if (!
|
|
713
|
-
if (!Array.isArray(
|
|
714
|
-
if ((
|
|
715
|
-
return
|
|
716
|
-
if (
|
|
712
|
+
if (!P) throw new Error("Coordinate is required");
|
|
713
|
+
if (!Array.isArray(P)) {
|
|
714
|
+
if ((P == null ? void 0 : P.type) === "Feature" && (P == null ? void 0 : P.geometry) !== null && ((j = P == null ? void 0 : P.geometry) == null ? void 0 : j.type) === "Point")
|
|
715
|
+
return P == null ? void 0 : P.geometry.coordinates;
|
|
716
|
+
if (P.type === "Point") return (P == null ? void 0 : P.coordinates) || [];
|
|
717
717
|
}
|
|
718
|
-
if (Array.isArray(
|
|
719
|
-
return
|
|
718
|
+
if (Array.isArray(P) && P.length >= 2 && !Array.isArray(P[0]) && !Array.isArray(P[1]))
|
|
719
|
+
return P;
|
|
720
720
|
throw new Error(
|
|
721
721
|
"Coordinate must be GeoJSON Point or an Array of numbers"
|
|
722
722
|
);
|
|
723
723
|
}
|
|
724
|
-
function P
|
|
724
|
+
function E(P, j, I = {}) {
|
|
725
725
|
if (I.final)
|
|
726
726
|
return function(je, Qe) {
|
|
727
|
-
return (
|
|
728
|
-
}(
|
|
729
|
-
const Q =
|
|
730
|
-
return x(Math.atan2(Le,
|
|
727
|
+
return (E(Qe, je) + 180) % 360;
|
|
728
|
+
}(P, j);
|
|
729
|
+
const Q = O(P), Se = O(j), Ze = v(Q[0]), De = v(Se[0]), He = v(Q[1]), Ne = v(Se[1]), Le = Math.sin(De - Ze) * Math.cos(Ne), Re = Math.cos(He) * Math.sin(Ne) - Math.sin(He) * Math.cos(Ne) * Math.cos(De - Ze);
|
|
730
|
+
return x(Math.atan2(Le, Re));
|
|
731
731
|
}
|
|
732
|
-
function
|
|
733
|
-
return !isNaN(
|
|
732
|
+
function T(P) {
|
|
733
|
+
return !isNaN(P) && P !== null && !Array.isArray(P);
|
|
734
734
|
}
|
|
735
|
-
function
|
|
736
|
-
return
|
|
735
|
+
function W(P, j = {}, I = {}) {
|
|
736
|
+
return P || console.log("Coordinates are required"), Array.isArray(P) || console.log("Coordinates must be an Array"), P.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (!T(P[0]) || !T(P[1])) && console.log("Coordinates must contain numbers"), K({ type: "Point", coordinates: P }, j, I);
|
|
737
737
|
}
|
|
738
|
-
function K(
|
|
738
|
+
function K(P, j = {}, I = {}) {
|
|
739
739
|
const Q = {
|
|
740
740
|
type: "Feature",
|
|
741
741
|
id: "",
|
|
@@ -743,21 +743,21 @@ const bo = (e) => {
|
|
|
743
743
|
bbox: {},
|
|
744
744
|
geometry: {}
|
|
745
745
|
};
|
|
746
|
-
return I.id !== void 0 && (Q.id = I.id), I.bbox && (Q.bbox = I.bbox), Q.properties = j, Q.geometry =
|
|
746
|
+
return I.id !== void 0 && (Q.id = I.id), I.bbox && (Q.bbox = I.bbox), Q.properties = j, Q.geometry = P, Q;
|
|
747
747
|
}
|
|
748
|
-
const re =
|
|
748
|
+
const re = E(W(a), W(m), w);
|
|
749
749
|
return re < 0 ? 360 + re : re;
|
|
750
750
|
};
|
|
751
751
|
return {
|
|
752
|
-
render:
|
|
752
|
+
render: S,
|
|
753
753
|
remove: it,
|
|
754
754
|
play: Zt,
|
|
755
755
|
setCenter: ve,
|
|
756
|
-
close:
|
|
756
|
+
close: qe,
|
|
757
757
|
getLength: _e,
|
|
758
|
-
handleTrackMapEvent:
|
|
759
|
-
reRenderTrackLine:
|
|
760
|
-
getTrackStatus:
|
|
758
|
+
handleTrackMapEvent: ne,
|
|
759
|
+
reRenderTrackLine: te,
|
|
760
|
+
getTrackStatus: V
|
|
761
761
|
};
|
|
762
762
|
}, ko = (e, l) => {
|
|
763
763
|
let c = null;
|
|
@@ -765,20 +765,20 @@ const bo = (e) => {
|
|
|
765
765
|
if (!e || (console.log("vehicleInfo", t), !(t != null && t.lon && (t != null && t.lat)))) return;
|
|
766
766
|
const n = Math.abs(Number(t.lon)) > 180 ? xt(t.lon, t.lat) : [t.lon, t.lat];
|
|
767
767
|
d(t, fe(n));
|
|
768
|
-
const
|
|
769
|
-
|
|
768
|
+
const y = e == null ? void 0 : e.getView(), F = new de(n);
|
|
769
|
+
y.setCenter(Xe(F.getCoordinates(), se.data, se.mercator));
|
|
770
770
|
}, d = (t, n) => {
|
|
771
|
-
const
|
|
771
|
+
const y = `${$t}map/car-icon.gif`;
|
|
772
772
|
c || (c = new Ce({
|
|
773
773
|
element: document.createElement("div"),
|
|
774
774
|
positioning: "center-center",
|
|
775
775
|
stopEvent: !1
|
|
776
776
|
// 允许交互事件穿透
|
|
777
777
|
}), e.addOverlay(c));
|
|
778
|
-
const
|
|
779
|
-
|
|
778
|
+
const F = c.getElement();
|
|
779
|
+
F.style.backgroundImage = `url(${y})`, F.style.width = "80px", F.style.height = "80px";
|
|
780
780
|
const Z = (t == null ? void 0 : t.drc) || "";
|
|
781
|
-
|
|
781
|
+
F.style.transform = `rotate(${Z}deg)`, F.style.backgroundSize = "cover", c == null || c.setPosition(n);
|
|
782
782
|
};
|
|
783
783
|
return {
|
|
784
784
|
location: r,
|
|
@@ -786,8 +786,8 @@ const bo = (e) => {
|
|
|
786
786
|
const t = c == null ? void 0 : c.getElement();
|
|
787
787
|
t && (t.innerHTML = "");
|
|
788
788
|
},
|
|
789
|
-
renderTrack: (t, n,
|
|
790
|
-
l.render(t, n,
|
|
789
|
+
renderTrack: (t, n, y, F) => {
|
|
790
|
+
l.render(t, n, y, "truck", F || 1e3);
|
|
791
791
|
},
|
|
792
792
|
setCenter: (t) => {
|
|
793
793
|
l.setCenter(t);
|
|
@@ -939,15 +939,15 @@ const Vt = (e) => {
|
|
|
939
939
|
return l ? c !== null && +c != 511 && r !== null ? r - +c >= 3 ? ye.right : r - +c <= -3 ? ye.left : ye.front : ye.front : "";
|
|
940
940
|
};
|
|
941
941
|
function Mo(e, l) {
|
|
942
|
-
const { isHighlight: c, shipData: r, color: d } = e.getProperties(), s = ot(l), o = nt(l, r, s),
|
|
942
|
+
const { isHighlight: c, shipData: r, color: d } = e.getProperties(), s = ot(l), o = nt(l, r, s), h = ((r == null ? void 0 : r.cog) - 90 + 360) % 360, b = Vt(r);
|
|
943
943
|
return {
|
|
944
944
|
featureId: r.id,
|
|
945
945
|
shipType: s,
|
|
946
946
|
isHighlight: !!c,
|
|
947
947
|
scale: o,
|
|
948
948
|
fill: d,
|
|
949
|
-
deg:
|
|
950
|
-
direct:
|
|
949
|
+
deg: h,
|
|
950
|
+
direct: b
|
|
951
951
|
};
|
|
952
952
|
}
|
|
953
953
|
const Ye = /* @__PURE__ */ new Map();
|
|
@@ -958,8 +958,8 @@ const $e = (e, l) => {
|
|
|
958
958
|
const c = Mo(l, e), r = Lo(c);
|
|
959
959
|
if (Ye.has(r))
|
|
960
960
|
return Ye.get(r);
|
|
961
|
-
const { shipData: d } = l.getProperties(), s = ot(e), o = nt(e, d, s),
|
|
962
|
-
return Ye.set(r,
|
|
961
|
+
const { shipData: d } = l.getProperties(), s = ot(e), o = nt(e, d, s), h = Eo(l, o, s);
|
|
962
|
+
return Ye.set(r, h), h;
|
|
963
963
|
}, ot = (e) => {
|
|
964
964
|
const l = e == null ? void 0 : e.getView().getZoom();
|
|
965
965
|
return l && l <= ce.shipModelMax && l >= ce.shipTriggleMin ? "ship" : "triangle";
|
|
@@ -972,25 +972,25 @@ const nt = (e, l, c) => {
|
|
|
972
972
|
if (Tt === r && c === "triangle")
|
|
973
973
|
return ce.scaleNum;
|
|
974
974
|
if (Tt = r, c === "ship") {
|
|
975
|
-
const { len: d, wid: s } = l, o = 97,
|
|
975
|
+
const { len: d, wid: s } = l, o = 97, h = 20, b = 1 / r, M = d * b / o, t = s * b / h, n = Math.min(M, t);
|
|
976
976
|
return Math.max(0.2, Math.min(2, n));
|
|
977
977
|
}
|
|
978
978
|
return ce.scaleNum;
|
|
979
979
|
}, Eo = (e, l, c) => {
|
|
980
|
-
const { color: r, direct: d, isHighlight: s, shipData: o } = e.getProperties(),
|
|
981
|
-
return new
|
|
980
|
+
const { color: r, direct: d, isHighlight: s, shipData: o } = e.getProperties(), h = ((o == null ? void 0 : o.cog) - 90 + 360) % 360;
|
|
981
|
+
return new oe({
|
|
982
982
|
image: new Fe({
|
|
983
|
-
src:
|
|
983
|
+
src: b(),
|
|
984
984
|
scale: l || ce.scaleNum,
|
|
985
985
|
anchor: [0.5, 0.5],
|
|
986
|
-
rotation:
|
|
986
|
+
rotation: h * Math.PI / 180,
|
|
987
987
|
rotateWithView: !1
|
|
988
988
|
})
|
|
989
989
|
});
|
|
990
|
-
function
|
|
991
|
-
return `data:image/svg+xml;utf8,${encodeURIComponent(
|
|
990
|
+
function b() {
|
|
991
|
+
return `data:image/svg+xml;utf8,${encodeURIComponent(M())}`;
|
|
992
992
|
}
|
|
993
|
-
function
|
|
993
|
+
function M() {
|
|
994
994
|
switch (c) {
|
|
995
995
|
case "triangle":
|
|
996
996
|
return `<svg width="41" height="24" viewBox="0 0 41 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -1031,7 +1031,7 @@ const Pt = (e, l) => {
|
|
|
1031
1031
|
<path d="M1.99982 46.9998L1.99982 1.99982L46.9998 1.99982L46.9998 46.9998L1.99982 46.9998Z" fill="#FF2424" fill-opacity="0.2"/>
|
|
1032
1032
|
<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"/>
|
|
1033
1033
|
</svg>
|
|
1034
|
-
`,
|
|
1034
|
+
`, h = new oe({
|
|
1035
1035
|
image: new Fe({
|
|
1036
1036
|
src: `data:image/svg+xml;utf8,${encodeURIComponent(o)}`,
|
|
1037
1037
|
scale: d,
|
|
@@ -1039,7 +1039,7 @@ const Pt = (e, l) => {
|
|
|
1039
1039
|
anchorYUnits: "fraction"
|
|
1040
1040
|
})
|
|
1041
1041
|
});
|
|
1042
|
-
return Be.set(c,
|
|
1042
|
+
return Be.set(c, h), h;
|
|
1043
1043
|
};
|
|
1044
1044
|
function Po(e, l, c, r) {
|
|
1045
1045
|
if (l) {
|
|
@@ -1062,7 +1062,7 @@ const Fo = (e, l) => {
|
|
|
1062
1062
|
}, Ot = (e) => {
|
|
1063
1063
|
const l = document.createElement("div");
|
|
1064
1064
|
l.className = "ship-overlay-box", l.style.position = "relative";
|
|
1065
|
-
const { lon: c, lat: r, blinking: d, blinkingColors: s, name: o } = e,
|
|
1065
|
+
const { lon: c, lat: r, blinking: d, blinkingColors: s, name: o } = e, h = ut({
|
|
1066
1066
|
setup() {
|
|
1067
1067
|
return po({
|
|
1068
1068
|
id: e == null ? void 0 : e.id,
|
|
@@ -1075,7 +1075,7 @@ const Fo = (e, l) => {
|
|
|
1075
1075
|
});
|
|
1076
1076
|
}
|
|
1077
1077
|
});
|
|
1078
|
-
return Yt(
|
|
1078
|
+
return Yt(h, l), l;
|
|
1079
1079
|
}, Ft = (e) => {
|
|
1080
1080
|
const l = [];
|
|
1081
1081
|
return e.existDevice && l.push(""), e.existMobile && l.push(""), e.existWaterGauge && l.push(""), l;
|
|
@@ -1091,9 +1091,9 @@ function So() {
|
|
|
1091
1091
|
];
|
|
1092
1092
|
return e[Math.floor(Math.random() * e.length)];
|
|
1093
1093
|
}
|
|
1094
|
-
const
|
|
1094
|
+
const No = window.devicePixelRatio || 1, ct = /* @__PURE__ */ new Map();
|
|
1095
1095
|
let We = null, at = null;
|
|
1096
|
-
function
|
|
1096
|
+
function Ro(e, l, c = "left-bottom", r = 10) {
|
|
1097
1097
|
const d = `${e}-${l.join(",")}-${c}-${r}`;
|
|
1098
1098
|
if (ct.has(d))
|
|
1099
1099
|
return ct.get(d);
|
|
@@ -1110,72 +1110,72 @@ function No(e, l, c = "left-bottom", r = 10) {
|
|
|
1110
1110
|
const s = We, o = at;
|
|
1111
1111
|
if (!o) return "";
|
|
1112
1112
|
s.width = 0, s.height = 0;
|
|
1113
|
-
const
|
|
1113
|
+
const h = 2, b = 4, M = 16, t = window.devicePixelRatio || 1, n = "500 12px Arial", y = "12px map-iconfont";
|
|
1114
1114
|
o.font = n;
|
|
1115
1115
|
const Z = o.measureText(e).width;
|
|
1116
|
-
o.font =
|
|
1117
|
-
const
|
|
1118
|
-
let
|
|
1119
|
-
switch (
|
|
1116
|
+
o.font = y;
|
|
1117
|
+
const C = l.map((B) => ({ width: o.measureText(Te(B)).width, height: 14 })), i = C.reduce((B, ne) => B + ne.width, 0), u = l.length * r, k = b + Z + i + u + b, f = h + 14 + h * 2;
|
|
1118
|
+
let L, A, z = 0, q = 0, te = 0, V = 0, p = 0, S = 0;
|
|
1119
|
+
switch (L = M + k, c) {
|
|
1120
1120
|
case "right-top":
|
|
1121
|
-
|
|
1121
|
+
A = M + f, z = 0, q = M + f, te = M, V = 0, p = M, S = 0;
|
|
1122
1122
|
break;
|
|
1123
1123
|
case "right-middle":
|
|
1124
|
-
|
|
1124
|
+
A = f, z = 0, q = f / 2, te = M, V = f / 2, p = M, S = 0;
|
|
1125
1125
|
break;
|
|
1126
1126
|
case "right-bottom":
|
|
1127
|
-
|
|
1127
|
+
A = M + f, z = 0, q = 0, te = M, V = M, p = M, S = M;
|
|
1128
1128
|
break;
|
|
1129
1129
|
case "left-top":
|
|
1130
|
-
|
|
1130
|
+
A = M + f, z = k, q = M, te = k + M, V = f + M, p = 0, S = 0;
|
|
1131
1131
|
break;
|
|
1132
1132
|
case "left-middle":
|
|
1133
|
-
|
|
1133
|
+
A = f, z = k, q = f / 2, te = k + M, V = f / 2, p = 0, S = 0;
|
|
1134
1134
|
break;
|
|
1135
1135
|
case "left-bottom":
|
|
1136
|
-
|
|
1136
|
+
A = M + f, z = k, q = f, te = k + M, V = 0, p = 0, S = M;
|
|
1137
1137
|
break;
|
|
1138
1138
|
}
|
|
1139
|
-
|
|
1140
|
-
const
|
|
1141
|
-
o.strokeStyle = "#ffffff", o.lineWidth = 1, o.strokeText(e,
|
|
1142
|
-
let
|
|
1143
|
-
const
|
|
1144
|
-
l.length > 0 && l.forEach((
|
|
1145
|
-
o.fillText(Te(
|
|
1139
|
+
A = A + h, s.width = Math.round(L * t), s.height = Math.round(A * t), o.scale(t, t), o.clearRect(0, 0, L, A), o.beginPath(), o.moveTo(z, q), o.lineTo(te, V), o.strokeStyle = "#FFF", o.lineWidth = 1, o.stroke(), o.fillStyle = "#FFF", o.fillRect(p, S, k, f), o.font = n, o.textBaseline = "middle";
|
|
1140
|
+
const G = S + h / 2 + f / 2;
|
|
1141
|
+
o.strokeStyle = "#ffffff", o.lineWidth = 1, o.strokeText(e, p + b, G), o.fillStyle = "#000000", o.fillText(e, p + b, G), o.font = y, o.fillStyle = "#3370ff";
|
|
1142
|
+
let H = p + b + Z + r;
|
|
1143
|
+
const _ = S + f / 2;
|
|
1144
|
+
l.length > 0 && l.forEach((B, ne) => {
|
|
1145
|
+
o.fillText(Te(B), H, _), H += C[ne].width + r;
|
|
1146
1146
|
});
|
|
1147
|
-
const
|
|
1148
|
-
return ct.set(d,
|
|
1147
|
+
const X = s.toDataURL("image/png");
|
|
1148
|
+
return ct.set(d, X), X;
|
|
1149
1149
|
}
|
|
1150
1150
|
const St = (e, l) => {
|
|
1151
|
-
const { name: c, rightIcons: r, selected: d } = e.getProperties(), s = l !== 1 ? So() : "right-top", o =
|
|
1152
|
-
let
|
|
1151
|
+
const { name: c, rightIcons: r, selected: d } = e.getProperties(), s = l !== 1 ? So() : "right-top", o = Ro(c, r, s);
|
|
1152
|
+
let h = [0, 0];
|
|
1153
1153
|
switch (s) {
|
|
1154
1154
|
case "right-top":
|
|
1155
|
-
|
|
1155
|
+
h = [0, 1];
|
|
1156
1156
|
break;
|
|
1157
1157
|
case "right-middle":
|
|
1158
|
-
|
|
1158
|
+
h = [0, 0.5];
|
|
1159
1159
|
break;
|
|
1160
1160
|
case "right-bottom":
|
|
1161
|
-
|
|
1161
|
+
h = [0, 0];
|
|
1162
1162
|
break;
|
|
1163
1163
|
case "left-top":
|
|
1164
|
-
|
|
1164
|
+
h = [1, 1];
|
|
1165
1165
|
break;
|
|
1166
1166
|
case "left-middle":
|
|
1167
|
-
|
|
1167
|
+
h = [1, 0.5];
|
|
1168
1168
|
break;
|
|
1169
1169
|
case "left-bottom":
|
|
1170
|
-
|
|
1170
|
+
h = [1, 0];
|
|
1171
1171
|
break;
|
|
1172
1172
|
}
|
|
1173
|
-
return new
|
|
1173
|
+
return new oe({
|
|
1174
1174
|
image: new Fe({
|
|
1175
1175
|
src: o,
|
|
1176
|
-
anchor:
|
|
1176
|
+
anchor: h,
|
|
1177
1177
|
displacement: [0, 0],
|
|
1178
|
-
scale: 1 /
|
|
1178
|
+
scale: 1 / No,
|
|
1179
1179
|
anchorXUnits: "fraction",
|
|
1180
1180
|
anchorYUnits: "fraction"
|
|
1181
1181
|
}),
|
|
@@ -1193,19 +1193,19 @@ const St = (e, l) => {
|
|
|
1193
1193
|
const c = e.getViewport();
|
|
1194
1194
|
c && (c.style.cursor = l);
|
|
1195
1195
|
}, Vo = (e, l) => {
|
|
1196
|
-
const c = ge([]), r = ge("km"), d = (
|
|
1197
|
-
r.value =
|
|
1196
|
+
const c = ge([]), r = ge("km"), d = (V) => {
|
|
1197
|
+
r.value = V;
|
|
1198
1198
|
};
|
|
1199
|
-
let s, o = "close"
|
|
1200
|
-
const
|
|
1201
|
-
Me(e, "crosshair"),
|
|
1199
|
+
let s, o = "close";
|
|
1200
|
+
const h = () => {
|
|
1201
|
+
Me(e, "crosshair"), t(), $o(e), e.on("pointermove", F), e.getViewport().addEventListener("mouseout", () => {
|
|
1202
1202
|
s && s.classList.add("hidden");
|
|
1203
|
-
}),
|
|
1203
|
+
}), C(), o = "open";
|
|
1204
1204
|
};
|
|
1205
|
-
let
|
|
1206
|
-
const
|
|
1207
|
-
|
|
1208
|
-
source:
|
|
1205
|
+
let b, M;
|
|
1206
|
+
const t = () => {
|
|
1207
|
+
b = new be(), M = new pe({
|
|
1208
|
+
source: b,
|
|
1209
1209
|
zIndex: 1e3,
|
|
1210
1210
|
style: {
|
|
1211
1211
|
"fill-color": "rgba(255, 255, 255, 0.2)",
|
|
@@ -1214,21 +1214,21 @@ const St = (e, l) => {
|
|
|
1214
1214
|
"circle-radius": 7,
|
|
1215
1215
|
"circle-fill-color": "#ffcc33"
|
|
1216
1216
|
}
|
|
1217
|
-
}), e == null || e.addLayer(
|
|
1217
|
+
}), e == null || e.addLayer(M);
|
|
1218
1218
|
};
|
|
1219
|
-
let
|
|
1220
|
-
const
|
|
1221
|
-
if (
|
|
1219
|
+
let n, y;
|
|
1220
|
+
const F = (V) => {
|
|
1221
|
+
if (V.dragging)
|
|
1222
1222
|
return;
|
|
1223
|
-
let
|
|
1224
|
-
|
|
1223
|
+
let p = "点击选择起点";
|
|
1224
|
+
n && (p = "单击继续,双击结束"), s && (s.innerHTML = p, y.setPosition(V.coordinate), s.classList.remove("hidden"));
|
|
1225
1225
|
};
|
|
1226
|
-
let
|
|
1227
|
-
const
|
|
1228
|
-
|
|
1229
|
-
source:
|
|
1226
|
+
let Z;
|
|
1227
|
+
const C = () => {
|
|
1228
|
+
Z = new Ie({
|
|
1229
|
+
source: b,
|
|
1230
1230
|
type: "LineString",
|
|
1231
|
-
style: new
|
|
1231
|
+
style: new oe({
|
|
1232
1232
|
fill: new ue({
|
|
1233
1233
|
color: "rgba(255, 255, 255, 0.2)"
|
|
1234
1234
|
}),
|
|
@@ -1248,95 +1248,83 @@ const St = (e, l) => {
|
|
|
1248
1248
|
})
|
|
1249
1249
|
}),
|
|
1250
1250
|
// 添加条件函数,判断是否应该出发点绘制
|
|
1251
|
-
condition: (
|
|
1252
|
-
const
|
|
1253
|
-
return
|
|
1251
|
+
condition: (p) => {
|
|
1252
|
+
const S = p.originalEvent.target;
|
|
1253
|
+
return S.className !== "ol-tooltip-measure" && S.className !== "ol-tooltip-delete-button";
|
|
1254
1254
|
}
|
|
1255
|
-
}), e == null || e.addInteraction(
|
|
1256
|
-
let
|
|
1257
|
-
|
|
1258
|
-
var
|
|
1259
|
-
|
|
1260
|
-
let
|
|
1261
|
-
|
|
1262
|
-
const _ =
|
|
1263
|
-
|
|
1255
|
+
}), e == null || e.addInteraction(Z), f(), L();
|
|
1256
|
+
let V;
|
|
1257
|
+
Z.on("drawstart", function(p) {
|
|
1258
|
+
var G;
|
|
1259
|
+
n = p.feature, n.set("randomId", i());
|
|
1260
|
+
let S;
|
|
1261
|
+
V = (G = n.getGeometry()) == null ? void 0 : G.on("change", function(H) {
|
|
1262
|
+
const _ = H.target, X = At(_, r.value);
|
|
1263
|
+
S = _.getLastCoordinate(), u && X && (u.innerHTML = X), k.setPosition(S);
|
|
1264
1264
|
});
|
|
1265
|
-
}),
|
|
1266
|
-
var
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
c.value.push({ id: q, value: u == null ? void 0 : u.innerHTML }), u.innerHTML = `${u.innerHTML}<div class="ol-tooltip-delete-button" data-id="${q}">
|
|
1271
|
-
<i class="map-iconfont icon-delete"></i>
|
|
1272
|
-
</div>`;
|
|
1273
|
-
}
|
|
1274
|
-
p.setOffset([0, -7]), T = null, u = null, C && gt(C), (A = (M = l.getProps()) == null ? void 0 : M.lineDrawEnd) == null || A.call(M, c.value), s && (s.innerHTML = "");
|
|
1275
|
-
const W = document.querySelectorAll(".ol-tooltip-static .ol-tooltip-delete-button");
|
|
1276
|
-
W && W.length > 0 && W.forEach((q) => {
|
|
1277
|
-
q.addEventListener("click", b);
|
|
1278
|
-
});
|
|
1279
|
-
} catch (W) {
|
|
1280
|
-
console.log(W);
|
|
1265
|
+
}), Z.on("drawend", function() {
|
|
1266
|
+
var p, S, G;
|
|
1267
|
+
if (u && (u.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), u != null && u.innerHTML) {
|
|
1268
|
+
const H = (n == null ? void 0 : n.get("randomId")) || i();
|
|
1269
|
+
c.value.push({ id: H, value: u == null ? void 0 : u.innerHTML }), u.innerHTML = `${u.innerHTML}<div class="ol-tooltip-delete-button" data-id="${H}"><i class="map-iconfont icon-delete"></i></div>`;
|
|
1281
1270
|
}
|
|
1271
|
+
(p = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || p.addEventListener("click", (H) => {
|
|
1272
|
+
var X;
|
|
1273
|
+
H.preventDefault(), H.stopPropagation();
|
|
1274
|
+
const _ = (X = H.target) == null ? void 0 : X.getAttribute("data-id");
|
|
1275
|
+
_ && z(_);
|
|
1276
|
+
}), k.setOffset([0, -7]), n = null, u = null, f(), V && gt(V), (G = (S = l.getProps()) == null ? void 0 : S.lineDrawEnd) == null || G.call(S, c.value), s.innerHTML = "";
|
|
1282
1277
|
});
|
|
1283
|
-
},
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
M && X(M);
|
|
1288
|
-
}, f = () => Math.random().toString(36).substring(2, 9), E = () => {
|
|
1289
|
-
u = document.createElement("div"), u.className = "ol-tooltip ol-tooltip-measure", p = new Ce({
|
|
1278
|
+
}, i = () => Math.random().toString(36).substring(2, 9);
|
|
1279
|
+
let u, k;
|
|
1280
|
+
const f = () => {
|
|
1281
|
+
u != null && u.parentNode && u.parentNode.removeChild(u), u = document.createElement("div"), u.className = "ol-tooltip ol-tooltip-measure", k = new Ce({
|
|
1290
1282
|
element: u,
|
|
1291
1283
|
offset: [0, -15],
|
|
1292
1284
|
positioning: "bottom-center",
|
|
1293
1285
|
stopEvent: !1,
|
|
1294
1286
|
insertFirst: !1
|
|
1295
|
-
}), e == null || e.addOverlay(
|
|
1296
|
-
},
|
|
1297
|
-
s != null && s.parentNode && s.parentNode.removeChild(s), s = document.createElement("div"), s.className = "ol-tooltip hidden",
|
|
1287
|
+
}), e == null || e.addOverlay(k);
|
|
1288
|
+
}, L = () => {
|
|
1289
|
+
s != null && s.parentNode && s.parentNode.removeChild(s), s = document.createElement("div"), s.className = "ol-tooltip hidden", y = new Ce({
|
|
1298
1290
|
element: s,
|
|
1299
1291
|
offset: [15, 0],
|
|
1300
1292
|
positioning: "center-left",
|
|
1301
1293
|
stopEvent: !1
|
|
1302
|
-
}), e == null || e.addOverlay(
|
|
1303
|
-
},
|
|
1304
|
-
c.value.forEach((
|
|
1305
|
-
var
|
|
1306
|
-
const
|
|
1307
|
-
|
|
1308
|
-
const
|
|
1309
|
-
|
|
1310
|
-
}),
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
const D = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1321
|
-
D[M] && ((W = (A = D[M]) == null ? void 0 : A.parentNode) == null || W.removeChild(D[M]));
|
|
1322
|
-
const te = t.getFeatures();
|
|
1323
|
-
te[M] && t.removeFeature(te[M]);
|
|
1294
|
+
}), e == null || e.addOverlay(y);
|
|
1295
|
+
}, A = () => {
|
|
1296
|
+
c.value.forEach((V, p) => {
|
|
1297
|
+
var H, _;
|
|
1298
|
+
const S = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1299
|
+
S[p] && ((_ = (H = S[p]) == null ? void 0 : H.parentNode) == null || _.removeChild(S[p]));
|
|
1300
|
+
const G = b.getFeatures();
|
|
1301
|
+
G[p] && b.removeFeature(G[p]);
|
|
1302
|
+
}), q(), zo(e), o = "close", Me(e, "grab");
|
|
1303
|
+
}, z = (V) => {
|
|
1304
|
+
var S, G, H, _;
|
|
1305
|
+
const p = c.value.findIndex((X) => X.id === V);
|
|
1306
|
+
if (p !== -1) {
|
|
1307
|
+
c.value.splice(p, 1);
|
|
1308
|
+
const X = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1309
|
+
X[p] && ((G = (S = X[p]) == null ? void 0 : S.parentNode) == null || G.removeChild(X[p]));
|
|
1310
|
+
const B = b.getFeatures();
|
|
1311
|
+
B[p] && b.removeFeature(B[p]);
|
|
1324
1312
|
}
|
|
1325
|
-
(_ = (
|
|
1326
|
-
},
|
|
1327
|
-
if (c.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((
|
|
1328
|
-
var
|
|
1329
|
-
(
|
|
1330
|
-
}),
|
|
1331
|
-
const
|
|
1332
|
-
|
|
1313
|
+
(_ = (H = l.getProps()) == null ? void 0 : H.lineDrawEnd) == null || _.call(H, c.value);
|
|
1314
|
+
}, q = () => {
|
|
1315
|
+
if (c.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((V) => {
|
|
1316
|
+
var p;
|
|
1317
|
+
(p = V == null ? void 0 : V.parentNode) == null || p.removeChild(V);
|
|
1318
|
+
}), b == null || b.clear(), Z) {
|
|
1319
|
+
const V = e.getInteractions().getArray().find((p) => Mt(p) === Mt(Z));
|
|
1320
|
+
V && e.removeInteraction(V);
|
|
1333
1321
|
}
|
|
1334
|
-
e.removeLayer(
|
|
1322
|
+
e.removeLayer(M), s != null && s.parentNode && s.parentNode.removeChild(s), u != null && u.parentNode && u.parentNode.removeChild(u);
|
|
1335
1323
|
};
|
|
1336
1324
|
return {
|
|
1337
|
-
open:
|
|
1338
|
-
close:
|
|
1339
|
-
deleteLine:
|
|
1325
|
+
open: h,
|
|
1326
|
+
close: A,
|
|
1327
|
+
deleteLine: z,
|
|
1340
1328
|
setUnit: d,
|
|
1341
1329
|
getState: () => o
|
|
1342
1330
|
};
|
|
@@ -1358,16 +1346,16 @@ const St = (e, l) => {
|
|
|
1358
1346
|
}, Oo = (e, l) => {
|
|
1359
1347
|
let c, r, d = "close";
|
|
1360
1348
|
const s = () => {
|
|
1361
|
-
|
|
1349
|
+
q(), d = "open", o(), Me(e, "crosshair");
|
|
1362
1350
|
}, o = () => {
|
|
1363
|
-
|
|
1351
|
+
M(), k(), A(), Z();
|
|
1364
1352
|
};
|
|
1365
|
-
let
|
|
1366
|
-
const
|
|
1367
|
-
if (
|
|
1368
|
-
const
|
|
1369
|
-
source:
|
|
1370
|
-
style: new
|
|
1353
|
+
let h = null, b = null;
|
|
1354
|
+
const M = () => {
|
|
1355
|
+
if (h && b) return;
|
|
1356
|
+
const V = new be(), p = new pe({
|
|
1357
|
+
source: V,
|
|
1358
|
+
style: new oe({
|
|
1371
1359
|
stroke: new Pe({
|
|
1372
1360
|
color: "#fbcc33",
|
|
1373
1361
|
width: 2
|
|
@@ -1375,46 +1363,46 @@ const St = (e, l) => {
|
|
|
1375
1363
|
}),
|
|
1376
1364
|
zIndex: 1e3
|
|
1377
1365
|
});
|
|
1378
|
-
|
|
1379
|
-
|
|
1366
|
+
h = p, b = V, e.on("pointermove", n), e.addLayer(p), e.on(["dblclick"], function(S) {
|
|
1367
|
+
y && (S.stopPropagation(), S.preventDefault());
|
|
1380
1368
|
});
|
|
1381
1369
|
};
|
|
1382
1370
|
let t;
|
|
1383
|
-
const n = (
|
|
1384
|
-
if (
|
|
1385
|
-
const
|
|
1386
|
-
f && (f.innerHTML =
|
|
1371
|
+
const n = (V) => {
|
|
1372
|
+
if (V.dragging) return;
|
|
1373
|
+
const p = t ? "单击继续,双击结束" : "点击选择起点";
|
|
1374
|
+
f && (f.innerHTML = p, L.setPosition(V.coordinate));
|
|
1387
1375
|
};
|
|
1388
|
-
let
|
|
1376
|
+
let y, F = !1;
|
|
1389
1377
|
const Z = () => {
|
|
1390
1378
|
if (c) {
|
|
1391
1379
|
f != null && f.parentNode && f.parentNode.removeChild(f);
|
|
1392
|
-
const
|
|
1393
|
-
if (!
|
|
1394
|
-
const
|
|
1380
|
+
const p = c.getGeometry();
|
|
1381
|
+
if (!p) return;
|
|
1382
|
+
const S = C(p, "nm");
|
|
1395
1383
|
i && (i.innerHTML = `
|
|
1396
|
-
<span class="text">面积:${
|
|
1384
|
+
<span class="text">面积:${S}${F ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1397
1385
|
`), i && (i.innerHTML += '<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');
|
|
1398
|
-
const
|
|
1399
|
-
if (
|
|
1400
|
-
const
|
|
1401
|
-
|
|
1386
|
+
const G = p.getCoordinates(), H = G[0][G[0].length - 2];
|
|
1387
|
+
if (u.setPosition(H), h) {
|
|
1388
|
+
const X = h.getSource();
|
|
1389
|
+
X && c && (X.clear(), X.addFeature(c));
|
|
1402
1390
|
}
|
|
1403
1391
|
setTimeout(() => {
|
|
1404
|
-
var
|
|
1405
|
-
(
|
|
1406
|
-
var
|
|
1407
|
-
z(), (
|
|
1392
|
+
var X;
|
|
1393
|
+
(X = document.querySelector(".delete-icon")) == null || X.addEventListener("click", () => {
|
|
1394
|
+
var B, ne;
|
|
1395
|
+
z(), (ne = (B = l.getProps()) == null ? void 0 : B.areaDrawEnd) == null || ne.call(B, []);
|
|
1408
1396
|
});
|
|
1409
1397
|
}, 0);
|
|
1410
|
-
const
|
|
1411
|
-
e == null || e.getView().setCenter(
|
|
1398
|
+
const _ = to(c.getGeometry().getExtent());
|
|
1399
|
+
e == null || e.getView().setCenter(_);
|
|
1412
1400
|
return;
|
|
1413
1401
|
}
|
|
1414
|
-
const
|
|
1402
|
+
const V = {
|
|
1415
1403
|
type: "Polygon",
|
|
1416
1404
|
trace: !0,
|
|
1417
|
-
style: [new
|
|
1405
|
+
style: [new oe({
|
|
1418
1406
|
stroke: new Pe({
|
|
1419
1407
|
color: "rgba(255, 255, 255, 1)",
|
|
1420
1408
|
width: 1.5,
|
|
@@ -1423,226 +1411,226 @@ const St = (e, l) => {
|
|
|
1423
1411
|
fill: new ue({
|
|
1424
1412
|
color: "rgba(255, 255, 255, 0.25)"
|
|
1425
1413
|
})
|
|
1426
|
-
}), new
|
|
1414
|
+
}), new oe({
|
|
1427
1415
|
image: new et({
|
|
1428
1416
|
radius: 5,
|
|
1429
1417
|
fill: new ue({
|
|
1430
1418
|
color: "rgb(51,112,255, 1)"
|
|
1431
1419
|
})
|
|
1432
1420
|
}),
|
|
1433
|
-
geometry: function(
|
|
1434
|
-
const
|
|
1435
|
-
return new oo(
|
|
1421
|
+
geometry: function(p) {
|
|
1422
|
+
const S = p.getGeometry().getCoordinates();
|
|
1423
|
+
return new oo(S);
|
|
1436
1424
|
}
|
|
1437
1425
|
})]
|
|
1438
1426
|
};
|
|
1439
|
-
|
|
1440
|
-
var
|
|
1441
|
-
t =
|
|
1442
|
-
const
|
|
1443
|
-
if (
|
|
1427
|
+
V.source = b, y = new Ie(V), e == null || e.addInteraction(y), y.on("drawstart", (p) => {
|
|
1428
|
+
var S;
|
|
1429
|
+
t = p.feature, r = (S = t.getGeometry()) == null ? void 0 : S.on("change", (G) => {
|
|
1430
|
+
const H = G.target, _ = C(H, "nm"), B = H.getCoordinates()[0], ne = new Ge([B[B.length - 2], B[B.length - 1]]), ke = At(ne, "nm");
|
|
1431
|
+
if (F = Number(yt(ne) / 1e3) > 150, !_) return;
|
|
1444
1432
|
const ie = '<span class="error pl-4">超出可以绘画的距离</span>';
|
|
1445
1433
|
i && (i.innerHTML = `
|
|
1446
1434
|
<div class="text">
|
|
1447
|
-
面积:${
|
|
1448
|
-
${
|
|
1435
|
+
面积:${_}
|
|
1436
|
+
${F ? ie : ""}
|
|
1449
1437
|
</div>
|
|
1450
1438
|
`), f && (f.innerHTML = `
|
|
1451
1439
|
<div class="text">
|
|
1452
|
-
面积:${
|
|
1440
|
+
面积:${_}
|
|
1453
1441
|
</div>
|
|
1454
|
-
<div class="text ${
|
|
1455
|
-
线段 ${
|
|
1456
|
-
${
|
|
1442
|
+
<div class="text ${F ? "error" : ""}">
|
|
1443
|
+
线段 ${B.length - 2}: ${ke}
|
|
1444
|
+
${F ? ie : ""}
|
|
1457
1445
|
</div>
|
|
1458
1446
|
<div>
|
|
1459
1447
|
<span class="text">单击继续,双击结束</span>
|
|
1460
1448
|
</div>
|
|
1461
1449
|
`);
|
|
1462
1450
|
});
|
|
1463
|
-
}),
|
|
1464
|
-
var
|
|
1465
|
-
if (!
|
|
1466
|
-
i && !c && (i.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), c =
|
|
1467
|
-
const
|
|
1468
|
-
if (
|
|
1469
|
-
const ie =
|
|
1470
|
-
(
|
|
1451
|
+
}), y.on("drawend", (p) => {
|
|
1452
|
+
var X, B, ne, ke;
|
|
1453
|
+
if (!p.feature.getGeometry()) return;
|
|
1454
|
+
i && !c && (i.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), c = p.feature, u.setOffset([10, 0]);
|
|
1455
|
+
const H = p.feature.getGeometry().getCoordinates(), _ = H[0][H[0].length - 2];
|
|
1456
|
+
if (u.setPosition(_), f != null && f.parentNode && f.parentNode.removeChild(f), (X = l.getProps()) != null && X.areaDrawEnd) {
|
|
1457
|
+
const ie = H[0].map((ae) => Xe(ae, se.mercator, se.data));
|
|
1458
|
+
(ne = (B = l.getProps()) == null ? void 0 : B.areaDrawEnd) == null || ne.call(B, ie);
|
|
1471
1459
|
}
|
|
1472
|
-
|
|
1460
|
+
y && (y.setActive(!1), e == null || e.removeInteraction(y), (e == null ? void 0 : e.getInteractions()).forEach((ae) => {
|
|
1473
1461
|
ae instanceof Ie && (ae.setActive(!1), e == null || e.removeInteraction(ae));
|
|
1474
1462
|
})), r && gt(r), (ke = document.querySelector(".delete-icon")) == null || ke.addEventListener("click", () => {
|
|
1475
1463
|
var ie, ae;
|
|
1476
1464
|
z(), (ae = (ie = l.getProps()) == null ? void 0 : ie.areaDrawEnd) == null || ae.call(ie, []);
|
|
1477
1465
|
});
|
|
1478
1466
|
});
|
|
1479
|
-
},
|
|
1480
|
-
const
|
|
1481
|
-
switch (
|
|
1467
|
+
}, C = (V, p) => {
|
|
1468
|
+
const S = eo(V);
|
|
1469
|
+
switch (p) {
|
|
1482
1470
|
case "km":
|
|
1483
|
-
return
|
|
1471
|
+
return S > 1e4 ? Math.round(S / 1e6 * 100) / 100 + " km<sup>2</sup>" : Math.round(S * 100) / 100 + " m<sup>2</sup>";
|
|
1484
1472
|
case "nm": {
|
|
1485
|
-
if (
|
|
1473
|
+
if (S < 0.01)
|
|
1486
1474
|
return "0 nm<sup>2</sup>";
|
|
1487
|
-
const
|
|
1488
|
-
return
|
|
1475
|
+
const G = S / (1852 * 1852);
|
|
1476
|
+
return G >= 0.01 ? (Math.round(G * 100) / 100).toFixed(2) + " nm<sup>2</sup>" : S >= 1 ? (Math.round(S * 100) / 100).toFixed(2) + " m<sup>2</sup>" : (Math.round(S * 1e4) / 100).toFixed(2) + " cm<sup>2</sup>";
|
|
1489
1477
|
}
|
|
1490
1478
|
}
|
|
1491
1479
|
};
|
|
1492
|
-
let i,
|
|
1493
|
-
const
|
|
1494
|
-
i != null && i.parentNode && i.parentNode.removeChild(i), i = document.createElement("div"), i.style.display = "flex", i.className = "ol-tooltip ol-tooltip-draw-polygon",
|
|
1480
|
+
let i, u;
|
|
1481
|
+
const k = () => {
|
|
1482
|
+
i != null && i.parentNode && i.parentNode.removeChild(i), i = document.createElement("div"), i.style.display = "flex", i.className = "ol-tooltip ol-tooltip-draw-polygon", u = new Ce({
|
|
1495
1483
|
element: i,
|
|
1496
1484
|
offset: [0, -15],
|
|
1497
1485
|
positioning: "bottom-center",
|
|
1498
1486
|
stopEvent: !1,
|
|
1499
1487
|
insertFirst: !1
|
|
1500
|
-
}), e == null || e.addOverlay(
|
|
1488
|
+
}), e == null || e.addOverlay(u);
|
|
1501
1489
|
};
|
|
1502
|
-
let f,
|
|
1503
|
-
const
|
|
1504
|
-
f != null && f.parentNode && (f.parentNode.removeChild(f), f.parentNode.addEventListener("click", (
|
|
1505
|
-
|
|
1506
|
-
})), f = document.createElement("div"), f.className = "ol-tooltip ol-help-tooltip pointer-none",
|
|
1490
|
+
let f, L;
|
|
1491
|
+
const A = () => {
|
|
1492
|
+
f != null && f.parentNode && (f.parentNode.removeChild(f), f.parentNode.addEventListener("click", (V) => {
|
|
1493
|
+
V.preventDefault(), V.stopPropagation();
|
|
1494
|
+
})), f = document.createElement("div"), f.className = "ol-tooltip ol-help-tooltip pointer-none", L = new Ce({
|
|
1507
1495
|
element: f,
|
|
1508
1496
|
offset: [15, 0],
|
|
1509
1497
|
positioning: "center-left",
|
|
1510
1498
|
stopEvent: !1
|
|
1511
|
-
}), e == null || e.addOverlay(
|
|
1499
|
+
}), e == null || e.addOverlay(L);
|
|
1512
1500
|
}, z = () => {
|
|
1513
1501
|
c = null, s();
|
|
1514
|
-
},
|
|
1515
|
-
d = "close", e.un("pointermove", n), t = null,
|
|
1516
|
-
|
|
1517
|
-
}),
|
|
1502
|
+
}, q = () => {
|
|
1503
|
+
d = "close", e.un("pointermove", n), t = null, y && (y.abortDrawing(), console.log("abortDrawing"), y.setActive(!1), (e == null ? void 0 : e.getInteractions()).forEach((p) => {
|
|
1504
|
+
p instanceof Ie && (p.setActive(!1), e == null || e.removeInteraction(p));
|
|
1505
|
+
}), y = null), r && gt(r), r = void 0, b == null || b.clear(), b = null, h && e.getAllLayers().includes(h) && (e.removeLayer(h), h = null), f != null && f.parentElement && (f.innerHTML = "", f.parentElement.removeChild(f), f = null), i != null && i.parentElement && (i.innerHTML = "", i.parentElement.removeChild(i), i = null), L && e.removeOverlay(L), u && e.removeOverlay(u), Me(e, "grab");
|
|
1518
1506
|
};
|
|
1519
1507
|
return {
|
|
1520
1508
|
open: s,
|
|
1521
|
-
close:
|
|
1509
|
+
close: q,
|
|
1522
1510
|
reset: z,
|
|
1523
1511
|
getState: () => d
|
|
1524
1512
|
};
|
|
1525
1513
|
}, Ao = (e, l, c, r, d) => {
|
|
1526
1514
|
let s = null, o = null;
|
|
1527
|
-
const
|
|
1528
|
-
source:
|
|
1515
|
+
const h = new be(), b = new no({
|
|
1516
|
+
source: h,
|
|
1529
1517
|
className: "zh-map--ship-layer",
|
|
1530
1518
|
renderBuffer: 300,
|
|
1531
1519
|
zIndex: 101,
|
|
1532
1520
|
properties: { layerType: le.SHIP }
|
|
1533
|
-
}),
|
|
1534
|
-
source:
|
|
1521
|
+
}), M = new be(), t = new pe({
|
|
1522
|
+
source: M,
|
|
1535
1523
|
className: "zh-map--ship-label-layer",
|
|
1536
1524
|
zIndex: 102,
|
|
1537
1525
|
updateWhileInteracting: !1,
|
|
1538
1526
|
updateWhileAnimating: !1,
|
|
1539
1527
|
properties: { layerType: le.SHIP },
|
|
1540
1528
|
declutter: !0
|
|
1541
|
-
}), n = new be(),
|
|
1529
|
+
}), n = new be(), y = new pe({
|
|
1542
1530
|
source: n,
|
|
1543
1531
|
className: "zh-map--ship-selected-layer",
|
|
1544
1532
|
zIndex: 999
|
|
1545
1533
|
});
|
|
1546
|
-
e == null || e.addLayer(
|
|
1547
|
-
let
|
|
1534
|
+
e == null || e.addLayer(b), e == null || e.addLayer(t), e == null || e.addLayer(y);
|
|
1535
|
+
let F = null, Z = null, C = null, i = "", u = {}, k = {};
|
|
1548
1536
|
const f = (g) => {
|
|
1549
1537
|
if (!g || !e) return;
|
|
1550
|
-
const
|
|
1538
|
+
const R = (o == null ? void 0 : o.id) || (s == null ? void 0 : s.get("id"));
|
|
1551
1539
|
if (o) {
|
|
1552
|
-
const
|
|
1553
|
-
|
|
1540
|
+
const N = g.filter((D) => D.id === R);
|
|
1541
|
+
N.length === 0 ? g.push(o) : o = N[0];
|
|
1554
1542
|
}
|
|
1555
|
-
|
|
1556
|
-
},
|
|
1557
|
-
Array.from(Ye.keys()).forEach((
|
|
1558
|
-
const
|
|
1559
|
-
g.find((J) => J.id ===
|
|
1543
|
+
V(), ie(g), q(), L(g);
|
|
1544
|
+
}, L = (g) => {
|
|
1545
|
+
Array.from(Ye.keys()).forEach((R) => {
|
|
1546
|
+
const N = R.split("_")[0];
|
|
1547
|
+
g.find((J) => J.id === N) || Ye.delete(R);
|
|
1560
1548
|
});
|
|
1561
|
-
},
|
|
1549
|
+
}, A = () => {
|
|
1562
1550
|
Array.from(Be.keys()).forEach((g) => {
|
|
1563
1551
|
Be.delete(g);
|
|
1564
1552
|
});
|
|
1565
1553
|
}, z = (g) => {
|
|
1566
1554
|
var $;
|
|
1567
|
-
const
|
|
1568
|
-
geometry: new de(
|
|
1555
|
+
const R = (o == null ? void 0 : o.id) || (s == null ? void 0 : s.get("id")), N = fe([g == null ? void 0 : g.lon, g == null ? void 0 : g.lat]), D = (($ = k[g.id]) == null ? void 0 : $.blinkColors) || [], U = D[D.length - 1] || g.fill || "#04C900", ee = Vt(g), Y = new me({
|
|
1556
|
+
geometry: new de(N),
|
|
1569
1557
|
// 船舶数据
|
|
1570
1558
|
shipData: g,
|
|
1571
1559
|
id: g.id,
|
|
1572
1560
|
name: g.cnname || g.enname || g.name || g.id || "未命名船舶",
|
|
1573
|
-
selected: g.id ===
|
|
1561
|
+
selected: g.id === R,
|
|
1574
1562
|
// 图标
|
|
1575
1563
|
rightIcons: Ft(g),
|
|
1576
1564
|
// 船舶颜色
|
|
1577
1565
|
color: U,
|
|
1578
1566
|
// 船艏向的方向
|
|
1579
|
-
direct:
|
|
1567
|
+
direct: ee,
|
|
1580
1568
|
// 高亮
|
|
1581
1569
|
isHighlight: !1
|
|
1582
1570
|
});
|
|
1583
|
-
return Y.set("clickGeometry", new lo(
|
|
1584
|
-
},
|
|
1571
|
+
return Y.set("clickGeometry", new lo(N)), Y;
|
|
1572
|
+
}, q = () => {
|
|
1585
1573
|
if (o && e && o) {
|
|
1586
1574
|
n.getFeatures().length > 0 && n.clear();
|
|
1587
|
-
const g = fe([o == null ? void 0 : o.lon, o == null ? void 0 : o.lat]),
|
|
1575
|
+
const g = fe([o == null ? void 0 : o.lon, o == null ? void 0 : o.lat]), R = new me({
|
|
1588
1576
|
geometry: new de(g),
|
|
1589
1577
|
id: o.id
|
|
1590
1578
|
});
|
|
1591
|
-
|
|
1579
|
+
R.setStyle(Pt(e, o)), n.addFeature(R);
|
|
1592
1580
|
}
|
|
1593
|
-
},
|
|
1594
|
-
const g =
|
|
1595
|
-
let
|
|
1596
|
-
const
|
|
1597
|
-
const
|
|
1598
|
-
for (;
|
|
1599
|
-
const Y = g[
|
|
1581
|
+
}, te = () => {
|
|
1582
|
+
const g = h.getFeatures(), R = 100;
|
|
1583
|
+
let N = 0;
|
|
1584
|
+
const D = () => {
|
|
1585
|
+
const ee = Math.min(N + R, g.length);
|
|
1586
|
+
for (; N < ee; N++) {
|
|
1587
|
+
const Y = g[N], $ = $e(e, Y);
|
|
1600
1588
|
Y.setStyle($);
|
|
1601
1589
|
}
|
|
1602
|
-
|
|
1590
|
+
N < g.length && requestAnimationFrame(D);
|
|
1603
1591
|
};
|
|
1604
|
-
|
|
1592
|
+
D();
|
|
1605
1593
|
const U = n.getFeatures()[0];
|
|
1606
1594
|
if (U && o) {
|
|
1607
|
-
const
|
|
1608
|
-
U.setStyle(
|
|
1595
|
+
const ee = Pt(e, o);
|
|
1596
|
+
U.setStyle(ee);
|
|
1609
1597
|
}
|
|
1610
|
-
},
|
|
1611
|
-
e &&
|
|
1612
|
-
},
|
|
1613
|
-
const g = e.getOverlays().getArray().filter((
|
|
1598
|
+
}, V = () => {
|
|
1599
|
+
e && h && (p(), h.clear(), M.clear(), n.clear());
|
|
1600
|
+
}, p = () => {
|
|
1601
|
+
const g = e.getOverlays().getArray().filter((R) => R.get("class") == "zh-map-ship-overlay");
|
|
1614
1602
|
if (g && g.length > 0)
|
|
1615
|
-
for (let
|
|
1616
|
-
const
|
|
1617
|
-
|
|
1603
|
+
for (let R = 0; R < g.length; R++) {
|
|
1604
|
+
const N = g[R];
|
|
1605
|
+
N.setPosition(void 0), e.removeOverlay(N), N.dispose();
|
|
1618
1606
|
}
|
|
1619
|
-
},
|
|
1620
|
-
|
|
1621
|
-
const
|
|
1622
|
-
for (const J in
|
|
1623
|
-
const U =
|
|
1624
|
-
if (
|
|
1625
|
-
const $ =
|
|
1607
|
+
}, S = (g, R) => {
|
|
1608
|
+
u = g, k = R;
|
|
1609
|
+
const N = e.getOverlays().getArray(), D = h.getFeatures();
|
|
1610
|
+
for (const J in u) {
|
|
1611
|
+
const U = u[J], ee = N.find(($) => ($ == null ? void 0 : $.getId()) === "label-" + J), Y = D.find(($) => J === $.get("id"));
|
|
1612
|
+
if (ee && Y) {
|
|
1613
|
+
const $ = R[J].blinkColors || [], { shipData: he, name: ve, color: xe } = Y.getProperties();
|
|
1626
1614
|
Y.set("blinking", U), $[($ == null ? void 0 : $.length) - 1] && xe !== $[($ == null ? void 0 : $.length) - 1] && (Y.set("color", $[($ == null ? void 0 : $.length) - 1] || ""), Y.setStyle($e(e, Y)));
|
|
1627
1615
|
const it = {
|
|
1628
1616
|
...he,
|
|
1629
1617
|
blinking: U,
|
|
1630
1618
|
blinkingColors: $ || [],
|
|
1631
|
-
name: ve + "(" +
|
|
1632
|
-
},
|
|
1633
|
-
|
|
1619
|
+
name: ve + "(" + R[J].shipState + ")"
|
|
1620
|
+
}, qe = ee.getElement(), _e = Ot(it);
|
|
1621
|
+
qe && qe !== _e && ee.setElement(_e);
|
|
1634
1622
|
}
|
|
1635
1623
|
}
|
|
1636
|
-
},
|
|
1624
|
+
}, G = (g) => {
|
|
1637
1625
|
if (!e) return;
|
|
1638
|
-
const
|
|
1626
|
+
const R = h.getFeatures(), N = M.getFeatures(), D = s ? s.get("id") : "", J = R.filter(($) => $.get("id") !== D), U = N == null ? void 0 : N.filter(($) => $.get("id") !== D), ee = /* @__PURE__ */ new Map();
|
|
1639
1627
|
g.forEach(($) => {
|
|
1640
|
-
|
|
1628
|
+
ee.set($.id, !0);
|
|
1641
1629
|
});
|
|
1642
1630
|
const Y = e.getOverlays().getArray();
|
|
1643
1631
|
J.forEach(($) => {
|
|
1644
1632
|
const he = $.get("id");
|
|
1645
|
-
if (!
|
|
1633
|
+
if (!ee.has(he))
|
|
1646
1634
|
$.setStyle([]);
|
|
1647
1635
|
else {
|
|
1648
1636
|
const xe = $.getStyle();
|
|
@@ -1652,84 +1640,84 @@ const St = (e, l) => {
|
|
|
1652
1640
|
ve && ve.setPosition(void 0);
|
|
1653
1641
|
}), U.forEach(($) => {
|
|
1654
1642
|
const he = $.get("id");
|
|
1655
|
-
if (!
|
|
1643
|
+
if (!ee.has(he))
|
|
1656
1644
|
$.setStyle([]);
|
|
1657
1645
|
else {
|
|
1658
1646
|
const ve = $.getStyle();
|
|
1659
1647
|
(ve == null ? void 0 : ve.length) == 0 && $.setStyle(St($, g.length));
|
|
1660
1648
|
}
|
|
1661
1649
|
});
|
|
1662
|
-
},
|
|
1650
|
+
}, H = (g) => {
|
|
1663
1651
|
if (g) {
|
|
1664
1652
|
console.log("选中", g);
|
|
1665
|
-
const
|
|
1666
|
-
|
|
1653
|
+
const R = h.getFeatures().find((D) => D.get("id") === g.id), N = M.getFeatures().find((D) => D.get("id") === g.id);
|
|
1654
|
+
R && (s = R), N && N.set("selected", !0), o = g, q();
|
|
1667
1655
|
} else
|
|
1668
|
-
console.log("取消选中"), o = null, s = null,
|
|
1669
|
-
},
|
|
1670
|
-
Z = g,
|
|
1671
|
-
},
|
|
1656
|
+
console.log("取消选中"), o = null, s = null, ne(), A();
|
|
1657
|
+
}, _ = (g, R, N) => {
|
|
1658
|
+
Z = g, C = R, F = N;
|
|
1659
|
+
}, X = ro((g, R, N) => {
|
|
1672
1660
|
try {
|
|
1673
1661
|
if (g) {
|
|
1674
|
-
const
|
|
1675
|
-
if (
|
|
1676
|
-
i && i !== J &&
|
|
1677
|
-
const U =
|
|
1662
|
+
const D = g.get("shipData"), J = g.get("id");
|
|
1663
|
+
if (R === "click" && (H(D), N && N(J)), R === "hover") {
|
|
1664
|
+
i && i !== J && B(), i = J;
|
|
1665
|
+
const U = h.getFeatures().find((ee) => ee.get("id") === i);
|
|
1678
1666
|
U == null || U.set("isHighlight", !0), U == null || U.setStyle($e(e, U));
|
|
1679
1667
|
}
|
|
1680
1668
|
} else
|
|
1681
|
-
|
|
1682
|
-
} catch (
|
|
1683
|
-
console.log("handleShipMapEvent",
|
|
1669
|
+
B();
|
|
1670
|
+
} catch (D) {
|
|
1671
|
+
console.log("handleShipMapEvent", D);
|
|
1684
1672
|
}
|
|
1685
|
-
}, 10),
|
|
1686
|
-
const g = i ?
|
|
1673
|
+
}, 10), B = () => {
|
|
1674
|
+
const g = i ? h.getFeatures().find((R) => R.get("id") === i) : null;
|
|
1687
1675
|
i = null, g == null || g.set("isHighlight", !1), g == null || g.setStyle($e(e, g));
|
|
1688
|
-
},
|
|
1676
|
+
}, ne = () => {
|
|
1689
1677
|
try {
|
|
1690
1678
|
n.clear();
|
|
1691
1679
|
} catch (g) {
|
|
1692
1680
|
console.log(g);
|
|
1693
1681
|
}
|
|
1694
|
-
}, ke = (g,
|
|
1695
|
-
const
|
|
1696
|
-
geometry: new de(
|
|
1682
|
+
}, ke = (g, R) => {
|
|
1683
|
+
const N = fe([g == null ? void 0 : g.lon, g == null ? void 0 : g.lat]), D = new me({
|
|
1684
|
+
geometry: new de(N),
|
|
1697
1685
|
name: g.cnname || g.enname || g.name || g.id || "未命名船舶",
|
|
1698
1686
|
// 图标
|
|
1699
1687
|
rightIcons: Ft(g),
|
|
1700
1688
|
selected: (g == null ? void 0 : g.id) === (o == null ? void 0 : o.id),
|
|
1701
1689
|
shipData: g
|
|
1702
1690
|
});
|
|
1703
|
-
|
|
1704
|
-
const J = St(
|
|
1705
|
-
return
|
|
1691
|
+
D.set("id", g.id);
|
|
1692
|
+
const J = St(D, R);
|
|
1693
|
+
return D.setStyle(J), D;
|
|
1706
1694
|
}, ie = (g) => {
|
|
1707
|
-
const
|
|
1695
|
+
const R = e.getView().getZoom(), N = [], D = [];
|
|
1708
1696
|
g.forEach((Y) => {
|
|
1709
1697
|
const $ = z(Y);
|
|
1710
|
-
$.setStyle($e(e, $)),
|
|
1711
|
-
}), (
|
|
1698
|
+
$.setStyle($e(e, $)), h.addFeature($), u[Y.id] && N.push(Y), (o == null ? void 0 : o.id) == Y.id && (o = Y), !u[Y.id] && (o == null ? void 0 : o.id) !== Y.id && D.push(Y);
|
|
1699
|
+
}), (C !== null ? C : (o == null ? void 0 : o.id) && u[o == null ? void 0 : o.id] || R && R >= ce.shipModelMin) && N.map((Y) => {
|
|
1712
1700
|
lt(Y);
|
|
1713
|
-
}), o && (
|
|
1701
|
+
}), o && (F !== null ? F : !0) && !u[o == null ? void 0 : o.id] && ae(o, g), (Z !== null ? Z : R && R >= ce.shipModelMin) && D.map((Y) => {
|
|
1714
1702
|
ae(Y, g);
|
|
1715
1703
|
});
|
|
1716
|
-
}, ae = (g,
|
|
1717
|
-
const
|
|
1718
|
-
|
|
1704
|
+
}, ae = (g, R) => {
|
|
1705
|
+
const N = ke(g, R.length);
|
|
1706
|
+
M.addFeature(N);
|
|
1719
1707
|
}, rt = (g) => {
|
|
1720
|
-
var R;
|
|
1721
|
-
const N = u.getFeatures().find((H) => H.get("id") === g);
|
|
1722
|
-
N && _(N, "click", (R = l.getProps()) == null ? void 0 : R.selectShip);
|
|
1723
|
-
}, lt = (g) => {
|
|
1724
1708
|
var N;
|
|
1725
|
-
|
|
1726
|
-
|
|
1709
|
+
const R = h.getFeatures().find((D) => D.get("id") === g);
|
|
1710
|
+
R && X(R, "click", (N = l.getProps()) == null ? void 0 : N.selectShip);
|
|
1711
|
+
}, lt = (g) => {
|
|
1712
|
+
var R;
|
|
1713
|
+
if (g.id && k[g == null ? void 0 : g.id]) {
|
|
1714
|
+
const N = k[g == null ? void 0 : g.id] || {}, D = (N == null ? void 0 : N.blinkColors) || [], J = (N == null ? void 0 : N.shipState) || "", U = (g.cnname || g.enname || g.name || g.id || "未命名船舶") + "(" + J + ")", ee = {
|
|
1727
1715
|
...g,
|
|
1728
1716
|
name: U,
|
|
1729
|
-
blinking:
|
|
1730
|
-
blinkingColors:
|
|
1717
|
+
blinking: u[g.id],
|
|
1718
|
+
blinkingColors: D || []
|
|
1731
1719
|
};
|
|
1732
|
-
Fo(e,
|
|
1720
|
+
Fo(e, ee), (R = document.querySelector(".ship-label-overlay-blinking")) == null || R.addEventListener("click", (Y) => {
|
|
1733
1721
|
var he;
|
|
1734
1722
|
if (r.getState() === "open" || d.getState() === "open" || !c.getMapClick()) return;
|
|
1735
1723
|
const $ = (he = Y.target) == null ? void 0 : he.getAttribute("data-id");
|
|
@@ -1739,43 +1727,43 @@ const St = (e, l) => {
|
|
|
1739
1727
|
};
|
|
1740
1728
|
return {
|
|
1741
1729
|
render: f,
|
|
1742
|
-
selected:
|
|
1743
|
-
filter:
|
|
1744
|
-
blinking:
|
|
1745
|
-
clear:
|
|
1746
|
-
setLableStatus:
|
|
1747
|
-
handleShipMapEvent:
|
|
1748
|
-
changeShipScale:
|
|
1730
|
+
selected: H,
|
|
1731
|
+
filter: G,
|
|
1732
|
+
blinking: S,
|
|
1733
|
+
clear: V,
|
|
1734
|
+
setLableStatus: _,
|
|
1735
|
+
handleShipMapEvent: X,
|
|
1736
|
+
changeShipScale: te
|
|
1749
1737
|
};
|
|
1750
1738
|
}, Zo = (e) => {
|
|
1751
|
-
const l = () => e == null ? void 0 : e.getLayers(), c = ge("vector"), r = () => c.value, d = (
|
|
1752
|
-
c.value =
|
|
1753
|
-
const
|
|
1754
|
-
|
|
1755
|
-
(t.className_ === "vector" || t.className_ === "satellite") && t.setVisible(t.className_ ===
|
|
1739
|
+
const l = () => e == null ? void 0 : e.getLayers(), c = ge("vector"), r = () => c.value, d = (b) => {
|
|
1740
|
+
c.value = b;
|
|
1741
|
+
const M = l();
|
|
1742
|
+
M && (M == null || M.getArray().forEach((t) => {
|
|
1743
|
+
(t.className_ === "vector" || t.className_ === "satellite") && t.setVisible(t.className_ === b);
|
|
1756
1744
|
}));
|
|
1757
1745
|
}, s = ge(!1);
|
|
1758
1746
|
return {
|
|
1759
1747
|
getLayers: l,
|
|
1760
1748
|
getGreenTileVisible: () => s.value,
|
|
1761
|
-
setGreenTileVisible: (
|
|
1762
|
-
if (
|
|
1763
|
-
if (
|
|
1764
|
-
const
|
|
1765
|
-
if (!
|
|
1749
|
+
setGreenTileVisible: (b) => {
|
|
1750
|
+
if (b !== s.value) {
|
|
1751
|
+
if (b) {
|
|
1752
|
+
const M = l();
|
|
1753
|
+
if (!M.getArray().find((n) => n.className_ === "greenTile")) {
|
|
1766
1754
|
const n = new ze({
|
|
1767
1755
|
source: new Ve({ url: Ee.greenTile }),
|
|
1768
|
-
visible:
|
|
1756
|
+
visible: b,
|
|
1769
1757
|
zIndex: 2,
|
|
1770
1758
|
className: "greenTile"
|
|
1771
1759
|
});
|
|
1772
|
-
|
|
1760
|
+
M.push(n);
|
|
1773
1761
|
}
|
|
1774
1762
|
} else {
|
|
1775
|
-
const
|
|
1776
|
-
t &&
|
|
1763
|
+
const M = l(), t = M.getArray().find((n) => n.className_ === "greenTile");
|
|
1764
|
+
t && M.remove(t);
|
|
1777
1765
|
}
|
|
1778
|
-
s.value =
|
|
1766
|
+
s.value = b;
|
|
1779
1767
|
}
|
|
1780
1768
|
},
|
|
1781
1769
|
getShowLayerType: r,
|
|
@@ -1789,25 +1777,25 @@ const St = (e, l) => {
|
|
|
1789
1777
|
const o = (i) => {
|
|
1790
1778
|
if (!(!i || i.length === 0)) {
|
|
1791
1779
|
if (r.clear(), s) {
|
|
1792
|
-
const
|
|
1793
|
-
|
|
1780
|
+
const u = i.find((k) => k.id === (s == null ? void 0 : s.id));
|
|
1781
|
+
u ? s = u : i.push(s);
|
|
1794
1782
|
}
|
|
1795
|
-
i.forEach((
|
|
1796
|
-
u
|
|
1783
|
+
i.forEach((u) => {
|
|
1784
|
+
h(u);
|
|
1797
1785
|
}), c || (c = new pe({
|
|
1798
1786
|
className: l,
|
|
1799
1787
|
source: r,
|
|
1800
1788
|
zIndex: 100
|
|
1801
1789
|
}), e == null || e.addLayer(c));
|
|
1802
1790
|
}
|
|
1803
|
-
},
|
|
1804
|
-
const
|
|
1805
|
-
geometry: new de(fe([Number(
|
|
1791
|
+
}, h = (i) => {
|
|
1792
|
+
const u = e == null ? void 0 : e.getView().getZoom(), [k, f] = i.latLon.split(","), L = new me({
|
|
1793
|
+
geometry: new de(fe([Number(k), Number(f)]))
|
|
1806
1794
|
});
|
|
1807
|
-
|
|
1808
|
-
},
|
|
1795
|
+
L.setStyle(b(i, u, i.id === (s == null ? void 0 : s.id))), L.set("loactionData", i), r.addFeature(L);
|
|
1796
|
+
}, b = (i, u, k) => {
|
|
1809
1797
|
let f = {
|
|
1810
|
-
src:
|
|
1798
|
+
src: k && i.selectedPath || i.defaultPath
|
|
1811
1799
|
};
|
|
1812
1800
|
i != null && i.width && (i != null && i.height) ? f = {
|
|
1813
1801
|
...f,
|
|
@@ -1815,13 +1803,13 @@ const St = (e, l) => {
|
|
|
1815
1803
|
height: i.height
|
|
1816
1804
|
} : f = {
|
|
1817
1805
|
...f,
|
|
1818
|
-
scale: 0.5 *
|
|
1806
|
+
scale: 0.5 * u / 10
|
|
1819
1807
|
};
|
|
1820
|
-
let
|
|
1808
|
+
let L = {
|
|
1821
1809
|
image: new Fe(f)
|
|
1822
1810
|
};
|
|
1823
|
-
return i.name && (
|
|
1824
|
-
...
|
|
1811
|
+
return i.name && (L = {
|
|
1812
|
+
...L,
|
|
1825
1813
|
text: new Oe({
|
|
1826
1814
|
text: i.name,
|
|
1827
1815
|
font: "12px sans-serif",
|
|
@@ -1833,40 +1821,40 @@ const St = (e, l) => {
|
|
|
1833
1821
|
}),
|
|
1834
1822
|
offsetY: 30
|
|
1835
1823
|
})
|
|
1836
|
-
}), new
|
|
1837
|
-
},
|
|
1824
|
+
}), new oe(L);
|
|
1825
|
+
}, M = () => {
|
|
1838
1826
|
if (d) {
|
|
1839
1827
|
const i = d.get("loactionData").id;
|
|
1840
|
-
r.getFeatures().forEach((
|
|
1841
|
-
|
|
1828
|
+
r.getFeatures().forEach((u) => {
|
|
1829
|
+
u.get("loactionData").id !== i && r.removeFeature(u);
|
|
1842
1830
|
});
|
|
1843
1831
|
} else
|
|
1844
1832
|
r.clear();
|
|
1845
1833
|
}, t = () => {
|
|
1846
1834
|
var f;
|
|
1847
|
-
const i = d == null ? void 0 : d.get("loactionData"),
|
|
1848
|
-
r.getFeatures().forEach((
|
|
1849
|
-
|
|
1835
|
+
const i = d == null ? void 0 : d.get("loactionData"), u = (f = e == null ? void 0 : e.getView()) == null ? void 0 : f.getZoom();
|
|
1836
|
+
r.getFeatures().forEach((L) => {
|
|
1837
|
+
L.get("loactionData").id === i.id && (L == null || L.setStyle(b(i, u, !1)));
|
|
1850
1838
|
}), s = null, d = null;
|
|
1851
1839
|
}, n = (i) => {
|
|
1852
|
-
i ? (
|
|
1853
|
-
},
|
|
1840
|
+
i ? (y(), F(i)) : t();
|
|
1841
|
+
}, y = () => {
|
|
1854
1842
|
var i;
|
|
1855
1843
|
if (d) {
|
|
1856
|
-
const
|
|
1857
|
-
d.setStyle(
|
|
1844
|
+
const u = d.get("loactionData"), k = (i = e == null ? void 0 : e.getView()) == null ? void 0 : i.getZoom();
|
|
1845
|
+
d.setStyle(b(u, k, !1));
|
|
1858
1846
|
}
|
|
1859
|
-
},
|
|
1860
|
-
const
|
|
1861
|
-
s = i, d =
|
|
1847
|
+
}, F = (i) => {
|
|
1848
|
+
const u = r.getFeatures();
|
|
1849
|
+
s = i, d = u.find((k) => k.get("loactionData").id === i.id);
|
|
1862
1850
|
};
|
|
1863
1851
|
return {
|
|
1864
1852
|
render: o,
|
|
1865
|
-
renderHtml: (i,
|
|
1866
|
-
const
|
|
1867
|
-
|
|
1868
|
-
let
|
|
1869
|
-
element:
|
|
1853
|
+
renderHtml: (i, u, k, f) => {
|
|
1854
|
+
const L = document.createElement("div");
|
|
1855
|
+
L.innerHTML = k;
|
|
1856
|
+
let A = {
|
|
1857
|
+
element: L,
|
|
1870
1858
|
// 覆盖层的DOM元素
|
|
1871
1859
|
positioning: "top-center",
|
|
1872
1860
|
// 相对于位置点的定位
|
|
@@ -1875,20 +1863,20 @@ const St = (e, l) => {
|
|
|
1875
1863
|
offset: [0, -20],
|
|
1876
1864
|
id: "position-" + i
|
|
1877
1865
|
};
|
|
1878
|
-
f && (
|
|
1879
|
-
...
|
|
1866
|
+
f && (A = {
|
|
1867
|
+
...A,
|
|
1880
1868
|
...f
|
|
1881
1869
|
});
|
|
1882
|
-
const z = new Ce(
|
|
1883
|
-
z.setPosition(fe(
|
|
1870
|
+
const z = new Ce(A);
|
|
1871
|
+
z.setPosition(fe(u)), e.addOverlay(z);
|
|
1884
1872
|
},
|
|
1885
1873
|
removeHtml: (i) => {
|
|
1886
|
-
const
|
|
1887
|
-
|
|
1874
|
+
const u = e.getOverlays().getArray().find((k) => k.getId() === "position-" + i);
|
|
1875
|
+
u && (u.setPosition(void 0), e.removeOverlay(u));
|
|
1888
1876
|
},
|
|
1889
1877
|
selected: n,
|
|
1890
1878
|
clearSelected: t,
|
|
1891
|
-
clear:
|
|
1879
|
+
clear: M
|
|
1892
1880
|
};
|
|
1893
1881
|
}, Ho = "zh-map-port-layer", Wo = (e) => {
|
|
1894
1882
|
const l = new be(), c = new pe({
|
|
@@ -1901,46 +1889,46 @@ const St = (e, l) => {
|
|
|
1901
1889
|
});
|
|
1902
1890
|
e == null || e.addLayer(c);
|
|
1903
1891
|
let r = null, d = null;
|
|
1904
|
-
const s = (i,
|
|
1892
|
+
const s = (i, u = !0) => {
|
|
1905
1893
|
if (!i || i.length === 0) return;
|
|
1906
1894
|
if (l.clear(), d) {
|
|
1907
|
-
const f = i.find((
|
|
1895
|
+
const f = i.find((L) => L.id === (d == null ? void 0 : d.id));
|
|
1908
1896
|
f ? d = f : i.push(d);
|
|
1909
1897
|
}
|
|
1910
|
-
const
|
|
1898
|
+
const k = [];
|
|
1911
1899
|
i.forEach((f) => {
|
|
1912
|
-
const [
|
|
1913
|
-
geometry: new de(fe([Number(
|
|
1900
|
+
const [L, A] = f.latLon.split(","), z = new me({
|
|
1901
|
+
geometry: new de(fe([Number(L), Number(A)])),
|
|
1914
1902
|
portData: f,
|
|
1915
1903
|
id: f.id,
|
|
1916
1904
|
select: f.id === (d == null ? void 0 : d.id),
|
|
1917
|
-
showTitle: f.id === (d == null ? void 0 : d.id) ||
|
|
1918
|
-
}),
|
|
1919
|
-
z.setStyle(
|
|
1920
|
-
}), l.addFeatures(
|
|
1905
|
+
showTitle: f.id === (d == null ? void 0 : d.id) || u
|
|
1906
|
+
}), q = t(z);
|
|
1907
|
+
z.setStyle(q), k.push(z);
|
|
1908
|
+
}), l.addFeatures(k);
|
|
1921
1909
|
};
|
|
1922
|
-
let o = null,
|
|
1923
|
-
const
|
|
1924
|
-
o || (o = document.createElement("canvas"),
|
|
1910
|
+
let o = null, h = null;
|
|
1911
|
+
const b = /* @__PURE__ */ new Map(), M = (i, u) => {
|
|
1912
|
+
o || (o = document.createElement("canvas"), h = o.getContext("2d", {
|
|
1925
1913
|
willReadFrequently: !0
|
|
1926
1914
|
}));
|
|
1927
|
-
const
|
|
1928
|
-
if (
|
|
1929
|
-
return
|
|
1930
|
-
const f = o,
|
|
1931
|
-
if (!
|
|
1915
|
+
const k = `${i}-${u}`;
|
|
1916
|
+
if (b.has(k))
|
|
1917
|
+
return b.get(k);
|
|
1918
|
+
const f = o, L = h;
|
|
1919
|
+
if (!L) return "";
|
|
1932
1920
|
f.width = 0, f.height = 0;
|
|
1933
|
-
const
|
|
1934
|
-
|
|
1935
|
-
const
|
|
1936
|
-
f.width = Math.round(
|
|
1937
|
-
const
|
|
1938
|
-
|
|
1939
|
-
const
|
|
1940
|
-
return
|
|
1921
|
+
const A = 2, z = 8, q = window.devicePixelRatio || 1, te = "12px sans-serif";
|
|
1922
|
+
L.font = te;
|
|
1923
|
+
const p = L.measureText(i).width, S = z + p + z, G = A + 12 + A * 2;
|
|
1924
|
+
f.width = Math.round(S * q), f.height = Math.round(G * q), L.scale(q, q), L.clearRect(0, 0, S, G), L.fillStyle = u ? "#F32D2D" : "#FFF", L.beginPath(), L.roundRect(0, 0, S, G, 4), L.fill(), L.font = te, L.textBaseline = "middle";
|
|
1925
|
+
const H = G / 2;
|
|
1926
|
+
L.strokeStyle = u ? "#000" : "#ffffff", L.lineWidth = 1, L.strokeText(i, z, H), L.fillStyle = u ? "#FFF" : "#000000", L.fillText(i, z, H);
|
|
1927
|
+
const _ = f.toDataURL("image/png");
|
|
1928
|
+
return b.set(k, _), _;
|
|
1941
1929
|
}, t = (i) => {
|
|
1942
|
-
const { select:
|
|
1943
|
-
<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="${
|
|
1930
|
+
const { select: u, showTitle: k } = i.getProperties(), f = (p) => `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1931
|
+
<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="${p}"/>
|
|
1944
1932
|
<g clip-path="url(#clip0_10059_122082)">
|
|
1945
1933
|
<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"/>
|
|
1946
1934
|
</g>
|
|
@@ -1950,22 +1938,22 @@ const St = (e, l) => {
|
|
|
1950
1938
|
</clipPath>
|
|
1951
1939
|
</defs>
|
|
1952
1940
|
</svg>
|
|
1953
|
-
`,
|
|
1941
|
+
`, L = () => `data:image/svg+xml;utf8,${encodeURIComponent(f(u ? "#F32D2D" : "#3370FF"))}`, A = e.getView().getZoom(), z = i.get("portData"), q = window.devicePixelRatio || 1, te = new oe({
|
|
1954
1942
|
image: new Fe({
|
|
1955
|
-
src:
|
|
1956
|
-
scale: 0.5 *
|
|
1943
|
+
src: L(),
|
|
1944
|
+
scale: 0.5 * A / 10
|
|
1957
1945
|
}),
|
|
1958
|
-
zIndex:
|
|
1959
|
-
}),
|
|
1946
|
+
zIndex: u ? 110 : 100
|
|
1947
|
+
}), V = new oe({
|
|
1960
1948
|
image: new Fe({
|
|
1961
|
-
src:
|
|
1949
|
+
src: M(z.shortName, u),
|
|
1962
1950
|
anchor: [0.5, 0.5],
|
|
1963
1951
|
displacement: [0, -30],
|
|
1964
|
-
scale: 1 /
|
|
1952
|
+
scale: 1 / q,
|
|
1965
1953
|
anchorXUnits: "fraction",
|
|
1966
1954
|
anchorYUnits: "fraction"
|
|
1967
1955
|
}),
|
|
1968
|
-
zIndex:
|
|
1956
|
+
zIndex: u ? 110 : 100
|
|
1969
1957
|
// text: new Text({
|
|
1970
1958
|
// text: port.shortName,
|
|
1971
1959
|
// font: '12px sans-serif',
|
|
@@ -1978,67 +1966,67 @@ const St = (e, l) => {
|
|
|
1978
1966
|
// offsetY: 30,
|
|
1979
1967
|
// }),
|
|
1980
1968
|
});
|
|
1981
|
-
return !
|
|
1969
|
+
return !k && !u ? te : [te, V];
|
|
1982
1970
|
}, n = () => {
|
|
1983
1971
|
if (l)
|
|
1984
1972
|
if (r) {
|
|
1985
1973
|
console.log("清除非选中的港口");
|
|
1986
1974
|
const i = r.get("portData").id;
|
|
1987
|
-
l.getFeatures().forEach((
|
|
1988
|
-
|
|
1975
|
+
l.getFeatures().forEach((u) => {
|
|
1976
|
+
u.get("portData").id !== i && l.removeFeature(u);
|
|
1989
1977
|
});
|
|
1990
1978
|
} else
|
|
1991
1979
|
console.log("清除所有港口", l), l == null || l.clear();
|
|
1992
|
-
},
|
|
1980
|
+
}, y = (i) => {
|
|
1993
1981
|
if (l) {
|
|
1994
1982
|
if (!i)
|
|
1995
|
-
return
|
|
1996
|
-
(r == null ? void 0 : r.get("portData").id) !== i.id && (
|
|
1983
|
+
return F();
|
|
1984
|
+
(r == null ? void 0 : r.get("portData").id) !== i.id && (F(), Z(i));
|
|
1997
1985
|
}
|
|
1998
|
-
},
|
|
1986
|
+
}, F = () => {
|
|
1999
1987
|
var i;
|
|
2000
1988
|
if (r) {
|
|
2001
|
-
const
|
|
2002
|
-
|
|
1989
|
+
const u = r == null ? void 0 : r.get("portData"), k = (i = l.getFeatures()) == null ? void 0 : i.find((f) => f.get("portData").id === u.id);
|
|
1990
|
+
k && (k.set("select", !1), k.setStyle(t(k)), r = null, d = null);
|
|
2003
1991
|
}
|
|
2004
1992
|
}, Z = (i) => {
|
|
2005
1993
|
if (!l) return;
|
|
2006
|
-
const
|
|
2007
|
-
d = i, r =
|
|
1994
|
+
const u = l.getFeatures();
|
|
1995
|
+
d = i, r = u.find((k) => k.get("portData").id === i.id), r && (r.set("select", !0), r.setStyle(t(r)));
|
|
2008
1996
|
};
|
|
2009
1997
|
return {
|
|
2010
1998
|
render: s,
|
|
2011
1999
|
clear: n,
|
|
2012
|
-
selected:
|
|
2000
|
+
selected: y,
|
|
2013
2001
|
handlePortHover: (i) => {
|
|
2014
2002
|
i && i.get("portData") ? Me(e, "pointer") : Me(e, "grab");
|
|
2015
2003
|
}
|
|
2016
2004
|
};
|
|
2017
2005
|
}, Go = (e, l, c, r, d, s, o) => {
|
|
2018
|
-
const
|
|
2019
|
-
|
|
2020
|
-
var n,
|
|
2006
|
+
const h = e.getInstall();
|
|
2007
|
+
h.on("moveend", () => {
|
|
2008
|
+
var n, y;
|
|
2021
2009
|
try {
|
|
2022
|
-
const
|
|
2023
|
-
(
|
|
2024
|
-
} catch (
|
|
2025
|
-
console.log("moveend---catch",
|
|
2010
|
+
const F = e.getZoom();
|
|
2011
|
+
(y = (n = l.getProps()).mapMoveEnd) == null || y.call(n, F), F >= ce.min && F <= ce.max && c.reRenderTrackLine(), r.changeShipScale();
|
|
2012
|
+
} catch (F) {
|
|
2013
|
+
console.log("moveend---catch", F);
|
|
2026
2014
|
}
|
|
2027
2015
|
});
|
|
2028
|
-
const
|
|
2016
|
+
const b = {
|
|
2029
2017
|
[le.PORT]: null,
|
|
2030
2018
|
[le.SHIP]: null,
|
|
2031
2019
|
[le.TRACK]: null,
|
|
2032
2020
|
[le.DELETE]: null
|
|
2033
|
-
},
|
|
2021
|
+
}, M = (n, y, F) => {
|
|
2034
2022
|
switch (n) {
|
|
2035
2023
|
case le.SHIP:
|
|
2036
|
-
r == null || r.handleShipMapEvent(
|
|
2024
|
+
r == null || r.handleShipMapEvent(y, "hover");
|
|
2037
2025
|
break;
|
|
2038
2026
|
case le.PORT:
|
|
2039
2027
|
break;
|
|
2040
2028
|
case le.TRACK:
|
|
2041
|
-
c == null || c.handleTrackMapEvent(
|
|
2029
|
+
c == null || c.handleTrackMapEvent(y, "hover", F);
|
|
2042
2030
|
break;
|
|
2043
2031
|
}
|
|
2044
2032
|
}, t = (n) => {
|
|
@@ -2053,38 +2041,38 @@ const St = (e, l) => {
|
|
|
2053
2041
|
break;
|
|
2054
2042
|
}
|
|
2055
2043
|
};
|
|
2056
|
-
|
|
2057
|
-
if (o.getState() !== "open" && s.getState() !== "open" && e.getMapClick() && !
|
|
2044
|
+
h.on("pointermove", (n) => {
|
|
2045
|
+
if (o.getState() !== "open" && s.getState() !== "open" && e.getMapClick() && !h.getView().getAnimating())
|
|
2058
2046
|
try {
|
|
2059
|
-
let
|
|
2060
|
-
const Z =
|
|
2047
|
+
let y = !1, F = !1;
|
|
2048
|
+
const Z = h.getLayers().getArray().filter((C) => C.get("layerType"));
|
|
2061
2049
|
try {
|
|
2062
|
-
Z && Z.length > 0 && Z.forEach((
|
|
2063
|
-
if (
|
|
2064
|
-
const i =
|
|
2065
|
-
layerFilter: (f) => f ===
|
|
2050
|
+
Z && Z.length > 0 && Z.forEach((C) => {
|
|
2051
|
+
if (F) return;
|
|
2052
|
+
const i = h == null ? void 0 : h.getEventPixel(n.originalEvent), u = C == null ? void 0 : C.get("layerType"), k = h == null ? void 0 : h.forEachFeatureAtPixel(i, (f) => f, {
|
|
2053
|
+
layerFilter: (f) => f === C,
|
|
2066
2054
|
// 严格图层过滤
|
|
2067
2055
|
hitTolerance: 5
|
|
2068
2056
|
});
|
|
2069
|
-
|
|
2070
|
-
}),
|
|
2071
|
-
} catch (
|
|
2072
|
-
console.log("pointermove----",
|
|
2057
|
+
k !== b[u] && (b[u] && t(u, b[u]), b[u] = k, k && (M(u, k, n), F = !0)), k && (y = !0);
|
|
2058
|
+
}), y ? Me(h, "pointer") : Me(h, "grab");
|
|
2059
|
+
} catch (C) {
|
|
2060
|
+
console.log("pointermove----", C);
|
|
2073
2061
|
}
|
|
2074
|
-
} catch (
|
|
2075
|
-
console.log("pointermove----",
|
|
2062
|
+
} catch (y) {
|
|
2063
|
+
console.log("pointermove----", y);
|
|
2076
2064
|
}
|
|
2077
|
-
}),
|
|
2078
|
-
if (o.getState() !== "open" && s.getState() !== "open" && e.getMapClick() && !
|
|
2065
|
+
}), h.on("click", Rt((n) => {
|
|
2066
|
+
if (o.getState() !== "open" && s.getState() !== "open" && e.getMapClick() && !h.getView().getAnimating())
|
|
2079
2067
|
try {
|
|
2080
|
-
let
|
|
2081
|
-
const
|
|
2082
|
-
|
|
2083
|
-
var
|
|
2084
|
-
if (!
|
|
2068
|
+
let y = !1;
|
|
2069
|
+
const F = h.getLayers().getArray().filter((Z) => Z.get("layerType"));
|
|
2070
|
+
F && F.length > 0 && F.forEach((Z) => {
|
|
2071
|
+
var C, i, u, k, f;
|
|
2072
|
+
if (!y)
|
|
2085
2073
|
try {
|
|
2086
|
-
if (((i = (
|
|
2087
|
-
const
|
|
2074
|
+
if (((i = (C = Z == null ? void 0 : Z.getSource()) == null ? void 0 : C.getFeatures()) == null ? void 0 : i.length) > 0) {
|
|
2075
|
+
const L = h == null ? void 0 : h.getEventPixel(n.originalEvent), A = h == null ? void 0 : h.forEachFeatureAtPixel(L, (z) => {
|
|
2088
2076
|
if (z.get("shipData") || z.get("portData") || z.get("polygonData") || z.get("pathData"))
|
|
2089
2077
|
return z;
|
|
2090
2078
|
}, {
|
|
@@ -2092,24 +2080,24 @@ const St = (e, l) => {
|
|
|
2092
2080
|
// 严格图层过滤
|
|
2093
2081
|
hitTolerance: 10
|
|
2094
2082
|
});
|
|
2095
|
-
if (console.log("clickFeature",
|
|
2096
|
-
if (
|
|
2097
|
-
c.getTrackStatus() || r.handleShipMapEvent(
|
|
2098
|
-
else if (
|
|
2099
|
-
const z =
|
|
2100
|
-
d.selected(z), (f = (
|
|
2083
|
+
if (console.log("clickFeature", A), A) {
|
|
2084
|
+
if (A != null && A.get("shipData"))
|
|
2085
|
+
c.getTrackStatus() || r.handleShipMapEvent(A, "click", (u = l.getProps()) == null ? void 0 : u.selectShip);
|
|
2086
|
+
else if (A != null && A.get("portData")) {
|
|
2087
|
+
const z = A == null ? void 0 : A.get("portData");
|
|
2088
|
+
d.selected(z), (f = (k = l.getProps()) == null ? void 0 : k.selectPort) == null || f.call(k, z);
|
|
2101
2089
|
}
|
|
2102
|
-
|
|
2090
|
+
y = !0;
|
|
2103
2091
|
}
|
|
2104
2092
|
}
|
|
2105
|
-
} catch (
|
|
2106
|
-
console.log("click--",
|
|
2093
|
+
} catch (L) {
|
|
2094
|
+
console.log("click--", L);
|
|
2107
2095
|
}
|
|
2108
2096
|
});
|
|
2109
|
-
} catch (
|
|
2110
|
-
console.log("click----",
|
|
2097
|
+
} catch (y) {
|
|
2098
|
+
console.log("click----", y);
|
|
2111
2099
|
}
|
|
2112
|
-
}, 150)),
|
|
2100
|
+
}, 150)), h.getView().on("change:resolution", () => {
|
|
2113
2101
|
r.changeShipScale();
|
|
2114
2102
|
});
|
|
2115
2103
|
}, Yo = () => {
|
|
@@ -2118,34 +2106,34 @@ const St = (e, l) => {
|
|
|
2118
2106
|
createInstance: (r, d) => {
|
|
2119
2107
|
const s = vo();
|
|
2120
2108
|
s.initMap(r, d);
|
|
2121
|
-
const o = s.getInstall(),
|
|
2122
|
-
|
|
2123
|
-
const
|
|
2124
|
-
Go(s,
|
|
2109
|
+
const o = s.getInstall(), h = Zo(o), b = Co();
|
|
2110
|
+
b.setProps(d), h.setShowLayerType(d.layerType), h.setGreenTileVisible(d.showGreenLayer);
|
|
2111
|
+
const M = bo(o), t = ko(o, M), n = Vo(o, b), y = Oo(o, b), F = Ao(o, b, s, y, n), Z = Do(o), C = Wo(o);
|
|
2112
|
+
Go(s, b, M, F, C, n, y);
|
|
2125
2113
|
const i = () => {
|
|
2126
|
-
const
|
|
2127
|
-
return [f[0], f[1],
|
|
2128
|
-
},
|
|
2114
|
+
const k = o.getView().calculateExtent(s.getSize()), f = Xe([k[0], k[1]], se.mercator, se.data), L = Xe([k[2], k[3]], se.mercator, se.data);
|
|
2115
|
+
return [f[0], f[1], L[0], L[1]];
|
|
2116
|
+
}, u = {
|
|
2129
2117
|
id: Symbol("map-instance"),
|
|
2130
2118
|
innerMap: null,
|
|
2131
2119
|
map: s.getInstall(),
|
|
2132
2120
|
destroy: () => {
|
|
2133
|
-
e.splice(e.indexOf(
|
|
2121
|
+
e.splice(e.indexOf(u), 1);
|
|
2134
2122
|
},
|
|
2135
2123
|
methods: {
|
|
2136
2124
|
...s,
|
|
2137
|
-
layer:
|
|
2138
|
-
ship:
|
|
2139
|
-
track:
|
|
2125
|
+
layer: h,
|
|
2126
|
+
ship: F,
|
|
2127
|
+
track: M,
|
|
2140
2128
|
carTrack: t,
|
|
2141
2129
|
port: {
|
|
2142
|
-
render:
|
|
2143
|
-
clear:
|
|
2144
|
-
selected:
|
|
2130
|
+
render: C.render,
|
|
2131
|
+
clear: C.clear,
|
|
2132
|
+
selected: C.selected
|
|
2145
2133
|
},
|
|
2146
2134
|
position: Z,
|
|
2147
2135
|
drawLine: n,
|
|
2148
|
-
drawPolygon:
|
|
2136
|
+
drawPolygon: y,
|
|
2149
2137
|
// 子模块
|
|
2150
2138
|
utils: {
|
|
2151
2139
|
getCalculateExtent: i,
|
|
@@ -2154,7 +2142,7 @@ const St = (e, l) => {
|
|
|
2154
2142
|
}
|
|
2155
2143
|
}
|
|
2156
2144
|
};
|
|
2157
|
-
return e.push(
|
|
2145
|
+
return e.push(u), u;
|
|
2158
2146
|
},
|
|
2159
2147
|
destroyInstance: (r) => {
|
|
2160
2148
|
const d = e.findIndex((s) => s.id === r);
|
|
@@ -2165,7 +2153,7 @@ const St = (e, l) => {
|
|
|
2165
2153
|
},
|
|
2166
2154
|
getAllInstances: () => [...e]
|
|
2167
2155
|
};
|
|
2168
|
-
}, Bo = { class: "zh-map-box" },
|
|
2156
|
+
}, Bo = { class: "zh-map-box" }, Xo = /* @__PURE__ */ ft({
|
|
2169
2157
|
__name: "Map",
|
|
2170
2158
|
props: {
|
|
2171
2159
|
zoom: { default: ce.default },
|
|
@@ -2191,24 +2179,24 @@ const St = (e, l) => {
|
|
|
2191
2179
|
});
|
|
2192
2180
|
}
|
|
2193
2181
|
c();
|
|
2194
|
-
const r = ge(), d = ge(), s = Yo(), o = ge(),
|
|
2182
|
+
const r = ge(), d = ge(), s = Yo(), o = ge(), h = e, b = ge({
|
|
2195
2183
|
getInstall() {
|
|
2196
2184
|
}
|
|
2197
2185
|
});
|
|
2198
|
-
|
|
2186
|
+
Xt(() => {
|
|
2199
2187
|
var t;
|
|
2200
|
-
o.value = s.createInstance(r.value,
|
|
2201
|
-
|
|
2188
|
+
o.value = s.createInstance(r.value, h), b.value = o.value.methods, (t = d.value) == null || t.setScaleLine(o.value.map, h.scaleLineUnit), window.addEventListener("nativeDoubleTap", function() {
|
|
2189
|
+
M();
|
|
2202
2190
|
});
|
|
2203
2191
|
});
|
|
2204
|
-
function
|
|
2205
|
-
var n,
|
|
2206
|
-
if (((n = o.value) == null ? void 0 : n.methods.drawPolygon.getState()) === "open" || ((
|
|
2192
|
+
function M() {
|
|
2193
|
+
var n, y, F, Z, C;
|
|
2194
|
+
if (((n = o.value) == null ? void 0 : n.methods.drawPolygon.getState()) === "open" || ((y = o.value) == null ? void 0 : y.methods.drawLine.getState()) === "open" || !((F = o.value) != null && F.methods.getMapClick()))
|
|
2207
2195
|
return;
|
|
2208
2196
|
let t = (Z = o.value) == null ? void 0 : Z.methods.getZoom();
|
|
2209
|
-
(
|
|
2197
|
+
(C = o.value) == null || C.methods.setZoom(t + 1);
|
|
2210
2198
|
}
|
|
2211
|
-
return
|
|
2199
|
+
return qt(() => {
|
|
2212
2200
|
var t, n;
|
|
2213
2201
|
s.destroyInstance((t = o == null ? void 0 : o.value) == null ? void 0 : t.id), (n = o.value) == null || n.destroy();
|
|
2214
2202
|
}), l({
|
|
@@ -2237,8 +2225,8 @@ const St = (e, l) => {
|
|
|
2237
2225
|
return (t = o.value) == null ? void 0 : t.methods.getView();
|
|
2238
2226
|
},
|
|
2239
2227
|
setCenter: (t, n) => {
|
|
2240
|
-
var
|
|
2241
|
-
return (
|
|
2228
|
+
var y;
|
|
2229
|
+
return (y = o.value) == null ? void 0 : y.methods.setCenter(t, n);
|
|
2242
2230
|
},
|
|
2243
2231
|
getSize: () => {
|
|
2244
2232
|
var t;
|
|
@@ -2346,8 +2334,8 @@ const St = (e, l) => {
|
|
|
2346
2334
|
},
|
|
2347
2335
|
port: {
|
|
2348
2336
|
render: (t, n) => {
|
|
2349
|
-
var
|
|
2350
|
-
return (
|
|
2337
|
+
var y;
|
|
2338
|
+
return (y = o.value) == null ? void 0 : y.methods.port.render(t, n);
|
|
2351
2339
|
},
|
|
2352
2340
|
clear: () => {
|
|
2353
2341
|
var t;
|
|
@@ -2431,8 +2419,8 @@ const St = (e, l) => {
|
|
|
2431
2419
|
return (n = o.value) == null ? void 0 : n.methods.utils.convertSixHundredThousandToLatLng(...t);
|
|
2432
2420
|
},
|
|
2433
2421
|
calculateCirclePoints: (t, n) => {
|
|
2434
|
-
var
|
|
2435
|
-
return (
|
|
2422
|
+
var y;
|
|
2423
|
+
return (y = o.value) == null ? void 0 : y.methods.utils.calculateCirclePoints(t, n);
|
|
2436
2424
|
}
|
|
2437
2425
|
}
|
|
2438
2426
|
}), (t, n) => (ht(), vt("div", Bo, [
|
|
@@ -2452,7 +2440,7 @@ const St = (e, l) => {
|
|
|
2452
2440
|
}, null, 8, ["map-instance"])
|
|
2453
2441
|
]));
|
|
2454
2442
|
}
|
|
2455
|
-
}),
|
|
2443
|
+
}), qo = /* @__PURE__ */ wt(Xo, [["__scopeId", "data-v-d9ec684d"]]), Jo = io(qo);
|
|
2456
2444
|
export {
|
|
2457
2445
|
Jo as Z
|
|
2458
2446
|
};
|