zhihao-ui 1.3.28 → 1.3.29
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,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as Ae, openBlock as We, createElementBlock as Ye, createElementVNode as Ze, ref as U, computed as Te, h as re, createVNode as De, render as Nt, reactive as St, onMounted as
|
|
1
|
+
import { defineComponent as Ae, openBlock as We, createElementBlock as Ye, createElementVNode as Ze, ref as U, computed as Te, h as re, createVNode as De, render as Nt, reactive as St, onMounted as Vt, onUnmounted as $t } from "vue";
|
|
2
2
|
import { S as zt, M as Ue, T as he, X as me, p as I, V as Ot, q as Rt, t as Zt, h as lt, r as Be, s as Dt, u as ue, F as Q, v as H, O as ie, P as ne, w as xe, x as qe, L as Pe, y as Gt, z as Ie, A as se, B as ve, C as ae, D as fe, i as At, G as Se, H as Wt, I as be, J as Yt, K as Bt, N as st, Q as Ne, R as Ge, U as et, W as qt, Y as Ht, Z as Xt } from "./vendor-D2mv9LHk.js";
|
|
3
3
|
import { _ as He } from "./Button-CGndQwez.js";
|
|
4
4
|
import { w as jt } from "./utils-D2wHR1YB.js";
|
|
5
5
|
const Qt = { id: "scale-line-container" }, Jt = /* @__PURE__ */ Ae({
|
|
6
6
|
__name: "scaleLine",
|
|
7
|
-
setup(e, { expose:
|
|
8
|
-
return
|
|
7
|
+
setup(e, { expose: n }) {
|
|
8
|
+
return n({
|
|
9
9
|
setScaleLine: (s, a) => {
|
|
10
10
|
a || (a = "metric");
|
|
11
11
|
const o = new zt({
|
|
@@ -24,16 +24,16 @@ const Qt = { id: "scale-line-container" }, Jt = /* @__PURE__ */ Ae({
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
setup(e) {
|
|
27
|
-
const
|
|
28
|
-
console.log("props",
|
|
29
|
-
const
|
|
27
|
+
const n = e;
|
|
28
|
+
console.log("props", n);
|
|
29
|
+
const l = () => {
|
|
30
30
|
console.log("props");
|
|
31
|
-
const { setZoom: a, getZoom: o, getInstall: f } =
|
|
31
|
+
const { setZoom: a, getZoom: o, getInstall: f } = n.mapInstance.methods;
|
|
32
32
|
if (!f()) return;
|
|
33
33
|
const t = o();
|
|
34
34
|
t && a(t + 1);
|
|
35
35
|
}, s = () => {
|
|
36
|
-
const { setZoom: a, getZoom: o, getInstall: f } =
|
|
36
|
+
const { setZoom: a, getZoom: o, getInstall: f } = n.mapInstance.methods;
|
|
37
37
|
if (!f()) return;
|
|
38
38
|
const t = o();
|
|
39
39
|
t && a(t - 1);
|
|
@@ -41,7 +41,7 @@ const Qt = { id: "scale-line-container" }, Jt = /* @__PURE__ */ Ae({
|
|
|
41
41
|
return (a, o) => (We(), Ye("div", _t, [
|
|
42
42
|
Ze("div", {
|
|
43
43
|
class: "button big-button",
|
|
44
|
-
onClick:
|
|
44
|
+
onClick: l
|
|
45
45
|
}, " + "),
|
|
46
46
|
Ze("div", {
|
|
47
47
|
class: "button small-button",
|
|
@@ -69,28 +69,28 @@ const Qt = { id: "scale-line-container" }, Jt = /* @__PURE__ */ Ae({
|
|
|
69
69
|
data: "EPSG:4326",
|
|
70
70
|
// 墨卡托投影坐标 渲染坐标
|
|
71
71
|
mercator: "EPSG:3857"
|
|
72
|
-
}, eo = [114.84, 30.52], it = "https://static.zhihaoscm.cn/",
|
|
72
|
+
}, eo = [114.84, 30.52], it = "https://static.zhihaoscm.cn/", Ve = 2003750834e-2;
|
|
73
73
|
var de = ((e) => (e.vectorTile = `https://t0.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${Fe}`, e.vectorTileMark = `https://t0.tianditu.gov.cn/cva_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${Fe}`, e.satelliteImgTile = `https://t0.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${Fe}`, e.satelliteImgTileMark = `https://t0.tianditu.gov.cn/cia_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cia&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${Fe}`, e.greenTile = `${it}/map/tile/{z}/{x}/{y}.png`, e))(de || {}), we = /* @__PURE__ */ ((e) => (e[e.M = 1] = "M", e[e.KM = 2] = "KM", e[e.NM = 3] = "NM", e))(we || {});
|
|
74
74
|
function to() {
|
|
75
|
-
const e = U(),
|
|
75
|
+
const e = U(), n = () => e.value, l = () => n().getView(), s = () => {
|
|
76
76
|
var h;
|
|
77
|
-
return (h =
|
|
77
|
+
return (h = l()) == null ? void 0 : h.getZoom();
|
|
78
78
|
}, a = (h) => {
|
|
79
79
|
var P;
|
|
80
|
-
(P =
|
|
80
|
+
(P = l()) == null || P.setZoom(h);
|
|
81
81
|
}, o = (h, P) => {
|
|
82
|
-
var
|
|
83
|
-
(
|
|
82
|
+
var k;
|
|
83
|
+
(k = l()) == null || k.setCenter(I([h, P]));
|
|
84
84
|
}, f = () => {
|
|
85
85
|
var P;
|
|
86
|
-
const h = (P =
|
|
86
|
+
const h = (P = l()) == null ? void 0 : P.getCenter();
|
|
87
87
|
return Zt(h);
|
|
88
|
-
},
|
|
88
|
+
}, w = () => {
|
|
89
89
|
var h;
|
|
90
|
-
return (h =
|
|
91
|
-
}, t = new Ue(),
|
|
92
|
-
|
|
93
|
-
const
|
|
90
|
+
return (h = n()) == null ? void 0 : h.getSize();
|
|
91
|
+
}, t = new Ue(), r = (h, P) => {
|
|
92
|
+
y(P);
|
|
93
|
+
const k = {
|
|
94
94
|
zoom: P.zoom,
|
|
95
95
|
center: I(P.center),
|
|
96
96
|
minZoom: ee.min,
|
|
@@ -98,7 +98,7 @@ function to() {
|
|
|
98
98
|
constrainResolution: !0,
|
|
99
99
|
enableRotation: !1,
|
|
100
100
|
multiWorld: !0
|
|
101
|
-
},
|
|
101
|
+
}, x = new Ue({
|
|
102
102
|
target: h,
|
|
103
103
|
controls: Rt({
|
|
104
104
|
zoom: !1
|
|
@@ -109,10 +109,10 @@ function to() {
|
|
|
109
109
|
t.get("satelliteImgTile"),
|
|
110
110
|
t.get("satelliteImgTileMark")
|
|
111
111
|
],
|
|
112
|
-
view: new Ot(
|
|
112
|
+
view: new Ot(k)
|
|
113
113
|
});
|
|
114
|
-
e.value =
|
|
115
|
-
},
|
|
114
|
+
e.value = x;
|
|
115
|
+
}, y = (h) => {
|
|
116
116
|
t.set("vectorTile", new he({
|
|
117
117
|
source: new me({ url: de.vectorTile }),
|
|
118
118
|
visible: h.layerType === "vector",
|
|
@@ -145,26 +145,26 @@ function to() {
|
|
|
145
145
|
}));
|
|
146
146
|
};
|
|
147
147
|
return {
|
|
148
|
-
getInstall:
|
|
149
|
-
getView:
|
|
148
|
+
getInstall: n,
|
|
149
|
+
getView: l,
|
|
150
150
|
getZoom: s,
|
|
151
151
|
setZoom: a,
|
|
152
152
|
setCenter: o,
|
|
153
153
|
getCenter: f,
|
|
154
|
-
getSize:
|
|
155
|
-
initMap:
|
|
156
|
-
setBaseLayerMap:
|
|
154
|
+
getSize: w,
|
|
155
|
+
initMap: r,
|
|
156
|
+
setBaseLayerMap: y
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
|
-
const Xe = function(e,
|
|
160
|
-
const
|
|
161
|
-
return [Number(e) / 6e5,
|
|
162
|
-
}, oo = (e,
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
159
|
+
const Xe = function(e, n) {
|
|
160
|
+
const l = Number(n) / 6e5;
|
|
161
|
+
return [Number(e) / 6e5, l];
|
|
162
|
+
}, oo = (e, n) => {
|
|
163
|
+
const l = I(e), s = n * 1e3, a = [
|
|
164
|
+
l[0] - s,
|
|
165
|
+
l[1] - s,
|
|
166
|
+
l[0] + s,
|
|
167
|
+
l[1] + s
|
|
168
168
|
], o = Dt(a, J.mercator, J.data);
|
|
169
169
|
return {
|
|
170
170
|
leftTopPoint: { lng: o[0], lat: o[3] },
|
|
@@ -172,10 +172,10 @@ const Xe = function(e, l) {
|
|
|
172
172
|
rightBottomPoint: { lng: o[2], lat: o[1] },
|
|
173
173
|
leftBottomPoint: { lng: o[0], lat: o[1] }
|
|
174
174
|
};
|
|
175
|
-
}, ro = function(e,
|
|
175
|
+
}, ro = function(e, n) {
|
|
176
176
|
const s = Be(e);
|
|
177
177
|
let a = "";
|
|
178
|
-
switch (console.log(
|
|
178
|
+
switch (console.log(n, we), n) {
|
|
179
179
|
case we.M:
|
|
180
180
|
a = Math.round(s * 100) / 100 + " m";
|
|
181
181
|
break;
|
|
@@ -189,102 +189,102 @@ const Xe = function(e, l) {
|
|
|
189
189
|
return a;
|
|
190
190
|
};
|
|
191
191
|
function no(e) {
|
|
192
|
-
const
|
|
193
|
-
let
|
|
194
|
-
return
|
|
192
|
+
const n = e[0] * Ve / 180;
|
|
193
|
+
let l = Math.log(Math.tan((90 + e[1]) * Math.PI / 360)) / (Math.PI / 180);
|
|
194
|
+
return l = l * Ve / 180, [n, l];
|
|
195
195
|
}
|
|
196
196
|
function ge(e = "") {
|
|
197
|
-
let
|
|
198
|
-
return
|
|
197
|
+
let n = e.replace(/&?/g, "&");
|
|
198
|
+
return n = n.replace(/&#x([0-9a-fA-F]+);?/g, (l, s) => {
|
|
199
199
|
const a = parseInt(s, 16);
|
|
200
200
|
return String.fromCodePoint(a);
|
|
201
|
-
}),
|
|
201
|
+
}), n;
|
|
202
202
|
}
|
|
203
203
|
const tt = (e) => {
|
|
204
|
-
const
|
|
204
|
+
const n = new ue({
|
|
205
205
|
font: "Normal 14px map-iconfont",
|
|
206
206
|
text: ge(e),
|
|
207
207
|
fill: new Q({ color: "#fff" }),
|
|
208
208
|
offsetY: -14
|
|
209
209
|
});
|
|
210
210
|
return new H({
|
|
211
|
-
text:
|
|
211
|
+
text: n,
|
|
212
212
|
zIndex: 100
|
|
213
213
|
});
|
|
214
|
-
}, ot = (e,
|
|
215
|
-
const
|
|
216
|
-
let a = e[1] /
|
|
217
|
-
return a = 180 / Math.PI * (2 * Math.atan(Math.exp(a * Math.PI / 180)) - Math.PI / 2),
|
|
214
|
+
}, ot = (e, n = "lonlat") => {
|
|
215
|
+
const l = { lon: 0, lat: 0 }, s = e[0] / Ve * 180;
|
|
216
|
+
let a = e[1] / Ve * 180;
|
|
217
|
+
return a = 180 / Math.PI * (2 * Math.atan(Math.exp(a * Math.PI / 180)) - Math.PI / 2), l.lon = s, l.lat = a, n === "lonlat" ? l : [s, a];
|
|
218
218
|
}, lo = (e) => {
|
|
219
|
-
const
|
|
219
|
+
const n = lt.duration(e, "minutes"), l = Math.floor(n.asDays()), s = n.hours(), a = n.minutes();
|
|
220
220
|
let o = `${String(a).padStart(2, "0")}分`;
|
|
221
|
-
return s !== 0 && (o = `${String(s).padStart(2, "0")}时${o}`),
|
|
222
|
-
}, so = (e,
|
|
223
|
-
let
|
|
224
|
-
const s = async (
|
|
225
|
-
if (!e || (console.log("vehicleInfo",
|
|
226
|
-
const h = Math.abs(Number(
|
|
227
|
-
a(
|
|
228
|
-
const P = e == null ? void 0 : e.getView(),
|
|
229
|
-
P.setCenter(xe(
|
|
230
|
-
}, a = (
|
|
221
|
+
return s !== 0 && (o = `${String(s).padStart(2, "0")}时${o}`), l !== 0 && (o = `${String(l).padStart(2, "0")}天${o}`), o;
|
|
222
|
+
}, so = (e, n) => {
|
|
223
|
+
let l = null;
|
|
224
|
+
const s = async (y) => {
|
|
225
|
+
if (!e || (console.log("vehicleInfo", y), !(y != null && y.lon && (y != null && y.lat)))) return;
|
|
226
|
+
const h = Math.abs(Number(y.lon)) > 180 ? Xe(y.lon, y.lat) : [y.lon, y.lat];
|
|
227
|
+
a(y, I(h));
|
|
228
|
+
const P = e == null ? void 0 : e.getView(), k = new ne(h);
|
|
229
|
+
P.setCenter(xe(k.getCoordinates(), J.data, J.mercator));
|
|
230
|
+
}, a = (y, h) => {
|
|
231
231
|
const P = `${it}map/car-icon.gif`;
|
|
232
|
-
|
|
232
|
+
l || (l = new ie({
|
|
233
233
|
element: document.createElement("div"),
|
|
234
234
|
positioning: "center-center",
|
|
235
235
|
stopEvent: !1
|
|
236
236
|
// 允许交互事件穿透
|
|
237
|
-
}), e.addOverlay(
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
const
|
|
241
|
-
|
|
237
|
+
}), e.addOverlay(l));
|
|
238
|
+
const k = l.getElement();
|
|
239
|
+
k.style.backgroundImage = `url(${P})`, k.style.width = "80px", k.style.height = "80px";
|
|
240
|
+
const x = (y == null ? void 0 : y.drc) || "";
|
|
241
|
+
k.style.transform = `rotate(${x}deg)`, k.style.backgroundSize = "cover", l == null || l.setPosition(h);
|
|
242
242
|
};
|
|
243
243
|
return {
|
|
244
244
|
location: s,
|
|
245
245
|
remove: () => {
|
|
246
|
-
const
|
|
247
|
-
|
|
246
|
+
const y = l == null ? void 0 : l.getElement();
|
|
247
|
+
y && (y.innerHTML = "");
|
|
248
248
|
},
|
|
249
|
-
renderTrack: (
|
|
250
|
-
|
|
249
|
+
renderTrack: (y, h, P) => {
|
|
250
|
+
n.render(y, h, P, "truck", 1e3);
|
|
251
251
|
},
|
|
252
|
-
setCenter: (
|
|
253
|
-
|
|
252
|
+
setCenter: (y) => {
|
|
253
|
+
n.setCenter(y);
|
|
254
254
|
},
|
|
255
255
|
closeTrack: () => {
|
|
256
|
-
|
|
256
|
+
n.close();
|
|
257
257
|
},
|
|
258
|
-
playTrack: (
|
|
259
|
-
|
|
258
|
+
playTrack: (y, h) => {
|
|
259
|
+
n.play(y, h);
|
|
260
260
|
}
|
|
261
261
|
};
|
|
262
262
|
};
|
|
263
263
|
var ct = /* @__PURE__ */ ((e) => (e[e.发动机使用中 = 0] = "发动机使用中", e[e.锚泊 = 1] = "锚泊", e[e.未操作 = 2] = "未操作", e[e.操纵能力受限 = 3] = "操纵能力受限", e[e.吃水受限 = 4] = "吃水受限", e[e.系泊 = 5] = "系泊", e[e.搁浅 = 6] = "搁浅", e[e.从事捕捞 = 7] = "从事捕捞", e[e.航行中 = 8] = "航行中", e[e.留作将来修正导航状态 = 9] = "留作将来修正导航状态", e[e.高速船留用 = 10] = "高速船留用", e[e.机动船尾推作业 = 11] = "机动船尾推作业", e[e.机动船顶推或侧推作业 = 12] = "机动船顶推或侧推作业", e[e.飞翼船留用 = 13] = "飞翼船留用", e[e.现行的 = 14] = "现行的", e[e.未定义 = 15] = "未定义", e))(ct || {}), te = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.front = "front", e.up = "up", e.down = "down", e.back = "back", e))(te || {});
|
|
264
264
|
const io = (e) => {
|
|
265
|
-
const
|
|
265
|
+
const n = /* @__PURE__ */ new Map(), l = {};
|
|
266
266
|
let s = null;
|
|
267
267
|
const a = "--";
|
|
268
268
|
let o = null;
|
|
269
|
-
const f = document.createElement("div"),
|
|
269
|
+
const f = document.createElement("div"), w = new ie({
|
|
270
270
|
element: f,
|
|
271
271
|
positioning: "top-left",
|
|
272
272
|
stopEvent: !1,
|
|
273
273
|
className: "track-label-popup"
|
|
274
274
|
});
|
|
275
|
-
let t,
|
|
276
|
-
const
|
|
275
|
+
let t, r, y, h, P, k = !1, x = Date.now(), m, N = 0, C = null, b = 20, A = !1;
|
|
276
|
+
const Y = 5, B = [], X = (c) => {
|
|
277
277
|
var d;
|
|
278
|
-
for (B.unshift(c); B.length >
|
|
279
|
-
const g = B.pop(), M =
|
|
280
|
-
M && ((d = M.getSource()) == null || d.clear(), e == null || e.removeLayer(M),
|
|
278
|
+
for (B.unshift(c); B.length > Y; ) {
|
|
279
|
+
const g = B.pop(), M = n.get(g);
|
|
280
|
+
M && ((d = M.getSource()) == null || d.clear(), e == null || e.removeLayer(M), n.delete(g), delete l[g]);
|
|
281
281
|
}
|
|
282
282
|
};
|
|
283
283
|
let O = "";
|
|
284
284
|
const D = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], i = qe(() => {
|
|
285
|
-
if (s &&
|
|
285
|
+
if (s && l[s] && n.get(s).getVisible() && A) {
|
|
286
286
|
console.log("reRenderTrackLine------------");
|
|
287
|
-
const c = At(u(s,
|
|
287
|
+
const c = At(u(s, l[s]));
|
|
288
288
|
ze(s, c);
|
|
289
289
|
}
|
|
290
290
|
}, 300), u = (c, d) => {
|
|
@@ -292,18 +292,18 @@ const io = (e) => {
|
|
|
292
292
|
const M = Math.max(1, Math.floor(d.length / b));
|
|
293
293
|
return g = d.filter((T, R) => R % M === 0).map((T, R) => {
|
|
294
294
|
if (Number(T.lon) > 180 || Number(T.lat) > 180) {
|
|
295
|
-
const [
|
|
296
|
-
T.lon =
|
|
295
|
+
const [V, G] = Xe(T.lon, T.lat);
|
|
296
|
+
T.lon = V, T.lat = G;
|
|
297
297
|
}
|
|
298
298
|
return T.center = [T.lon, T.lat], T.centerPoint = no(T.center), T.time = lt(T.createdAt).format("YYYY-MM-DD HH:mm:ss"), T.id = c, T.index = R, T;
|
|
299
299
|
}), g;
|
|
300
300
|
}, v = async (c, d, g, M = "ship", E = 200) => {
|
|
301
|
-
if (console.log("renderTrackLine--------", c, d, g), !e || JSON.stringify(
|
|
301
|
+
if (console.log("renderTrackLine--------", c, d, g), !e || JSON.stringify(l[c]) === JSON.stringify(d) && s === c || (d = d == null ? void 0 : d.reverse(), w && M === "ship" && (e != null && e.getOverlays().getArray().includes(w) || e.addOverlay(w)), (d == null ? void 0 : d.length) < 2))
|
|
302
302
|
return;
|
|
303
|
-
X(c), s = c,
|
|
304
|
-
const T = Object.keys(
|
|
305
|
-
O = g || D[T > 10 ? 10 : T],
|
|
306
|
-
},
|
|
303
|
+
X(c), s = c, l[c] = d, b = E;
|
|
304
|
+
const T = Object.keys(l).findIndex((R) => R === c) || 0;
|
|
305
|
+
O = g || D[T > 10 ? 10 : T], A = !0, await S(), await Je(s);
|
|
306
|
+
}, L = (c) => {
|
|
307
307
|
const d = new ae();
|
|
308
308
|
return new ve({
|
|
309
309
|
source: d,
|
|
@@ -313,47 +313,47 @@ const io = (e) => {
|
|
|
313
313
|
renderBuffer: 1024
|
|
314
314
|
// 增大渲染缓冲区
|
|
315
315
|
});
|
|
316
|
-
},
|
|
317
|
-
|
|
316
|
+
}, p = (c) => {
|
|
317
|
+
n.forEach((d, g) => {
|
|
318
318
|
var E;
|
|
319
319
|
const M = g === c;
|
|
320
320
|
d.getVisible() !== M && (d.setVisible(M), e.getLayers().getArray().includes(d) || e.addLayer(d), M || (E = d.getSource()) == null || E.clear());
|
|
321
321
|
}), s = c;
|
|
322
|
-
},
|
|
322
|
+
}, S = async () => {
|
|
323
323
|
const c = s;
|
|
324
|
-
if (!
|
|
325
|
-
const T =
|
|
326
|
-
|
|
324
|
+
if (!n.has(c)) {
|
|
325
|
+
const T = L(c);
|
|
326
|
+
n.set(c, T);
|
|
327
327
|
}
|
|
328
|
-
await
|
|
329
|
-
const d = O || "", g =
|
|
328
|
+
await p(c);
|
|
329
|
+
const d = O || "", g = l[c] || [];
|
|
330
330
|
if (!(g && g.length > 1)) return [];
|
|
331
331
|
let M = [];
|
|
332
332
|
M = u(c, g);
|
|
333
333
|
const E = M.map((T) => T.centerPoint);
|
|
334
334
|
M.length >= 2 && await z(c, E, d);
|
|
335
335
|
}, z = (c, d, g) => {
|
|
336
|
-
const M = new Pe(d), E =
|
|
336
|
+
const M = new Pe(d), E = n.get(c).getSource(), T = E.getFeatureById(c);
|
|
337
337
|
if (T)
|
|
338
|
-
T.setGeometry(M), T.setId(c), T.setStyle(Z(g)),
|
|
338
|
+
T.setGeometry(M), T.setId(c), T.setStyle(Z(g)), C = T;
|
|
339
339
|
else {
|
|
340
340
|
const R = new se({ geometry: M });
|
|
341
|
-
R.setId(c), R.set("type", "line"), R.setStyle(Z(g)), E.addFeature(R),
|
|
341
|
+
R.setId(c), R.set("type", "line"), R.setStyle(Z(g)), E.addFeature(R), C = R;
|
|
342
342
|
}
|
|
343
|
-
return
|
|
343
|
+
return C;
|
|
344
344
|
}, Z = (c) => new H({
|
|
345
345
|
stroke: new fe({
|
|
346
346
|
color: c,
|
|
347
347
|
width: 2
|
|
348
348
|
})
|
|
349
|
-
}),
|
|
349
|
+
}), $ = (c, d, g) => {
|
|
350
350
|
const M = c == null ? void 0 : c.get("trackId");
|
|
351
351
|
if (c && M && d === "hover") {
|
|
352
352
|
e.getTargetElement().style.cursor = M ? "pointer" : "";
|
|
353
353
|
const E = c.get("data"), T = ce(E), R = g == null ? void 0 : g.coordinate;
|
|
354
|
-
R && (f.querySelector(".popup-content"), f.innerHTML = T,
|
|
354
|
+
R && (f.querySelector(".popup-content"), f.innerHTML = T, w == null || w.setPosition(R));
|
|
355
355
|
} else
|
|
356
|
-
|
|
356
|
+
w && w.setPosition(void 0);
|
|
357
357
|
}, ce = (c) => {
|
|
358
358
|
if (!(c != null && c.time)) return;
|
|
359
359
|
let d = "";
|
|
@@ -395,31 +395,31 @@ const io = (e) => {
|
|
|
395
395
|
${d ?? d}
|
|
396
396
|
</div>`;
|
|
397
397
|
}, oe = (c) => {
|
|
398
|
-
const g = c.map((
|
|
399
|
-
const
|
|
398
|
+
const g = c.map((V) => {
|
|
399
|
+
const G = e.getPixelFromCoordinate(I(V.center));
|
|
400
400
|
return {
|
|
401
|
-
|
|
402
|
-
original:
|
|
403
|
-
pixel:
|
|
401
|
+
...V,
|
|
402
|
+
original: V,
|
|
403
|
+
pixel: G,
|
|
404
404
|
distance: 0
|
|
405
405
|
// 先初始化,后续计算
|
|
406
406
|
};
|
|
407
407
|
});
|
|
408
408
|
let M = 0;
|
|
409
409
|
g[0].distance = 0;
|
|
410
|
-
for (let
|
|
411
|
-
const
|
|
412
|
-
M += Math.sqrt(K * K + F * F), g[
|
|
410
|
+
for (let V = 1; V < g.length; V++) {
|
|
411
|
+
const G = g[V - 1].pixel, q = g[V].pixel, K = q[0] - G[0], F = q[1] - G[1];
|
|
412
|
+
M += Math.sqrt(K * K + F * F), g[V].distance = M;
|
|
413
413
|
}
|
|
414
414
|
const E = g.filter(
|
|
415
|
-
(
|
|
415
|
+
(V, G) => G === 0 || G === g.length - 1
|
|
416
416
|
), T = [];
|
|
417
|
-
for (let
|
|
418
|
-
const
|
|
419
|
-
if (T.push(
|
|
420
|
-
const q = E[
|
|
421
|
-
for (let
|
|
422
|
-
const j =
|
|
417
|
+
for (let V = 0; V < E.length; V++) {
|
|
418
|
+
const G = E[V];
|
|
419
|
+
if (T.push(G), V < E.length - 1) {
|
|
420
|
+
const q = E[V + 1], K = q.distance - G.distance, F = Math.floor(K / 100);
|
|
421
|
+
for (let W = 1; W <= F; W++) {
|
|
422
|
+
const j = G.distance + W * 100;
|
|
423
423
|
if (j >= q.distance) break;
|
|
424
424
|
const _ = le(
|
|
425
425
|
g,
|
|
@@ -430,28 +430,28 @@ const io = (e) => {
|
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
432
|
return Array.from(
|
|
433
|
-
new Map(T.map((
|
|
434
|
-
).map((
|
|
435
|
-
|
|
433
|
+
new Map(T.map((V) => [V.distance.toFixed(2), V])).values()
|
|
434
|
+
).map((V) => ({
|
|
435
|
+
...V.original,
|
|
436
436
|
// 优先保留原始数据
|
|
437
|
-
|
|
437
|
+
...V,
|
|
438
438
|
// 覆盖坐标等计算属性
|
|
439
|
-
coord:
|
|
439
|
+
coord: V.coord,
|
|
440
440
|
// 确保使用插值后的坐标
|
|
441
|
-
pixel:
|
|
442
|
-
distance:
|
|
441
|
+
pixel: V.pixel,
|
|
442
|
+
distance: V.distance
|
|
443
443
|
}));
|
|
444
444
|
};
|
|
445
445
|
function le(c, d) {
|
|
446
446
|
for (let g = 1; g < c.length; g++) {
|
|
447
447
|
const M = c[g - 1], E = c[g];
|
|
448
448
|
if (d >= M.distance && d <= E.distance) {
|
|
449
|
-
const T = (d - M.distance) / (E.distance - M.distance), R = M.pixel[0] + T * (E.pixel[0] - M.pixel[0]),
|
|
449
|
+
const T = (d - M.distance) / (E.distance - M.distance), R = M.pixel[0] + T * (E.pixel[0] - M.pixel[0]), V = M.pixel[1] + T * (E.pixel[1] - M.pixel[1]), G = e == null ? void 0 : e.getCoordinateFromPixel([R, V]);
|
|
450
450
|
return {
|
|
451
451
|
...M,
|
|
452
452
|
// 继承前一个点的属性(可调整)
|
|
453
|
-
coord:
|
|
454
|
-
pixel: [R,
|
|
453
|
+
coord: G,
|
|
454
|
+
pixel: [R, V],
|
|
455
455
|
distance: d,
|
|
456
456
|
original: void 0
|
|
457
457
|
// 明确标记为插值生成点
|
|
@@ -463,7 +463,7 @@ const io = (e) => {
|
|
|
463
463
|
const ze = async (c, d) => {
|
|
464
464
|
await Qe(), await ft(c);
|
|
465
465
|
const g = oe(d), M = g.map((T) => ke(T));
|
|
466
|
-
|
|
466
|
+
n.get(c).getSource().addFeatures(M), ht(c, g, d, O), g.forEach((T) => {
|
|
467
467
|
const R = pe(c, O, T);
|
|
468
468
|
e.addOverlay(R);
|
|
469
469
|
});
|
|
@@ -476,7 +476,7 @@ const io = (e) => {
|
|
|
476
476
|
let g = [
|
|
477
477
|
...vt(c, O)
|
|
478
478
|
];
|
|
479
|
-
return (c.index === 0 || c.index ===
|
|
479
|
+
return (c.index === 0 || c.index === l[c.id].length - 1) && (g = [...mt(c)], d.set("type", "track_begin")), c.state !== void 0 && c.state !== null && (g = [...yt(c)], d.set("type", "track_icon")), d.setStyle(g), d;
|
|
480
480
|
}, pe = (c, d, g) => {
|
|
481
481
|
const M = document.createElement("div");
|
|
482
482
|
M.className = "track-overlay-label", M.style.position = "relative", M.style.backgroundColor = "rgba(255,255,255,0.8)", M.style.border = `1px solid ${d}`, M.style.fontSize = "12px", M.innerHTML = `
|
|
@@ -507,7 +507,7 @@ const io = (e) => {
|
|
|
507
507
|
g.setPosition(void 0), g.dispose();
|
|
508
508
|
});
|
|
509
509
|
}, ft = (c) => {
|
|
510
|
-
const d =
|
|
510
|
+
const d = n.get(c).getSource();
|
|
511
511
|
d.forEachFeature((g) => {
|
|
512
512
|
g.get("type") !== "line" && d.removeFeature(g);
|
|
513
513
|
});
|
|
@@ -539,29 +539,29 @@ const io = (e) => {
|
|
|
539
539
|
})
|
|
540
540
|
}),
|
|
541
541
|
zIndex: 99
|
|
542
|
-
}), R = tt(""),
|
|
543
|
-
return Number(c.state) === 0 ? q.push(R) : Number(c.state) === 1 && q.push(
|
|
542
|
+
}), R = tt(""), G = tt(""), q = [];
|
|
543
|
+
return Number(c.state) === 0 ? q.push(R) : Number(c.state) === 1 && q.push(G), q.push(E), q;
|
|
544
544
|
}, ht = (c, d, g, M) => {
|
|
545
545
|
const E = d || [], T = d.length;
|
|
546
546
|
T || (E.push(g[0]), E.push(g[g.length - 1]));
|
|
547
547
|
const R = [];
|
|
548
|
-
for (let
|
|
548
|
+
for (let G = 0; G < T - 1; G++) {
|
|
549
549
|
let q;
|
|
550
|
-
const K = d[
|
|
550
|
+
const K = d[G], F = (d[G + 1].index + K.index) / 2;
|
|
551
551
|
if (F % 2 === 0)
|
|
552
552
|
q = g[F].centerPoint;
|
|
553
553
|
else {
|
|
554
|
-
const
|
|
555
|
-
if (
|
|
556
|
-
const [_, Ce] =
|
|
554
|
+
const W = g[Math.floor(F)], j = g[Math.ceil(F)];
|
|
555
|
+
if (W && j) {
|
|
556
|
+
const [_, Ce] = W.centerPoint, [Le, Ee] = j.centerPoint;
|
|
557
557
|
q = [(_ + Le) / 2, (Ce + Ee) / 2];
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
560
|
if (q) {
|
|
561
|
-
const
|
|
561
|
+
const W = new se({
|
|
562
562
|
geometry: new ne(q)
|
|
563
563
|
});
|
|
564
|
-
|
|
564
|
+
W.set("type", "track_arrow"), W.setStyle(
|
|
565
565
|
new H({
|
|
566
566
|
text: new ue({
|
|
567
567
|
font: "700 12px map-iconfont",
|
|
@@ -569,27 +569,27 @@ const io = (e) => {
|
|
|
569
569
|
fill: new Q({ color: M }),
|
|
570
570
|
// 设置箭头旋转 角度转为弧度
|
|
571
571
|
rotation: Ke(
|
|
572
|
-
d[
|
|
573
|
-
d[
|
|
572
|
+
d[G].center,
|
|
573
|
+
d[G + 1].center
|
|
574
574
|
) * (Math.PI / 180)
|
|
575
575
|
})
|
|
576
576
|
})
|
|
577
|
-
), R.push(
|
|
577
|
+
), R.push(W);
|
|
578
578
|
}
|
|
579
579
|
}
|
|
580
|
-
const
|
|
581
|
-
|
|
580
|
+
const V = n.get(c).getSource();
|
|
581
|
+
V == null || V.addFeatures(R);
|
|
582
582
|
}, Je = (c) => {
|
|
583
583
|
var T, R;
|
|
584
|
-
const d = e.getView(), g = (T =
|
|
584
|
+
const d = e.getView(), g = (T = n == null ? void 0 : n.get(c)) == null ? void 0 : T.getSource(), M = C || (c ? g == null ? void 0 : g.getFeatureById(c) : null);
|
|
585
585
|
if (!M) return;
|
|
586
586
|
const E = (R = M == null ? void 0 : M.getGeometry()) == null ? void 0 : R.getExtent();
|
|
587
587
|
if (E != null && E.length)
|
|
588
588
|
try {
|
|
589
|
-
const
|
|
590
|
-
d.fit(
|
|
591
|
-
} catch (
|
|
592
|
-
console.log(
|
|
589
|
+
const V = Gt(E, Math.max(E[2] - E[0], E[3] - E[1]) * 0.02);
|
|
590
|
+
d.fit(V);
|
|
591
|
+
} catch (V) {
|
|
592
|
+
console.log(V);
|
|
593
593
|
}
|
|
594
594
|
}, mt = (c) => {
|
|
595
595
|
const d = "", E = c.index === 0 ? "#fcdc3f" : "#ff0000";
|
|
@@ -602,14 +602,14 @@ const io = (e) => {
|
|
|
602
602
|
zIndex: 101
|
|
603
603
|
})];
|
|
604
604
|
}, wt = () => {
|
|
605
|
-
console.log("清除所有的轨迹-----"), Me(),
|
|
605
|
+
console.log("清除所有的轨迹-----"), Me(), n.forEach((d) => {
|
|
606
606
|
var g;
|
|
607
607
|
(g = d.getSource()) == null || g.clear(), e == null || e.removeLayer(d);
|
|
608
|
-
}), Object.keys(
|
|
609
|
-
|
|
610
|
-
}),
|
|
608
|
+
}), Object.keys(l).forEach((d) => {
|
|
609
|
+
n.delete(d), delete l[d];
|
|
610
|
+
}), A = !1, Qe();
|
|
611
611
|
}, xt = (c) => {
|
|
612
|
-
const d =
|
|
612
|
+
const d = n.get(c || s);
|
|
613
613
|
d == null || d.setVisible(!1);
|
|
614
614
|
const g = e.getOverlays().getArray();
|
|
615
615
|
for (let M = 0; M < g.length; ) {
|
|
@@ -621,14 +621,14 @@ const io = (e) => {
|
|
|
621
621
|
const g = {
|
|
622
622
|
id: c,
|
|
623
623
|
length: "--"
|
|
624
|
-
}, E = (
|
|
624
|
+
}, E = (l[c] || []).map(
|
|
625
625
|
(R) => xe([R.lon, R.lat], J.data, J.mercator)
|
|
626
626
|
), T = new Pe(E);
|
|
627
627
|
return g.length = ro(T, d) || "--", g;
|
|
628
628
|
}, kt = (c, d) => {
|
|
629
629
|
pt(String(c), d);
|
|
630
630
|
}, pt = (c, d) => {
|
|
631
|
-
const g =
|
|
631
|
+
const g = l[String(c)], M = g == null ? void 0 : g.map((E) => [E.lon, E.lat]);
|
|
632
632
|
M && Lt(M, d);
|
|
633
633
|
}, Oe = new H({
|
|
634
634
|
text: new ue({
|
|
@@ -639,52 +639,52 @@ const io = (e) => {
|
|
|
639
639
|
// 初始旋转角度
|
|
640
640
|
})
|
|
641
641
|
}), Mt = (c, d) => {
|
|
642
|
-
var F,
|
|
643
|
-
const g = Number(50 * d), M = ((F = c.frameState) == null ? void 0 : F.time) ?? Date.now(), E = M -
|
|
644
|
-
if (
|
|
642
|
+
var F, W;
|
|
643
|
+
const g = Number(50 * d), M = ((F = c.frameState) == null ? void 0 : F.time) ?? Date.now(), E = M - x;
|
|
644
|
+
if (N = (N + g * E / 1e6) % 2, x = M, N >= 1) {
|
|
645
645
|
Me();
|
|
646
646
|
return;
|
|
647
647
|
}
|
|
648
|
-
const T =
|
|
649
|
-
|
|
650
|
-
), R =
|
|
651
|
-
|
|
652
|
-
),
|
|
653
|
-
|
|
648
|
+
const T = r.getCoordinateAt(
|
|
649
|
+
N > 1 ? 2 - N : N
|
|
650
|
+
), R = r.getCoordinateAt(
|
|
651
|
+
N > 1 ? N - 0.01 : N
|
|
652
|
+
), V = r.getCoordinateAt(
|
|
653
|
+
N > 1 ? 2 - N : N + 0.01
|
|
654
654
|
), q = Ke(
|
|
655
655
|
ot(R, "array"),
|
|
656
|
-
ot(
|
|
656
|
+
ot(V, "array")
|
|
657
657
|
) * Math.PI / 180;
|
|
658
|
-
(
|
|
658
|
+
(W = Oe.getText()) == null || W.setRotation(q), h.setCoordinates(T);
|
|
659
659
|
const K = Wt(c);
|
|
660
660
|
K.setStyle(Oe), K.drawGeometry(h), e == null || e.render();
|
|
661
661
|
}, Ct = () => {
|
|
662
662
|
var c;
|
|
663
|
-
|
|
663
|
+
k = !0, x = Date.now(), N = 0, h = ((c = y.getGeometry()) == null ? void 0 : c.clone()) || new ne([0, 0]), o && (m == null || m.on("postrender", o)), P == null || P.setGeometry(void 0);
|
|
664
664
|
}, Me = () => {
|
|
665
|
-
|
|
665
|
+
k && (k = !1, P == null || P.setGeometry(void 0), o && m && m.un("postrender", o), m && (e == null || e.removeLayer(m)), m = null, P = null);
|
|
666
666
|
}, Lt = (c, d) => {
|
|
667
|
-
|
|
667
|
+
k && Me(), t = new Ie({
|
|
668
668
|
factor: 1e6
|
|
669
|
-
}).writeGeometry(new Pe(c)),
|
|
669
|
+
}).writeGeometry(new Pe(c)), r = new Ie({
|
|
670
670
|
factor: 1e6
|
|
671
671
|
}).readGeometry(t, {
|
|
672
672
|
dataProjection: J.data,
|
|
673
673
|
featureProjection: J.mercator
|
|
674
|
-
}),
|
|
674
|
+
}), y = new se({
|
|
675
675
|
type: "icon",
|
|
676
|
-
geometry: new ne(
|
|
676
|
+
geometry: new ne(r.getFirstCoordinate())
|
|
677
677
|
});
|
|
678
|
-
const g =
|
|
678
|
+
const g = y.getGeometry();
|
|
679
679
|
h = g ? g.clone() : new ne([0, 0]), P = new se({
|
|
680
680
|
type: "geoMarker",
|
|
681
681
|
style: Oe,
|
|
682
682
|
geometry: h
|
|
683
|
-
}),
|
|
683
|
+
}), m = new ve({
|
|
684
684
|
source: new ae({
|
|
685
685
|
features: [P]
|
|
686
686
|
})
|
|
687
|
-
}), e == null || e.addLayer(
|
|
687
|
+
}), e == null || e.addLayer(m), o = (M) => Mt(M, d), Ct();
|
|
688
688
|
}, Ke = (c, d, g) => {
|
|
689
689
|
function M(F) {
|
|
690
690
|
return 180 * (F % (2 * Math.PI)) / Math.PI;
|
|
@@ -693,10 +693,10 @@ const io = (e) => {
|
|
|
693
693
|
return F % 360 * Math.PI / 180;
|
|
694
694
|
}
|
|
695
695
|
function T(F) {
|
|
696
|
-
var
|
|
696
|
+
var W;
|
|
697
697
|
if (!F) throw new Error("Coordinate is required");
|
|
698
698
|
if (!Array.isArray(F)) {
|
|
699
|
-
if ((F == null ? void 0 : F.type) === "Feature" && (F == null ? void 0 : F.geometry) !== null && ((
|
|
699
|
+
if ((F == null ? void 0 : F.type) === "Feature" && (F == null ? void 0 : F.geometry) !== null && ((W = F == null ? void 0 : F.geometry) == null ? void 0 : W.type) === "Point")
|
|
700
700
|
return F == null ? void 0 : F.geometry.coordinates;
|
|
701
701
|
if (F.type === "Point") return (F == null ? void 0 : F.coordinates) || [];
|
|
702
702
|
}
|
|
@@ -706,21 +706,21 @@ const io = (e) => {
|
|
|
706
706
|
"Coordinate must be GeoJSON Point or an Array of numbers"
|
|
707
707
|
);
|
|
708
708
|
}
|
|
709
|
-
function R(F,
|
|
709
|
+
function R(F, W, j = {}) {
|
|
710
710
|
if (j.final)
|
|
711
711
|
return function(Ft, Pt) {
|
|
712
712
|
return (R(Pt, Ft) + 180) % 360;
|
|
713
|
-
}(F,
|
|
714
|
-
const _ = T(F), Ce = T(
|
|
713
|
+
}(F, W);
|
|
714
|
+
const _ = T(F), Ce = T(W), Le = E(_[0]), Ee = E(Ce[0]), _e = E(_[1]), Re = E(Ce[1]), Et = Math.sin(Ee - Le) * Math.cos(Re), Tt = Math.cos(_e) * Math.sin(Re) - Math.sin(_e) * Math.cos(Re) * Math.cos(Ee - Le);
|
|
715
715
|
return M(Math.atan2(Et, Tt));
|
|
716
716
|
}
|
|
717
|
-
function
|
|
717
|
+
function V(F) {
|
|
718
718
|
return !isNaN(F) && F !== null && !Array.isArray(F);
|
|
719
719
|
}
|
|
720
|
-
function
|
|
721
|
-
return F || console.log("Coordinates are required"), Array.isArray(F) || console.log("Coordinates must be an Array"), F.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (
|
|
720
|
+
function G(F, W = {}, j = {}) {
|
|
721
|
+
return F || console.log("Coordinates are required"), Array.isArray(F) || console.log("Coordinates must be an Array"), F.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (!V(F[0]) || !V(F[1])) && console.log("Coordinates must contain numbers"), q({ type: "Point", coordinates: F }, W, j);
|
|
722
722
|
}
|
|
723
|
-
function q(F,
|
|
723
|
+
function q(F, W = {}, j = {}) {
|
|
724
724
|
const _ = {
|
|
725
725
|
type: "Feature",
|
|
726
726
|
id: "",
|
|
@@ -728,9 +728,9 @@ const io = (e) => {
|
|
|
728
728
|
bbox: {},
|
|
729
729
|
geometry: {}
|
|
730
730
|
};
|
|
731
|
-
return j.id !== void 0 && (_.id = j.id), j.bbox && (_.bbox = j.bbox), _.properties =
|
|
731
|
+
return j.id !== void 0 && (_.id = j.id), j.bbox && (_.bbox = j.bbox), _.properties = W, _.geometry = F, _;
|
|
732
732
|
}
|
|
733
|
-
const K = R(
|
|
733
|
+
const K = R(G(c), G(d), g);
|
|
734
734
|
return K < 0 ? 360 + K : K;
|
|
735
735
|
};
|
|
736
736
|
return {
|
|
@@ -740,13 +740,13 @@ const io = (e) => {
|
|
|
740
740
|
setCenter: Je,
|
|
741
741
|
close: xt,
|
|
742
742
|
getLength: bt,
|
|
743
|
-
handleTrackMapEvent:
|
|
743
|
+
handleTrackMapEvent: $,
|
|
744
744
|
reRenderTrackLine: i
|
|
745
745
|
};
|
|
746
746
|
};
|
|
747
747
|
function co(e) {
|
|
748
748
|
console.log("useShipOverlay", e);
|
|
749
|
-
const
|
|
749
|
+
const n = U(null), l = Te(() => ({
|
|
750
750
|
"--overlay-color": "#FFF",
|
|
751
751
|
"--bg-color1": e.colors && e.colors[0] ? e.colors[0] : "#ffffff",
|
|
752
752
|
// 默认第一个颜色
|
|
@@ -793,9 +793,9 @@ function co(e) {
|
|
|
793
793
|
left: "-20px"
|
|
794
794
|
}));
|
|
795
795
|
return () => re("div", {
|
|
796
|
-
ref:
|
|
796
|
+
ref: n,
|
|
797
797
|
class: "ship-overlay-container",
|
|
798
|
-
style:
|
|
798
|
+
style: l.value
|
|
799
799
|
}, [
|
|
800
800
|
re(
|
|
801
801
|
"div",
|
|
@@ -860,51 +860,51 @@ function co(e) {
|
|
|
860
860
|
]);
|
|
861
861
|
}
|
|
862
862
|
U([]);
|
|
863
|
-
function ao(e,
|
|
864
|
-
if (
|
|
863
|
+
function ao(e, n, l, s) {
|
|
864
|
+
if (n) {
|
|
865
865
|
const a = new ie({
|
|
866
|
-
element:
|
|
866
|
+
element: l,
|
|
867
867
|
positioning: "top-left",
|
|
868
868
|
id: "label-" + (s == null ? void 0 : s.id),
|
|
869
869
|
offset: [20, -20],
|
|
870
870
|
autoPan: !1,
|
|
871
|
-
position:
|
|
871
|
+
position: n,
|
|
872
872
|
className: s.blinking ? "ship-label-overlay-blinking" : "ship-label-overlay"
|
|
873
873
|
});
|
|
874
874
|
a.set("class", "zh-map-ship-overlay"), e.addOverlay(a);
|
|
875
875
|
}
|
|
876
876
|
}
|
|
877
877
|
const uo = (e) => {
|
|
878
|
-
const { spd:
|
|
879
|
-
return
|
|
880
|
-
}, ye = (e,
|
|
881
|
-
const { shipData:
|
|
882
|
-
return go(
|
|
878
|
+
const { spd: n, hdg: l, cog: s } = e;
|
|
879
|
+
return n ? l !== null && +l != 511 && s !== null ? s - +l >= 3 ? te.right : s - +l <= -3 ? te.left : te.front : te.front : "";
|
|
880
|
+
}, ye = (e, n) => {
|
|
881
|
+
const { shipData: l } = n.getProperties(), s = at(e), a = je(e, l, s);
|
|
882
|
+
return go(n, a, s);
|
|
883
883
|
}, at = (e) => {
|
|
884
|
-
const
|
|
885
|
-
return
|
|
886
|
-
}, je = (e,
|
|
887
|
-
if (
|
|
888
|
-
const { len: s, wid: a } =
|
|
884
|
+
const n = e == null ? void 0 : e.getView().getZoom();
|
|
885
|
+
return n <= ee.shipModelMax && n >= ee.shipTriggleMin ? "ship" : "triangle";
|
|
886
|
+
}, je = (e, n, l) => {
|
|
887
|
+
if (l === "ship") {
|
|
888
|
+
const { len: s, wid: a } = n, o = 97, f = 20, t = 1 / (e == null ? void 0 : e.getView().getResolution()), r = s * t / o, y = a * t / f, h = Math.min(r, y);
|
|
889
889
|
return h < 0.2 ? 0.2 : h > 2 ? 2 : h;
|
|
890
890
|
}
|
|
891
891
|
return ee.scaleNum;
|
|
892
|
-
}, go = (e,
|
|
893
|
-
const { color: s, direct: a, isHighlight: o, shipData: f } = e.getProperties(),
|
|
892
|
+
}, go = (e, n, l) => {
|
|
893
|
+
const { color: s, direct: a, isHighlight: o, shipData: f } = e.getProperties(), w = ((f == null ? void 0 : f.cog) - 90 + 360) % 360;
|
|
894
894
|
return new H({
|
|
895
895
|
image: new be({
|
|
896
896
|
src: t(),
|
|
897
|
-
scale:
|
|
897
|
+
scale: n || ee.scaleNum,
|
|
898
898
|
anchor: [0.5, 0.5],
|
|
899
|
-
rotation:
|
|
899
|
+
rotation: w * Math.PI / 180,
|
|
900
900
|
rotateWithView: !1
|
|
901
901
|
})
|
|
902
902
|
});
|
|
903
903
|
function t() {
|
|
904
|
-
return `data:image/svg+xml;utf8,${encodeURIComponent(
|
|
904
|
+
return `data:image/svg+xml;utf8,${encodeURIComponent(r())}`;
|
|
905
905
|
}
|
|
906
|
-
function
|
|
907
|
-
switch (
|
|
906
|
+
function r() {
|
|
907
|
+
switch (l) {
|
|
908
908
|
case "triangle":
|
|
909
909
|
return `<svg width="41" height="24" viewBox="0 0 41 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
910
910
|
<path d="M30.8843 12.6777L2.21343 21.7067C1.75559 21.8509 1.28947 21.509 1.28947 21.029L1.28947 2.97103C1.28947 2.49102 1.75558 2.14913 2.21342 2.29331L30.8843 11.3223C31.5471 11.531 31.5471 12.469 30.8843 12.6777Z"
|
|
@@ -930,9 +930,9 @@ const uo = (e) => {
|
|
|
930
930
|
return "";
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
|
-
}, fo = (e,
|
|
934
|
-
const
|
|
935
|
-
element:
|
|
933
|
+
}, fo = (e, n) => {
|
|
934
|
+
const l = dt(e, n), s = n.id, { lon: a, lat: o } = n, f = new ie({
|
|
935
|
+
element: l,
|
|
936
936
|
position: I([a, o]),
|
|
937
937
|
id: "selected-" + s,
|
|
938
938
|
positioning: "center-center",
|
|
@@ -940,24 +940,24 @@ const uo = (e) => {
|
|
|
940
940
|
className: "ship-selected-overlay"
|
|
941
941
|
});
|
|
942
942
|
return f.set("class", "ship-overlay-selected"), f;
|
|
943
|
-
}, dt = (e,
|
|
944
|
-
const
|
|
943
|
+
}, dt = (e, n) => {
|
|
944
|
+
const l = at(e), s = je(e, n, l), a = l === "ship" ? 109 : 49, o = `
|
|
945
945
|
<svg style="transform:scale(${s});" xmlns="http://www.w3.org/2000/svg" width="${a}" height="${a}" viewBox="0 0 49 49" fill="none">
|
|
946
946
|
<path d="M1.99982 46.9998L1.99982 1.99982L46.9998 1.99982L46.9998 46.9998L1.99982 46.9998Z" fill="#FF2424" fill-opacity="0.2"/>
|
|
947
947
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M19.9998 0.5V3.5L3.49976 3.5V20H0.499756V0.500002L19.9998 0.5ZM45.4998 3.5H28.9998V0.5H48.4998V20H45.4998V3.5ZM48.4998 29L48.4998 48.5H28.9998V45.5H45.4998L45.4998 29H48.4998ZM3.49976 45.5L3.49976 29H0.499756L0.499758 48.5L19.9998 48.5V45.5L3.49976 45.5Z" fill="#FF2424"/>
|
|
948
948
|
</svg>
|
|
949
949
|
`, f = document.createElement("div");
|
|
950
950
|
return f.className = "ship-overlay-selected", f.innerHTML = o, f;
|
|
951
|
-
}, vo = (e,
|
|
952
|
-
const { lon:
|
|
953
|
-
|
|
951
|
+
}, vo = (e, n) => {
|
|
952
|
+
const { lon: l, lat: s, blinking: a } = n, o = ut(n);
|
|
953
|
+
l && s && ao(e, I([l, s]), o, { ...n, blinking: a });
|
|
954
954
|
}, ut = (e) => {
|
|
955
|
-
const
|
|
956
|
-
|
|
957
|
-
const { lon:
|
|
955
|
+
const n = document.createElement("div");
|
|
956
|
+
n.className = "ship-overlay-box", n.style.position = "relative";
|
|
957
|
+
const { lon: l, lat: s, blinking: a, blinkingColors: o, name: f } = e, w = De({
|
|
958
958
|
setup() {
|
|
959
959
|
return co({
|
|
960
|
-
position: [
|
|
960
|
+
position: [l + 2e-3, s + 2e-3],
|
|
961
961
|
selected: a,
|
|
962
962
|
name: f,
|
|
963
963
|
colors: o || [],
|
|
@@ -967,10 +967,10 @@ const uo = (e) => {
|
|
|
967
967
|
});
|
|
968
968
|
}
|
|
969
969
|
});
|
|
970
|
-
return Nt(
|
|
970
|
+
return Nt(w, n), n;
|
|
971
971
|
}, rt = (e) => {
|
|
972
|
-
const
|
|
973
|
-
return e.existDevice &&
|
|
972
|
+
const n = [];
|
|
973
|
+
return e.existDevice && n.push(""), e.existMobile && n.push(""), e.existWaterGauge && n.push(""), n;
|
|
974
974
|
};
|
|
975
975
|
function yo() {
|
|
976
976
|
const e = [
|
|
@@ -984,71 +984,71 @@ function yo() {
|
|
|
984
984
|
return e[Math.floor(Math.random() * e.length)];
|
|
985
985
|
}
|
|
986
986
|
const ho = window.devicePixelRatio || 1;
|
|
987
|
-
function mo(e,
|
|
987
|
+
function mo(e, n, l = "left-bottom", s = 2) {
|
|
988
988
|
const a = document.createElement("canvas"), o = a.getContext("2d");
|
|
989
989
|
if (!o) return "";
|
|
990
|
-
const f = 2,
|
|
991
|
-
o.font =
|
|
992
|
-
const
|
|
990
|
+
const f = 2, w = 8, t = 16, r = window.devicePixelRatio || 1, y = "500 12px Arial", h = "14px map-iconfont";
|
|
991
|
+
o.font = y;
|
|
992
|
+
const k = o.measureText(e).width;
|
|
993
993
|
o.font = h;
|
|
994
|
-
const
|
|
995
|
-
let
|
|
996
|
-
switch (
|
|
994
|
+
const x = n.map((p) => ({ width: o.measureText(ge(p)).width, height: 14 })), m = x.reduce((p, S) => p + S.width, 0), N = (n.length - 1) * s, C = w + k + m + N + w, b = f + 14 + f * 2;
|
|
995
|
+
let A, Y, B = 0, X = 0, O = 0, D = 0, i = 0, u = 0;
|
|
996
|
+
switch (A = t + C, l) {
|
|
997
997
|
case "right-top":
|
|
998
|
-
|
|
998
|
+
Y = t + b, B = 0, X = t + b, O = t, D = 0, i = t, u = 0;
|
|
999
999
|
break;
|
|
1000
1000
|
case "right-middle":
|
|
1001
|
-
|
|
1001
|
+
Y = b, B = 0, X = b / 2, O = t, D = b / 2, i = t, u = 0;
|
|
1002
1002
|
break;
|
|
1003
1003
|
case "right-bottom":
|
|
1004
|
-
|
|
1004
|
+
Y = t + b, B = 0, X = 0, O = t, D = t, i = t, u = t;
|
|
1005
1005
|
break;
|
|
1006
1006
|
case "left-top":
|
|
1007
|
-
|
|
1007
|
+
Y = t + b, B = C, X = t, O = C + t, D = b + t, i = 0, u = 0;
|
|
1008
1008
|
break;
|
|
1009
1009
|
case "left-middle":
|
|
1010
|
-
|
|
1010
|
+
Y = b, B = C, X = b / 2, O = C + t, D = b / 2, i = 0, u = 0;
|
|
1011
1011
|
break;
|
|
1012
1012
|
case "left-bottom":
|
|
1013
|
-
|
|
1013
|
+
Y = t + b, B = C, X = b, O = C + t, D = 0, i = 0, u = t;
|
|
1014
1014
|
break;
|
|
1015
1015
|
}
|
|
1016
|
-
a.width = Math.round(
|
|
1016
|
+
a.width = Math.round(A * r), a.height = Math.round(Y * r), o.scale(r, r), o.clearRect(0, 0, A, Y), o.beginPath(), o.moveTo(B, X), o.lineTo(O, D), o.strokeStyle = "#FFF", o.lineWidth = 1, o.stroke(), o.fillStyle = "#FFF", o.fillRect(i, u, C, b), o.font = y, o.textBaseline = "middle";
|
|
1017
1017
|
const v = u + f + b / 2;
|
|
1018
|
-
o.strokeStyle = "#ffffff", o.lineWidth = 1, o.strokeText(e, i +
|
|
1019
|
-
let
|
|
1020
|
-
return
|
|
1018
|
+
o.strokeStyle = "#ffffff", o.lineWidth = 1, o.strokeText(e, i + w, v), o.fillStyle = "#000000", o.fillText(e, i + w, v), o.font = h, o.fillStyle = "#3370ff";
|
|
1019
|
+
let L = i + w + k + s;
|
|
1020
|
+
return n.length > 0 && n.forEach((p, S) => {
|
|
1021
1021
|
const z = u + f + b / 2;
|
|
1022
|
-
o.fillText(ge(
|
|
1022
|
+
o.fillText(ge(p), L, z), L += x[S].width + s;
|
|
1023
1023
|
}), a.toDataURL("image/png");
|
|
1024
1024
|
}
|
|
1025
|
-
const nt = (e,
|
|
1026
|
-
const { name:
|
|
1027
|
-
let
|
|
1025
|
+
const nt = (e, n) => {
|
|
1026
|
+
const { name: l, rightIcons: s, selected: a } = e.getProperties(), o = n !== 1 ? yo() : "right-top", f = mo(l, s, o);
|
|
1027
|
+
let w = [0, 0];
|
|
1028
1028
|
switch (o) {
|
|
1029
1029
|
case "right-top":
|
|
1030
|
-
|
|
1030
|
+
w = [0, 1];
|
|
1031
1031
|
break;
|
|
1032
1032
|
case "right-middle":
|
|
1033
|
-
|
|
1033
|
+
w = [0, 0.5];
|
|
1034
1034
|
break;
|
|
1035
1035
|
case "right-bottom":
|
|
1036
|
-
|
|
1036
|
+
w = [0, 0];
|
|
1037
1037
|
break;
|
|
1038
1038
|
case "left-top":
|
|
1039
|
-
|
|
1039
|
+
w = [1, 1];
|
|
1040
1040
|
break;
|
|
1041
1041
|
case "left-middle":
|
|
1042
|
-
|
|
1042
|
+
w = [1, 0.5];
|
|
1043
1043
|
break;
|
|
1044
1044
|
case "left-bottom":
|
|
1045
|
-
|
|
1045
|
+
w = [1, 0];
|
|
1046
1046
|
break;
|
|
1047
1047
|
}
|
|
1048
1048
|
return new H({
|
|
1049
1049
|
image: new be({
|
|
1050
1050
|
src: f,
|
|
1051
|
-
anchor:
|
|
1051
|
+
anchor: w,
|
|
1052
1052
|
displacement: [0, 0],
|
|
1053
1053
|
scale: 1 / ho,
|
|
1054
1054
|
anchorXUnits: "fraction",
|
|
@@ -1057,7 +1057,7 @@ const nt = (e, l) => {
|
|
|
1057
1057
|
zIndex: a ? 100 : 10
|
|
1058
1058
|
});
|
|
1059
1059
|
}, wo = (e) => {
|
|
1060
|
-
let
|
|
1060
|
+
let n = null, l = null;
|
|
1061
1061
|
const s = new ae(), a = new Yt({
|
|
1062
1062
|
source: s,
|
|
1063
1063
|
className: "zh-map--ship-layer",
|
|
@@ -1072,18 +1072,18 @@ const nt = (e, l) => {
|
|
|
1072
1072
|
declutter: !0
|
|
1073
1073
|
});
|
|
1074
1074
|
e == null || e.addLayer(a), e == null || e.addLayer(f);
|
|
1075
|
-
let
|
|
1075
|
+
let w = null, t = "", r = {}, y = {};
|
|
1076
1076
|
const h = (i) => {
|
|
1077
1077
|
if (!i || !e) return;
|
|
1078
|
-
const u = (
|
|
1079
|
-
if (
|
|
1080
|
-
const v = i.filter((
|
|
1081
|
-
v.length === 0 ? i.push(
|
|
1078
|
+
const u = (l == null ? void 0 : l.id) || (n == null ? void 0 : n.get("id"));
|
|
1079
|
+
if (l) {
|
|
1080
|
+
const v = i.filter((L) => L.id === u);
|
|
1081
|
+
v.length === 0 ? i.push(l) : l = v[0];
|
|
1082
1082
|
}
|
|
1083
|
-
|
|
1083
|
+
m(), N(!0), D(i), k();
|
|
1084
1084
|
}, P = (i) => {
|
|
1085
|
-
var
|
|
1086
|
-
const u = (
|
|
1085
|
+
var $;
|
|
1086
|
+
const u = (l == null ? void 0 : l.id) || (n == null ? void 0 : n.get("id")), v = I([i == null ? void 0 : i.lon, i == null ? void 0 : i.lat]), L = (($ = y[i.id]) == null ? void 0 : $.blinkColors) || [], S = L[L.length - 1] || i.fill || "#04C900", z = uo(i), Z = new se({
|
|
1087
1087
|
geometry: new ne(v),
|
|
1088
1088
|
// 船舶数据
|
|
1089
1089
|
shipData: i,
|
|
@@ -1097,115 +1097,115 @@ const nt = (e, l) => {
|
|
|
1097
1097
|
// // 闪烁颜色
|
|
1098
1098
|
// blinkingColor: attentionShipsColor[ship.id].blinkColors || '',
|
|
1099
1099
|
// 船舶颜色
|
|
1100
|
-
color:
|
|
1100
|
+
color: S,
|
|
1101
1101
|
// 船艏向的方向
|
|
1102
1102
|
direct: z,
|
|
1103
1103
|
// 高亮
|
|
1104
1104
|
isHighlight: !1
|
|
1105
1105
|
});
|
|
1106
1106
|
return Z.set("clickGeometry", new Bt(v)), Z;
|
|
1107
|
-
},
|
|
1108
|
-
if (!
|
|
1107
|
+
}, k = async () => {
|
|
1108
|
+
if (!l || !e) return;
|
|
1109
1109
|
let u = e.getOverlays().getArray().find((v) => v.get("class") == "ship-overlay-selected");
|
|
1110
1110
|
if (u) {
|
|
1111
|
-
const v = dt(e,
|
|
1112
|
-
await u.setElement(v), await u.setPosition(I([
|
|
1111
|
+
const v = dt(e, l);
|
|
1112
|
+
await u.setElement(v), await u.setPosition(I([l.lon, l.lat]));
|
|
1113
1113
|
} else
|
|
1114
|
-
u = fo(e,
|
|
1114
|
+
u = fo(e, l), u && e.addOverlay(u);
|
|
1115
1115
|
setTimeout(() => {
|
|
1116
1116
|
var v;
|
|
1117
1117
|
u && ((v = u.get("element")) != null && v.parentElement) && (u.get("element").parentElement.style.display = "block");
|
|
1118
1118
|
}, 20);
|
|
1119
|
-
},
|
|
1119
|
+
}, x = (i) => {
|
|
1120
1120
|
if (i === "start") {
|
|
1121
1121
|
const u = () => {
|
|
1122
|
-
s.getFeatures().forEach((
|
|
1123
|
-
|
|
1122
|
+
s.getFeatures().forEach((p) => {
|
|
1123
|
+
p.setStyle(ye(e, p));
|
|
1124
1124
|
});
|
|
1125
|
-
const
|
|
1126
|
-
if (
|
|
1127
|
-
const
|
|
1128
|
-
console.log("scaleFactor",
|
|
1125
|
+
const L = (e == null ? void 0 : e.getOverlays().getArray()).find((p) => p.get("class") == "ship-overlay-selected");
|
|
1126
|
+
if (L) {
|
|
1127
|
+
const p = L.getElement(), S = je(e, l, "ship");
|
|
1128
|
+
console.log("scaleFactor", S), p.style.transform = `scale(${S})`;
|
|
1129
1129
|
}
|
|
1130
|
-
|
|
1130
|
+
w = requestAnimationFrame(u);
|
|
1131
1131
|
};
|
|
1132
1132
|
u();
|
|
1133
1133
|
} else
|
|
1134
|
-
|
|
1135
|
-
},
|
|
1136
|
-
e && s && (s.clear(), o.clear(),
|
|
1137
|
-
},
|
|
1134
|
+
w && (cancelAnimationFrame(w), w = null);
|
|
1135
|
+
}, m = () => {
|
|
1136
|
+
e && s && (s.clear(), o.clear(), N());
|
|
1137
|
+
}, N = (i) => {
|
|
1138
1138
|
const u = e.getOverlays().getArray().filter((v) => v.get("class") == "zh-map-ship-overlay");
|
|
1139
1139
|
if (u && u.length > 0) {
|
|
1140
1140
|
for (let v = 0; v < u.length; v++)
|
|
1141
1141
|
if (!i && u[v].get("class") !== "ship-overlay-selected") {
|
|
1142
|
-
const
|
|
1143
|
-
|
|
1142
|
+
const L = u[v];
|
|
1143
|
+
L.setPosition(void 0), e.removeOverlay(L), L.dispose();
|
|
1144
1144
|
}
|
|
1145
1145
|
}
|
|
1146
|
-
},
|
|
1147
|
-
|
|
1148
|
-
const v = e.getOverlays().getArray(),
|
|
1149
|
-
for (const
|
|
1150
|
-
const
|
|
1146
|
+
}, C = (i, u) => {
|
|
1147
|
+
r = i, y = u, console.log("attentionShips", r, "attentionShipsColor", u);
|
|
1148
|
+
const v = e.getOverlays().getArray(), L = s.getFeatures();
|
|
1149
|
+
for (const p in r) {
|
|
1150
|
+
const S = r[p], z = v.find(($) => $.getId() === "label-" + p), Z = L.find(($) => p === $.get("id"));
|
|
1151
1151
|
if (z && Z) {
|
|
1152
|
-
const
|
|
1153
|
-
Z.set("blinking",
|
|
1152
|
+
const $ = u[p].blinkColors || [], { shipData: ce, name: oe, color: le } = Z == null ? void 0 : Z.getProperties();
|
|
1153
|
+
Z.set("blinking", S), $[($ == null ? void 0 : $.length) - 1] && le !== $[($ == null ? void 0 : $.length) - 1] && (Z.set("color", $[($ == null ? void 0 : $.length) - 1] || ""), Z.setStyle(ye(e, Z)));
|
|
1154
1154
|
const ze = {
|
|
1155
1155
|
...ce,
|
|
1156
|
-
blinking:
|
|
1157
|
-
blinkingColors:
|
|
1158
|
-
name: oe + "(" + u[
|
|
1156
|
+
blinking: S,
|
|
1157
|
+
blinkingColors: $ || [],
|
|
1158
|
+
name: oe + "(" + u[p].shipState + ")"
|
|
1159
1159
|
}, ke = z.getElement(), pe = ut(ze);
|
|
1160
1160
|
ke && ke !== pe && z.setElement(pe);
|
|
1161
1161
|
}
|
|
1162
1162
|
}
|
|
1163
1163
|
}, b = (i) => {
|
|
1164
1164
|
if (!e) return;
|
|
1165
|
-
const u = s.getFeatures(), v = o.getFeatures(),
|
|
1166
|
-
i.forEach((
|
|
1167
|
-
z.set(
|
|
1165
|
+
const u = s.getFeatures(), v = o.getFeatures(), L = n ? n.get("id") : "", p = u.filter(($) => $.get("id") !== L), S = v == null ? void 0 : v.filter(($) => $.get("id") !== L), z = /* @__PURE__ */ new Map();
|
|
1166
|
+
i.forEach(($) => {
|
|
1167
|
+
z.set($.id, !0);
|
|
1168
1168
|
});
|
|
1169
1169
|
const Z = e.getOverlays().getArray();
|
|
1170
|
-
|
|
1171
|
-
const ce =
|
|
1170
|
+
p.forEach(($) => {
|
|
1171
|
+
const ce = $.get("id");
|
|
1172
1172
|
if (!z.has(ce))
|
|
1173
|
-
|
|
1173
|
+
$.setStyle([]);
|
|
1174
1174
|
else {
|
|
1175
|
-
const le =
|
|
1176
|
-
(le == null ? void 0 : le.length) == 0 &&
|
|
1175
|
+
const le = $.getStyle();
|
|
1176
|
+
(le == null ? void 0 : le.length) == 0 && $.setStyle(ye(e, $));
|
|
1177
1177
|
}
|
|
1178
1178
|
const oe = Z.find((le) => le.getId() === "label-" + ce);
|
|
1179
1179
|
oe && oe.setPosition(void 0);
|
|
1180
|
-
}), console.log(
|
|
1181
|
-
const ce =
|
|
1180
|
+
}), console.log(S), S.forEach(($) => {
|
|
1181
|
+
const ce = $.get("id");
|
|
1182
1182
|
if (!z.has(ce))
|
|
1183
|
-
|
|
1183
|
+
$.setStyle([]);
|
|
1184
1184
|
else {
|
|
1185
|
-
const oe =
|
|
1186
|
-
(oe == null ? void 0 : oe.length) == 0 &&
|
|
1185
|
+
const oe = $.getStyle();
|
|
1186
|
+
(oe == null ? void 0 : oe.length) == 0 && $.setStyle(nt($));
|
|
1187
1187
|
}
|
|
1188
1188
|
});
|
|
1189
|
-
},
|
|
1189
|
+
}, A = (i) => {
|
|
1190
1190
|
if (i) {
|
|
1191
1191
|
console.log("选中", i);
|
|
1192
|
-
const u = s.getFeatures().find((
|
|
1193
|
-
u && (
|
|
1192
|
+
const u = s.getFeatures().find((L) => L.get("id") === i.id), v = o.getFeatures().find((L) => L.get("id") === i.id);
|
|
1193
|
+
u && (n = u), v && v.set("selected", !0), l = i, k();
|
|
1194
1194
|
} else
|
|
1195
|
-
console.log("取消选中"),
|
|
1196
|
-
},
|
|
1195
|
+
console.log("取消选中"), l = null, n = null, X();
|
|
1196
|
+
}, Y = qe((i, u, v) => {
|
|
1197
1197
|
try {
|
|
1198
1198
|
if (i) {
|
|
1199
|
-
const
|
|
1200
|
-
if (e.getTargetElement().style.cursor =
|
|
1201
|
-
t && t !==
|
|
1202
|
-
const
|
|
1203
|
-
|
|
1199
|
+
const L = i.get("shipData"), p = i.get("id");
|
|
1200
|
+
if (e.getTargetElement().style.cursor = p ? "pointer" : "", u === "click" && (A(L), v && v(p)), u === "hover") {
|
|
1201
|
+
t && t !== p && B(), t = p;
|
|
1202
|
+
const S = s.getFeatures().find((z) => z.get("id") === t);
|
|
1203
|
+
S == null || S.set("isHighlight", !0), S == null || S.setStyle(ye(e, S));
|
|
1204
1204
|
}
|
|
1205
1205
|
} else
|
|
1206
1206
|
e.getTargetElement().style.cursor = "", B();
|
|
1207
|
-
} catch (
|
|
1208
|
-
console.log("handleShipMapEvent",
|
|
1207
|
+
} catch (L) {
|
|
1208
|
+
console.log("handleShipMapEvent", L);
|
|
1209
1209
|
}
|
|
1210
1210
|
}, 10), B = () => {
|
|
1211
1211
|
const i = t ? s.getFeatures().find((u) => u.get("id") === t) : null;
|
|
@@ -1218,74 +1218,74 @@ const nt = (e, l) => {
|
|
|
1218
1218
|
console.log(i);
|
|
1219
1219
|
}
|
|
1220
1220
|
}, O = (i, u) => {
|
|
1221
|
-
const v = I([i == null ? void 0 : i.lon, i == null ? void 0 : i.lat]),
|
|
1221
|
+
const v = I([i == null ? void 0 : i.lon, i == null ? void 0 : i.lat]), L = new se({
|
|
1222
1222
|
geometry: new ne(v),
|
|
1223
1223
|
name: i.cnname || i.enname || i.name || i.id || "未命名船舶",
|
|
1224
1224
|
// 图标
|
|
1225
1225
|
rightIcons: rt(i),
|
|
1226
|
-
selected: (i == null ? void 0 : i.id) === (
|
|
1226
|
+
selected: (i == null ? void 0 : i.id) === (l == null ? void 0 : l.id),
|
|
1227
1227
|
shipData: i
|
|
1228
1228
|
});
|
|
1229
|
-
|
|
1230
|
-
const
|
|
1231
|
-
return
|
|
1229
|
+
L.set("id", i.id);
|
|
1230
|
+
const p = nt(L, u);
|
|
1231
|
+
return L.setStyle(p), L;
|
|
1232
1232
|
}, D = (i) => {
|
|
1233
1233
|
const u = e.getView().getZoom();
|
|
1234
1234
|
i.forEach((v) => {
|
|
1235
|
-
const
|
|
1236
|
-
if (
|
|
1237
|
-
if (
|
|
1238
|
-
if (v.id &&
|
|
1239
|
-
const
|
|
1235
|
+
const L = P(v);
|
|
1236
|
+
if (L.setStyle(ye(e, L)), s.addFeature(L), (l == null ? void 0 : l.id) == v.id || u >= ee.shipModelMin)
|
|
1237
|
+
if (r[v.id]) {
|
|
1238
|
+
if (v.id && y[v == null ? void 0 : v.id]) {
|
|
1239
|
+
const p = y[v == null ? void 0 : v.id] || {}, S = (p == null ? void 0 : p.blinkColors) || [], z = (p == null ? void 0 : p.shipState) || "", Z = (v.cnname || v.enname || v.name || v.id || "未命名船舶") + "(" + z + ")", $ = {
|
|
1240
1240
|
...v,
|
|
1241
1241
|
name: Z,
|
|
1242
|
-
blinking:
|
|
1243
|
-
blinkingColors:
|
|
1242
|
+
blinking: r[v.id],
|
|
1243
|
+
blinkingColors: S || []
|
|
1244
1244
|
};
|
|
1245
|
-
vo(e,
|
|
1245
|
+
vo(e, $);
|
|
1246
1246
|
}
|
|
1247
1247
|
} else {
|
|
1248
|
-
const
|
|
1249
|
-
o.addFeature(
|
|
1248
|
+
const p = O(v, i.length);
|
|
1249
|
+
o.addFeature(p);
|
|
1250
1250
|
}
|
|
1251
1251
|
});
|
|
1252
1252
|
};
|
|
1253
1253
|
return {
|
|
1254
1254
|
render: h,
|
|
1255
|
-
selected:
|
|
1255
|
+
selected: A,
|
|
1256
1256
|
filter: b,
|
|
1257
|
-
blinking:
|
|
1258
|
-
clear:
|
|
1259
|
-
handleShipMapEvent:
|
|
1260
|
-
changeShipScale:
|
|
1257
|
+
blinking: C,
|
|
1258
|
+
clear: m,
|
|
1259
|
+
handleShipMapEvent: Y,
|
|
1260
|
+
changeShipScale: x
|
|
1261
1261
|
};
|
|
1262
1262
|
}, xo = (e) => {
|
|
1263
|
-
const
|
|
1264
|
-
|
|
1265
|
-
const
|
|
1266
|
-
|
|
1267
|
-
(
|
|
1263
|
+
const n = () => e == null ? void 0 : e.getLayers(), l = U("vector"), s = () => l.value, a = (t) => {
|
|
1264
|
+
l.value = t;
|
|
1265
|
+
const r = n();
|
|
1266
|
+
r && (r == null || r.getArray().forEach((y) => {
|
|
1267
|
+
(y.className_ === "vector" || y.className_ === "satellite") && y.setVisible(y.className_ === t);
|
|
1268
1268
|
}));
|
|
1269
1269
|
}, o = U(!1);
|
|
1270
1270
|
return {
|
|
1271
|
-
getLayers:
|
|
1271
|
+
getLayers: n,
|
|
1272
1272
|
getGreenTileVisible: () => o.value,
|
|
1273
1273
|
setGreenTileVisible: (t) => {
|
|
1274
1274
|
if (t !== o.value) {
|
|
1275
1275
|
if (t) {
|
|
1276
|
-
const
|
|
1277
|
-
if (!
|
|
1276
|
+
const r = n();
|
|
1277
|
+
if (!r.getArray().find((h) => h.className_ === "greenTile")) {
|
|
1278
1278
|
const h = new he({
|
|
1279
1279
|
source: new me({ url: de.greenTile }),
|
|
1280
1280
|
visible: t,
|
|
1281
1281
|
zIndex: 2,
|
|
1282
1282
|
className: "greenTile"
|
|
1283
1283
|
});
|
|
1284
|
-
|
|
1284
|
+
r.push(h);
|
|
1285
1285
|
}
|
|
1286
1286
|
} else {
|
|
1287
|
-
const
|
|
1288
|
-
|
|
1287
|
+
const r = n(), y = r.getArray().find((h) => h.className_ === "greenTile");
|
|
1288
|
+
y && r.remove(y);
|
|
1289
1289
|
}
|
|
1290
1290
|
o.value = t;
|
|
1291
1291
|
}
|
|
@@ -1302,36 +1302,36 @@ const nt = (e, l) => {
|
|
|
1302
1302
|
getProps: () => e.value
|
|
1303
1303
|
};
|
|
1304
1304
|
}, ko = (e) => {
|
|
1305
|
-
const
|
|
1306
|
-
let
|
|
1307
|
-
const f = (
|
|
1308
|
-
if (!(!
|
|
1305
|
+
const n = "zh-map-location-layer";
|
|
1306
|
+
let l, s, a = null, o = null;
|
|
1307
|
+
const f = (x) => {
|
|
1308
|
+
if (!(!x || x.length === 0)) {
|
|
1309
1309
|
if (s || (s = new ae()), s.clear(), o) {
|
|
1310
|
-
const
|
|
1311
|
-
|
|
1310
|
+
const m = x.find((N) => N.id === o.id);
|
|
1311
|
+
m ? o = m : x.push(o);
|
|
1312
1312
|
}
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
}),
|
|
1316
|
-
className:
|
|
1313
|
+
x.forEach((m) => {
|
|
1314
|
+
w(m);
|
|
1315
|
+
}), l || (l = new ve({
|
|
1316
|
+
className: n,
|
|
1317
1317
|
source: s,
|
|
1318
1318
|
zIndex: 100
|
|
1319
|
-
}), e == null || e.addLayer(
|
|
1319
|
+
}), e == null || e.addLayer(l));
|
|
1320
1320
|
}
|
|
1321
|
-
},
|
|
1322
|
-
const
|
|
1323
|
-
geometry: new ne(I([Number(
|
|
1321
|
+
}, w = (x) => {
|
|
1322
|
+
const m = e == null ? void 0 : e.getView().getZoom(), [N, C] = x.latLon.split(","), b = new se({
|
|
1323
|
+
geometry: new ne(I([Number(N), Number(C)]))
|
|
1324
1324
|
});
|
|
1325
|
-
b.setStyle(t(
|
|
1326
|
-
}, t = (
|
|
1327
|
-
const
|
|
1325
|
+
b.setStyle(t(x, m, x.id === (o == null ? void 0 : o.id))), b.set("loactionData", x), s.addFeature(b);
|
|
1326
|
+
}, t = (x, m, N) => {
|
|
1327
|
+
const C = {
|
|
1328
1328
|
image: new be({
|
|
1329
|
-
src:
|
|
1330
|
-
scale: 0.5 *
|
|
1329
|
+
src: N && x.selectedPath || x.defaultPath,
|
|
1330
|
+
scale: 0.5 * m / 10
|
|
1331
1331
|
})
|
|
1332
1332
|
};
|
|
1333
|
-
return
|
|
1334
|
-
text:
|
|
1333
|
+
return x.name && (C.text = new ue({
|
|
1334
|
+
text: x.name,
|
|
1335
1335
|
font: "12px sans-serif",
|
|
1336
1336
|
fill: new Q({
|
|
1337
1337
|
color: "#000000"
|
|
@@ -1340,63 +1340,63 @@ const nt = (e, l) => {
|
|
|
1340
1340
|
color: "#FFFFFF"
|
|
1341
1341
|
}),
|
|
1342
1342
|
offsetY: 30
|
|
1343
|
-
})), new H(
|
|
1344
|
-
},
|
|
1343
|
+
})), new H(C);
|
|
1344
|
+
}, r = () => {
|
|
1345
1345
|
if (a) {
|
|
1346
|
-
const
|
|
1347
|
-
s.getFeatures().forEach((
|
|
1348
|
-
|
|
1346
|
+
const x = a.get("loactionData").id;
|
|
1347
|
+
s.getFeatures().forEach((m) => {
|
|
1348
|
+
m.get("loactionData").id !== x && s.removeFeature(m);
|
|
1349
1349
|
});
|
|
1350
1350
|
} else
|
|
1351
1351
|
s.clear();
|
|
1352
|
-
},
|
|
1353
|
-
var
|
|
1354
|
-
const
|
|
1352
|
+
}, y = () => {
|
|
1353
|
+
var C;
|
|
1354
|
+
const x = a.get("loactionData"), m = (C = e == null ? void 0 : e.getView()) == null ? void 0 : C.getZoom();
|
|
1355
1355
|
s.getFeatures().forEach((b) => {
|
|
1356
|
-
b.get("loactionData").id ===
|
|
1356
|
+
b.get("loactionData").id === x.id && (b == null || b.setStyle(t(x, m, !1)));
|
|
1357
1357
|
}), o = null, a = null;
|
|
1358
|
-
}, h = (
|
|
1359
|
-
|
|
1358
|
+
}, h = (x) => {
|
|
1359
|
+
x ? (P(), k(x)) : clearSelectedPort();
|
|
1360
1360
|
}, P = () => {
|
|
1361
|
-
var
|
|
1361
|
+
var x;
|
|
1362
1362
|
if (a) {
|
|
1363
|
-
const
|
|
1364
|
-
a.setStyle(t(
|
|
1363
|
+
const m = a.get("loactionData"), N = (x = e == null ? void 0 : e.getView()) == null ? void 0 : x.getZoom();
|
|
1364
|
+
a.setStyle(t(m, N, !1));
|
|
1365
1365
|
}
|
|
1366
|
-
},
|
|
1367
|
-
const
|
|
1368
|
-
o =
|
|
1366
|
+
}, k = (x) => {
|
|
1367
|
+
const m = s.getFeatures();
|
|
1368
|
+
o = x, a = m.find((N) => N.get("loactionData").id === x.id);
|
|
1369
1369
|
};
|
|
1370
1370
|
return {
|
|
1371
1371
|
render: f,
|
|
1372
1372
|
selected: h,
|
|
1373
|
-
clearSelected:
|
|
1374
|
-
clear:
|
|
1373
|
+
clearSelected: y,
|
|
1374
|
+
clear: r
|
|
1375
1375
|
};
|
|
1376
1376
|
}, po = (e) => {
|
|
1377
|
-
e.getInteractions().forEach((
|
|
1378
|
-
|
|
1377
|
+
e.getInteractions().forEach((n) => {
|
|
1378
|
+
n instanceof st && n.setActive(!1);
|
|
1379
1379
|
});
|
|
1380
1380
|
}, Mo = (e) => {
|
|
1381
|
-
e.getInteractions().forEach((
|
|
1382
|
-
|
|
1381
|
+
e.getInteractions().forEach((n) => {
|
|
1382
|
+
n instanceof st && n.setActive(!0);
|
|
1383
1383
|
});
|
|
1384
|
-
},
|
|
1385
|
-
const
|
|
1386
|
-
|
|
1387
|
-
}, Co = (e,
|
|
1388
|
-
const
|
|
1384
|
+
}, $e = (e, n) => {
|
|
1385
|
+
const l = e.getViewport();
|
|
1386
|
+
l && (l.style.cursor = n);
|
|
1387
|
+
}, Co = (e, n) => {
|
|
1388
|
+
const l = U([]), s = U("km"), a = (i) => {
|
|
1389
1389
|
s.value = i;
|
|
1390
1390
|
};
|
|
1391
1391
|
let o;
|
|
1392
|
-
const f = U(!1),
|
|
1393
|
-
|
|
1392
|
+
const f = U(!1), w = () => {
|
|
1393
|
+
$e(e, "crosshair"), y(), po(e), e.on("pointermove", k), e.getViewport().addEventListener("mouseout", () => {
|
|
1394
1394
|
o && o.classList.add("hidden");
|
|
1395
|
-
}),
|
|
1395
|
+
}), m(), f.value = !0;
|
|
1396
1396
|
};
|
|
1397
|
-
let t,
|
|
1398
|
-
const
|
|
1399
|
-
t = new ae(),
|
|
1397
|
+
let t, r;
|
|
1398
|
+
const y = () => {
|
|
1399
|
+
t = new ae(), r = new ve({
|
|
1400
1400
|
source: t,
|
|
1401
1401
|
zIndex: 1e3,
|
|
1402
1402
|
style: {
|
|
@@ -1406,18 +1406,18 @@ const nt = (e, l) => {
|
|
|
1406
1406
|
"circle-radius": 7,
|
|
1407
1407
|
"circle-fill-color": "#ffcc33"
|
|
1408
1408
|
}
|
|
1409
|
-
}), e == null || e.addLayer(
|
|
1409
|
+
}), e == null || e.addLayer(r);
|
|
1410
1410
|
};
|
|
1411
1411
|
let h, P;
|
|
1412
|
-
const
|
|
1412
|
+
const k = (i) => {
|
|
1413
1413
|
if (i.dragging)
|
|
1414
1414
|
return;
|
|
1415
1415
|
let u = "点击选择起点";
|
|
1416
1416
|
h && (u = "单击继续,双击结束"), o && (o.innerHTML = u, P.setPosition(i.coordinate), o.classList.remove("hidden"));
|
|
1417
1417
|
};
|
|
1418
|
-
let
|
|
1419
|
-
const
|
|
1420
|
-
|
|
1418
|
+
let x;
|
|
1419
|
+
const m = () => {
|
|
1420
|
+
x = new Ne({
|
|
1421
1421
|
source: t,
|
|
1422
1422
|
type: "LineString",
|
|
1423
1423
|
style: new H({
|
|
@@ -1441,85 +1441,85 @@ const nt = (e, l) => {
|
|
|
1441
1441
|
}),
|
|
1442
1442
|
// 添加条件函数,判断是否应该出发点绘制
|
|
1443
1443
|
condition: (u) => u.originalEvent.target.tagName !== "DIV"
|
|
1444
|
-
}), e == null || e.addInteraction(
|
|
1444
|
+
}), e == null || e.addInteraction(x), A(), Y();
|
|
1445
1445
|
let i;
|
|
1446
|
-
|
|
1447
|
-
var
|
|
1448
|
-
h = u.feature, h.set("randomId",
|
|
1446
|
+
x.on("drawstart", function(u) {
|
|
1447
|
+
var L;
|
|
1448
|
+
h = u.feature, h.set("randomId", N());
|
|
1449
1449
|
let v;
|
|
1450
|
-
i = (
|
|
1451
|
-
const
|
|
1452
|
-
v =
|
|
1450
|
+
i = (L = h.getGeometry()) == null ? void 0 : L.on("change", function(p) {
|
|
1451
|
+
const S = p.target, z = gt(S, s.value);
|
|
1452
|
+
v = S.getLastCoordinate(), C && z && (C.innerHTML = z), b.setPosition(v);
|
|
1453
1453
|
});
|
|
1454
|
-
}),
|
|
1455
|
-
var u, v,
|
|
1456
|
-
if (
|
|
1457
|
-
const
|
|
1458
|
-
|
|
1454
|
+
}), x.on("drawend", function() {
|
|
1455
|
+
var u, v, L;
|
|
1456
|
+
if (C && (C.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), C != null && C.innerHTML) {
|
|
1457
|
+
const p = (h == null ? void 0 : h.get("randomId")) || N();
|
|
1458
|
+
l.value.push({ id: p, value: C == null ? void 0 : C.innerHTML }), C.innerHTML = `${C.innerHTML}<div class="ol-tooltip-delete-button" data-id="${p}"><i class="map-iconfont icon-delete"></i></div>`;
|
|
1459
1459
|
}
|
|
1460
|
-
(u = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || u.addEventListener("click", (
|
|
1460
|
+
(u = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || u.addEventListener("click", (p) => {
|
|
1461
1461
|
var z;
|
|
1462
|
-
|
|
1463
|
-
const
|
|
1464
|
-
|
|
1465
|
-
}), b.setOffset([0, -7]), h = null,
|
|
1462
|
+
p.preventDefault(), p.stopPropagation();
|
|
1463
|
+
const S = (z = p.target) == null ? void 0 : z.getAttribute("data-id");
|
|
1464
|
+
S && X(S);
|
|
1465
|
+
}), b.setOffset([0, -7]), h = null, C = null, A(), i && Ge(i), (L = (v = n.getProps()) == null ? void 0 : v.lineDrawEnd) == null || L.call(v, l.value);
|
|
1466
1466
|
});
|
|
1467
|
-
},
|
|
1468
|
-
let
|
|
1469
|
-
const
|
|
1470
|
-
|
|
1471
|
-
element:
|
|
1467
|
+
}, N = () => Math.random().toString(36).substring(2, 9);
|
|
1468
|
+
let C, b;
|
|
1469
|
+
const A = () => {
|
|
1470
|
+
C != null && C.parentNode && C.parentNode.removeChild(C), C = document.createElement("div"), C.className = "ol-tooltip ol-tooltip-measure", b = new ie({
|
|
1471
|
+
element: C,
|
|
1472
1472
|
offset: [0, -15],
|
|
1473
1473
|
positioning: "bottom-center",
|
|
1474
1474
|
stopEvent: !1,
|
|
1475
1475
|
insertFirst: !1
|
|
1476
1476
|
}), e == null || e.addOverlay(b);
|
|
1477
|
-
},
|
|
1477
|
+
}, Y = () => {
|
|
1478
1478
|
o != null && o.parentNode && o.parentNode.removeChild(o), o = document.createElement("div"), o.className = "ol-tooltip hidden", P = new ie({
|
|
1479
1479
|
element: o,
|
|
1480
1480
|
offset: [15, 0],
|
|
1481
1481
|
positioning: "center-left"
|
|
1482
1482
|
}), e == null || e.addOverlay(P);
|
|
1483
1483
|
}, B = () => {
|
|
1484
|
-
|
|
1485
|
-
var
|
|
1484
|
+
l.value.forEach((i, u) => {
|
|
1485
|
+
var p, S;
|
|
1486
1486
|
const v = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1487
|
-
v[u] && ((
|
|
1488
|
-
const
|
|
1489
|
-
|
|
1490
|
-
}), O(), Mo(e), f.value = !1,
|
|
1487
|
+
v[u] && ((S = (p = v[u]) == null ? void 0 : p.parentNode) == null || S.removeChild(v[u]));
|
|
1488
|
+
const L = t.getFeatures();
|
|
1489
|
+
L[u] && t.removeFeature(L[u]);
|
|
1490
|
+
}), O(), Mo(e), f.value = !1, $e(e, "pointer");
|
|
1491
1491
|
}, X = (i) => {
|
|
1492
|
-
var v,
|
|
1493
|
-
const u =
|
|
1492
|
+
var v, L, p, S;
|
|
1493
|
+
const u = l.value.findIndex((z) => z.id === i);
|
|
1494
1494
|
if (u !== -1) {
|
|
1495
|
-
|
|
1495
|
+
l.value.splice(u, 1);
|
|
1496
1496
|
const z = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1497
|
-
z[u] && ((
|
|
1497
|
+
z[u] && ((L = (v = z[u]) == null ? void 0 : v.parentNode) == null || L.removeChild(z[u]));
|
|
1498
1498
|
const Z = t.getFeatures();
|
|
1499
1499
|
Z[u] && t.removeFeature(Z[u]);
|
|
1500
1500
|
}
|
|
1501
|
-
(
|
|
1501
|
+
(S = (p = n.getProps()) == null ? void 0 : p.lineDrawEnd) == null || S.call(p, l.value);
|
|
1502
1502
|
}, O = () => {
|
|
1503
|
-
if (
|
|
1503
|
+
if (l.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((i) => {
|
|
1504
1504
|
var u;
|
|
1505
1505
|
(u = i == null ? void 0 : i.parentNode) == null || u.removeChild(i);
|
|
1506
|
-
}), t.clear(),
|
|
1507
|
-
const i = e.getInteractions().getArray().find((u) => et(u) === et(
|
|
1506
|
+
}), t.clear(), x) {
|
|
1507
|
+
const i = e.getInteractions().getArray().find((u) => et(u) === et(x));
|
|
1508
1508
|
i && e.removeInteraction(i);
|
|
1509
1509
|
}
|
|
1510
|
-
e.removeLayer(
|
|
1510
|
+
e.removeLayer(r), o != null && o.parentNode && o.parentNode.removeChild(o), C != null && C.parentNode && C.parentNode.removeChild(C);
|
|
1511
1511
|
};
|
|
1512
1512
|
return {
|
|
1513
|
-
open:
|
|
1513
|
+
open: w,
|
|
1514
1514
|
close: B,
|
|
1515
1515
|
deleteLine: X,
|
|
1516
1516
|
setUnit: a,
|
|
1517
1517
|
getState: () => f.value
|
|
1518
1518
|
};
|
|
1519
|
-
}, gt = (e,
|
|
1519
|
+
}, gt = (e, n) => {
|
|
1520
1520
|
const s = Be(e);
|
|
1521
1521
|
let a = "";
|
|
1522
|
-
switch (
|
|
1522
|
+
switch (n) {
|
|
1523
1523
|
case "m":
|
|
1524
1524
|
a = `${Math.round(s * 100) / 100} m`;
|
|
1525
1525
|
break;
|
|
@@ -1531,16 +1531,16 @@ const nt = (e, l) => {
|
|
|
1531
1531
|
break;
|
|
1532
1532
|
}
|
|
1533
1533
|
return a;
|
|
1534
|
-
}, Lo = (e,
|
|
1535
|
-
let
|
|
1534
|
+
}, Lo = (e, n) => {
|
|
1535
|
+
let l, s;
|
|
1536
1536
|
const a = () => {
|
|
1537
|
-
o(),
|
|
1537
|
+
o(), $e(e, "crosshair");
|
|
1538
1538
|
}, o = () => {
|
|
1539
|
-
t(),
|
|
1539
|
+
t(), C(), Y(), k();
|
|
1540
1540
|
};
|
|
1541
|
-
let f = null,
|
|
1541
|
+
let f = null, w = null;
|
|
1542
1542
|
const t = () => {
|
|
1543
|
-
if (f &&
|
|
1543
|
+
if (f && w) return;
|
|
1544
1544
|
const O = new ae(), D = new ve({
|
|
1545
1545
|
source: O,
|
|
1546
1546
|
style: new H({
|
|
@@ -1550,45 +1550,45 @@ const nt = (e, l) => {
|
|
|
1550
1550
|
})
|
|
1551
1551
|
})
|
|
1552
1552
|
});
|
|
1553
|
-
f = D,
|
|
1553
|
+
f = D, w = O, e.on("pointermove", y), e.addLayer(D), e.on(["dblclick"], function(i) {
|
|
1554
1554
|
h && (i.stopPropagation(), i.preventDefault());
|
|
1555
1555
|
});
|
|
1556
1556
|
};
|
|
1557
|
-
let
|
|
1558
|
-
const
|
|
1557
|
+
let r;
|
|
1558
|
+
const y = (O) => {
|
|
1559
1559
|
if (O.dragging) return;
|
|
1560
|
-
const D =
|
|
1561
|
-
b && (b.innerHTML = D,
|
|
1560
|
+
const D = r ? "单击继续,双击结束" : "点击选择起点";
|
|
1561
|
+
b && (b.innerHTML = D, A.setPosition(O.coordinate));
|
|
1562
1562
|
};
|
|
1563
1563
|
let h, P = !1;
|
|
1564
|
-
const
|
|
1565
|
-
if (
|
|
1564
|
+
const k = () => {
|
|
1565
|
+
if (l) {
|
|
1566
1566
|
b != null && b.parentNode && b.parentNode.removeChild(b);
|
|
1567
|
-
const O =
|
|
1567
|
+
const O = l.getGeometry();
|
|
1568
1568
|
if (!O) return;
|
|
1569
|
-
const D =
|
|
1570
|
-
|
|
1569
|
+
const D = x(O, "nm");
|
|
1570
|
+
m && (m.innerHTML = `
|
|
1571
1571
|
<span class="text">面积:${D}${P ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1572
|
-
`),
|
|
1572
|
+
`), m && (m.innerHTML += '<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');
|
|
1573
1573
|
const i = O.getCoordinates(), u = i[0][i[0].length - 2];
|
|
1574
|
-
if (
|
|
1575
|
-
const
|
|
1576
|
-
|
|
1574
|
+
if (N.setPosition(u), f) {
|
|
1575
|
+
const L = f.getSource();
|
|
1576
|
+
L && l && (L.clear(), L.addFeature(l));
|
|
1577
1577
|
}
|
|
1578
1578
|
setTimeout(() => {
|
|
1579
|
-
var
|
|
1580
|
-
(
|
|
1581
|
-
var
|
|
1582
|
-
console.log("delete"), B(), (
|
|
1579
|
+
var L;
|
|
1580
|
+
(L = document.querySelector(".delete-icon")) == null || L.addEventListener("click", () => {
|
|
1581
|
+
var p, S;
|
|
1582
|
+
console.log("delete"), B(), (S = (p = n.getProps()) == null ? void 0 : p.areaDrawEnd) == null || S.call(p, []);
|
|
1583
1583
|
});
|
|
1584
1584
|
}, 0);
|
|
1585
|
-
const v = Ht(
|
|
1585
|
+
const v = Ht(l.getGeometry().getExtent());
|
|
1586
1586
|
e == null || e.getView().setCenter(v);
|
|
1587
1587
|
return;
|
|
1588
1588
|
}
|
|
1589
1589
|
h = new Ne({
|
|
1590
1590
|
type: "Polygon",
|
|
1591
|
-
source:
|
|
1591
|
+
source: w,
|
|
1592
1592
|
trace: !0,
|
|
1593
1593
|
style: [new H({
|
|
1594
1594
|
stroke: new fe({
|
|
@@ -1613,11 +1613,11 @@ const nt = (e, l) => {
|
|
|
1613
1613
|
})]
|
|
1614
1614
|
}), e == null || e.addInteraction(h), h.on("drawstart", (O) => {
|
|
1615
1615
|
var D;
|
|
1616
|
-
|
|
1617
|
-
const u = i.target, v =
|
|
1618
|
-
if (P = Number(Be(
|
|
1616
|
+
r = O.feature, s = (D = r.getGeometry()) == null ? void 0 : D.on("change", (i) => {
|
|
1617
|
+
const u = i.target, v = x(u, "nm"), p = u.getCoordinates()[0], S = new Pe([p[p.length - 2], p[p.length - 1]]), z = gt(S, "nm");
|
|
1618
|
+
if (P = Number(Be(S) / 1e3) > 150, !v) return;
|
|
1619
1619
|
const Z = '<span class="error pl-4">超出可以绘画的距离</span>';
|
|
1620
|
-
|
|
1620
|
+
m && (m.innerHTML = `
|
|
1621
1621
|
<div class="text">
|
|
1622
1622
|
面积:${v}
|
|
1623
1623
|
${P ? Z : ""}
|
|
@@ -1627,7 +1627,7 @@ const nt = (e, l) => {
|
|
|
1627
1627
|
面积:${v}
|
|
1628
1628
|
</div>
|
|
1629
1629
|
<div class="text ${P ? "error" : ""}">
|
|
1630
|
-
线段 ${
|
|
1630
|
+
线段 ${p.length - 2}: ${z}
|
|
1631
1631
|
${P ? Z : ""}
|
|
1632
1632
|
|
|
1633
1633
|
</div>
|
|
@@ -1637,22 +1637,22 @@ const nt = (e, l) => {
|
|
|
1637
1637
|
`);
|
|
1638
1638
|
});
|
|
1639
1639
|
}), h.on("drawend", (O) => {
|
|
1640
|
-
var v,
|
|
1640
|
+
var v, L, p, S;
|
|
1641
1641
|
if (!O.feature.getGeometry()) return;
|
|
1642
|
-
|
|
1642
|
+
l = O.feature, m && (m.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), N.setOffset([10, 0]);
|
|
1643
1643
|
const i = O.feature.getGeometry().getCoordinates(), u = i[0][i[0].length - 2];
|
|
1644
|
-
if (
|
|
1644
|
+
if (N.setPosition(u), b != null && b.parentNode && b.parentNode.removeChild(b), (v = n.getProps()) != null && v.areaDrawEnd) {
|
|
1645
1645
|
const z = i[0].map((Z) => xe(Z, J.mercator, J.data));
|
|
1646
|
-
(
|
|
1646
|
+
(p = (L = n.getProps()) == null ? void 0 : L.areaDrawEnd) == null || p.call(L, z);
|
|
1647
1647
|
}
|
|
1648
1648
|
h && (h.setActive(!1), e == null || e.removeInteraction(h), (e == null ? void 0 : e.getInteractions()).forEach((Z) => {
|
|
1649
1649
|
Z instanceof Ne && (Z.setActive(!1), e == null || e.removeInteraction(Z));
|
|
1650
|
-
})), s && Ge(s), (
|
|
1650
|
+
})), s && Ge(s), (S = document.querySelector(".delete-icon")) == null || S.addEventListener("click", () => {
|
|
1651
1651
|
var z, Z;
|
|
1652
|
-
B(), (Z = (z =
|
|
1652
|
+
B(), (Z = (z = n.getProps()) == null ? void 0 : z.areaDrawEnd) == null || Z.call(z, []);
|
|
1653
1653
|
});
|
|
1654
1654
|
});
|
|
1655
|
-
},
|
|
1655
|
+
}, x = (O, D) => {
|
|
1656
1656
|
const i = qt(O);
|
|
1657
1657
|
switch (D) {
|
|
1658
1658
|
case "km":
|
|
@@ -1661,64 +1661,64 @@ const nt = (e, l) => {
|
|
|
1661
1661
|
return i > 1e4 ? Math.round(i / 1e6 / Math.pow(1.852, 2) * 100) / 100 + " nm<sup>2</sup>" : Math.round(i * 100) / 100 + " m<sup>2</sup>";
|
|
1662
1662
|
}
|
|
1663
1663
|
};
|
|
1664
|
-
let
|
|
1665
|
-
const
|
|
1666
|
-
|
|
1667
|
-
element:
|
|
1664
|
+
let m, N;
|
|
1665
|
+
const C = () => {
|
|
1666
|
+
m != null && m.parentNode && m.parentNode.removeChild(m), m = document.createElement("div"), m.style.display = "flex", m.className = "ol-tooltip ol-tooltip-draw-polygon", N = new ie({
|
|
1667
|
+
element: m,
|
|
1668
1668
|
offset: [0, -15],
|
|
1669
1669
|
positioning: "bottom-center",
|
|
1670
1670
|
stopEvent: !1,
|
|
1671
1671
|
insertFirst: !1
|
|
1672
|
-
}), e == null || e.addOverlay(
|
|
1672
|
+
}), e == null || e.addOverlay(N);
|
|
1673
1673
|
};
|
|
1674
|
-
let b,
|
|
1675
|
-
const
|
|
1676
|
-
b != null && b.parentNode && b.parentNode.removeChild(b), b = document.createElement("div"), b.className = "ol-tooltip ol-help-tooltip",
|
|
1674
|
+
let b, A;
|
|
1675
|
+
const Y = () => {
|
|
1676
|
+
b != null && b.parentNode && b.parentNode.removeChild(b), b = document.createElement("div"), b.className = "ol-tooltip ol-help-tooltip", A = new ie({
|
|
1677
1677
|
element: b,
|
|
1678
1678
|
offset: [15, 0],
|
|
1679
1679
|
positioning: "center-left"
|
|
1680
|
-
}), e == null || e.addOverlay(
|
|
1680
|
+
}), e == null || e.addOverlay(A);
|
|
1681
1681
|
}, B = () => {
|
|
1682
|
-
|
|
1682
|
+
w == null || w.clear(), l = null, C(), Y(), k();
|
|
1683
1683
|
};
|
|
1684
1684
|
return {
|
|
1685
1685
|
open: a,
|
|
1686
1686
|
close: () => {
|
|
1687
|
-
|
|
1687
|
+
w == null || w.clear(), w = null, f && (e.removeLayer(f), f = null), r = null, h && (h.setActive(!1), (e == null ? void 0 : e.getInteractions()).forEach((D) => {
|
|
1688
1688
|
D instanceof Ne && (D.setActive(!1), e == null || e.removeInteraction(D));
|
|
1689
|
-
}), h = null), s && Ge(s), b != null && b.parentElement && b.parentElement.removeChild(b),
|
|
1689
|
+
}), h = null), s && Ge(s), b != null && b.parentElement && b.parentElement.removeChild(b), m != null && m.parentElement && m.parentElement.removeChild(m), A && e.removeOverlay(A), N && e.removeOverlay(N), $e(e, "pointer");
|
|
1690
1690
|
},
|
|
1691
1691
|
reset: B
|
|
1692
1692
|
};
|
|
1693
1693
|
}, Eo = "zh-map-port-layer", To = (e) => {
|
|
1694
|
-
const
|
|
1694
|
+
const n = new ae(), l = new ve({
|
|
1695
1695
|
className: Eo,
|
|
1696
|
-
source:
|
|
1696
|
+
source: n,
|
|
1697
1697
|
zIndex: 100
|
|
1698
1698
|
});
|
|
1699
|
-
|
|
1700
|
-
let
|
|
1701
|
-
const
|
|
1702
|
-
if (!(!
|
|
1703
|
-
if (
|
|
1704
|
-
const
|
|
1705
|
-
|
|
1699
|
+
e == null || e.addLayer(l);
|
|
1700
|
+
let s = null, a = null;
|
|
1701
|
+
const o = (k, x = !0) => {
|
|
1702
|
+
if (!(!k || k.length === 0)) {
|
|
1703
|
+
if (n.clear(), a) {
|
|
1704
|
+
const m = k.find((N) => N.id === a.id);
|
|
1705
|
+
m ? a = m : k.push(a);
|
|
1706
1706
|
}
|
|
1707
|
-
|
|
1708
|
-
|
|
1707
|
+
k.forEach((m) => {
|
|
1708
|
+
f(m, x);
|
|
1709
1709
|
});
|
|
1710
1710
|
}
|
|
1711
|
-
},
|
|
1712
|
-
const
|
|
1713
|
-
geometry: new ne(I([Number(
|
|
1714
|
-
portData:
|
|
1715
|
-
select:
|
|
1716
|
-
showTitle:
|
|
1717
|
-
}),
|
|
1718
|
-
console.log("point-styles--------",
|
|
1719
|
-
},
|
|
1720
|
-
const { select:
|
|
1721
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M22.6563 44.9304C22.5453 44.8844 22.4445 44.817 22.3595 44.7321C22.3595 44.7321 9.36986 31.7424 9.32952 31.6913C7.09059 29.0791 5.64794 25.8802 5.17255 22.4736C4.69716 19.0671 5.20896 15.5957 6.64728 12.471C8.08561 9.34625 10.3902 6.69909 13.2878 4.84325C16.1855 2.98741 19.5548 2.00068 22.9965 2C26.4381 1.99932 29.8078 2.98473 32.7062 4.83943C35.6046 6.69414 37.9102 9.34039 39.3498 12.4646C40.7893 15.5888 41.3025 19.0599 40.8284 22.4666C40.3544 25.8734 38.913 29.0729 36.6751 31.686C36.6401 31.737 23.6531 44.7321 23.6531 44.7321C23.5682 44.817 23.4674 44.8844 23.3564 44.9304C23.2454 44.9763 23.1265 45 23.0063 45C22.8862 45 22.7673 44.9763 22.6563 44.9304Z" fill="${
|
|
1711
|
+
}, f = (k, x = !0) => {
|
|
1712
|
+
const [m, N] = k.latLon.split(","), C = new se({
|
|
1713
|
+
geometry: new ne(I([Number(m), Number(N)])),
|
|
1714
|
+
portData: k,
|
|
1715
|
+
select: k.id === (a == null ? void 0 : a.id),
|
|
1716
|
+
showTitle: k.id === (a == null ? void 0 : a.id) || x
|
|
1717
|
+
}), b = w(C);
|
|
1718
|
+
console.log("point-styles--------", b), C.setStyle(b), n.addFeature(C);
|
|
1719
|
+
}, w = (k) => {
|
|
1720
|
+
const { select: x, showTitle: m } = k.getProperties(), N = (Y) => `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1721
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M22.6563 44.9304C22.5453 44.8844 22.4445 44.817 22.3595 44.7321C22.3595 44.7321 9.36986 31.7424 9.32952 31.6913C7.09059 29.0791 5.64794 25.8802 5.17255 22.4736C4.69716 19.0671 5.20896 15.5957 6.64728 12.471C8.08561 9.34625 10.3902 6.69909 13.2878 4.84325C16.1855 2.98741 19.5548 2.00068 22.9965 2C26.4381 1.99932 29.8078 2.98473 32.7062 4.83943C35.6046 6.69414 37.9102 9.34039 39.3498 12.4646C40.7893 15.5888 41.3025 19.0599 40.8284 22.4666C40.3544 25.8734 38.913 29.0729 36.6751 31.686C36.6401 31.737 23.6531 44.7321 23.6531 44.7321C23.5682 44.817 23.4674 44.8844 23.3564 44.9304C23.2454 44.9763 23.1265 45 23.0063 45C22.8862 45 22.7673 44.9763 22.6563 44.9304Z" fill="${Y}"/>
|
|
1722
1722
|
<g clip-path="url(#clip0_10059_122082)">
|
|
1723
1723
|
<path d="M34.8624 22.8687L32.5874 25.6313L33.4812 25.7125C33.4812 25.7125 30.5562 28.0687 27.9562 28.2312C25.3562 28.3937 24.1374 24.9 24.1374 24.9V19.1312H27.6312V17.425H24.2999V15.15C25.7624 14.6625 26.7374 13.2812 26.7374 11.6562C26.7374 9.625 25.1124 8 23.0812 8H22.9999C20.9687 8 19.3437 9.625 19.3437 11.6562C19.3437 13.2812 20.3999 14.6625 21.7812 15.15V17.425H18.4499V19.1312H21.9437V24.9C21.9437 24.9 20.6437 28.3125 18.0437 28.2312C15.4437 28.0687 12.5187 25.7125 12.5187 25.7125L13.4124 25.6313L11.0562 22.8687L10.2437 26.2812L11.2187 26.0375C11.2187 26.0375 13.1687 29.5313 16.1749 30.8313C19.1812 32.2125 22.1874 33.9187 22.8374 34C23.4874 33.9187 26.4937 32.2125 29.4187 30.8313C32.3437 29.45 34.3749 26.0375 34.3749 26.0375L35.3499 26.2812L34.8624 22.8687ZM23.0812 13.6875C21.9437 13.6875 21.0499 12.7937 21.0499 11.6562C21.0499 10.6 21.9437 9.70625 22.9999 9.70625H23.0812C24.1374 9.70625 25.0312 10.6 25.0312 11.6562C25.1124 12.7937 24.1374 13.6875 23.0812 13.6875Z" fill="white"/>
|
|
1724
1724
|
</g>
|
|
@@ -1728,113 +1728,113 @@ const nt = (e, l) => {
|
|
|
1728
1728
|
</clipPath>
|
|
1729
1729
|
</defs>
|
|
1730
1730
|
</svg>
|
|
1731
|
-
`,
|
|
1732
|
-
return !
|
|
1731
|
+
`, C = () => `data:image/svg+xml;utf8,${encodeURIComponent(N(x ? "#FF5733" : "#3370FF"))}`, b = e.getView().getZoom(), A = k.get("portData");
|
|
1732
|
+
return !m && !x ? new H({
|
|
1733
1733
|
image: new be({
|
|
1734
|
-
src:
|
|
1735
|
-
scale: 0.5 *
|
|
1734
|
+
src: C(),
|
|
1735
|
+
scale: 0.5 * b / 10
|
|
1736
1736
|
}),
|
|
1737
|
-
zIndex:
|
|
1738
|
-
}) : (console.log("showTitle",
|
|
1737
|
+
zIndex: x ? 110 : 100
|
|
1738
|
+
}) : (console.log("showTitle", m, A.shortName, "选中", x, b), new H({
|
|
1739
1739
|
text: new ue({
|
|
1740
|
-
text:
|
|
1740
|
+
text: A.shortName,
|
|
1741
1741
|
font: "12px sans-serif",
|
|
1742
1742
|
fill: new Q({
|
|
1743
|
-
color:
|
|
1743
|
+
color: x ? "#ffffff" : "#000000"
|
|
1744
1744
|
}),
|
|
1745
1745
|
backgroundFill: new Q({
|
|
1746
|
-
color:
|
|
1746
|
+
color: x ? "#FF5733" : "#FFFFFF"
|
|
1747
1747
|
}),
|
|
1748
1748
|
offsetY: 30
|
|
1749
1749
|
}),
|
|
1750
1750
|
image: new be({
|
|
1751
|
-
src:
|
|
1752
|
-
scale: 0.5 *
|
|
1751
|
+
src: C(),
|
|
1752
|
+
scale: 0.5 * b / 10
|
|
1753
1753
|
}),
|
|
1754
|
-
zIndex:
|
|
1754
|
+
zIndex: x ? 110 : 100
|
|
1755
1755
|
}));
|
|
1756
|
-
},
|
|
1757
|
-
if (
|
|
1758
|
-
if (
|
|
1756
|
+
}, t = () => {
|
|
1757
|
+
if (n)
|
|
1758
|
+
if (s) {
|
|
1759
1759
|
console.log("清除非选中的港口");
|
|
1760
|
-
const
|
|
1761
|
-
|
|
1762
|
-
|
|
1760
|
+
const k = s.get("portData").id;
|
|
1761
|
+
n.getFeatures().forEach((x) => {
|
|
1762
|
+
x.get("portData").id !== k && n.removeFeature(x);
|
|
1763
1763
|
});
|
|
1764
1764
|
} else
|
|
1765
|
-
console.log("清除所有港口",
|
|
1766
|
-
},
|
|
1767
|
-
if (
|
|
1768
|
-
if (!
|
|
1769
|
-
return
|
|
1770
|
-
(
|
|
1765
|
+
console.log("清除所有港口", n), n == null || n.clear();
|
|
1766
|
+
}, r = (k) => {
|
|
1767
|
+
if (n) {
|
|
1768
|
+
if (!k)
|
|
1769
|
+
return y();
|
|
1770
|
+
(s == null ? void 0 : s.get("portData").id) !== k.id && (y(), h(k));
|
|
1771
1771
|
}
|
|
1772
|
-
},
|
|
1773
|
-
if (
|
|
1774
|
-
const
|
|
1775
|
-
|
|
1776
|
-
|
|
1772
|
+
}, y = () => {
|
|
1773
|
+
if (s) {
|
|
1774
|
+
const k = s == null ? void 0 : s.get("portData");
|
|
1775
|
+
n.getFeatures().forEach((m) => {
|
|
1776
|
+
m.get("portData").id === k.id && (m.setStyle(w(m)), m.set("select", !1), s = null);
|
|
1777
1777
|
});
|
|
1778
1778
|
}
|
|
1779
|
-
},
|
|
1780
|
-
if (!
|
|
1781
|
-
const
|
|
1782
|
-
|
|
1779
|
+
}, h = (k) => {
|
|
1780
|
+
if (!n) return;
|
|
1781
|
+
const x = n.getFeatures();
|
|
1782
|
+
a = k, s = x.find((m) => m.get("portData").id === k.id), s && (s.set("select", !0), s.setStyle(w(s)));
|
|
1783
1783
|
};
|
|
1784
1784
|
return {
|
|
1785
|
-
render:
|
|
1786
|
-
clear:
|
|
1787
|
-
selected:
|
|
1788
|
-
handlePortHover: (
|
|
1789
|
-
const
|
|
1790
|
-
|
|
1785
|
+
render: o,
|
|
1786
|
+
clear: t,
|
|
1787
|
+
selected: r,
|
|
1788
|
+
handlePortHover: (k) => {
|
|
1789
|
+
const x = e == null ? void 0 : e.getTargetElement();
|
|
1790
|
+
k && k.get("portData") && x && (x.style.cursor = "pointer");
|
|
1791
1791
|
}
|
|
1792
1792
|
};
|
|
1793
|
-
}, Fo = (e,
|
|
1793
|
+
}, Fo = (e, n, l, s, a, o) => {
|
|
1794
1794
|
const f = e.getInstall();
|
|
1795
1795
|
f.on("moveend", () => {
|
|
1796
|
-
var
|
|
1796
|
+
var w, t;
|
|
1797
1797
|
try {
|
|
1798
|
-
const
|
|
1799
|
-
(t = (
|
|
1800
|
-
} catch (
|
|
1801
|
-
console.log("moveend---catch",
|
|
1798
|
+
const r = e.getZoom();
|
|
1799
|
+
(t = (w = n.getProps()).mapMoveEnd) == null || t.call(w, r), l.reRenderTrackLine(), r <= ee.shipModelMax && r >= ee.shipTriggleMin && s.changeShipScale("end");
|
|
1800
|
+
} catch (r) {
|
|
1801
|
+
console.log("moveend---catch", r);
|
|
1802
1802
|
}
|
|
1803
|
-
}), f.on("pointermove", (
|
|
1803
|
+
}), f.on("pointermove", (w) => {
|
|
1804
1804
|
try {
|
|
1805
|
-
const t = f == null ? void 0 : f.getEventPixel(
|
|
1805
|
+
const t = f == null ? void 0 : f.getEventPixel(w.originalEvent);
|
|
1806
1806
|
if (!t || !f) return;
|
|
1807
|
-
const
|
|
1808
|
-
layerFilter: (
|
|
1807
|
+
const r = f == null ? void 0 : f.forEachFeatureAtPixel(t, (y) => y, {
|
|
1808
|
+
layerFilter: (y) => y.getVisible()
|
|
1809
1809
|
});
|
|
1810
|
-
s == null || s.handleShipMapEvent(
|
|
1810
|
+
s == null || s.handleShipMapEvent(r, "hover"), l == null || l.handleTrackMapEvent(r, "hover", w), r && (a == null || a.handlePortHover(r));
|
|
1811
1811
|
} catch (t) {
|
|
1812
1812
|
console.log("pointermove---catch", t);
|
|
1813
1813
|
}
|
|
1814
1814
|
}), f.on("movestart", () => {
|
|
1815
1815
|
try {
|
|
1816
|
-
const
|
|
1817
|
-
|
|
1818
|
-
} catch (
|
|
1819
|
-
console.log("movestart---catch",
|
|
1816
|
+
const w = f == null ? void 0 : f.getView().getZoom();
|
|
1817
|
+
w && w <= ee.shipModelMax && w >= ee.shipTriggleMin && s.changeShipScale("start");
|
|
1818
|
+
} catch (w) {
|
|
1819
|
+
console.log("movestart---catch", w);
|
|
1820
1820
|
}
|
|
1821
|
-
}), f.on("click", qe((
|
|
1822
|
-
var t,
|
|
1821
|
+
}), f.on("click", qe((w) => {
|
|
1822
|
+
var t, r, y;
|
|
1823
1823
|
try {
|
|
1824
1824
|
if (console.log("1", o.getState()), o.getState()) return;
|
|
1825
|
-
const h = f.getEventPixel(
|
|
1825
|
+
const h = f.getEventPixel(w.originalEvent), P = f.forEachFeatureAtPixel(
|
|
1826
1826
|
h,
|
|
1827
|
-
(
|
|
1828
|
-
if (
|
|
1829
|
-
return
|
|
1827
|
+
(k) => {
|
|
1828
|
+
if (k != null && k.get("shipData") || k != null && k.get("portData"))
|
|
1829
|
+
return k;
|
|
1830
1830
|
}
|
|
1831
1831
|
);
|
|
1832
1832
|
if (console.log("2", P), !P) return;
|
|
1833
1833
|
if (P.get("shipData"))
|
|
1834
|
-
s.handleShipMapEvent(P, "click", (t =
|
|
1834
|
+
s.handleShipMapEvent(P, "click", (t = n.getProps()) == null ? void 0 : t.selectShip);
|
|
1835
1835
|
else if (P.get("portData")) {
|
|
1836
|
-
const
|
|
1837
|
-
a.selected(
|
|
1836
|
+
const k = P.get("portData");
|
|
1837
|
+
a.selected(k), (y = (r = n.getProps()) == null ? void 0 : r.selectPort) == null || y.call(r, k);
|
|
1838
1838
|
}
|
|
1839
1839
|
} catch (h) {
|
|
1840
1840
|
console.log("click---catch", h);
|
|
@@ -1846,43 +1846,43 @@ const nt = (e, l) => {
|
|
|
1846
1846
|
createInstance: (s, a) => {
|
|
1847
1847
|
const o = to();
|
|
1848
1848
|
o.initMap(s, a);
|
|
1849
|
-
const f = o.getInstall(),
|
|
1850
|
-
t.setProps(a),
|
|
1851
|
-
const
|
|
1852
|
-
Fo(o, t,
|
|
1853
|
-
const
|
|
1854
|
-
const b = f.getView().calculateExtent(o.getSize()),
|
|
1855
|
-
return [
|
|
1856
|
-
},
|
|
1849
|
+
const f = o.getInstall(), w = xo(f), t = bo();
|
|
1850
|
+
t.setProps(a), w.setShowLayerType(a.layerType), w.setGreenTileVisible(a.showGreenLayer);
|
|
1851
|
+
const r = io(f), y = so(f, r), h = wo(f), P = ko(f), k = Co(f, t), x = Lo(f, t), m = To(f);
|
|
1852
|
+
Fo(o, t, r, h, m, k);
|
|
1853
|
+
const N = () => {
|
|
1854
|
+
const b = f.getView().calculateExtent(o.getSize()), A = xe([b[0], b[1]], J.mercator, J.data), Y = xe([b[2], b[3]], J.mercator, J.data);
|
|
1855
|
+
return [A[0], A[1], Y[0], Y[1]];
|
|
1856
|
+
}, C = {
|
|
1857
1857
|
id: Symbol("map-instance"),
|
|
1858
1858
|
innerMap: null,
|
|
1859
1859
|
map: o.getInstall(),
|
|
1860
1860
|
destroy: () => {
|
|
1861
|
-
e.splice(e.indexOf(
|
|
1861
|
+
e.splice(e.indexOf(C), 1);
|
|
1862
1862
|
},
|
|
1863
1863
|
methods: {
|
|
1864
1864
|
...o,
|
|
1865
|
-
layer:
|
|
1865
|
+
layer: w,
|
|
1866
1866
|
ship: h,
|
|
1867
|
-
track:
|
|
1868
|
-
carTrack:
|
|
1867
|
+
track: r,
|
|
1868
|
+
carTrack: y,
|
|
1869
1869
|
port: {
|
|
1870
|
-
render:
|
|
1871
|
-
clear:
|
|
1872
|
-
selected:
|
|
1870
|
+
render: m.render,
|
|
1871
|
+
clear: m.clear,
|
|
1872
|
+
selected: m.selected
|
|
1873
1873
|
},
|
|
1874
1874
|
position: P,
|
|
1875
|
-
drawLine:
|
|
1876
|
-
drawPolygon:
|
|
1875
|
+
drawLine: k,
|
|
1876
|
+
drawPolygon: x,
|
|
1877
1877
|
// 子模块
|
|
1878
1878
|
utils: {
|
|
1879
|
-
getCalculateExtent:
|
|
1879
|
+
getCalculateExtent: N,
|
|
1880
1880
|
convertSixHundredThousandToLatLng: Xe,
|
|
1881
1881
|
calculateCirclePoints: oo
|
|
1882
1882
|
}
|
|
1883
1883
|
}
|
|
1884
1884
|
};
|
|
1885
|
-
return e.push(
|
|
1885
|
+
return e.push(C), C;
|
|
1886
1886
|
},
|
|
1887
1887
|
destroyInstance: (s) => {
|
|
1888
1888
|
const a = e.findIndex((o) => o.id === s);
|
|
@@ -1912,25 +1912,25 @@ const nt = (e, l) => {
|
|
|
1912
1912
|
selectPort: { type: Function, default: () => {
|
|
1913
1913
|
} }
|
|
1914
1914
|
},
|
|
1915
|
-
setup(e, { expose:
|
|
1916
|
-
const
|
|
1915
|
+
setup(e, { expose: n }) {
|
|
1916
|
+
const l = U(), s = U(), a = Po(), o = U(), f = e, w = U({
|
|
1917
1917
|
getInstall() {
|
|
1918
1918
|
}
|
|
1919
1919
|
});
|
|
1920
|
-
return
|
|
1920
|
+
return Vt(() => {
|
|
1921
1921
|
var t;
|
|
1922
|
-
o.value = a.createInstance(
|
|
1923
|
-
}),
|
|
1924
|
-
var t,
|
|
1925
|
-
a.destroyInstance((t = o == null ? void 0 : o.value) == null ? void 0 : t.id), (
|
|
1926
|
-
}),
|
|
1922
|
+
o.value = a.createInstance(l.value, f), w.value = o.value.methods, (t = s.value) == null || t.setScaleLine(o.value.map, f.scaleLineUnit);
|
|
1923
|
+
}), $t(() => {
|
|
1924
|
+
var t, r;
|
|
1925
|
+
a.destroyInstance((t = o == null ? void 0 : o.value) == null ? void 0 : t.id), (r = o.value) == null || r.destroy();
|
|
1926
|
+
}), n({
|
|
1927
1927
|
getZoom: () => {
|
|
1928
1928
|
var t;
|
|
1929
1929
|
return (t = o.value) == null ? void 0 : t.methods.getZoom();
|
|
1930
1930
|
},
|
|
1931
1931
|
setZoom: (t) => {
|
|
1932
|
-
var
|
|
1933
|
-
return (
|
|
1932
|
+
var r;
|
|
1933
|
+
return (r = o.value) == null ? void 0 : r.methods.setZoom(t);
|
|
1934
1934
|
},
|
|
1935
1935
|
getInstall: () => {
|
|
1936
1936
|
var t;
|
|
@@ -1940,22 +1940,22 @@ const nt = (e, l) => {
|
|
|
1940
1940
|
var t;
|
|
1941
1941
|
return (t = o.value) == null ? void 0 : t.methods.getView();
|
|
1942
1942
|
},
|
|
1943
|
-
setCenter: (t,
|
|
1944
|
-
var
|
|
1945
|
-
return (
|
|
1943
|
+
setCenter: (t, r) => {
|
|
1944
|
+
var y;
|
|
1945
|
+
return (y = o.value) == null ? void 0 : y.methods.setCenter(t, r);
|
|
1946
1946
|
},
|
|
1947
1947
|
getSize: () => {
|
|
1948
1948
|
var t;
|
|
1949
1949
|
return (t = o.value) == null ? void 0 : t.methods.getSize();
|
|
1950
1950
|
},
|
|
1951
|
-
getCenter: (t,
|
|
1952
|
-
var
|
|
1953
|
-
return (
|
|
1951
|
+
getCenter: (t, r) => {
|
|
1952
|
+
var y;
|
|
1953
|
+
return (y = o.value) == null ? void 0 : y.methods.getCenter();
|
|
1954
1954
|
},
|
|
1955
1955
|
layer: {
|
|
1956
1956
|
setGreenTileVisible: (t) => {
|
|
1957
|
-
var
|
|
1958
|
-
return (
|
|
1957
|
+
var r;
|
|
1958
|
+
return (r = o.value) == null ? void 0 : r.methods.layer.setGreenTileVisible(t);
|
|
1959
1959
|
},
|
|
1960
1960
|
getGreenTileVisible: () => {
|
|
1961
1961
|
var t;
|
|
@@ -1966,26 +1966,26 @@ const nt = (e, l) => {
|
|
|
1966
1966
|
return (t = o.value) == null ? void 0 : t.methods.layer.getShowLayerType();
|
|
1967
1967
|
},
|
|
1968
1968
|
setShowLayerType: (t) => {
|
|
1969
|
-
var
|
|
1970
|
-
return (
|
|
1969
|
+
var r;
|
|
1970
|
+
return (r = o.value) == null ? void 0 : r.methods.layer.setShowLayerType(t);
|
|
1971
1971
|
}
|
|
1972
1972
|
},
|
|
1973
1973
|
ship: {
|
|
1974
1974
|
render: (...t) => {
|
|
1975
|
-
var
|
|
1976
|
-
return (
|
|
1975
|
+
var r;
|
|
1976
|
+
return (r = o.value) == null ? void 0 : r.methods.ship.render(...t);
|
|
1977
1977
|
},
|
|
1978
1978
|
selected: (...t) => {
|
|
1979
|
-
var
|
|
1980
|
-
return (
|
|
1979
|
+
var r;
|
|
1980
|
+
return (r = o.value) == null ? void 0 : r.methods.ship.selected(...t);
|
|
1981
1981
|
},
|
|
1982
1982
|
filter: (...t) => {
|
|
1983
|
-
var
|
|
1984
|
-
return (
|
|
1983
|
+
var r;
|
|
1984
|
+
return (r = o.value) == null ? void 0 : r.methods.ship.filter(...t);
|
|
1985
1985
|
},
|
|
1986
1986
|
blinking: (...t) => {
|
|
1987
|
-
var
|
|
1988
|
-
return (
|
|
1987
|
+
var r;
|
|
1988
|
+
return (r = o.value) == null ? void 0 : r.methods.ship.blinking(...t);
|
|
1989
1989
|
},
|
|
1990
1990
|
clear: () => {
|
|
1991
1991
|
var t;
|
|
@@ -1994,82 +1994,82 @@ const nt = (e, l) => {
|
|
|
1994
1994
|
},
|
|
1995
1995
|
track: {
|
|
1996
1996
|
render: (...t) => {
|
|
1997
|
-
var
|
|
1998
|
-
return (
|
|
1997
|
+
var r;
|
|
1998
|
+
return (r = o.value) == null ? void 0 : r.methods.track.render(...t);
|
|
1999
1999
|
},
|
|
2000
2000
|
remove: (...t) => {
|
|
2001
|
-
var
|
|
2002
|
-
return (
|
|
2001
|
+
var r;
|
|
2002
|
+
return (r = o.value) == null ? void 0 : r.methods.track.remove(...t);
|
|
2003
2003
|
},
|
|
2004
2004
|
play: (...t) => {
|
|
2005
|
-
var
|
|
2006
|
-
return (
|
|
2005
|
+
var r;
|
|
2006
|
+
return (r = o.value) == null ? void 0 : r.methods.track.play(...t);
|
|
2007
2007
|
},
|
|
2008
2008
|
setCenter: (...t) => {
|
|
2009
|
-
var
|
|
2010
|
-
return (
|
|
2009
|
+
var r;
|
|
2010
|
+
return (r = o.value) == null ? void 0 : r.methods.track.setCenter(...t);
|
|
2011
2011
|
},
|
|
2012
2012
|
close: (...t) => {
|
|
2013
|
-
var
|
|
2014
|
-
return (
|
|
2013
|
+
var r;
|
|
2014
|
+
return (r = o.value) == null ? void 0 : r.methods.track.close(...t);
|
|
2015
2015
|
},
|
|
2016
2016
|
getLength: (...t) => {
|
|
2017
|
-
var
|
|
2018
|
-
return (
|
|
2017
|
+
var r;
|
|
2018
|
+
return (r = o.value) == null ? void 0 : r.methods.track.getLength(...t);
|
|
2019
2019
|
}
|
|
2020
2020
|
},
|
|
2021
2021
|
carTrack: {
|
|
2022
2022
|
location: (...t) => {
|
|
2023
|
-
var
|
|
2024
|
-
return (
|
|
2023
|
+
var r;
|
|
2024
|
+
return (r = o.value) == null ? void 0 : r.methods.carTrack.location(...t);
|
|
2025
2025
|
},
|
|
2026
2026
|
remove: (...t) => {
|
|
2027
|
-
var
|
|
2028
|
-
return (
|
|
2027
|
+
var r;
|
|
2028
|
+
return (r = o.value) == null ? void 0 : r.methods.carTrack.remove(...t);
|
|
2029
2029
|
},
|
|
2030
2030
|
renderTrack: (...t) => {
|
|
2031
|
-
var
|
|
2032
|
-
return (
|
|
2031
|
+
var r;
|
|
2032
|
+
return (r = o.value) == null ? void 0 : r.methods.carTrack.renderTrack(...t);
|
|
2033
2033
|
},
|
|
2034
2034
|
setCenter: (...t) => {
|
|
2035
|
-
var
|
|
2036
|
-
return (
|
|
2035
|
+
var r;
|
|
2036
|
+
return (r = o.value) == null ? void 0 : r.methods.carTrack.setCenter(...t);
|
|
2037
2037
|
},
|
|
2038
2038
|
closeTrack: () => {
|
|
2039
2039
|
var t;
|
|
2040
2040
|
return (t = o.value) == null ? void 0 : t.methods.carTrack.closeTrack();
|
|
2041
2041
|
},
|
|
2042
2042
|
playTrack: (...t) => {
|
|
2043
|
-
var
|
|
2044
|
-
return (
|
|
2043
|
+
var r;
|
|
2044
|
+
return (r = o.value) == null ? void 0 : r.methods.carTrack.playTrack(...t);
|
|
2045
2045
|
}
|
|
2046
2046
|
},
|
|
2047
2047
|
port: {
|
|
2048
|
-
render: (t,
|
|
2049
|
-
var
|
|
2050
|
-
return (
|
|
2048
|
+
render: (t, r) => {
|
|
2049
|
+
var y;
|
|
2050
|
+
return (y = o.value) == null ? void 0 : y.methods.port.render(t, r);
|
|
2051
2051
|
},
|
|
2052
2052
|
clear: () => {
|
|
2053
2053
|
var t;
|
|
2054
2054
|
return (t = o.value) == null ? void 0 : t.methods.port.clear();
|
|
2055
2055
|
},
|
|
2056
2056
|
selected: (t) => {
|
|
2057
|
-
var
|
|
2058
|
-
return (
|
|
2057
|
+
var r;
|
|
2058
|
+
return (r = o.value) == null ? void 0 : r.methods.port.selected(t);
|
|
2059
2059
|
}
|
|
2060
2060
|
},
|
|
2061
2061
|
position: {
|
|
2062
2062
|
render: (...t) => {
|
|
2063
|
-
var
|
|
2064
|
-
return (
|
|
2063
|
+
var r;
|
|
2064
|
+
return (r = o.value) == null ? void 0 : r.methods.position.render(...t);
|
|
2065
2065
|
},
|
|
2066
2066
|
selected: (...t) => {
|
|
2067
|
-
var
|
|
2068
|
-
return (
|
|
2067
|
+
var r;
|
|
2068
|
+
return (r = o.value) == null ? void 0 : r.methods.position.selected(...t);
|
|
2069
2069
|
},
|
|
2070
2070
|
clearSelected: (...t) => {
|
|
2071
|
-
var
|
|
2072
|
-
return (
|
|
2071
|
+
var r;
|
|
2072
|
+
return (r = o.value) == null ? void 0 : r.methods.position.clearSelected(...t);
|
|
2073
2073
|
},
|
|
2074
2074
|
clear: () => {
|
|
2075
2075
|
var t;
|
|
@@ -2086,12 +2086,12 @@ const nt = (e, l) => {
|
|
|
2086
2086
|
return (t = o.value) == null ? void 0 : t.methods.drawLine.close();
|
|
2087
2087
|
},
|
|
2088
2088
|
deleteLine: (t) => {
|
|
2089
|
-
var
|
|
2090
|
-
return (
|
|
2089
|
+
var r;
|
|
2090
|
+
return (r = o.value) == null ? void 0 : r.methods.drawLine.deleteLine(t);
|
|
2091
2091
|
},
|
|
2092
2092
|
setUnit: (t) => {
|
|
2093
|
-
var
|
|
2094
|
-
return (
|
|
2093
|
+
var r;
|
|
2094
|
+
return (r = o.value) == null ? void 0 : r.methods.drawLine.setUnit(t);
|
|
2095
2095
|
},
|
|
2096
2096
|
getState: () => {
|
|
2097
2097
|
var t;
|
|
@@ -2115,23 +2115,23 @@ const nt = (e, l) => {
|
|
|
2115
2115
|
// 子模块
|
|
2116
2116
|
utils: {
|
|
2117
2117
|
getCalculateExtent: (...t) => {
|
|
2118
|
-
var
|
|
2119
|
-
return (
|
|
2118
|
+
var r;
|
|
2119
|
+
return (r = o.value) == null ? void 0 : r.methods.utils.getCalculateExtent(...t);
|
|
2120
2120
|
},
|
|
2121
2121
|
convertSixHundredThousandToLatLng: (...t) => {
|
|
2122
|
-
var
|
|
2123
|
-
return (
|
|
2122
|
+
var r;
|
|
2123
|
+
return (r = o.value) == null ? void 0 : r.methods.utils.convertSixHundredThousandToLatLng(...t);
|
|
2124
2124
|
},
|
|
2125
|
-
calculateCirclePoints: (t,
|
|
2126
|
-
var
|
|
2127
|
-
return (
|
|
2125
|
+
calculateCirclePoints: (t, r) => {
|
|
2126
|
+
var y;
|
|
2127
|
+
return (y = o.value) == null ? void 0 : y.methods.utils.calculateCirclePoints(t, r);
|
|
2128
2128
|
}
|
|
2129
2129
|
}
|
|
2130
|
-
}), (t,
|
|
2130
|
+
}), (t, r) => (We(), Ye("div", No, [
|
|
2131
2131
|
Ze("div", {
|
|
2132
2132
|
id: "map",
|
|
2133
2133
|
ref_key: "zhMapRef",
|
|
2134
|
-
ref:
|
|
2134
|
+
ref: l,
|
|
2135
2135
|
class: "zh-map"
|
|
2136
2136
|
}, null, 512),
|
|
2137
2137
|
De(Kt, {
|
|
@@ -2144,7 +2144,7 @@ const nt = (e, l) => {
|
|
|
2144
2144
|
}, null, 8, ["map-instance"])
|
|
2145
2145
|
]));
|
|
2146
2146
|
}
|
|
2147
|
-
}),
|
|
2147
|
+
}), Vo = /* @__PURE__ */ He(So, [["__scopeId", "data-v-9c5af6bb"]]), Do = jt(Vo);
|
|
2148
2148
|
export {
|
|
2149
2149
|
Do as Z
|
|
2150
2150
|
};
|