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