zhihao-ui 1.3.36 → 1.3.38
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-bFoPIK8W.js → Map-DBGLMSuw.js} +776 -771
- package/dist/es/index.js +1 -1
- package/dist/umd/index.umd.cjs +24 -24
- package/package.json +1 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { defineComponent as Ye, openBlock as Be, createElementBlock as qe, createElementVNode as Ge, ref as
|
|
2
|
-
import { S as $t, M as Ue, T as
|
|
1
|
+
import { defineComponent as Ye, openBlock as Be, createElementBlock as qe, createElementVNode as Ge, ref as U, computed as Fe, h as ne, createVNode as Ae, render as Pt, reactive as St, onMounted as Nt, onUnmounted as Vt } from "vue";
|
|
2
|
+
import { S as $t, M as Ue, T as ye, X as me, p as I, V as zt, q as Ot, t as Rt, h as lt, r as He, s as Zt, u as we, F as ee, v as X, O as ce, P as le, w as ke, x as Ve, L as Se, y as Dt, z as Ie, A as ie, B as he, C as de, D as fe, i as Gt, G as $e, H as At, I as pe, J as Wt, K as Yt, N as st, Q as Ne, R as We, U as et, W as Bt, Y as qt, Z as Ht } from "./vendor-D2mv9LHk.js";
|
|
3
3
|
import { _ as Xe } from "./Button-CGndQwez.js";
|
|
4
4
|
import { w as Xt } from "./utils-D2wHR1YB.js";
|
|
5
5
|
const jt = { id: "scale-line-container" }, Qt = /* @__PURE__ */ Ye({
|
|
6
6
|
__name: "scaleLine",
|
|
7
7
|
setup(e, { expose: r }) {
|
|
8
8
|
return r({
|
|
9
|
-
setScaleLine: (s,
|
|
10
|
-
|
|
9
|
+
setScaleLine: (s, c) => {
|
|
10
|
+
c || (c = "metric");
|
|
11
11
|
const o = new $t({
|
|
12
|
-
units:
|
|
12
|
+
units: c
|
|
13
13
|
}), u = document.getElementById("scale-line-container");
|
|
14
14
|
u && (o.setTarget(u), s.addControl(o));
|
|
15
15
|
}
|
|
16
|
-
}), (s,
|
|
16
|
+
}), (s, c) => (Be(), qe("div", jt));
|
|
17
17
|
}
|
|
18
18
|
}), Jt = /* @__PURE__ */ Xe(Qt, [["__scopeId", "data-v-2bc5dee8"]]), Kt = { class: "zoom" }, _t = /* @__PURE__ */ Ye({
|
|
19
19
|
__name: "zoomControl",
|
|
@@ -28,17 +28,17 @@ const jt = { id: "scale-line-container" }, Qt = /* @__PURE__ */ Ye({
|
|
|
28
28
|
console.log("props", r);
|
|
29
29
|
const l = () => {
|
|
30
30
|
console.log("props");
|
|
31
|
-
const { setZoom:
|
|
31
|
+
const { setZoom: c, getZoom: o, getInstall: u } = r.mapInstance.methods;
|
|
32
32
|
if (!u()) return;
|
|
33
33
|
const t = o();
|
|
34
|
-
t &&
|
|
34
|
+
t && c(t + 1);
|
|
35
35
|
}, s = () => {
|
|
36
|
-
const { setZoom:
|
|
36
|
+
const { setZoom: c, getZoom: o, getInstall: u } = r.mapInstance.methods;
|
|
37
37
|
if (!u()) return;
|
|
38
38
|
const t = o();
|
|
39
|
-
t &&
|
|
39
|
+
t && c(t - 1);
|
|
40
40
|
};
|
|
41
|
-
return (
|
|
41
|
+
return (c, o) => (Be(), qe("div", Kt, [
|
|
42
42
|
Ge("div", {
|
|
43
43
|
class: "button big-button",
|
|
44
44
|
onClick: l
|
|
@@ -49,7 +49,7 @@ const jt = { id: "scale-line-container" }, Qt = /* @__PURE__ */ Ye({
|
|
|
49
49
|
}, " - ")
|
|
50
50
|
]));
|
|
51
51
|
}
|
|
52
|
-
}), Ut = /* @__PURE__ */ Xe(_t, [["__scopeId", "data-v-c39c3075"]]),
|
|
52
|
+
}), Ut = /* @__PURE__ */ Xe(_t, [["__scopeId", "data-v-c39c3075"]]), Pe = "a6e8f78974f2581f2ca00485b40c948f", te = {
|
|
53
53
|
// 地图默认层级
|
|
54
54
|
default: 13,
|
|
55
55
|
// 地图缩放最小层级
|
|
@@ -64,43 +64,43 @@ const jt = { id: "scale-line-container" }, Qt = /* @__PURE__ */ Ye({
|
|
|
64
64
|
shipModelMax: 18,
|
|
65
65
|
//根据原系统canvas图片转换svg长宽比例计算缩放值
|
|
66
66
|
scaleNum: 0.555
|
|
67
|
-
},
|
|
67
|
+
}, J = {
|
|
68
68
|
// 经纬度 源数据 地理坐标 WGS84
|
|
69
69
|
data: "EPSG:4326",
|
|
70
70
|
// 墨卡托投影坐标 渲染坐标
|
|
71
71
|
mercator: "EPSG:3857"
|
|
72
|
-
}, It = [114.84, 30.52], it = "https://static.zhihaoscm.cn/",
|
|
73
|
-
var ue = ((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=${
|
|
72
|
+
}, It = [114.84, 30.52], it = "https://static.zhihaoscm.cn/", ze = 2003750834e-2;
|
|
73
|
+
var ue = ((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=${Pe}`, 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=${Pe}`, 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=${Pe}`, 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=${Pe}`, e.greenTile = `${it}/map/tile/{z}/{x}/{y}.png`, e))(ue || {}), xe = /* @__PURE__ */ ((e) => (e[e.M = 1] = "M", e[e.KM = 2] = "KM", e[e.NM = 3] = "NM", e))(xe || {});
|
|
74
74
|
function eo() {
|
|
75
|
-
const e =
|
|
76
|
-
var
|
|
77
|
-
return (
|
|
78
|
-
},
|
|
75
|
+
const e = U(), r = () => e.value, l = () => r().getView(), s = () => {
|
|
76
|
+
var h;
|
|
77
|
+
return (h = l()) == null ? void 0 : h.getZoom();
|
|
78
|
+
}, c = (h) => {
|
|
79
79
|
var N;
|
|
80
|
-
(N = l()) == null || N.setZoom(
|
|
81
|
-
}, o = (
|
|
82
|
-
var
|
|
83
|
-
(
|
|
80
|
+
(N = l()) == null || N.setZoom(h);
|
|
81
|
+
}, o = (h, N) => {
|
|
82
|
+
var L;
|
|
83
|
+
(L = l()) == null || L.setCenter(I([h, N]));
|
|
84
84
|
}, u = () => {
|
|
85
85
|
var N;
|
|
86
|
-
const
|
|
87
|
-
return Rt(
|
|
88
|
-
},
|
|
89
|
-
var
|
|
90
|
-
return (
|
|
91
|
-
}, t = new Ue(), n = (
|
|
86
|
+
const h = (N = l()) == null ? void 0 : N.getCenter();
|
|
87
|
+
return Rt(h);
|
|
88
|
+
}, y = () => {
|
|
89
|
+
var h;
|
|
90
|
+
return (h = r()) == null ? void 0 : h.getSize();
|
|
91
|
+
}, t = new Ue(), n = (h, N) => {
|
|
92
92
|
m(N);
|
|
93
|
-
const
|
|
93
|
+
const L = {
|
|
94
94
|
zoom: N.zoom,
|
|
95
|
-
center:
|
|
95
|
+
center: I(N.center),
|
|
96
96
|
minZoom: te.min,
|
|
97
97
|
maxZoom: te.max,
|
|
98
98
|
constrainResolution: !0,
|
|
99
99
|
enableRotation: !1,
|
|
100
100
|
multiWorld: !0
|
|
101
101
|
};
|
|
102
|
-
let
|
|
103
|
-
target:
|
|
102
|
+
let v = {
|
|
103
|
+
target: h,
|
|
104
104
|
controls: Ot({
|
|
105
105
|
zoom: !1
|
|
106
106
|
}),
|
|
@@ -110,38 +110,38 @@ function eo() {
|
|
|
110
110
|
t.get("satelliteImgTile"),
|
|
111
111
|
t.get("satelliteImgTileMark")
|
|
112
112
|
],
|
|
113
|
-
view: new zt(
|
|
113
|
+
view: new zt(L)
|
|
114
114
|
};
|
|
115
|
-
const w = new Ue(
|
|
115
|
+
const w = new Ue(v);
|
|
116
116
|
e.value = w;
|
|
117
|
-
}, m = (
|
|
118
|
-
t.set("vectorTile", new
|
|
119
|
-
source: new
|
|
120
|
-
visible:
|
|
117
|
+
}, m = (h) => {
|
|
118
|
+
t.set("vectorTile", new ye({
|
|
119
|
+
source: new me({ url: ue.vectorTile }),
|
|
120
|
+
visible: h.layerType === "vector",
|
|
121
121
|
zIndex: 0,
|
|
122
122
|
preload: 1,
|
|
123
123
|
className: "vector"
|
|
124
|
-
})), t.set("vectorTileMark", new
|
|
125
|
-
source: new
|
|
126
|
-
visible:
|
|
124
|
+
})), t.set("vectorTileMark", new ye({
|
|
125
|
+
source: new me({ url: ue.vectorTileMark }),
|
|
126
|
+
visible: h.layerType === "vector",
|
|
127
127
|
zIndex: 1,
|
|
128
128
|
preload: 1,
|
|
129
129
|
className: "vector"
|
|
130
|
-
})), t.set("satelliteImgTile", new
|
|
131
|
-
source: new
|
|
132
|
-
visible:
|
|
130
|
+
})), t.set("satelliteImgTile", new ye({
|
|
131
|
+
source: new me({ url: ue.satelliteImgTile }),
|
|
132
|
+
visible: h.layerType === "satellite",
|
|
133
133
|
zIndex: 0,
|
|
134
134
|
preload: 1,
|
|
135
135
|
className: "satellite"
|
|
136
|
-
})), t.set("satelliteImgTileMark", new
|
|
137
|
-
source: new
|
|
138
|
-
visible:
|
|
136
|
+
})), t.set("satelliteImgTileMark", new ye({
|
|
137
|
+
source: new me({ url: ue.satelliteImgTileMark }),
|
|
138
|
+
visible: h.layerType === "satellite",
|
|
139
139
|
zIndex: 1,
|
|
140
140
|
preload: 1,
|
|
141
141
|
className: "satellite"
|
|
142
|
-
})), t.set("greenMark", new
|
|
143
|
-
source: new
|
|
144
|
-
visible:
|
|
142
|
+
})), t.set("greenMark", new ye({
|
|
143
|
+
source: new me({ url: ue.greenTile }),
|
|
144
|
+
visible: h.showGreenLayer,
|
|
145
145
|
zIndex: 2,
|
|
146
146
|
className: "greenTile"
|
|
147
147
|
}));
|
|
@@ -150,10 +150,10 @@ function eo() {
|
|
|
150
150
|
getInstall: r,
|
|
151
151
|
getView: l,
|
|
152
152
|
getZoom: s,
|
|
153
|
-
setZoom:
|
|
153
|
+
setZoom: c,
|
|
154
154
|
setCenter: o,
|
|
155
155
|
getCenter: u,
|
|
156
|
-
getSize:
|
|
156
|
+
getSize: y,
|
|
157
157
|
initMap: n,
|
|
158
158
|
setBaseLayerMap: m
|
|
159
159
|
};
|
|
@@ -162,12 +162,12 @@ const je = function(e, r) {
|
|
|
162
162
|
const l = Number(r) / 6e5;
|
|
163
163
|
return [Number(e) / 6e5, l];
|
|
164
164
|
}, to = (e, r) => {
|
|
165
|
-
const l =
|
|
165
|
+
const l = I(e), s = r * 1e3, c = [
|
|
166
166
|
l[0] - s,
|
|
167
167
|
l[1] - s,
|
|
168
168
|
l[0] + s,
|
|
169
169
|
l[1] + s
|
|
170
|
-
], o = Zt(
|
|
170
|
+
], o = Zt(c, J.mercator, J.data);
|
|
171
171
|
return {
|
|
172
172
|
leftTopPoint: { lng: o[0], lat: o[3] },
|
|
173
173
|
rightTopPoint: { lng: o[2], lat: o[3] },
|
|
@@ -176,37 +176,37 @@ const je = function(e, r) {
|
|
|
176
176
|
};
|
|
177
177
|
}, oo = function(e, r) {
|
|
178
178
|
const s = He(e);
|
|
179
|
-
let
|
|
179
|
+
let c = "";
|
|
180
180
|
switch (console.log(r, xe), r) {
|
|
181
181
|
case xe.M:
|
|
182
|
-
|
|
182
|
+
c = Math.round(s * 100) / 100 + " m";
|
|
183
183
|
break;
|
|
184
184
|
case xe.KM:
|
|
185
|
-
|
|
185
|
+
c = Math.round(s / 1e3 * 100) / 100 + " km";
|
|
186
186
|
break;
|
|
187
187
|
case xe.NM:
|
|
188
|
-
|
|
188
|
+
c = (Math.round(s / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
|
|
189
189
|
break;
|
|
190
190
|
}
|
|
191
|
-
return
|
|
191
|
+
return c;
|
|
192
192
|
};
|
|
193
193
|
function ro(e) {
|
|
194
|
-
const r = e[0] *
|
|
194
|
+
const r = e[0] * ze / 180;
|
|
195
195
|
let l = Math.log(Math.tan((90 + e[1]) * Math.PI / 360)) / (Math.PI / 180);
|
|
196
|
-
return l = l *
|
|
196
|
+
return l = l * ze / 180, [r, l];
|
|
197
197
|
}
|
|
198
|
-
function
|
|
198
|
+
function ge(e = "") {
|
|
199
199
|
let r = e.replace(/&?/g, "&");
|
|
200
200
|
return r = r.replace(/&#x([0-9a-fA-F]+);?/g, (l, s) => {
|
|
201
|
-
const
|
|
202
|
-
return String.fromCodePoint(
|
|
201
|
+
const c = parseInt(s, 16);
|
|
202
|
+
return String.fromCodePoint(c);
|
|
203
203
|
}), r;
|
|
204
204
|
}
|
|
205
205
|
const tt = (e) => {
|
|
206
|
-
const r = new
|
|
206
|
+
const r = new we({
|
|
207
207
|
font: "Normal 14px map-iconfont",
|
|
208
|
-
text:
|
|
209
|
-
fill: new
|
|
208
|
+
text: ge(e),
|
|
209
|
+
fill: new ee({ color: "#fff" }),
|
|
210
210
|
offsetY: -14
|
|
211
211
|
});
|
|
212
212
|
return new X({
|
|
@@ -214,22 +214,22 @@ const tt = (e) => {
|
|
|
214
214
|
zIndex: 100
|
|
215
215
|
});
|
|
216
216
|
}, ot = (e, r = "lonlat") => {
|
|
217
|
-
const l = { lon: 0, lat: 0 }, s = e[0] /
|
|
218
|
-
let
|
|
219
|
-
return
|
|
217
|
+
const l = { lon: 0, lat: 0 }, s = e[0] / ze * 180;
|
|
218
|
+
let c = e[1] / ze * 180;
|
|
219
|
+
return c = 180 / Math.PI * (2 * Math.atan(Math.exp(c * Math.PI / 180)) - Math.PI / 2), l.lon = s, l.lat = c, r === "lonlat" ? l : [s, c];
|
|
220
220
|
}, no = (e) => {
|
|
221
|
-
const r = lt.duration(e, "minutes"), l = Math.floor(r.asDays()), s = r.hours(),
|
|
222
|
-
let o = `${String(
|
|
221
|
+
const r = lt.duration(e, "minutes"), l = Math.floor(r.asDays()), s = r.hours(), c = r.minutes();
|
|
222
|
+
let o = `${String(c).padStart(2, "0")}分`;
|
|
223
223
|
return s !== 0 && (o = `${String(s).padStart(2, "0")}时${o}`), l !== 0 && (o = `${String(l).padStart(2, "0")}天${o}`), o;
|
|
224
224
|
}, lo = (e, r) => {
|
|
225
225
|
let l = null;
|
|
226
226
|
const s = async (m) => {
|
|
227
227
|
if (!e || (console.log("vehicleInfo", m), !(m != null && m.lon && (m != null && m.lat)))) return;
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
const N = e == null ? void 0 : e.getView(),
|
|
231
|
-
N.setCenter(ke(
|
|
232
|
-
},
|
|
228
|
+
const h = Math.abs(Number(m.lon)) > 180 ? je(m.lon, m.lat) : [m.lon, m.lat];
|
|
229
|
+
c(m, I(h));
|
|
230
|
+
const N = e == null ? void 0 : e.getView(), L = new le(h);
|
|
231
|
+
N.setCenter(ke(L.getCoordinates(), J.data, J.mercator));
|
|
232
|
+
}, c = (m, h) => {
|
|
233
233
|
const N = `${it}map/car-icon.gif`;
|
|
234
234
|
l || (l = new ce({
|
|
235
235
|
element: document.createElement("div"),
|
|
@@ -237,10 +237,10 @@ const tt = (e) => {
|
|
|
237
237
|
stopEvent: !1
|
|
238
238
|
// 允许交互事件穿透
|
|
239
239
|
}), e.addOverlay(l));
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
const
|
|
243
|
-
|
|
240
|
+
const L = l.getElement();
|
|
241
|
+
L.style.backgroundImage = `url(${N})`, L.style.width = "80px", L.style.height = "80px";
|
|
242
|
+
const v = (m == null ? void 0 : m.drc) || "";
|
|
243
|
+
L.style.transform = `rotate(${v}deg)`, L.style.backgroundSize = "cover", l == null || l.setPosition(h);
|
|
244
244
|
};
|
|
245
245
|
return {
|
|
246
246
|
location: s,
|
|
@@ -248,8 +248,8 @@ const tt = (e) => {
|
|
|
248
248
|
const m = l == null ? void 0 : l.getElement();
|
|
249
249
|
m && (m.innerHTML = "");
|
|
250
250
|
},
|
|
251
|
-
renderTrack: (m,
|
|
252
|
-
r.render(m,
|
|
251
|
+
renderTrack: (m, h, N) => {
|
|
252
|
+
r.render(m, h, N, "truck", 1e3);
|
|
253
253
|
},
|
|
254
254
|
setCenter: (m) => {
|
|
255
255
|
r.setCenter(m);
|
|
@@ -257,8 +257,8 @@ const tt = (e) => {
|
|
|
257
257
|
closeTrack: () => {
|
|
258
258
|
r.close();
|
|
259
259
|
},
|
|
260
|
-
playTrack: (m,
|
|
261
|
-
r.play(m,
|
|
260
|
+
playTrack: (m, h) => {
|
|
261
|
+
r.play(m, h);
|
|
262
262
|
}
|
|
263
263
|
};
|
|
264
264
|
};
|
|
@@ -266,172 +266,172 @@ var ct = /* @__PURE__ */ ((e) => (e[e.发动机使用中 = 0] = "发动机使用
|
|
|
266
266
|
const so = (e) => {
|
|
267
267
|
const r = /* @__PURE__ */ new Map(), l = {};
|
|
268
268
|
let s = null;
|
|
269
|
-
const
|
|
269
|
+
const c = "--";
|
|
270
270
|
let o = null;
|
|
271
|
-
const u = document.createElement("div"),
|
|
271
|
+
const u = document.createElement("div"), y = new ce({
|
|
272
272
|
element: u,
|
|
273
273
|
positioning: "top-left",
|
|
274
274
|
className: "track-label-popup"
|
|
275
275
|
});
|
|
276
|
-
let t, n, m,
|
|
277
|
-
const
|
|
276
|
+
let t, n, m, h, N, L = !1, v = Date.now(), w, k = 0, C = null, x = 20;
|
|
277
|
+
const G = 8, D = [], q = (i) => {
|
|
278
278
|
var d;
|
|
279
|
-
for (
|
|
280
|
-
const f =
|
|
281
|
-
|
|
279
|
+
for (D.unshift(i); D.length > G; ) {
|
|
280
|
+
const f = D.pop(), M = r.get(f);
|
|
281
|
+
M && ((d = M.getSource()) == null || d.clear(), e == null || e.removeLayer(M), r.delete(f), delete l[f]);
|
|
282
282
|
}
|
|
283
283
|
};
|
|
284
284
|
let Y = "";
|
|
285
|
-
const
|
|
285
|
+
const O = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], Z = Ve(() => {
|
|
286
286
|
if (s && l[s] && r.get(s).getVisible()) {
|
|
287
287
|
console.log("reRenderTrackLine------------");
|
|
288
|
-
const
|
|
289
|
-
re(s,
|
|
288
|
+
const i = Gt(T(s, l[s]));
|
|
289
|
+
re(s, i);
|
|
290
290
|
}
|
|
291
|
-
}, 300),
|
|
291
|
+
}, 300), T = (i, d) => {
|
|
292
292
|
let f = [];
|
|
293
|
-
const
|
|
294
|
-
return f = d.filter((
|
|
295
|
-
if (Number(
|
|
296
|
-
const [$,
|
|
297
|
-
|
|
293
|
+
const M = Math.max(1, Math.floor(d.length / x));
|
|
294
|
+
return f = d.filter((F, R) => R % M === 0).map((F, R) => {
|
|
295
|
+
if (Number(F.lon) > 180 || Number(F.lat) > 180) {
|
|
296
|
+
const [$, W] = je(F.lon, F.lat);
|
|
297
|
+
F.lon = $, F.lat = W;
|
|
298
298
|
}
|
|
299
|
-
return
|
|
299
|
+
return F.center = [F.lon, F.lat], F.centerPoint = ro(F.center), F.time = lt(F.createdAt).format("YYYY-MM-DD HH:mm:ss"), F.id = i, F.index = R, F;
|
|
300
300
|
}), f;
|
|
301
|
-
}, a = async (
|
|
302
|
-
if (!e || JSON.stringify(l[
|
|
301
|
+
}, a = async (i, d, f, M = "ship", E = 200) => {
|
|
302
|
+
if (!e || JSON.stringify(l[i]) === JSON.stringify(d) && s === i || (d = d == null ? void 0 : d.reverse(), y && M === "ship" && (e != null && e.getOverlays().getArray().includes(y) || e.addOverlay(y)), (d == null ? void 0 : d.length) < 2))
|
|
303
303
|
return;
|
|
304
|
-
q(
|
|
305
|
-
const
|
|
306
|
-
Y = f ||
|
|
307
|
-
},
|
|
304
|
+
q(i), s = i, l[i] = d, x = E;
|
|
305
|
+
const F = Object.keys(l).findIndex((R) => R === i) || 0;
|
|
306
|
+
Y = f || O[F > 10 ? 10 : F], await p(), await Je(s);
|
|
307
|
+
}, b = (i) => {
|
|
308
308
|
const d = new de();
|
|
309
309
|
return new he({
|
|
310
310
|
source: d,
|
|
311
311
|
visible: !1,
|
|
312
312
|
// 默认隐藏
|
|
313
|
-
className: `track-layer-${
|
|
313
|
+
className: `track-layer-${i}`,
|
|
314
314
|
renderBuffer: 1024
|
|
315
315
|
// 增大渲染缓冲区
|
|
316
316
|
});
|
|
317
|
-
}, g = (
|
|
317
|
+
}, g = (i) => {
|
|
318
318
|
r.forEach((d, f) => {
|
|
319
319
|
var E;
|
|
320
|
-
const
|
|
321
|
-
d.getVisible() !==
|
|
322
|
-
}), s =
|
|
323
|
-
},
|
|
324
|
-
const
|
|
325
|
-
if (!r.has(
|
|
326
|
-
const
|
|
327
|
-
r.set(
|
|
320
|
+
const M = f === i;
|
|
321
|
+
d.getVisible() !== M && (d.setVisible(M), e.getLayers().getArray().includes(d) || e.addLayer(d), M || (E = d.getSource()) == null || E.clear());
|
|
322
|
+
}), s = i;
|
|
323
|
+
}, p = async () => {
|
|
324
|
+
const i = s;
|
|
325
|
+
if (!r.has(i)) {
|
|
326
|
+
const F = b(i);
|
|
327
|
+
r.set(i, F);
|
|
328
328
|
}
|
|
329
|
-
await g(
|
|
330
|
-
const d = Y || "", f = l[
|
|
329
|
+
await g(i);
|
|
330
|
+
const d = Y || "", f = l[i] || [];
|
|
331
331
|
if (!(f && f.length > 1)) return [];
|
|
332
|
-
let
|
|
333
|
-
|
|
334
|
-
const E =
|
|
335
|
-
|
|
336
|
-
},
|
|
337
|
-
const
|
|
338
|
-
if (
|
|
339
|
-
|
|
332
|
+
let M = [];
|
|
333
|
+
M = T(i, f);
|
|
334
|
+
const E = M.map((F) => F.centerPoint);
|
|
335
|
+
M.length >= 2 && await P(i, E, d);
|
|
336
|
+
}, P = (i, d, f) => {
|
|
337
|
+
const M = new Se(d), E = r.get(i).getSource(), F = E.getFeatureById(i);
|
|
338
|
+
if (F)
|
|
339
|
+
F.setGeometry(M), F.setId(i), F.setStyle(V(f)), C = F;
|
|
340
340
|
else {
|
|
341
|
-
const
|
|
342
|
-
|
|
341
|
+
const R = new ie({ geometry: M });
|
|
342
|
+
R.setId(i), R.set("type", "line"), R.setStyle(V(f)), E.addFeature(R), C = R;
|
|
343
343
|
}
|
|
344
344
|
return C;
|
|
345
|
-
}, V = (
|
|
346
|
-
stroke: new
|
|
347
|
-
color:
|
|
345
|
+
}, V = (i) => new X({
|
|
346
|
+
stroke: new fe({
|
|
347
|
+
color: i,
|
|
348
348
|
width: 2
|
|
349
349
|
})
|
|
350
|
-
}),
|
|
351
|
-
const
|
|
352
|
-
if (
|
|
353
|
-
e.getTargetElement().style.cursor =
|
|
354
|
-
const E =
|
|
355
|
-
|
|
350
|
+
}), A = (i, d, f) => {
|
|
351
|
+
const M = i == null ? void 0 : i.get("trackId");
|
|
352
|
+
if (i && M && d === "hover") {
|
|
353
|
+
e.getTargetElement().style.cursor = M ? "pointer" : "";
|
|
354
|
+
const E = i.get("data"), F = j(E), R = f == null ? void 0 : f.coordinate;
|
|
355
|
+
R && (u.querySelector(".popup-content"), u.innerHTML = F, y == null || y.setPosition(R));
|
|
356
356
|
} else
|
|
357
|
-
|
|
358
|
-
}, j = (
|
|
359
|
-
if (!(
|
|
357
|
+
y && y.setPosition(void 0);
|
|
358
|
+
}, j = (i) => {
|
|
359
|
+
if (!(i != null && i.time)) return;
|
|
360
360
|
let d = "";
|
|
361
|
-
return
|
|
361
|
+
return i != null && i.stayTime && (d = `
|
|
362
362
|
<div class="item w-100">
|
|
363
363
|
<div class="item-label">停泊时间约</div>
|
|
364
|
-
<div class="item-item">${no(Number(
|
|
364
|
+
<div class="item-item">${no(Number(i.stayTime))}</div>
|
|
365
365
|
</div>
|
|
366
366
|
`), `
|
|
367
367
|
<div class="track-point-popup">
|
|
368
368
|
<div class="item">
|
|
369
369
|
<div class="item-label">状态</div>
|
|
370
|
-
<div class="item-item">${
|
|
370
|
+
<div class="item-item">${i != null && i.sailStatus ? ct[i.sailStatus] : c}</div>
|
|
371
371
|
</div>
|
|
372
372
|
<div class="item">
|
|
373
373
|
<div class="item-label">航速</div>
|
|
374
|
-
<div class="item-item">${
|
|
374
|
+
<div class="item-item">${i.speed || c}</div>
|
|
375
375
|
</div>
|
|
376
376
|
<div class="item">
|
|
377
377
|
<div class="item-label">艏向</div>
|
|
378
|
-
<div class="item-item">${
|
|
378
|
+
<div class="item-item">${i.hdg || c}</div>
|
|
379
379
|
</div>
|
|
380
380
|
<div class="item">
|
|
381
381
|
<div class="item-label">航向</div>
|
|
382
|
-
<div class="item-item">${
|
|
382
|
+
<div class="item-item">${i.cog || c}</div>
|
|
383
383
|
</div>
|
|
384
384
|
<div class="item">
|
|
385
385
|
<div class="item-label">经度</div>
|
|
386
|
-
<div class="item-item">${
|
|
386
|
+
<div class="item-item">${i.lon || c}</div>
|
|
387
387
|
</div>
|
|
388
388
|
<div class="item">
|
|
389
389
|
<div class="item-label">纬度</div>
|
|
390
|
-
<div class="item-item">${
|
|
390
|
+
<div class="item-item">${i.lat || c}</div>
|
|
391
391
|
</div>
|
|
392
392
|
<div class="item w-100">
|
|
393
393
|
<div class="item-label">时间</div>
|
|
394
|
-
<div class="item-item">${
|
|
394
|
+
<div class="item-item">${i.time}</div>
|
|
395
395
|
</div>
|
|
396
396
|
${d ?? d}
|
|
397
397
|
</div>`;
|
|
398
|
-
}, z = (
|
|
399
|
-
const f =
|
|
400
|
-
const
|
|
398
|
+
}, z = (i) => {
|
|
399
|
+
const f = i.map(($) => {
|
|
400
|
+
const W = e.getPixelFromCoordinate(I($.center));
|
|
401
401
|
return {
|
|
402
402
|
...$,
|
|
403
403
|
original: $,
|
|
404
|
-
pixel:
|
|
404
|
+
pixel: W,
|
|
405
405
|
distance: 0
|
|
406
406
|
// 先初始化,后续计算
|
|
407
407
|
};
|
|
408
408
|
});
|
|
409
|
-
let
|
|
409
|
+
let M = 0;
|
|
410
410
|
f[0].distance = 0;
|
|
411
411
|
for (let $ = 1; $ < f.length; $++) {
|
|
412
|
-
const
|
|
413
|
-
|
|
412
|
+
const W = f[$ - 1].pixel, H = f[$].pixel, K = H[0] - W[0], S = H[1] - W[1];
|
|
413
|
+
M += Math.sqrt(K * K + S * S), f[$].distance = M;
|
|
414
414
|
}
|
|
415
415
|
const E = f.filter(
|
|
416
|
-
($,
|
|
417
|
-
),
|
|
416
|
+
($, W) => W === 0 || W === f.length - 1
|
|
417
|
+
), F = [];
|
|
418
418
|
for (let $ = 0; $ < E.length; $++) {
|
|
419
|
-
const
|
|
420
|
-
if (
|
|
421
|
-
const H = E[$ + 1],
|
|
422
|
-
for (let
|
|
423
|
-
const
|
|
424
|
-
if (
|
|
425
|
-
const
|
|
419
|
+
const W = E[$];
|
|
420
|
+
if (F.push(W), $ < E.length - 1) {
|
|
421
|
+
const H = E[$ + 1], K = H.distance - W.distance, S = Math.floor(K / 100);
|
|
422
|
+
for (let B = 1; B <= S; B++) {
|
|
423
|
+
const Q = W.distance + B * 100;
|
|
424
|
+
if (Q >= H.distance) break;
|
|
425
|
+
const _ = ae(
|
|
426
426
|
f,
|
|
427
|
-
|
|
427
|
+
Q
|
|
428
428
|
);
|
|
429
|
-
|
|
429
|
+
_ && F.push(_);
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
433
|
return Array.from(
|
|
434
|
-
new Map(
|
|
434
|
+
new Map(F.map(($) => [$.distance.toFixed(2), $])).values()
|
|
435
435
|
).map(($) => ({
|
|
436
436
|
...$.original,
|
|
437
437
|
// 优先保留原始数据
|
|
@@ -443,16 +443,16 @@ const so = (e) => {
|
|
|
443
443
|
distance: $.distance
|
|
444
444
|
}));
|
|
445
445
|
};
|
|
446
|
-
function ae(
|
|
447
|
-
for (let f = 1; f <
|
|
448
|
-
const
|
|
449
|
-
if (d >=
|
|
450
|
-
const
|
|
446
|
+
function ae(i, d) {
|
|
447
|
+
for (let f = 1; f < i.length; f++) {
|
|
448
|
+
const M = i[f - 1], E = i[f];
|
|
449
|
+
if (d >= M.distance && d <= E.distance) {
|
|
450
|
+
const F = (d - M.distance) / (E.distance - M.distance), R = M.pixel[0] + F * (E.pixel[0] - M.pixel[0]), $ = M.pixel[1] + F * (E.pixel[1] - M.pixel[1]), W = e == null ? void 0 : e.getCoordinateFromPixel([R, $]);
|
|
451
451
|
return {
|
|
452
|
-
...
|
|
452
|
+
...M,
|
|
453
453
|
// 继承前一个点的属性(可调整)
|
|
454
|
-
coord:
|
|
455
|
-
pixel: [
|
|
454
|
+
coord: W,
|
|
455
|
+
pixel: [R, $],
|
|
456
456
|
distance: d,
|
|
457
457
|
original: void 0
|
|
458
458
|
// 明确标记为插值生成点
|
|
@@ -461,26 +461,26 @@ const so = (e) => {
|
|
|
461
461
|
}
|
|
462
462
|
return null;
|
|
463
463
|
}
|
|
464
|
-
const re = async (
|
|
465
|
-
await be(), await
|
|
466
|
-
const f = z(d),
|
|
467
|
-
r.get(
|
|
468
|
-
const
|
|
469
|
-
e.addOverlay(
|
|
464
|
+
const re = async (i, d) => {
|
|
465
|
+
await be(), await Me(i);
|
|
466
|
+
const f = z(d), M = f.map((F) => se(F));
|
|
467
|
+
r.get(i).getSource().addFeatures(M), vt(i, f, d, Y), f.forEach((F) => {
|
|
468
|
+
const R = Re(i, Y, F);
|
|
469
|
+
e.addOverlay(R);
|
|
470
470
|
});
|
|
471
|
-
}, se = (
|
|
471
|
+
}, se = (i) => {
|
|
472
472
|
const d = new ie({
|
|
473
|
-
geometry: new le(
|
|
474
|
-
data:
|
|
473
|
+
geometry: new le(i.centerPoint),
|
|
474
|
+
data: i
|
|
475
475
|
});
|
|
476
|
-
d.set("type", "track_point"), d.set("trackId",
|
|
476
|
+
d.set("type", "track_point"), d.set("trackId", i.id), d.set("data", i);
|
|
477
477
|
let f = [
|
|
478
|
-
...ft(
|
|
478
|
+
...ft(i, Y)
|
|
479
479
|
];
|
|
480
|
-
return (
|
|
481
|
-
}, Re = (
|
|
482
|
-
const
|
|
483
|
-
|
|
480
|
+
return (i.index === 0 || i.index === l[i.id].length - 1) && (f = [...yt(i)], d.set("type", "track_begin")), i.state !== void 0 && i.state !== null && (f = [...ht(i)], d.set("type", "track_icon")), d.setStyle(f), d;
|
|
481
|
+
}, Re = (i, d, f) => {
|
|
482
|
+
const M = document.createElement("div");
|
|
483
|
+
M.className = "track-overlay-label", M.style.position = "relative", M.style.backgroundColor = "rgba(255,255,255,0.8)", M.style.border = `1px solid ${d}`, M.style.fontSize = "12px", M.innerHTML = `
|
|
484
484
|
<span>${f.time}</span>
|
|
485
485
|
<svg
|
|
486
486
|
style="position: absolute;right: -20px;top: 0;"
|
|
@@ -494,97 +494,97 @@ const so = (e) => {
|
|
|
494
494
|
stroke-width="1" />
|
|
495
495
|
`;
|
|
496
496
|
const E = new ce({
|
|
497
|
-
element:
|
|
498
|
-
position:
|
|
497
|
+
element: M,
|
|
498
|
+
position: I(f.center),
|
|
499
499
|
positioning: "top-right",
|
|
500
500
|
offset: [-20, -20],
|
|
501
501
|
stopEvent: !1,
|
|
502
502
|
className: "track-label-time-overlay"
|
|
503
503
|
});
|
|
504
|
-
return E.set("class", "track-label-overlay"), E.set("trackId",
|
|
504
|
+
return E.set("class", "track-label-overlay"), E.set("trackId", i), E;
|
|
505
505
|
}, be = () => {
|
|
506
|
-
const
|
|
506
|
+
const i = e == null ? void 0 : e.getOverlays().getArray(), d = i == null ? void 0 : i.filter((f) => f.get("class") === "track-label-overlay");
|
|
507
507
|
d && d.length > 0 && d.forEach((f) => {
|
|
508
508
|
f.setPosition(void 0), f.dispose();
|
|
509
509
|
});
|
|
510
|
-
},
|
|
511
|
-
const d = r.get(
|
|
510
|
+
}, Me = (i) => {
|
|
511
|
+
const d = r.get(i).getSource();
|
|
512
512
|
d.forEachFeature((f) => {
|
|
513
513
|
f.get("type") !== "line" && d.removeFeature(f);
|
|
514
514
|
});
|
|
515
|
-
}, ft = (
|
|
515
|
+
}, ft = (i, d) => (`${i.time}`, [
|
|
516
516
|
new X({
|
|
517
517
|
// 扩大交互热区
|
|
518
|
-
image: new
|
|
519
|
-
stroke: new
|
|
518
|
+
image: new $e({
|
|
519
|
+
stroke: new fe({ color: "rgba(0, 0, 0, 0.01)", width: 20 }),
|
|
520
520
|
radius: 3
|
|
521
521
|
})
|
|
522
522
|
}),
|
|
523
523
|
// 轨迹点样式
|
|
524
524
|
new X({
|
|
525
|
-
image: new
|
|
526
|
-
fill: new
|
|
527
|
-
stroke: new
|
|
525
|
+
image: new $e({
|
|
526
|
+
fill: new ee({ color: d }),
|
|
527
|
+
stroke: new fe({ color: "#fff", width: 2 }),
|
|
528
528
|
radius: 3
|
|
529
529
|
})
|
|
530
530
|
})
|
|
531
531
|
// textStyle,
|
|
532
|
-
]),
|
|
533
|
-
const d = "#E31818", f = "#1890FF",
|
|
534
|
-
text: new
|
|
532
|
+
]), ht = (i) => {
|
|
533
|
+
const d = "#E31818", f = "#1890FF", M = "", E = new X({
|
|
534
|
+
text: new we({
|
|
535
535
|
font: "Normal 22px map-iconfont",
|
|
536
|
-
text:
|
|
536
|
+
text: ge(M),
|
|
537
537
|
offsetY: -10,
|
|
538
|
-
fill: new
|
|
539
|
-
color: Number(
|
|
538
|
+
fill: new ee({
|
|
539
|
+
color: Number(i.state) === 0 ? d : Number(i.state) === 1 ? f : ""
|
|
540
540
|
})
|
|
541
541
|
}),
|
|
542
542
|
zIndex: 99
|
|
543
|
-
}),
|
|
544
|
-
return Number(
|
|
545
|
-
},
|
|
546
|
-
const E = d || [],
|
|
547
|
-
|
|
548
|
-
const
|
|
549
|
-
for (let
|
|
543
|
+
}), R = tt(""), W = tt(""), H = [];
|
|
544
|
+
return Number(i.state) === 0 ? H.push(R) : Number(i.state) === 1 && H.push(W), H.push(E), H;
|
|
545
|
+
}, vt = (i, d, f, M) => {
|
|
546
|
+
const E = d || [], F = d.length;
|
|
547
|
+
F || (E.push(f[0]), E.push(f[f.length - 1]));
|
|
548
|
+
const R = [];
|
|
549
|
+
for (let W = 0; W < F - 1; W++) {
|
|
550
550
|
let H;
|
|
551
|
-
const
|
|
552
|
-
if (
|
|
553
|
-
H = f[
|
|
551
|
+
const K = d[W], S = (d[W + 1].index + K.index) / 2;
|
|
552
|
+
if (S % 2 === 0)
|
|
553
|
+
H = f[S].centerPoint;
|
|
554
554
|
else {
|
|
555
|
-
const
|
|
556
|
-
if (
|
|
557
|
-
const [
|
|
558
|
-
H = [(
|
|
555
|
+
const B = f[Math.floor(S)], Q = f[Math.ceil(S)];
|
|
556
|
+
if (B && Q) {
|
|
557
|
+
const [_, Le] = B.centerPoint, [Ee, Te] = Q.centerPoint;
|
|
558
|
+
H = [(_ + Ee) / 2, (Le + Te) / 2];
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
561
|
if (H) {
|
|
562
|
-
const
|
|
562
|
+
const B = new ie({
|
|
563
563
|
geometry: new le(H)
|
|
564
564
|
});
|
|
565
|
-
|
|
565
|
+
B.set("type", "track_arrow"), B.setStyle(
|
|
566
566
|
new X({
|
|
567
|
-
text: new
|
|
567
|
+
text: new we({
|
|
568
568
|
font: "700 12px map-iconfont",
|
|
569
|
-
text:
|
|
570
|
-
fill: new
|
|
569
|
+
text: ge(""),
|
|
570
|
+
fill: new ee({ color: M }),
|
|
571
571
|
// 设置箭头旋转 角度转为弧度
|
|
572
572
|
rotation: Ke(
|
|
573
|
-
d[
|
|
574
|
-
d[
|
|
573
|
+
d[W].center,
|
|
574
|
+
d[W + 1].center
|
|
575
575
|
) * (Math.PI / 180)
|
|
576
576
|
})
|
|
577
577
|
})
|
|
578
|
-
),
|
|
578
|
+
), R.push(B);
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
|
-
const $ = r.get(
|
|
582
|
-
$ == null || $.addFeatures(
|
|
583
|
-
}, Je = (
|
|
584
|
-
var
|
|
585
|
-
const d = e.getView(), f = (
|
|
586
|
-
if (!
|
|
587
|
-
const E = (
|
|
581
|
+
const $ = r.get(i).getSource();
|
|
582
|
+
$ == null || $.addFeatures(R);
|
|
583
|
+
}, Je = (i) => {
|
|
584
|
+
var F, R;
|
|
585
|
+
const d = e.getView(), f = (F = r == null ? void 0 : r.get(i)) == null ? void 0 : F.getSource(), M = C || (i ? f == null ? void 0 : f.getFeatureById(i) : null);
|
|
586
|
+
if (!M) return;
|
|
587
|
+
const E = (R = M == null ? void 0 : M.getGeometry()) == null ? void 0 : R.getExtent();
|
|
588
588
|
if (E != null && E.length)
|
|
589
589
|
try {
|
|
590
590
|
const $ = Dt(E, Math.max(E[2] - E[0], E[3] - E[1]) * 0.02);
|
|
@@ -592,147 +592,147 @@ const so = (e) => {
|
|
|
592
592
|
} catch ($) {
|
|
593
593
|
console.log($);
|
|
594
594
|
}
|
|
595
|
-
}, yt = (
|
|
596
|
-
const d = "", E =
|
|
595
|
+
}, yt = (i) => {
|
|
596
|
+
const d = "", E = i.index === 0 ? "#fcdc3f" : "#ff0000";
|
|
597
597
|
return [new X({
|
|
598
|
-
text: new
|
|
598
|
+
text: new we({
|
|
599
599
|
font: "Normal 14px map-iconfont",
|
|
600
|
-
text:
|
|
601
|
-
fill: new
|
|
600
|
+
text: ge(d),
|
|
601
|
+
fill: new ee({ color: E })
|
|
602
602
|
}),
|
|
603
603
|
zIndex: 101
|
|
604
604
|
})];
|
|
605
605
|
}, mt = () => {
|
|
606
|
-
console.log("清除所有的轨迹-----"),
|
|
606
|
+
console.log("清除所有的轨迹-----"), Ce(), r.forEach((d) => {
|
|
607
607
|
var f;
|
|
608
608
|
(f = d.getSource()) == null || f.clear(), e == null || e.removeLayer(d);
|
|
609
609
|
}), Object.keys(l).forEach((d) => {
|
|
610
610
|
r.delete(d), delete l[d];
|
|
611
|
-
}),
|
|
612
|
-
}, wt = (
|
|
613
|
-
const d = r.get(
|
|
611
|
+
}), be();
|
|
612
|
+
}, wt = (i) => {
|
|
613
|
+
const d = r.get(i || s);
|
|
614
614
|
d == null || d.setVisible(!1);
|
|
615
615
|
const f = e.getOverlays().getArray();
|
|
616
|
-
for (let
|
|
617
|
-
const E = f[
|
|
618
|
-
E.get("class") === "track-label-overlay" ? (E.setPosition(void 0), e.removeOverlay(E)) :
|
|
616
|
+
for (let M = 0; M < f.length; ) {
|
|
617
|
+
const E = f[M];
|
|
618
|
+
E.get("class") === "track-label-overlay" ? (E.setPosition(void 0), e.removeOverlay(E)) : M++;
|
|
619
619
|
}
|
|
620
|
-
|
|
621
|
-
}, xt = (
|
|
620
|
+
Ce();
|
|
621
|
+
}, xt = (i, d = xe.NM) => {
|
|
622
622
|
const f = {
|
|
623
|
-
id:
|
|
623
|
+
id: i,
|
|
624
624
|
length: "--"
|
|
625
|
-
}, E = (l[
|
|
626
|
-
(
|
|
627
|
-
),
|
|
628
|
-
return f.length = oo(
|
|
629
|
-
}, bt = (
|
|
630
|
-
kt(String(
|
|
631
|
-
}, kt = (
|
|
632
|
-
const f = l[String(
|
|
633
|
-
|
|
625
|
+
}, E = (l[i] || []).map(
|
|
626
|
+
(R) => ke([R.lon, R.lat], J.data, J.mercator)
|
|
627
|
+
), F = new Se(E);
|
|
628
|
+
return f.length = oo(F, d) || "--", f;
|
|
629
|
+
}, bt = (i, d) => {
|
|
630
|
+
kt(String(i), d);
|
|
631
|
+
}, kt = (i, d) => {
|
|
632
|
+
const f = l[String(i)], M = f == null ? void 0 : f.map((E) => [E.lon, E.lat]);
|
|
633
|
+
M && Ct(M, d);
|
|
634
634
|
}, Ze = new X({
|
|
635
|
-
text: new
|
|
635
|
+
text: new we({
|
|
636
636
|
font: "700 20px map-iconfont",
|
|
637
|
-
text:
|
|
638
|
-
fill: new
|
|
637
|
+
text: ge(""),
|
|
638
|
+
fill: new ee({ color: "#ff0000" }),
|
|
639
639
|
rotation: 0
|
|
640
640
|
// 初始旋转角度
|
|
641
641
|
})
|
|
642
|
-
}), pt = (
|
|
643
|
-
var
|
|
644
|
-
const f = Number(50 * d),
|
|
645
|
-
if (
|
|
646
|
-
|
|
642
|
+
}), pt = (i, d) => {
|
|
643
|
+
var S, B;
|
|
644
|
+
const f = Number(50 * d), M = ((S = i.frameState) == null ? void 0 : S.time) ?? Date.now(), E = M - v;
|
|
645
|
+
if (k = (k + f * E / 1e6) % 2, v = M, k >= 1) {
|
|
646
|
+
Ce();
|
|
647
647
|
return;
|
|
648
648
|
}
|
|
649
|
-
const
|
|
650
|
-
|
|
651
|
-
),
|
|
652
|
-
|
|
649
|
+
const F = n.getCoordinateAt(
|
|
650
|
+
k > 1 ? 2 - k : k
|
|
651
|
+
), R = n.getCoordinateAt(
|
|
652
|
+
k > 1 ? k - 0.01 : k
|
|
653
653
|
), $ = n.getCoordinateAt(
|
|
654
|
-
|
|
654
|
+
k > 1 ? 2 - k : k + 0.01
|
|
655
655
|
), H = Ke(
|
|
656
|
-
ot(
|
|
656
|
+
ot(R, "array"),
|
|
657
657
|
ot($, "array")
|
|
658
658
|
) * Math.PI / 180;
|
|
659
|
-
(
|
|
660
|
-
const
|
|
661
|
-
|
|
659
|
+
(B = Ze.getText()) == null || B.setRotation(H), h.setCoordinates(F);
|
|
660
|
+
const K = At(i);
|
|
661
|
+
K.setStyle(Ze), K.drawGeometry(h), e == null || e.render();
|
|
662
662
|
}, Mt = () => {
|
|
663
|
-
var
|
|
664
|
-
|
|
665
|
-
},
|
|
666
|
-
|
|
667
|
-
}, Ct = (
|
|
668
|
-
|
|
663
|
+
var i;
|
|
664
|
+
L = !0, v = Date.now(), k = 0, h = ((i = m.getGeometry()) == null ? void 0 : i.clone()) || new le([0, 0]), o && (w == null || w.on("postrender", o)), N == null || N.setGeometry(void 0);
|
|
665
|
+
}, Ce = () => {
|
|
666
|
+
L && (L = !1, N == null || N.setGeometry(void 0), o && w && w.un("postrender", o), w && (e == null || e.removeLayer(w)), w = null, N = null);
|
|
667
|
+
}, Ct = (i, d) => {
|
|
668
|
+
L && Ce(), t = new Ie({
|
|
669
669
|
factor: 1e6
|
|
670
|
-
}).writeGeometry(new
|
|
670
|
+
}).writeGeometry(new Se(i)), n = new Ie({
|
|
671
671
|
factor: 1e6
|
|
672
672
|
}).readGeometry(t, {
|
|
673
|
-
dataProjection:
|
|
674
|
-
featureProjection:
|
|
673
|
+
dataProjection: J.data,
|
|
674
|
+
featureProjection: J.mercator
|
|
675
675
|
}), m = new ie({
|
|
676
676
|
type: "icon",
|
|
677
677
|
geometry: new le(n.getFirstCoordinate())
|
|
678
678
|
});
|
|
679
679
|
const f = m.getGeometry();
|
|
680
|
-
|
|
680
|
+
h = f ? f.clone() : new le([0, 0]), N = new ie({
|
|
681
681
|
type: "geoMarker",
|
|
682
682
|
style: Ze,
|
|
683
|
-
geometry:
|
|
683
|
+
geometry: h
|
|
684
684
|
}), w = new he({
|
|
685
685
|
source: new de({
|
|
686
686
|
features: [N]
|
|
687
687
|
})
|
|
688
|
-
}), e == null || e.addLayer(w), o = (
|
|
689
|
-
}, Ke = (
|
|
690
|
-
function
|
|
691
|
-
return 180 * (
|
|
688
|
+
}), e == null || e.addLayer(w), o = (M) => pt(M, d), Mt();
|
|
689
|
+
}, Ke = (i, d, f) => {
|
|
690
|
+
function M(S) {
|
|
691
|
+
return 180 * (S % (2 * Math.PI)) / Math.PI;
|
|
692
692
|
}
|
|
693
|
-
function E(
|
|
694
|
-
return
|
|
693
|
+
function E(S) {
|
|
694
|
+
return S % 360 * Math.PI / 180;
|
|
695
695
|
}
|
|
696
|
-
function
|
|
697
|
-
var
|
|
698
|
-
if (!
|
|
699
|
-
if (!Array.isArray(
|
|
700
|
-
if ((
|
|
701
|
-
return
|
|
702
|
-
if (
|
|
696
|
+
function F(S) {
|
|
697
|
+
var B;
|
|
698
|
+
if (!S) throw new Error("Coordinate is required");
|
|
699
|
+
if (!Array.isArray(S)) {
|
|
700
|
+
if ((S == null ? void 0 : S.type) === "Feature" && (S == null ? void 0 : S.geometry) !== null && ((B = S == null ? void 0 : S.geometry) == null ? void 0 : B.type) === "Point")
|
|
701
|
+
return S == null ? void 0 : S.geometry.coordinates;
|
|
702
|
+
if (S.type === "Point") return (S == null ? void 0 : S.coordinates) || [];
|
|
703
703
|
}
|
|
704
|
-
if (Array.isArray(
|
|
705
|
-
return
|
|
704
|
+
if (Array.isArray(S) && S.length >= 2 && !Array.isArray(S[0]) && !Array.isArray(S[1]))
|
|
705
|
+
return S;
|
|
706
706
|
throw new Error(
|
|
707
707
|
"Coordinate must be GeoJSON Point or an Array of numbers"
|
|
708
708
|
);
|
|
709
709
|
}
|
|
710
|
-
function
|
|
711
|
-
if (
|
|
710
|
+
function R(S, B, Q = {}) {
|
|
711
|
+
if (Q.final)
|
|
712
712
|
return function(Tt, Ft) {
|
|
713
|
-
return (
|
|
714
|
-
}(
|
|
715
|
-
const
|
|
716
|
-
return
|
|
713
|
+
return (R(Ft, Tt) + 180) % 360;
|
|
714
|
+
}(S, B);
|
|
715
|
+
const _ = F(S), Le = F(B), Ee = E(_[0]), Te = E(Le[0]), _e = E(_[1]), De = E(Le[1]), Lt = Math.sin(Te - Ee) * Math.cos(De), Et = Math.cos(_e) * Math.sin(De) - Math.sin(_e) * Math.cos(De) * Math.cos(Te - Ee);
|
|
716
|
+
return M(Math.atan2(Lt, Et));
|
|
717
717
|
}
|
|
718
|
-
function $(
|
|
719
|
-
return !isNaN(
|
|
718
|
+
function $(S) {
|
|
719
|
+
return !isNaN(S) && S !== null && !Array.isArray(S);
|
|
720
720
|
}
|
|
721
|
-
function
|
|
722
|
-
return
|
|
721
|
+
function W(S, B = {}, Q = {}) {
|
|
722
|
+
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"), (!$(S[0]) || !$(S[1])) && console.log("Coordinates must contain numbers"), H({ type: "Point", coordinates: S }, B, Q);
|
|
723
723
|
}
|
|
724
|
-
function H(
|
|
725
|
-
const
|
|
724
|
+
function H(S, B = {}, Q = {}) {
|
|
725
|
+
const _ = {
|
|
726
726
|
type: "Feature",
|
|
727
727
|
id: "",
|
|
728
728
|
properties: {},
|
|
729
729
|
bbox: {},
|
|
730
730
|
geometry: {}
|
|
731
731
|
};
|
|
732
|
-
return
|
|
732
|
+
return Q.id !== void 0 && (_.id = Q.id), Q.bbox && (_.bbox = Q.bbox), _.properties = B, _.geometry = S, _;
|
|
733
733
|
}
|
|
734
|
-
const
|
|
735
|
-
return
|
|
734
|
+
const K = R(W(i), W(d), f);
|
|
735
|
+
return K < 0 ? 360 + K : K;
|
|
736
736
|
};
|
|
737
737
|
return {
|
|
738
738
|
render: a,
|
|
@@ -741,13 +741,13 @@ const so = (e) => {
|
|
|
741
741
|
setCenter: Je,
|
|
742
742
|
close: wt,
|
|
743
743
|
getLength: xt,
|
|
744
|
-
handleTrackMapEvent:
|
|
744
|
+
handleTrackMapEvent: A,
|
|
745
745
|
reRenderTrackLine: Z
|
|
746
746
|
};
|
|
747
747
|
};
|
|
748
748
|
function io(e) {
|
|
749
749
|
console.log("useShipOverlay", e);
|
|
750
|
-
const r =
|
|
750
|
+
const r = U(null), l = Fe(() => ({
|
|
751
751
|
"--overlay-color": "#FFF",
|
|
752
752
|
"--bg-color1": e.colors && e.colors[0] ? e.colors[0] : "#ffffff",
|
|
753
753
|
// 默认第一个颜色
|
|
@@ -755,7 +755,7 @@ function io(e) {
|
|
|
755
755
|
"--bg-color": "#ffffff",
|
|
756
756
|
position: "relative",
|
|
757
757
|
"pointer-events": "none"
|
|
758
|
-
})), s =
|
|
758
|
+
})), s = Fe(() => {
|
|
759
759
|
var u;
|
|
760
760
|
return {
|
|
761
761
|
position: "relative",
|
|
@@ -776,12 +776,12 @@ function io(e) {
|
|
|
776
776
|
animation: e.selected ? e.colors && ((u = e.colors) == null ? void 0 : u.length) >= 2 ? "blink-dual 2s ease-in-out infinite" : "blink-single 1.5s ease-in-out infinite" : "none"
|
|
777
777
|
// "animation": props.selected ? 'blink 1.5s ease-in-out infinite' : 'none', // 动画开关
|
|
778
778
|
};
|
|
779
|
-
}),
|
|
779
|
+
}), c = Fe(() => ({
|
|
780
780
|
width: "14px",
|
|
781
781
|
height: "14px",
|
|
782
782
|
margin: "1px 5px 1px 1px",
|
|
783
783
|
"background-color": "var(--attention-bg)"
|
|
784
|
-
})), o =
|
|
784
|
+
})), o = Fe(() => ({
|
|
785
785
|
position: "absolute",
|
|
786
786
|
top: "0px",
|
|
787
787
|
color: "var(--overlay-color)",
|
|
@@ -806,7 +806,7 @@ function io(e) {
|
|
|
806
806
|
},
|
|
807
807
|
[
|
|
808
808
|
ne("div", {
|
|
809
|
-
style: e.selected ?
|
|
809
|
+
style: e.selected ? c.value : {}
|
|
810
810
|
}, ""),
|
|
811
811
|
ne("div", {
|
|
812
812
|
class: "text",
|
|
@@ -860,10 +860,10 @@ function io(e) {
|
|
|
860
860
|
])
|
|
861
861
|
]);
|
|
862
862
|
}
|
|
863
|
-
|
|
863
|
+
U([]);
|
|
864
864
|
function co(e, r, l, s) {
|
|
865
865
|
if (r) {
|
|
866
|
-
const
|
|
866
|
+
const c = new ce({
|
|
867
867
|
element: l,
|
|
868
868
|
positioning: "top-left",
|
|
869
869
|
id: "label-" + (s == null ? void 0 : s.id),
|
|
@@ -872,32 +872,32 @@ function co(e, r, l, s) {
|
|
|
872
872
|
position: r,
|
|
873
873
|
className: s.blinking ? "ship-label-overlay-blinking" : "ship-label-overlay"
|
|
874
874
|
});
|
|
875
|
-
|
|
875
|
+
c.set("class", "zh-map-ship-overlay"), e.addOverlay(c);
|
|
876
876
|
}
|
|
877
877
|
}
|
|
878
878
|
const ao = (e) => {
|
|
879
879
|
const { spd: r, hdg: l, cog: s } = e;
|
|
880
880
|
return r ? l !== null && +l != 511 && s !== null ? s - +l >= 3 ? oe.right : s - +l <= -3 ? oe.left : oe.front : oe.front : "";
|
|
881
|
-
},
|
|
882
|
-
const { shipData: l } = r.getProperties(), s = at(e),
|
|
883
|
-
return uo(r,
|
|
881
|
+
}, ve = (e, r) => {
|
|
882
|
+
const { shipData: l } = r.getProperties(), s = at(e), c = Qe(e, l, s);
|
|
883
|
+
return uo(r, c, s);
|
|
884
884
|
}, at = (e) => {
|
|
885
885
|
const r = e == null ? void 0 : e.getView().getZoom();
|
|
886
886
|
return r <= te.shipModelMax && r >= te.shipTriggleMin ? "ship" : "triangle";
|
|
887
887
|
}, Qe = (e, r, l) => {
|
|
888
888
|
if (l === "ship") {
|
|
889
|
-
const { len: s, wid:
|
|
890
|
-
return
|
|
889
|
+
const { len: s, wid: c } = r, o = 97, u = 20, t = 1 / (e == null ? void 0 : e.getView().getResolution()), n = s * t / o, m = c * t / u, h = Math.min(n, m);
|
|
890
|
+
return h < 0.2 ? 0.2 : h > 2 ? 2 : h;
|
|
891
891
|
}
|
|
892
892
|
return te.scaleNum;
|
|
893
893
|
}, uo = (e, r, l) => {
|
|
894
|
-
const { color: s, direct:
|
|
894
|
+
const { color: s, direct: c, isHighlight: o, shipData: u } = e.getProperties(), y = ((u == null ? void 0 : u.cog) - 90 + 360) % 360;
|
|
895
895
|
return new X({
|
|
896
|
-
image: new
|
|
896
|
+
image: new pe({
|
|
897
897
|
src: t(),
|
|
898
898
|
scale: r || te.scaleNum,
|
|
899
899
|
anchor: [0.5, 0.5],
|
|
900
|
-
rotation:
|
|
900
|
+
rotation: y * Math.PI / 180,
|
|
901
901
|
rotateWithView: !1
|
|
902
902
|
})
|
|
903
903
|
});
|
|
@@ -911,20 +911,20 @@ const ao = (e) => {
|
|
|
911
911
|
<path d="M30.8843 12.6777L2.21343 21.7067C1.75559 21.8509 1.28947 21.509 1.28947 21.029L1.28947 2.97103C1.28947 2.49102 1.75558 2.14913 2.21342 2.29331L30.8843 11.3223C31.5471 11.531 31.5471 12.469 30.8843 12.6777Z"
|
|
912
912
|
fill="${s}" stroke="${o ? "#FF2424" : "black"}" stroke-width="${o ? "2" : "0.578947"}" />
|
|
913
913
|
<!--path船航向左边或者向前-->
|
|
914
|
-
${
|
|
914
|
+
${c === oe.left && `<path d="M30 12L40 12L40 8" stroke="${o ? "#FF2424" : "black"}" stroke-width="2"/>`}
|
|
915
915
|
<!--path船航向右边-->
|
|
916
|
-
${
|
|
916
|
+
${c === oe.right && `<path d="M30 12L40 12L40 16" stroke="${o ? "#FF2424" : "black"}" stroke-width="2"/>`}
|
|
917
917
|
<!--path黑线无左右-->
|
|
918
|
-
${
|
|
918
|
+
${c === oe.front && `<path d="M30 12L40 12" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
919
919
|
</svg>
|
|
920
920
|
`;
|
|
921
921
|
case "ship":
|
|
922
922
|
return `<svg width="97" height="20" viewBox="0 0 97 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
923
923
|
<path d="M0.289474 17.3433L0.289474 2.65655C0.289474 2.28572 0.574654 1.97725 0.944343 1.9482L22.0544 0.289473L67.5204 0.289473C67.6295 0.289473 67.7372 0.314613 67.835 0.362943L86.0565 9.3629C86.5844 9.6236 86.5844 10.3763 86.0565 10.637L67.835 19.6371C67.7372 19.6854 67.6295 19.7105 67.5203 19.7105L22.0544 19.7105L0.944343 18.0517C0.574653 18.0226 0.289474 17.7142 0.289474 17.3433Z"
|
|
924
924
|
fill="${s}" stroke="${o ? "#FF2424" : "black"}" stroke-width="${o ? "4" : "0.578947"}"/>
|
|
925
|
-
${
|
|
926
|
-
${
|
|
927
|
-
${
|
|
925
|
+
${c === oe.left && `<path d="M86 10L96 10L96 6" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
926
|
+
${c === oe.right && `<path d="M86 10L96 10L96 14" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
927
|
+
${c === oe.front && `<path d="M86 10L96 10" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
928
928
|
</svg>
|
|
929
929
|
`;
|
|
930
930
|
default:
|
|
@@ -932,9 +932,9 @@ const ao = (e) => {
|
|
|
932
932
|
}
|
|
933
933
|
}
|
|
934
934
|
}, go = (e, r) => {
|
|
935
|
-
const l = dt(e, r), s = r.id, { lon:
|
|
935
|
+
const l = dt(e, r), s = r.id, { lon: c, lat: o } = r, u = new ce({
|
|
936
936
|
element: l,
|
|
937
|
-
position:
|
|
937
|
+
position: I([c, o]),
|
|
938
938
|
id: "selected-" + s,
|
|
939
939
|
positioning: "center-center",
|
|
940
940
|
offset: [0, 5],
|
|
@@ -942,24 +942,24 @@ const ao = (e) => {
|
|
|
942
942
|
});
|
|
943
943
|
return u.set("class", "ship-overlay-selected"), u;
|
|
944
944
|
}, dt = (e, r) => {
|
|
945
|
-
const l = at(e), s = Qe(e, r, l),
|
|
946
|
-
<svg style="transform:scale(${s});" xmlns="http://www.w3.org/2000/svg" width="${
|
|
945
|
+
const l = at(e), s = Qe(e, r, l), c = l === "ship" ? 109 : 49, o = `
|
|
946
|
+
<svg style="transform:scale(${s});" xmlns="http://www.w3.org/2000/svg" width="${c}" height="${c}" viewBox="0 0 49 49" fill="none">
|
|
947
947
|
<path d="M1.99982 46.9998L1.99982 1.99982L46.9998 1.99982L46.9998 46.9998L1.99982 46.9998Z" fill="#FF2424" fill-opacity="0.2"/>
|
|
948
948
|
<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"/>
|
|
949
949
|
</svg>
|
|
950
950
|
`, u = document.createElement("div");
|
|
951
951
|
return u.className = "ship-overlay-selected", u.innerHTML = o, u;
|
|
952
952
|
}, fo = (e, r) => {
|
|
953
|
-
const { lon: l, lat: s, blinking:
|
|
954
|
-
l && s && co(e,
|
|
953
|
+
const { lon: l, lat: s, blinking: c } = r, o = ut(r);
|
|
954
|
+
l && s && co(e, I([l, s]), o, { ...r, blinking: c });
|
|
955
955
|
}, ut = (e) => {
|
|
956
956
|
const r = document.createElement("div");
|
|
957
957
|
r.className = "ship-overlay-box", r.style.position = "relative";
|
|
958
|
-
const { lon: l, lat: s, blinking:
|
|
958
|
+
const { lon: l, lat: s, blinking: c, blinkingColors: o, name: u } = e, y = Ae({
|
|
959
959
|
setup() {
|
|
960
960
|
return io({
|
|
961
961
|
position: [l + 2e-3, s + 2e-3],
|
|
962
|
-
selected:
|
|
962
|
+
selected: c,
|
|
963
963
|
name: u,
|
|
964
964
|
colors: o || [],
|
|
965
965
|
existDevice: e == null ? void 0 : e.existDevice,
|
|
@@ -968,12 +968,12 @@ const ao = (e) => {
|
|
|
968
968
|
});
|
|
969
969
|
}
|
|
970
970
|
});
|
|
971
|
-
return Pt(
|
|
971
|
+
return Pt(y, r), r;
|
|
972
972
|
}, rt = (e) => {
|
|
973
973
|
const r = [];
|
|
974
974
|
return e.existDevice && r.push(""), e.existMobile && r.push(""), e.existWaterGauge && r.push(""), r;
|
|
975
975
|
};
|
|
976
|
-
function
|
|
976
|
+
function ho() {
|
|
977
977
|
const e = [
|
|
978
978
|
"left-top",
|
|
979
979
|
"left-middle",
|
|
@@ -984,82 +984,82 @@ function vo() {
|
|
|
984
984
|
];
|
|
985
985
|
return e[Math.floor(Math.random() * e.length)];
|
|
986
986
|
}
|
|
987
|
-
const
|
|
987
|
+
const vo = window.devicePixelRatio || 1;
|
|
988
988
|
function yo(e, r, l = "left-bottom", s = 2) {
|
|
989
|
-
const
|
|
989
|
+
const c = document.createElement("canvas"), o = c.getContext("2d");
|
|
990
990
|
if (!o) return "";
|
|
991
|
-
const u = 2,
|
|
991
|
+
const u = 2, y = 8, t = 16, n = window.devicePixelRatio || 1, m = "500 12px Arial", h = "14px map-iconfont";
|
|
992
992
|
o.font = m;
|
|
993
|
-
const
|
|
994
|
-
o.font =
|
|
995
|
-
const
|
|
996
|
-
let
|
|
997
|
-
switch (
|
|
993
|
+
const L = o.measureText(e).width;
|
|
994
|
+
o.font = h;
|
|
995
|
+
const v = r.map((p) => ({ width: o.measureText(ge(p)).width, height: 14 })), w = v.reduce((p, P) => p + P.width, 0), k = (r.length - 1) * s, C = y + L + w + k + y, x = u + 14 + u;
|
|
996
|
+
let G, D, q = 0, Y = 0, O = 0, Z = 0, T = 0, a = 0;
|
|
997
|
+
switch (G = t + C, l) {
|
|
998
998
|
case "right-top":
|
|
999
|
-
|
|
999
|
+
D = t + x, q = 0, Y = t + x, O = t, Z = 0, T = t, a = 0;
|
|
1000
1000
|
break;
|
|
1001
1001
|
case "right-middle":
|
|
1002
|
-
|
|
1002
|
+
D = x, q = 0, Y = x / 2, O = t, Z = x / 2, T = t, a = 0;
|
|
1003
1003
|
break;
|
|
1004
1004
|
case "right-bottom":
|
|
1005
|
-
|
|
1005
|
+
D = t + x, q = 0, Y = 0, O = t, Z = t, T = t, a = t;
|
|
1006
1006
|
break;
|
|
1007
1007
|
case "left-top":
|
|
1008
|
-
|
|
1008
|
+
D = t + x, q = C, Y = t, O = C + t, Z = x + t, T = 0, a = 0;
|
|
1009
1009
|
break;
|
|
1010
1010
|
case "left-middle":
|
|
1011
|
-
|
|
1011
|
+
D = x, q = C, Y = x / 2, O = C + t, Z = x / 2, T = 0, a = 0;
|
|
1012
1012
|
break;
|
|
1013
1013
|
case "left-bottom":
|
|
1014
|
-
|
|
1014
|
+
D = t + x, q = C, Y = x, O = C + t, Z = 0, T = 0, a = t;
|
|
1015
1015
|
break;
|
|
1016
1016
|
}
|
|
1017
|
-
|
|
1018
|
-
const
|
|
1019
|
-
o.strokeStyle = "#ffffff", o.lineWidth = 1, o.strokeText(e,
|
|
1020
|
-
let g =
|
|
1021
|
-
return r.length > 0 && r.forEach((
|
|
1022
|
-
const V = a + u +
|
|
1023
|
-
o.fillText(
|
|
1024
|
-
}),
|
|
1017
|
+
D = D + u, c.width = Math.round(G * n), c.height = Math.round(D * n), o.scale(n, n), o.clearRect(0, 0, G, D), o.beginPath(), o.moveTo(q, Y), o.lineTo(O, Z), o.strokeStyle = "#FFF", o.lineWidth = 1, o.stroke(), o.fillStyle = "#FFF", o.fillRect(T, a, C, x), o.font = m, o.textBaseline = "middle";
|
|
1018
|
+
const b = a + u + x / 2;
|
|
1019
|
+
o.strokeStyle = "#ffffff", o.lineWidth = 1, o.strokeText(e, T + y, b), o.fillStyle = "#000000", o.fillText(e, T + y, b), o.font = h, o.fillStyle = "#3370ff";
|
|
1020
|
+
let g = T + y + L + s;
|
|
1021
|
+
return r.length > 0 && r.forEach((p, P) => {
|
|
1022
|
+
const V = a + u + x / 2;
|
|
1023
|
+
o.fillText(ge(p), g, V), g += v[P].width + s;
|
|
1024
|
+
}), c.toDataURL("image/png");
|
|
1025
1025
|
}
|
|
1026
1026
|
const nt = (e, r) => {
|
|
1027
|
-
const { name: l, rightIcons: s, selected:
|
|
1028
|
-
let
|
|
1027
|
+
const { name: l, rightIcons: s, selected: c } = e.getProperties(), o = r !== 1 ? ho() : "right-top", u = yo(l, s, o);
|
|
1028
|
+
let y = [0, 0];
|
|
1029
1029
|
switch (o) {
|
|
1030
1030
|
case "right-top":
|
|
1031
|
-
|
|
1031
|
+
y = [0, 1];
|
|
1032
1032
|
break;
|
|
1033
1033
|
case "right-middle":
|
|
1034
|
-
|
|
1034
|
+
y = [0, 0.5];
|
|
1035
1035
|
break;
|
|
1036
1036
|
case "right-bottom":
|
|
1037
|
-
|
|
1037
|
+
y = [0, 0];
|
|
1038
1038
|
break;
|
|
1039
1039
|
case "left-top":
|
|
1040
|
-
|
|
1040
|
+
y = [1, 1];
|
|
1041
1041
|
break;
|
|
1042
1042
|
case "left-middle":
|
|
1043
|
-
|
|
1043
|
+
y = [1, 0.5];
|
|
1044
1044
|
break;
|
|
1045
1045
|
case "left-bottom":
|
|
1046
|
-
|
|
1046
|
+
y = [1, 0];
|
|
1047
1047
|
break;
|
|
1048
1048
|
}
|
|
1049
1049
|
return new X({
|
|
1050
|
-
image: new
|
|
1050
|
+
image: new pe({
|
|
1051
1051
|
src: u,
|
|
1052
|
-
anchor:
|
|
1052
|
+
anchor: y,
|
|
1053
1053
|
displacement: [0, 0],
|
|
1054
|
-
scale: 1 /
|
|
1054
|
+
scale: 1 / vo,
|
|
1055
1055
|
anchorXUnits: "fraction",
|
|
1056
1056
|
anchorYUnits: "fraction"
|
|
1057
1057
|
}),
|
|
1058
|
-
zIndex:
|
|
1058
|
+
zIndex: c ? 100 : 10
|
|
1059
1059
|
});
|
|
1060
1060
|
}, mo = (e) => {
|
|
1061
1061
|
let r = null, l = null;
|
|
1062
|
-
const s = new de(),
|
|
1062
|
+
const s = new de(), c = new Wt({
|
|
1063
1063
|
source: s,
|
|
1064
1064
|
className: "zh-map--ship-layer",
|
|
1065
1065
|
renderBuffer: 300,
|
|
@@ -1073,25 +1073,25 @@ const nt = (e, r) => {
|
|
|
1073
1073
|
updateWhileAnimating: !1,
|
|
1074
1074
|
declutter: !0
|
|
1075
1075
|
});
|
|
1076
|
-
e == null || e.addLayer(
|
|
1077
|
-
let
|
|
1078
|
-
const
|
|
1076
|
+
e == null || e.addLayer(c), e == null || e.addLayer(u);
|
|
1077
|
+
let y = null, t = "", n = {}, m = {};
|
|
1078
|
+
const h = (a) => {
|
|
1079
1079
|
if (!a || !e) return;
|
|
1080
|
-
const
|
|
1080
|
+
const b = (l == null ? void 0 : l.id) || (r == null ? void 0 : r.get("id"));
|
|
1081
1081
|
if (l) {
|
|
1082
|
-
const g = a.filter((
|
|
1082
|
+
const g = a.filter((p) => p.id === b);
|
|
1083
1083
|
g.length === 0 ? a.push(l) : l = g[0];
|
|
1084
1084
|
}
|
|
1085
|
-
|
|
1085
|
+
k(), C(!0), T(a), L();
|
|
1086
1086
|
}, N = (a) => {
|
|
1087
1087
|
var z;
|
|
1088
|
-
const
|
|
1088
|
+
const b = (l == null ? void 0 : l.id) || (r == null ? void 0 : r.get("id")), g = I([a == null ? void 0 : a.lon, a == null ? void 0 : a.lat]), p = ((z = m[a.id]) == null ? void 0 : z.blinkColors) || [], V = p[p.length - 1] || a.fill || "#04C900", A = ao(a), j = new ie({
|
|
1089
1089
|
geometry: new le(g),
|
|
1090
1090
|
// 船舶数据
|
|
1091
1091
|
shipData: a,
|
|
1092
1092
|
id: a.id,
|
|
1093
1093
|
name: a.cnname || a.enname || a.name || a.id || "未命名船舶",
|
|
1094
|
-
selected: a.id ===
|
|
1094
|
+
selected: a.id === b,
|
|
1095
1095
|
// 图标
|
|
1096
1096
|
rightIcons: rt(a),
|
|
1097
1097
|
// 是否闪烁
|
|
@@ -1101,126 +1101,126 @@ const nt = (e, r) => {
|
|
|
1101
1101
|
// 船舶颜色
|
|
1102
1102
|
color: V,
|
|
1103
1103
|
// 船艏向的方向
|
|
1104
|
-
direct:
|
|
1104
|
+
direct: A,
|
|
1105
1105
|
// 高亮
|
|
1106
1106
|
isHighlight: !1
|
|
1107
1107
|
});
|
|
1108
1108
|
return j.set("clickGeometry", new Yt(g)), j;
|
|
1109
|
-
},
|
|
1109
|
+
}, L = async () => {
|
|
1110
1110
|
if (!l || !e) return;
|
|
1111
|
-
let
|
|
1112
|
-
if (
|
|
1111
|
+
let b = e.getOverlays().getArray().find((g) => g.get("class") == "ship-overlay-selected");
|
|
1112
|
+
if (b) {
|
|
1113
1113
|
const g = dt(e, l);
|
|
1114
|
-
await
|
|
1114
|
+
await b.setElement(g), await b.setPosition(I([l.lon, l.lat]));
|
|
1115
1115
|
} else
|
|
1116
|
-
|
|
1116
|
+
b = go(e, l), b && e.addOverlay(b);
|
|
1117
1117
|
setTimeout(() => {
|
|
1118
1118
|
var g;
|
|
1119
|
-
|
|
1119
|
+
b && ((g = b.get("element")) != null && g.parentElement) && (b.get("element").parentElement.style.display = "block");
|
|
1120
1120
|
}, 20);
|
|
1121
|
-
},
|
|
1121
|
+
}, v = (a) => {
|
|
1122
1122
|
if (a === "start") {
|
|
1123
|
-
const
|
|
1123
|
+
const b = () => {
|
|
1124
1124
|
s.getFeatures().forEach((g) => {
|
|
1125
|
-
g.setStyle(
|
|
1126
|
-
}),
|
|
1125
|
+
g.setStyle(ve(e, g));
|
|
1126
|
+
}), y = requestAnimationFrame(b);
|
|
1127
1127
|
};
|
|
1128
|
-
|
|
1128
|
+
b();
|
|
1129
1129
|
}
|
|
1130
|
-
a === "end" &&
|
|
1130
|
+
a === "end" && y && (cancelAnimationFrame(y), y = null);
|
|
1131
1131
|
}, w = () => {
|
|
1132
|
-
const
|
|
1133
|
-
if (
|
|
1134
|
-
const g =
|
|
1135
|
-
console.log(
|
|
1132
|
+
const b = (e == null ? void 0 : e.getOverlays().getArray()).find((g) => g.get("class") == "ship-overlay-selected");
|
|
1133
|
+
if (b) {
|
|
1134
|
+
const g = b.getElement(), p = Qe(e, l, "ship"), P = g.querySelector("svg");
|
|
1135
|
+
console.log(P), P && (P.style.transform = `scale(${p})`);
|
|
1136
1136
|
}
|
|
1137
|
-
},
|
|
1138
|
-
e && s && (s.clear(), o.clear(), C(),
|
|
1137
|
+
}, k = () => {
|
|
1138
|
+
e && s && (s.clear(), o.clear(), C(), v("end"));
|
|
1139
1139
|
}, C = (a) => {
|
|
1140
|
-
const
|
|
1141
|
-
if (
|
|
1142
|
-
for (let g = 0; g <
|
|
1143
|
-
if (!a &&
|
|
1144
|
-
const
|
|
1145
|
-
|
|
1140
|
+
const b = e.getOverlays().getArray().filter((g) => g.get("class") == "zh-map-ship-overlay");
|
|
1141
|
+
if (b && b.length > 0) {
|
|
1142
|
+
for (let g = 0; g < b.length; g++)
|
|
1143
|
+
if (!a && b[g].get("class") !== "ship-overlay-selected") {
|
|
1144
|
+
const p = b[g];
|
|
1145
|
+
p.setPosition(void 0), e.removeOverlay(p), p.dispose();
|
|
1146
1146
|
}
|
|
1147
1147
|
}
|
|
1148
|
-
},
|
|
1149
|
-
n = a, m =
|
|
1150
|
-
const g = e.getOverlays().getArray(),
|
|
1151
|
-
for (const
|
|
1152
|
-
const V = n[
|
|
1153
|
-
if (
|
|
1154
|
-
const z =
|
|
1155
|
-
j.set("blinking", V), z[(z == null ? void 0 : z.length) - 1] && se !== z[(z == null ? void 0 : z.length) - 1] && (j.set("color", z[(z == null ? void 0 : z.length) - 1] || ""), j.setStyle(
|
|
1148
|
+
}, x = (a, b) => {
|
|
1149
|
+
n = a, m = b;
|
|
1150
|
+
const g = e.getOverlays().getArray(), p = s.getFeatures();
|
|
1151
|
+
for (const P in n) {
|
|
1152
|
+
const V = n[P], A = g.find((z) => z.getId() === "label-" + P), j = p.find((z) => P === z.get("id"));
|
|
1153
|
+
if (A && j) {
|
|
1154
|
+
const z = b[P].blinkColors || [], { shipData: ae, name: re, color: se } = j.getProperties();
|
|
1155
|
+
j.set("blinking", V), z[(z == null ? void 0 : z.length) - 1] && se !== z[(z == null ? void 0 : z.length) - 1] && (j.set("color", z[(z == null ? void 0 : z.length) - 1] || ""), j.setStyle(ve(e, j)));
|
|
1156
1156
|
const Re = {
|
|
1157
1157
|
...ae,
|
|
1158
1158
|
blinking: V,
|
|
1159
1159
|
blinkingColors: z || [],
|
|
1160
|
-
name: re + "(" +
|
|
1161
|
-
}, be =
|
|
1162
|
-
be && be !==
|
|
1160
|
+
name: re + "(" + b[P].shipState + ")"
|
|
1161
|
+
}, be = A.getElement(), Me = ut(Re);
|
|
1162
|
+
be && be !== Me && A.setElement(Me);
|
|
1163
1163
|
}
|
|
1164
1164
|
}
|
|
1165
|
-
},
|
|
1165
|
+
}, G = (a) => {
|
|
1166
1166
|
if (!e) return;
|
|
1167
|
-
const
|
|
1167
|
+
const b = s.getFeatures(), g = o.getFeatures(), p = r ? r.get("id") : "", P = b.filter((z) => z.get("id") !== p), V = g == null ? void 0 : g.filter((z) => z.get("id") !== p), A = /* @__PURE__ */ new Map();
|
|
1168
1168
|
a.forEach((z) => {
|
|
1169
|
-
|
|
1169
|
+
A.set(z.id, !0);
|
|
1170
1170
|
});
|
|
1171
1171
|
const j = e.getOverlays().getArray();
|
|
1172
|
-
|
|
1172
|
+
P.forEach((z) => {
|
|
1173
1173
|
const ae = z.get("id");
|
|
1174
|
-
if (!
|
|
1174
|
+
if (!A.has(ae))
|
|
1175
1175
|
z.setStyle([]);
|
|
1176
1176
|
else {
|
|
1177
1177
|
const se = z.getStyle();
|
|
1178
|
-
(se == null ? void 0 : se.length) == 0 && z.setStyle(
|
|
1178
|
+
(se == null ? void 0 : se.length) == 0 && z.setStyle(ve(e, z));
|
|
1179
1179
|
}
|
|
1180
1180
|
const re = j.find((se) => se.getId() === "label-" + ae);
|
|
1181
1181
|
re && re.setPosition(void 0);
|
|
1182
1182
|
}), console.log(V), V.forEach((z) => {
|
|
1183
1183
|
const ae = z.get("id");
|
|
1184
|
-
if (!
|
|
1184
|
+
if (!A.has(ae))
|
|
1185
1185
|
z.setStyle([]);
|
|
1186
1186
|
else {
|
|
1187
1187
|
const re = z.getStyle();
|
|
1188
1188
|
(re == null ? void 0 : re.length) == 0 && z.setStyle(nt(z));
|
|
1189
1189
|
}
|
|
1190
1190
|
});
|
|
1191
|
-
},
|
|
1191
|
+
}, D = (a) => {
|
|
1192
1192
|
if (a) {
|
|
1193
1193
|
console.log("选中", a);
|
|
1194
|
-
const
|
|
1195
|
-
|
|
1194
|
+
const b = s.getFeatures().find((p) => p.get("id") === a.id), g = o.getFeatures().find((p) => p.get("id") === a.id);
|
|
1195
|
+
b && (r = b), g && g.set("selected", !0), l = a, L();
|
|
1196
1196
|
} else
|
|
1197
|
-
console.log("取消选中"), l = null, r = null,
|
|
1198
|
-
}, q =
|
|
1197
|
+
console.log("取消选中"), l = null, r = null, O();
|
|
1198
|
+
}, q = Ve((a, b, g) => {
|
|
1199
1199
|
try {
|
|
1200
1200
|
if (a) {
|
|
1201
|
-
const
|
|
1202
|
-
if (e.getTargetElement().style.cursor =
|
|
1203
|
-
t && t !==
|
|
1204
|
-
const V = s.getFeatures().find((
|
|
1205
|
-
V == null || V.set("isHighlight", !0), V == null || V.setStyle(
|
|
1201
|
+
const p = a.get("shipData"), P = a.get("id");
|
|
1202
|
+
if (e.getTargetElement().style.cursor = P ? "pointer" : "", b === "click" && (D(p), g && g(P)), b === "hover") {
|
|
1203
|
+
t && t !== P && Y(), t = P;
|
|
1204
|
+
const V = s.getFeatures().find((A) => A.get("id") === t);
|
|
1205
|
+
V == null || V.set("isHighlight", !0), V == null || V.setStyle(ve(e, V));
|
|
1206
1206
|
}
|
|
1207
1207
|
} else
|
|
1208
1208
|
e.getTargetElement().style.cursor = "", Y();
|
|
1209
|
-
} catch (
|
|
1210
|
-
console.log("handleShipMapEvent",
|
|
1209
|
+
} catch (p) {
|
|
1210
|
+
console.log("handleShipMapEvent", p);
|
|
1211
1211
|
}
|
|
1212
1212
|
}, 10), Y = () => {
|
|
1213
|
-
const a = t ? s.getFeatures().find((
|
|
1214
|
-
t = null, a == null || a.set("isHighlight", !1), a == null || a.setStyle(
|
|
1215
|
-
},
|
|
1213
|
+
const a = t ? s.getFeatures().find((b) => b.get("id") === t) : null;
|
|
1214
|
+
t = null, a == null || a.set("isHighlight", !1), a == null || a.setStyle(ve(e, a));
|
|
1215
|
+
}, O = () => {
|
|
1216
1216
|
try {
|
|
1217
|
-
const
|
|
1218
|
-
|
|
1217
|
+
const b = e.getOverlays().getArray().find((g) => g.get("class") == "ship-overlay-selected");
|
|
1218
|
+
b && b.setPosition(void 0);
|
|
1219
1219
|
} catch (a) {
|
|
1220
1220
|
console.log(a);
|
|
1221
1221
|
}
|
|
1222
|
-
}, Z = (a,
|
|
1223
|
-
const g =
|
|
1222
|
+
}, Z = (a, b) => {
|
|
1223
|
+
const g = I([a == null ? void 0 : a.lon, a == null ? void 0 : a.lat]), p = new ie({
|
|
1224
1224
|
geometry: new le(g),
|
|
1225
1225
|
name: a.cnname || a.enname || a.name || a.id || "未命名船舶",
|
|
1226
1226
|
// 图标
|
|
@@ -1228,17 +1228,17 @@ const nt = (e, r) => {
|
|
|
1228
1228
|
selected: (a == null ? void 0 : a.id) === (l == null ? void 0 : l.id),
|
|
1229
1229
|
shipData: a
|
|
1230
1230
|
});
|
|
1231
|
-
|
|
1232
|
-
const
|
|
1233
|
-
return
|
|
1234
|
-
},
|
|
1235
|
-
const
|
|
1231
|
+
p.set("id", a.id);
|
|
1232
|
+
const P = nt(p, b);
|
|
1233
|
+
return p.setStyle(P), p;
|
|
1234
|
+
}, T = (a) => {
|
|
1235
|
+
const b = e.getView().getZoom();
|
|
1236
1236
|
a.forEach((g) => {
|
|
1237
|
-
const
|
|
1238
|
-
if (
|
|
1237
|
+
const p = N(g);
|
|
1238
|
+
if (p.setStyle(ve(e, p)), s.addFeature(p), (l == null ? void 0 : l.id) == g.id || b >= te.shipModelMin)
|
|
1239
1239
|
if (n[g.id]) {
|
|
1240
1240
|
if (g.id && m[g == null ? void 0 : g.id]) {
|
|
1241
|
-
const
|
|
1241
|
+
const P = m[g == null ? void 0 : g.id] || {}, V = (P == null ? void 0 : P.blinkColors) || [], A = (P == null ? void 0 : P.shipState) || "", j = (g.cnname || g.enname || g.name || g.id || "未命名船舶") + "(" + A + ")", z = {
|
|
1242
1242
|
...g,
|
|
1243
1243
|
name: j,
|
|
1244
1244
|
blinking: n[g.id],
|
|
@@ -1247,29 +1247,29 @@ const nt = (e, r) => {
|
|
|
1247
1247
|
fo(e, z);
|
|
1248
1248
|
}
|
|
1249
1249
|
} else {
|
|
1250
|
-
const
|
|
1251
|
-
o.addFeature(
|
|
1250
|
+
const P = Z(g, a.length);
|
|
1251
|
+
o.addFeature(P);
|
|
1252
1252
|
}
|
|
1253
1253
|
});
|
|
1254
1254
|
};
|
|
1255
1255
|
return {
|
|
1256
|
-
render:
|
|
1257
|
-
selected:
|
|
1258
|
-
filter:
|
|
1259
|
-
blinking:
|
|
1260
|
-
clear:
|
|
1256
|
+
render: h,
|
|
1257
|
+
selected: D,
|
|
1258
|
+
filter: G,
|
|
1259
|
+
blinking: x,
|
|
1260
|
+
clear: k,
|
|
1261
1261
|
handleShipMapEvent: q,
|
|
1262
|
-
changeShipScale:
|
|
1262
|
+
changeShipScale: v,
|
|
1263
1263
|
changeSelectedScale: w
|
|
1264
1264
|
};
|
|
1265
1265
|
}, wo = (e) => {
|
|
1266
|
-
const r = () => e == null ? void 0 : e.getLayers(), l =
|
|
1266
|
+
const r = () => e == null ? void 0 : e.getLayers(), l = U("vector"), s = () => l.value, c = (t) => {
|
|
1267
1267
|
l.value = t;
|
|
1268
1268
|
const n = r();
|
|
1269
1269
|
n && (n == null || n.getArray().forEach((m) => {
|
|
1270
1270
|
(m.className_ === "vector" || m.className_ === "satellite") && m.setVisible(m.className_ === t);
|
|
1271
1271
|
}));
|
|
1272
|
-
}, o =
|
|
1272
|
+
}, o = U(!1);
|
|
1273
1273
|
return {
|
|
1274
1274
|
getLayers: r,
|
|
1275
1275
|
getGreenTileVisible: () => o.value,
|
|
@@ -1277,27 +1277,27 @@ const nt = (e, r) => {
|
|
|
1277
1277
|
if (t !== o.value) {
|
|
1278
1278
|
if (t) {
|
|
1279
1279
|
const n = r();
|
|
1280
|
-
if (!n.getArray().find((
|
|
1281
|
-
const
|
|
1282
|
-
source: new
|
|
1280
|
+
if (!n.getArray().find((h) => h.className_ === "greenTile")) {
|
|
1281
|
+
const h = new ye({
|
|
1282
|
+
source: new me({ url: ue.greenTile }),
|
|
1283
1283
|
visible: t,
|
|
1284
1284
|
zIndex: 2,
|
|
1285
1285
|
className: "greenTile"
|
|
1286
1286
|
});
|
|
1287
|
-
n.push(
|
|
1287
|
+
n.push(h);
|
|
1288
1288
|
}
|
|
1289
1289
|
} else {
|
|
1290
|
-
const n = r(), m = n.getArray().find((
|
|
1290
|
+
const n = r(), m = n.getArray().find((h) => h.className_ === "greenTile");
|
|
1291
1291
|
m && n.remove(m);
|
|
1292
1292
|
}
|
|
1293
1293
|
o.value = t;
|
|
1294
1294
|
}
|
|
1295
1295
|
},
|
|
1296
1296
|
getShowLayerType: s,
|
|
1297
|
-
setShowLayerType:
|
|
1297
|
+
setShowLayerType: c
|
|
1298
1298
|
};
|
|
1299
1299
|
}, xo = () => {
|
|
1300
|
-
const e =
|
|
1300
|
+
const e = U();
|
|
1301
1301
|
return {
|
|
1302
1302
|
setProps: (s) => {
|
|
1303
1303
|
e.value = s;
|
|
@@ -1306,73 +1306,73 @@ const nt = (e, r) => {
|
|
|
1306
1306
|
};
|
|
1307
1307
|
}, bo = (e) => {
|
|
1308
1308
|
const r = "zh-map-location-layer";
|
|
1309
|
-
let l, s,
|
|
1310
|
-
const u = (
|
|
1311
|
-
if (!(!
|
|
1309
|
+
let l, s, c = null, o = null;
|
|
1310
|
+
const u = (v) => {
|
|
1311
|
+
if (!(!v || v.length === 0)) {
|
|
1312
1312
|
if (s || (s = new de()), s.clear(), o) {
|
|
1313
|
-
const w =
|
|
1314
|
-
w ? o = w :
|
|
1313
|
+
const w = v.find((k) => k.id === o.id);
|
|
1314
|
+
w ? o = w : v.push(o);
|
|
1315
1315
|
}
|
|
1316
|
-
|
|
1317
|
-
|
|
1316
|
+
v.forEach((w) => {
|
|
1317
|
+
y(w);
|
|
1318
1318
|
}), l || (l = new he({
|
|
1319
1319
|
className: r,
|
|
1320
1320
|
source: s,
|
|
1321
1321
|
zIndex: 100
|
|
1322
1322
|
}), e == null || e.addLayer(l));
|
|
1323
1323
|
}
|
|
1324
|
-
},
|
|
1325
|
-
const w = e == null ? void 0 : e.getView().getZoom(), [
|
|
1326
|
-
geometry: new le(
|
|
1324
|
+
}, y = (v) => {
|
|
1325
|
+
const w = e == null ? void 0 : e.getView().getZoom(), [k, C] = v.latLon.split(","), x = new ie({
|
|
1326
|
+
geometry: new le(I([Number(k), Number(C)]))
|
|
1327
1327
|
});
|
|
1328
|
-
|
|
1329
|
-
}, t = (
|
|
1328
|
+
x.setStyle(t(v, w, v.id === (o == null ? void 0 : o.id))), x.set("loactionData", v), s.addFeature(x);
|
|
1329
|
+
}, t = (v, w, k) => {
|
|
1330
1330
|
const C = {
|
|
1331
|
-
image: new
|
|
1332
|
-
src:
|
|
1331
|
+
image: new pe({
|
|
1332
|
+
src: k && v.selectedPath || v.defaultPath,
|
|
1333
1333
|
scale: 0.5 * w / 10
|
|
1334
1334
|
})
|
|
1335
1335
|
};
|
|
1336
|
-
return
|
|
1337
|
-
text:
|
|
1336
|
+
return v.name && (C.text = new we({
|
|
1337
|
+
text: v.name,
|
|
1338
1338
|
font: "12px sans-serif",
|
|
1339
|
-
fill: new
|
|
1339
|
+
fill: new ee({
|
|
1340
1340
|
color: "#000000"
|
|
1341
1341
|
}),
|
|
1342
|
-
backgroundFill: new
|
|
1342
|
+
backgroundFill: new ee({
|
|
1343
1343
|
color: "#FFFFFF"
|
|
1344
1344
|
}),
|
|
1345
1345
|
offsetY: 30
|
|
1346
1346
|
})), new X(C);
|
|
1347
1347
|
}, n = () => {
|
|
1348
|
-
if (
|
|
1349
|
-
const
|
|
1348
|
+
if (c) {
|
|
1349
|
+
const v = c.get("loactionData").id;
|
|
1350
1350
|
s.getFeatures().forEach((w) => {
|
|
1351
|
-
w.get("loactionData").id !==
|
|
1351
|
+
w.get("loactionData").id !== v && s.removeFeature(w);
|
|
1352
1352
|
});
|
|
1353
1353
|
} else
|
|
1354
1354
|
s.clear();
|
|
1355
1355
|
}, m = () => {
|
|
1356
1356
|
var C;
|
|
1357
|
-
const
|
|
1358
|
-
s.getFeatures().forEach((
|
|
1359
|
-
|
|
1360
|
-
}), o = null,
|
|
1361
|
-
},
|
|
1362
|
-
|
|
1357
|
+
const v = c.get("loactionData"), w = (C = e == null ? void 0 : e.getView()) == null ? void 0 : C.getZoom();
|
|
1358
|
+
s.getFeatures().forEach((x) => {
|
|
1359
|
+
x.get("loactionData").id === v.id && (x == null || x.setStyle(t(v, w, !1)));
|
|
1360
|
+
}), o = null, c = null;
|
|
1361
|
+
}, h = (v) => {
|
|
1362
|
+
v ? (N(), L(v)) : clearSelectedPort();
|
|
1363
1363
|
}, N = () => {
|
|
1364
|
-
var
|
|
1365
|
-
if (
|
|
1366
|
-
const w =
|
|
1367
|
-
|
|
1364
|
+
var v;
|
|
1365
|
+
if (c) {
|
|
1366
|
+
const w = c.get("loactionData"), k = (v = e == null ? void 0 : e.getView()) == null ? void 0 : v.getZoom();
|
|
1367
|
+
c.setStyle(t(w, k, !1));
|
|
1368
1368
|
}
|
|
1369
|
-
},
|
|
1369
|
+
}, L = (v) => {
|
|
1370
1370
|
const w = s.getFeatures();
|
|
1371
|
-
o =
|
|
1371
|
+
o = v, c = w.find((k) => k.get("loactionData").id === v.id);
|
|
1372
1372
|
};
|
|
1373
1373
|
return {
|
|
1374
1374
|
render: u,
|
|
1375
|
-
selected:
|
|
1375
|
+
selected: h,
|
|
1376
1376
|
clearSelected: m,
|
|
1377
1377
|
clear: n
|
|
1378
1378
|
};
|
|
@@ -1384,16 +1384,16 @@ const nt = (e, r) => {
|
|
|
1384
1384
|
e.getInteractions().forEach((r) => {
|
|
1385
1385
|
r instanceof st && r.setActive(!0);
|
|
1386
1386
|
});
|
|
1387
|
-
},
|
|
1387
|
+
}, Oe = (e, r) => {
|
|
1388
1388
|
const l = e.getViewport();
|
|
1389
1389
|
l && (l.style.cursor = r);
|
|
1390
1390
|
}, Mo = (e, r) => {
|
|
1391
|
-
const l =
|
|
1392
|
-
s.value =
|
|
1391
|
+
const l = U([]), s = U("km"), c = (T) => {
|
|
1392
|
+
s.value = T;
|
|
1393
1393
|
};
|
|
1394
1394
|
let o;
|
|
1395
|
-
const u =
|
|
1396
|
-
|
|
1395
|
+
const u = U(!1), y = () => {
|
|
1396
|
+
Oe(e, "crosshair"), m(), ko(e), e.on("pointermove", L), e.getViewport().addEventListener("mouseout", () => {
|
|
1397
1397
|
o && o.classList.add("hidden");
|
|
1398
1398
|
}), w(), u.value = !0;
|
|
1399
1399
|
};
|
|
@@ -1411,227 +1411,227 @@ const nt = (e, r) => {
|
|
|
1411
1411
|
}
|
|
1412
1412
|
}), e == null || e.addLayer(n);
|
|
1413
1413
|
};
|
|
1414
|
-
let
|
|
1415
|
-
const
|
|
1416
|
-
if (
|
|
1414
|
+
let h, N;
|
|
1415
|
+
const L = (T) => {
|
|
1416
|
+
if (T.dragging)
|
|
1417
1417
|
return;
|
|
1418
1418
|
let a = "点击选择起点";
|
|
1419
|
-
|
|
1419
|
+
h && (a = "单击继续,双击结束"), o && (o.innerHTML = a, N.setPosition(T.coordinate), o.classList.remove("hidden"));
|
|
1420
1420
|
};
|
|
1421
|
-
let
|
|
1421
|
+
let v;
|
|
1422
1422
|
const w = () => {
|
|
1423
|
-
|
|
1423
|
+
v = new Ne({
|
|
1424
1424
|
source: t,
|
|
1425
1425
|
type: "LineString",
|
|
1426
1426
|
style: new X({
|
|
1427
|
-
fill: new
|
|
1427
|
+
fill: new ee({
|
|
1428
1428
|
color: "rgba(255, 255, 255, 0.2)"
|
|
1429
1429
|
}),
|
|
1430
|
-
stroke: new
|
|
1430
|
+
stroke: new fe({
|
|
1431
1431
|
color: "rgba(255,204,51)",
|
|
1432
1432
|
lineDash: [10, 10],
|
|
1433
1433
|
width: 2
|
|
1434
1434
|
}),
|
|
1435
|
-
image: new
|
|
1435
|
+
image: new $e({
|
|
1436
1436
|
radius: 5,
|
|
1437
|
-
stroke: new
|
|
1437
|
+
stroke: new fe({
|
|
1438
1438
|
color: "rgba(0, 0, 0, 0.7)"
|
|
1439
1439
|
}),
|
|
1440
|
-
fill: new
|
|
1440
|
+
fill: new ee({
|
|
1441
1441
|
color: "rgba(255, 255, 255, 0.2)"
|
|
1442
1442
|
})
|
|
1443
1443
|
})
|
|
1444
1444
|
}),
|
|
1445
1445
|
// 添加条件函数,判断是否应该出发点绘制
|
|
1446
1446
|
condition: (a) => a.originalEvent.target.tagName !== "DIV"
|
|
1447
|
-
}), e == null || e.addInteraction(
|
|
1448
|
-
let
|
|
1449
|
-
|
|
1447
|
+
}), e == null || e.addInteraction(v), G(), D();
|
|
1448
|
+
let T;
|
|
1449
|
+
v.on("drawstart", function(a) {
|
|
1450
1450
|
var g;
|
|
1451
|
-
|
|
1452
|
-
let
|
|
1453
|
-
|
|
1454
|
-
const
|
|
1455
|
-
|
|
1451
|
+
h = a.feature, h.set("randomId", k());
|
|
1452
|
+
let b;
|
|
1453
|
+
T = (g = h.getGeometry()) == null ? void 0 : g.on("change", function(p) {
|
|
1454
|
+
const P = p.target, V = gt(P, s.value);
|
|
1455
|
+
b = P.getLastCoordinate(), C && V && (C.innerHTML = V), x.setPosition(b);
|
|
1456
1456
|
});
|
|
1457
|
-
}),
|
|
1458
|
-
var a,
|
|
1457
|
+
}), v.on("drawend", function() {
|
|
1458
|
+
var a, b, g;
|
|
1459
1459
|
if (C && (C.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), C != null && C.innerHTML) {
|
|
1460
|
-
const
|
|
1461
|
-
l.value.push({ id:
|
|
1460
|
+
const p = (h == null ? void 0 : h.get("randomId")) || k();
|
|
1461
|
+
l.value.push({ id: p, value: C == null ? void 0 : C.innerHTML }), C.innerHTML = `${C.innerHTML}<div class="ol-tooltip-delete-button" data-id="${p}"><i class="map-iconfont icon-delete"></i></div>`;
|
|
1462
1462
|
}
|
|
1463
|
-
(a = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || a.addEventListener("click", (
|
|
1463
|
+
(a = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || a.addEventListener("click", (p) => {
|
|
1464
1464
|
var V;
|
|
1465
|
-
|
|
1466
|
-
const
|
|
1467
|
-
|
|
1468
|
-
}),
|
|
1465
|
+
p.preventDefault(), p.stopPropagation();
|
|
1466
|
+
const P = (V = p.target) == null ? void 0 : V.getAttribute("data-id");
|
|
1467
|
+
P && Y(P);
|
|
1468
|
+
}), x.setOffset([0, -7]), h = null, C = null, G(), T && We(T), (g = (b = r.getProps()) == null ? void 0 : b.lineDrawEnd) == null || g.call(b, l.value);
|
|
1469
1469
|
});
|
|
1470
|
-
},
|
|
1471
|
-
let C,
|
|
1472
|
-
const
|
|
1473
|
-
C != null && C.parentNode && C.parentNode.removeChild(C), C = document.createElement("div"), C.className = "ol-tooltip ol-tooltip-measure",
|
|
1470
|
+
}, k = () => Math.random().toString(36).substring(2, 9);
|
|
1471
|
+
let C, x;
|
|
1472
|
+
const G = () => {
|
|
1473
|
+
C != null && C.parentNode && C.parentNode.removeChild(C), C = document.createElement("div"), C.className = "ol-tooltip ol-tooltip-measure", x = new ce({
|
|
1474
1474
|
element: C,
|
|
1475
1475
|
offset: [0, -15],
|
|
1476
1476
|
positioning: "bottom-center",
|
|
1477
1477
|
stopEvent: !1,
|
|
1478
1478
|
insertFirst: !1
|
|
1479
|
-
}), e == null || e.addOverlay(
|
|
1480
|
-
},
|
|
1479
|
+
}), e == null || e.addOverlay(x);
|
|
1480
|
+
}, D = () => {
|
|
1481
1481
|
o != null && o.parentNode && o.parentNode.removeChild(o), o = document.createElement("div"), o.className = "ol-tooltip hidden", N = new ce({
|
|
1482
1482
|
element: o,
|
|
1483
1483
|
offset: [15, 0],
|
|
1484
1484
|
positioning: "center-left"
|
|
1485
1485
|
}), e == null || e.addOverlay(N);
|
|
1486
1486
|
}, q = () => {
|
|
1487
|
-
l.value.forEach((
|
|
1488
|
-
var
|
|
1489
|
-
const
|
|
1490
|
-
|
|
1487
|
+
l.value.forEach((T, a) => {
|
|
1488
|
+
var p, P;
|
|
1489
|
+
const b = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1490
|
+
b[a] && ((P = (p = b[a]) == null ? void 0 : p.parentNode) == null || P.removeChild(b[a]));
|
|
1491
1491
|
const g = t.getFeatures();
|
|
1492
1492
|
g[a] && t.removeFeature(g[a]);
|
|
1493
|
-
}),
|
|
1494
|
-
}, Y = (
|
|
1495
|
-
var
|
|
1496
|
-
const a = l.value.findIndex((V) => V.id ===
|
|
1493
|
+
}), O(), po(e), u.value = !1, Oe(e, "pointer");
|
|
1494
|
+
}, Y = (T) => {
|
|
1495
|
+
var b, g, p, P;
|
|
1496
|
+
const a = l.value.findIndex((V) => V.id === T);
|
|
1497
1497
|
if (a !== -1) {
|
|
1498
1498
|
l.value.splice(a, 1);
|
|
1499
1499
|
const V = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1500
|
-
V[a] && ((g = (
|
|
1501
|
-
const
|
|
1502
|
-
|
|
1500
|
+
V[a] && ((g = (b = V[a]) == null ? void 0 : b.parentNode) == null || g.removeChild(V[a]));
|
|
1501
|
+
const A = t.getFeatures();
|
|
1502
|
+
A[a] && t.removeFeature(A[a]);
|
|
1503
1503
|
}
|
|
1504
|
-
(
|
|
1505
|
-
},
|
|
1506
|
-
if (l.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((
|
|
1504
|
+
(P = (p = r.getProps()) == null ? void 0 : p.lineDrawEnd) == null || P.call(p, l.value);
|
|
1505
|
+
}, O = () => {
|
|
1506
|
+
if (l.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((T) => {
|
|
1507
1507
|
var a;
|
|
1508
|
-
(a =
|
|
1509
|
-
}), t == null || t.clear(),
|
|
1510
|
-
const
|
|
1511
|
-
|
|
1508
|
+
(a = T == null ? void 0 : T.parentNode) == null || a.removeChild(T);
|
|
1509
|
+
}), t == null || t.clear(), v) {
|
|
1510
|
+
const T = e.getInteractions().getArray().find((a) => et(a) === et(v));
|
|
1511
|
+
T && e.removeInteraction(T);
|
|
1512
1512
|
}
|
|
1513
1513
|
e.removeLayer(n), o != null && o.parentNode && o.parentNode.removeChild(o), C != null && C.parentNode && C.parentNode.removeChild(C);
|
|
1514
1514
|
};
|
|
1515
1515
|
return {
|
|
1516
|
-
open:
|
|
1516
|
+
open: y,
|
|
1517
1517
|
close: q,
|
|
1518
1518
|
deleteLine: Y,
|
|
1519
|
-
setUnit:
|
|
1519
|
+
setUnit: c,
|
|
1520
1520
|
getState: () => u.value
|
|
1521
1521
|
};
|
|
1522
1522
|
}, gt = (e, r) => {
|
|
1523
1523
|
const s = He(e);
|
|
1524
|
-
let
|
|
1524
|
+
let c = "";
|
|
1525
1525
|
switch (r) {
|
|
1526
1526
|
case "m":
|
|
1527
|
-
|
|
1527
|
+
c = `${Math.round(s * 100) / 100} m`;
|
|
1528
1528
|
break;
|
|
1529
1529
|
case "km":
|
|
1530
|
-
|
|
1530
|
+
c = `${Math.round(s / 1e3 * 100) / 100} km`;
|
|
1531
1531
|
break;
|
|
1532
1532
|
case "nm":
|
|
1533
|
-
|
|
1533
|
+
c = (Math.round(s / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
|
|
1534
1534
|
break;
|
|
1535
1535
|
}
|
|
1536
|
-
return
|
|
1536
|
+
return c;
|
|
1537
1537
|
}, Co = (e, r) => {
|
|
1538
1538
|
let l, s;
|
|
1539
|
-
const
|
|
1540
|
-
o(),
|
|
1539
|
+
const c = () => {
|
|
1540
|
+
o(), Oe(e, "crosshair");
|
|
1541
1541
|
}, o = () => {
|
|
1542
|
-
t(), C(),
|
|
1542
|
+
t(), C(), D(), L();
|
|
1543
1543
|
};
|
|
1544
|
-
let u = null,
|
|
1544
|
+
let u = null, y = null;
|
|
1545
1545
|
const t = () => {
|
|
1546
|
-
if (u &&
|
|
1547
|
-
const
|
|
1548
|
-
source:
|
|
1546
|
+
if (u && y) return;
|
|
1547
|
+
const O = new de(), Z = new he({
|
|
1548
|
+
source: O,
|
|
1549
1549
|
style: new X({
|
|
1550
|
-
stroke: new
|
|
1550
|
+
stroke: new fe({
|
|
1551
1551
|
color: "#fbcc33",
|
|
1552
1552
|
width: 2
|
|
1553
1553
|
})
|
|
1554
1554
|
})
|
|
1555
1555
|
});
|
|
1556
|
-
u = Z,
|
|
1557
|
-
|
|
1556
|
+
u = Z, y = O, e.on("pointermove", m), e.addLayer(Z), e.on(["dblclick"], function(T) {
|
|
1557
|
+
h && (T.stopPropagation(), T.preventDefault());
|
|
1558
1558
|
});
|
|
1559
1559
|
};
|
|
1560
1560
|
let n;
|
|
1561
|
-
const m = (
|
|
1562
|
-
if (
|
|
1561
|
+
const m = (O) => {
|
|
1562
|
+
if (O.dragging) return;
|
|
1563
1563
|
const Z = n ? "单击继续,双击结束" : "点击选择起点";
|
|
1564
|
-
|
|
1564
|
+
x && (x.innerHTML = Z, G.setPosition(O.coordinate));
|
|
1565
1565
|
};
|
|
1566
|
-
let
|
|
1567
|
-
const
|
|
1566
|
+
let h, N = !1;
|
|
1567
|
+
const L = () => {
|
|
1568
1568
|
if (l) {
|
|
1569
|
-
|
|
1570
|
-
const
|
|
1571
|
-
if (!
|
|
1572
|
-
const Z =
|
|
1569
|
+
x != null && x.parentNode && x.parentNode.removeChild(x);
|
|
1570
|
+
const O = l.getGeometry();
|
|
1571
|
+
if (!O) return;
|
|
1572
|
+
const Z = v(O, "nm");
|
|
1573
1573
|
w && (w.innerHTML = `
|
|
1574
1574
|
<span class="text">面积:${Z}${N ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1575
1575
|
`), w && (w.innerHTML += '<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');
|
|
1576
|
-
const
|
|
1577
|
-
if (
|
|
1576
|
+
const T = O.getCoordinates(), a = T[0][T[0].length - 2];
|
|
1577
|
+
if (k.setPosition(a), u) {
|
|
1578
1578
|
const g = u.getSource();
|
|
1579
1579
|
g && l && (g.clear(), g.addFeature(l));
|
|
1580
1580
|
}
|
|
1581
1581
|
setTimeout(() => {
|
|
1582
1582
|
var g;
|
|
1583
1583
|
(g = document.querySelector(".delete-icon")) == null || g.addEventListener("click", () => {
|
|
1584
|
-
var
|
|
1585
|
-
console.log("delete"), q(), (
|
|
1584
|
+
var p, P;
|
|
1585
|
+
console.log("delete"), q(), (P = (p = r.getProps()) == null ? void 0 : p.areaDrawEnd) == null || P.call(p, []);
|
|
1586
1586
|
});
|
|
1587
1587
|
}, 0);
|
|
1588
|
-
const
|
|
1589
|
-
e == null || e.getView().setCenter(
|
|
1588
|
+
const b = qt(l.getGeometry().getExtent());
|
|
1589
|
+
e == null || e.getView().setCenter(b);
|
|
1590
1590
|
return;
|
|
1591
1591
|
}
|
|
1592
|
-
|
|
1592
|
+
h = new Ne({
|
|
1593
1593
|
type: "Polygon",
|
|
1594
|
-
source:
|
|
1594
|
+
source: y,
|
|
1595
1595
|
trace: !0,
|
|
1596
1596
|
style: [new X({
|
|
1597
|
-
stroke: new
|
|
1597
|
+
stroke: new fe({
|
|
1598
1598
|
color: "rgba(255, 255, 255, 1)",
|
|
1599
1599
|
width: 1.5,
|
|
1600
1600
|
lineDash: [10, 10]
|
|
1601
1601
|
}),
|
|
1602
|
-
fill: new
|
|
1602
|
+
fill: new ee({
|
|
1603
1603
|
color: "rgba(255, 255, 255, 0.25)"
|
|
1604
1604
|
})
|
|
1605
1605
|
}), new X({
|
|
1606
|
-
image: new
|
|
1606
|
+
image: new $e({
|
|
1607
1607
|
radius: 5,
|
|
1608
|
-
fill: new
|
|
1608
|
+
fill: new ee({
|
|
1609
1609
|
color: "rgb(51,112,255, 1)"
|
|
1610
1610
|
})
|
|
1611
1611
|
}),
|
|
1612
|
-
geometry: function(
|
|
1613
|
-
const Z =
|
|
1612
|
+
geometry: function(O) {
|
|
1613
|
+
const Z = O.getGeometry().getCoordinates();
|
|
1614
1614
|
return new Ht(Z);
|
|
1615
1615
|
}
|
|
1616
1616
|
})]
|
|
1617
|
-
}), e == null || e.addInteraction(
|
|
1617
|
+
}), e == null || e.addInteraction(h), h.on("drawstart", (O) => {
|
|
1618
1618
|
var Z;
|
|
1619
|
-
n =
|
|
1620
|
-
const a =
|
|
1621
|
-
if (N = Number(He(
|
|
1622
|
-
const
|
|
1619
|
+
n = O.feature, s = (Z = n.getGeometry()) == null ? void 0 : Z.on("change", (T) => {
|
|
1620
|
+
const a = T.target, b = v(a, "nm"), p = a.getCoordinates()[0], P = new Se([p[p.length - 2], p[p.length - 1]]), V = gt(P, "nm");
|
|
1621
|
+
if (N = Number(He(P) / 1e3) > 150, !b) return;
|
|
1622
|
+
const A = '<span class="error pl-4">超出可以绘画的距离</span>';
|
|
1623
1623
|
w && (w.innerHTML = `
|
|
1624
1624
|
<div class="text">
|
|
1625
|
-
面积:${
|
|
1626
|
-
${N ?
|
|
1625
|
+
面积:${b}
|
|
1626
|
+
${N ? A : ""}
|
|
1627
1627
|
</div>
|
|
1628
|
-
`),
|
|
1628
|
+
`), x && (x.innerHTML = `
|
|
1629
1629
|
<div class="text">
|
|
1630
|
-
面积:${
|
|
1630
|
+
面积:${b}
|
|
1631
1631
|
</div>
|
|
1632
1632
|
<div class="text ${N ? "error" : ""}">
|
|
1633
|
-
线段 ${
|
|
1634
|
-
${N ?
|
|
1633
|
+
线段 ${p.length - 2}: ${V}
|
|
1634
|
+
${N ? A : ""}
|
|
1635
1635
|
|
|
1636
1636
|
</div>
|
|
1637
1637
|
<div>
|
|
@@ -1639,57 +1639,57 @@ const nt = (e, r) => {
|
|
|
1639
1639
|
</div>
|
|
1640
1640
|
`);
|
|
1641
1641
|
});
|
|
1642
|
-
}),
|
|
1643
|
-
var
|
|
1644
|
-
if (!
|
|
1645
|
-
w && !l && (w.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), l =
|
|
1646
|
-
const
|
|
1647
|
-
if (
|
|
1648
|
-
const V =
|
|
1649
|
-
(
|
|
1642
|
+
}), h.on("drawend", (O) => {
|
|
1643
|
+
var b, g, p, P;
|
|
1644
|
+
if (!O.feature.getGeometry()) return;
|
|
1645
|
+
w && !l && (w.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), l = O.feature, k.setOffset([10, 0]);
|
|
1646
|
+
const T = O.feature.getGeometry().getCoordinates(), a = T[0][T[0].length - 2];
|
|
1647
|
+
if (k.setPosition(a), x != null && x.parentNode && x.parentNode.removeChild(x), (b = r.getProps()) != null && b.areaDrawEnd) {
|
|
1648
|
+
const V = T[0].map((A) => ke(A, J.mercator, J.data));
|
|
1649
|
+
(p = (g = r.getProps()) == null ? void 0 : g.areaDrawEnd) == null || p.call(g, V);
|
|
1650
1650
|
}
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
})), s && We(s), (
|
|
1654
|
-
var V,
|
|
1655
|
-
q(), (
|
|
1651
|
+
h && (h.setActive(!1), e == null || e.removeInteraction(h), (e == null ? void 0 : e.getInteractions()).forEach((A) => {
|
|
1652
|
+
A instanceof Ne && (A.setActive(!1), e == null || e.removeInteraction(A));
|
|
1653
|
+
})), s && We(s), (P = document.querySelector(".delete-icon")) == null || P.addEventListener("click", () => {
|
|
1654
|
+
var V, A;
|
|
1655
|
+
q(), (A = (V = r.getProps()) == null ? void 0 : V.areaDrawEnd) == null || A.call(V, []);
|
|
1656
1656
|
});
|
|
1657
1657
|
});
|
|
1658
|
-
},
|
|
1659
|
-
const
|
|
1658
|
+
}, v = (O, Z) => {
|
|
1659
|
+
const T = Bt(O);
|
|
1660
1660
|
switch (Z) {
|
|
1661
1661
|
case "km":
|
|
1662
|
-
return
|
|
1662
|
+
return T > 1e4 ? Math.round(T / 1e6 * 100) / 100 + " km<sup>2</sup>" : Math.round(T * 100) / 100 + " m<sup>2</sup>";
|
|
1663
1663
|
case "nm":
|
|
1664
|
-
return
|
|
1664
|
+
return T > 1e4 ? Math.round(T / 1e6 / Math.pow(1.852, 2) * 100) / 100 + " nm<sup>2</sup>" : Math.round(T * 100) / 100 + " m<sup>2</sup>";
|
|
1665
1665
|
}
|
|
1666
1666
|
};
|
|
1667
|
-
let w,
|
|
1667
|
+
let w, k;
|
|
1668
1668
|
const C = () => {
|
|
1669
|
-
w != null && w.parentNode && w.parentNode.removeChild(w), w = document.createElement("div"), w.style.display = "flex", w.className = "ol-tooltip ol-tooltip-draw-polygon",
|
|
1669
|
+
w != null && w.parentNode && w.parentNode.removeChild(w), w = document.createElement("div"), w.style.display = "flex", w.className = "ol-tooltip ol-tooltip-draw-polygon", k = new ce({
|
|
1670
1670
|
element: w,
|
|
1671
1671
|
offset: [0, -15],
|
|
1672
1672
|
positioning: "bottom-center",
|
|
1673
1673
|
stopEvent: !1,
|
|
1674
1674
|
insertFirst: !1
|
|
1675
|
-
}), e == null || e.addOverlay(
|
|
1675
|
+
}), e == null || e.addOverlay(k);
|
|
1676
1676
|
};
|
|
1677
|
-
let
|
|
1678
|
-
const
|
|
1679
|
-
|
|
1680
|
-
element:
|
|
1677
|
+
let x, G;
|
|
1678
|
+
const D = () => {
|
|
1679
|
+
x != null && x.parentNode && x.parentNode.removeChild(x), x = document.createElement("div"), x.className = "ol-tooltip ol-help-tooltip", G = new ce({
|
|
1680
|
+
element: x,
|
|
1681
1681
|
offset: [15, 0],
|
|
1682
1682
|
positioning: "center-left"
|
|
1683
|
-
}), e == null || e.addOverlay(
|
|
1683
|
+
}), e == null || e.addOverlay(G);
|
|
1684
1684
|
}, q = () => {
|
|
1685
|
-
|
|
1685
|
+
y == null || y.clear(), l = null, C(), D(), L();
|
|
1686
1686
|
};
|
|
1687
1687
|
return {
|
|
1688
|
-
open:
|
|
1688
|
+
open: c,
|
|
1689
1689
|
close: () => {
|
|
1690
|
-
|
|
1691
|
-
Z instanceof
|
|
1692
|
-
}),
|
|
1690
|
+
y == null || y.clear(), y = null, u && (e.removeLayer(u), u = null), n = null, h && (h.setActive(!1), (e == null ? void 0 : e.getInteractions()).forEach((Z) => {
|
|
1691
|
+
Z instanceof Ne && (Z.setActive(!1), e == null || e.removeInteraction(Z));
|
|
1692
|
+
}), h = null), s && We(s), x != null && x.parentElement && x.parentElement.removeChild(x), w != null && w.parentElement && w.parentElement.removeChild(w), G && e.removeOverlay(G), k && e.removeOverlay(k), Oe(e, "pointer");
|
|
1693
1693
|
},
|
|
1694
1694
|
reset: q
|
|
1695
1695
|
};
|
|
@@ -1698,32 +1698,40 @@ const nt = (e, r) => {
|
|
|
1698
1698
|
className: Lo,
|
|
1699
1699
|
source: r,
|
|
1700
1700
|
zIndex: 100,
|
|
1701
|
-
updateWhileInteracting: !
|
|
1702
|
-
updateWhileAnimating: !
|
|
1701
|
+
updateWhileInteracting: !0,
|
|
1702
|
+
updateWhileAnimating: !0
|
|
1703
1703
|
});
|
|
1704
1704
|
e == null || e.addLayer(l);
|
|
1705
|
-
let s = null,
|
|
1706
|
-
const o = (
|
|
1707
|
-
if (!
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
}
|
|
1712
|
-
M.forEach((w) => {
|
|
1713
|
-
u(w, y);
|
|
1714
|
-
}), i && (console.log("selectedPortData", i), v(i));
|
|
1705
|
+
let s = null, c = null;
|
|
1706
|
+
const o = (L, v = !0) => {
|
|
1707
|
+
if (!L || L.length === 0) return;
|
|
1708
|
+
if (r.clear(), c) {
|
|
1709
|
+
const k = L.find((C) => C.id === (c == null ? void 0 : c.id));
|
|
1710
|
+
k ? c = k : L.push(c);
|
|
1715
1711
|
}
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1712
|
+
const w = [];
|
|
1713
|
+
L.forEach((k) => {
|
|
1714
|
+
const [C, x] = k.latLon.split(","), G = new ie({
|
|
1715
|
+
geometry: new le(I([Number(C), Number(x)])),
|
|
1716
|
+
portData: k,
|
|
1717
|
+
id: k.id,
|
|
1718
|
+
select: k.id === (c == null ? void 0 : c.id),
|
|
1719
|
+
showTitle: k.id === (c == null ? void 0 : c.id) || v
|
|
1720
|
+
}), D = y(G);
|
|
1721
|
+
G.setStyle(D), w.push(G);
|
|
1722
|
+
}), r.addFeatures(w);
|
|
1723
|
+
}, u = (L, v) => {
|
|
1724
|
+
const w = document.createElement("canvas"), k = w.getContext("2d");
|
|
1725
|
+
if (!k) return "";
|
|
1726
|
+
const C = 2, x = 8, G = window.devicePixelRatio || 1, D = "12px sans-serif";
|
|
1727
|
+
k.font = D;
|
|
1728
|
+
const Y = k.measureText(L).width, O = x + Y + x, Z = C + 12 + C * 2;
|
|
1729
|
+
w.width = Math.round(O * G), w.height = Math.round(Z * G), k.scale(G, G), k.clearRect(0, 0, O, Z), k.fillStyle = v ? "#FF5733" : "#FFF", k.fillRect(0, 0, O, Z), k.font = D, k.textBaseline = "middle";
|
|
1730
|
+
const T = Z / 2;
|
|
1731
|
+
return k.strokeStyle = v ? "#000" : "#ffffff", k.lineWidth = 1, k.strokeText(L, x, T), k.fillStyle = v ? "#FFF" : "#000000", k.fillText(L, x, T), w.toDataURL("image/png");
|
|
1732
|
+
}, y = (L) => {
|
|
1733
|
+
const { select: v, showTitle: w } = L.getProperties(), k = (O) => `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1734
|
+
<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="${O}"/>
|
|
1727
1735
|
<g clip-path="url(#clip0_10059_122082)">
|
|
1728
1736
|
<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"/>
|
|
1729
1737
|
</g>
|
|
@@ -1733,142 +1741,139 @@ const nt = (e, r) => {
|
|
|
1733
1741
|
</clipPath>
|
|
1734
1742
|
</defs>
|
|
1735
1743
|
</svg>
|
|
1736
|
-
`, C = () => `data:image/svg+xml;utf8,${encodeURIComponent(
|
|
1737
|
-
image: new
|
|
1744
|
+
`, C = () => `data:image/svg+xml;utf8,${encodeURIComponent(k(v ? "#FF5733" : "#3370FF"))}`, x = e.getView().getZoom(), G = L.get("portData"), D = window.devicePixelRatio || 1, q = new X({
|
|
1745
|
+
image: new pe({
|
|
1738
1746
|
src: C(),
|
|
1739
|
-
scale: 0.5 *
|
|
1747
|
+
scale: 0.5 * x / 10
|
|
1740
1748
|
}),
|
|
1741
|
-
zIndex:
|
|
1742
|
-
},
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1749
|
+
zIndex: v ? 110 : 100
|
|
1750
|
+
}), Y = new X({
|
|
1751
|
+
image: new pe({
|
|
1752
|
+
src: u(G.shortName, v),
|
|
1753
|
+
anchor: [0.5, 0.5],
|
|
1754
|
+
displacement: [0, -26],
|
|
1755
|
+
scale: 1 / D,
|
|
1756
|
+
anchorXUnits: "fraction",
|
|
1757
|
+
anchorYUnits: "fraction"
|
|
1758
|
+
}),
|
|
1759
|
+
zIndex: v ? 110 : 100
|
|
1760
|
+
// text: new Text({
|
|
1761
|
+
// text: port.shortName,
|
|
1762
|
+
// font: '12px sans-serif',
|
|
1763
|
+
// fill: new Fill({
|
|
1764
|
+
// color: select ? "#ffffff" : "#000000"
|
|
1765
|
+
// }),
|
|
1766
|
+
// backgroundFill: new Fill({
|
|
1767
|
+
// color: "#FFF",
|
|
1768
|
+
// }),
|
|
1769
|
+
// offsetY: 30,
|
|
1770
|
+
// }),
|
|
1760
1771
|
});
|
|
1772
|
+
return !w && !v ? q : [q, Y];
|
|
1761
1773
|
}, t = () => {
|
|
1762
1774
|
if (r)
|
|
1763
1775
|
if (s) {
|
|
1764
1776
|
console.log("清除非选中的港口");
|
|
1765
|
-
const
|
|
1766
|
-
r.getFeatures().forEach((
|
|
1767
|
-
|
|
1777
|
+
const L = s.get("portData").id;
|
|
1778
|
+
r.getFeatures().forEach((v) => {
|
|
1779
|
+
v.get("portData").id !== L && r.removeFeature(v);
|
|
1768
1780
|
});
|
|
1769
1781
|
} else
|
|
1770
1782
|
console.log("清除所有港口", r), r == null || r.clear();
|
|
1771
|
-
}, n = (
|
|
1783
|
+
}, n = (L) => {
|
|
1772
1784
|
if (r) {
|
|
1773
|
-
if (!
|
|
1785
|
+
if (!L)
|
|
1774
1786
|
return m();
|
|
1775
|
-
(s == null ? void 0 : s.get("portData").id) !==
|
|
1787
|
+
(s == null ? void 0 : s.get("portData").id) !== L.id && (m(), h(L));
|
|
1776
1788
|
}
|
|
1777
1789
|
}, m = () => {
|
|
1778
|
-
var
|
|
1790
|
+
var L;
|
|
1779
1791
|
if (s) {
|
|
1780
|
-
const
|
|
1792
|
+
const v = s == null ? void 0 : s.get("portData"), w = (L = r.getFeatures()) == null ? void 0 : L.find((k) => k.get("portData").id === v.id);
|
|
1781
1793
|
if (w) {
|
|
1782
|
-
const
|
|
1783
|
-
w.set("select", !1), w.setStyle(
|
|
1794
|
+
const k = y(w);
|
|
1795
|
+
w.set("select", !1), w.setStyle(k), s = null, c = null;
|
|
1784
1796
|
}
|
|
1785
1797
|
}
|
|
1786
|
-
},
|
|
1787
|
-
var w;
|
|
1798
|
+
}, h = (L) => {
|
|
1788
1799
|
if (!r) return;
|
|
1789
|
-
const
|
|
1790
|
-
|
|
1791
|
-
s.set("select", !0);
|
|
1792
|
-
const L = h(s);
|
|
1793
|
-
L && ((w = L == null ? void 0 : L.getText()) == null || w.setBackgroundFill(new Q({
|
|
1794
|
-
color: "#FF5733"
|
|
1795
|
-
}))), s.setStyle(L);
|
|
1796
|
-
}
|
|
1800
|
+
const v = r.getFeatures();
|
|
1801
|
+
c = L, s = v.find((w) => w.get("portData").id === L.id), s && (s.set("select", !0), s.setStyle(y(s)));
|
|
1797
1802
|
};
|
|
1798
1803
|
return {
|
|
1799
1804
|
render: o,
|
|
1800
1805
|
clear: t,
|
|
1801
1806
|
selected: n,
|
|
1802
|
-
handlePortHover: (
|
|
1803
|
-
const
|
|
1804
|
-
|
|
1807
|
+
handlePortHover: (L) => {
|
|
1808
|
+
const v = e == null ? void 0 : e.getTargetElement();
|
|
1809
|
+
L && L.get("portData") && v && (v.style.cursor = "pointer");
|
|
1805
1810
|
}
|
|
1806
1811
|
};
|
|
1807
|
-
}, To = (e, r, l, s,
|
|
1812
|
+
}, To = (e, r, l, s, c, o) => {
|
|
1808
1813
|
const u = e.getInstall();
|
|
1809
1814
|
u.on("moveend", () => {
|
|
1810
|
-
var
|
|
1815
|
+
var y, t;
|
|
1811
1816
|
try {
|
|
1812
1817
|
const n = e.getZoom();
|
|
1813
|
-
(t = (
|
|
1818
|
+
(t = (y = r.getProps()).mapMoveEnd) == null || t.call(y, n), l.reRenderTrackLine(), s.changeShipScale("end");
|
|
1814
1819
|
} catch (n) {
|
|
1815
1820
|
console.log("moveend---catch", n);
|
|
1816
1821
|
}
|
|
1817
|
-
}), u.on("pointermove", (
|
|
1822
|
+
}), u.on("pointermove", (y) => {
|
|
1818
1823
|
try {
|
|
1819
|
-
const t = u == null ? void 0 : u.getEventPixel(
|
|
1824
|
+
const t = u == null ? void 0 : u.getEventPixel(y.originalEvent);
|
|
1820
1825
|
if (!t || !u) return;
|
|
1821
1826
|
const n = u == null ? void 0 : u.forEachFeatureAtPixel(t, (m) => m, {
|
|
1822
1827
|
layerFilter: (m) => m.getVisible()
|
|
1823
1828
|
});
|
|
1824
|
-
s == null || s.handleShipMapEvent(n, "hover"), l == null || l.handleTrackMapEvent(n, "hover",
|
|
1829
|
+
s == null || s.handleShipMapEvent(n, "hover"), l == null || l.handleTrackMapEvent(n, "hover", y), n && (c == null || c.handlePortHover(n));
|
|
1825
1830
|
} catch (t) {
|
|
1826
1831
|
console.log("pointermove---catch", t);
|
|
1827
1832
|
}
|
|
1828
1833
|
}), u.on("movestart", () => {
|
|
1829
1834
|
try {
|
|
1830
|
-
const
|
|
1831
|
-
|
|
1832
|
-
} catch (
|
|
1833
|
-
console.log("movestart---catch",
|
|
1835
|
+
const y = u == null ? void 0 : u.getView().getZoom();
|
|
1836
|
+
y && y <= te.shipModelMax && y >= te.shipTriggleMin && s.changeShipScale("start");
|
|
1837
|
+
} catch (y) {
|
|
1838
|
+
console.log("movestart---catch", y);
|
|
1834
1839
|
}
|
|
1835
|
-
}), u.on("singleclick",
|
|
1840
|
+
}), u.on("singleclick", Ve((y) => {
|
|
1836
1841
|
var t, n, m;
|
|
1837
1842
|
try {
|
|
1838
1843
|
if (console.log("1", o.getState()), o.getState()) return;
|
|
1839
|
-
const
|
|
1840
|
-
if (!
|
|
1841
|
-
console.log("features------------",
|
|
1842
|
-
let N = null,
|
|
1843
|
-
if (
|
|
1844
|
-
|
|
1844
|
+
const h = u.getFeaturesAtPixel(y.pixel);
|
|
1845
|
+
if (!h && h.length === 0) return;
|
|
1846
|
+
console.log("features------------", h);
|
|
1847
|
+
let N = null, L = null;
|
|
1848
|
+
if (h == null || h.forEach((v) => {
|
|
1849
|
+
v.get("shipData") && (N = v), v.get("portData") && (L = v);
|
|
1845
1850
|
}), N)
|
|
1846
1851
|
s.handleShipMapEvent(N, "click", (t = r.getProps()) == null ? void 0 : t.selectShip);
|
|
1847
|
-
else if (
|
|
1848
|
-
const
|
|
1849
|
-
|
|
1852
|
+
else if (L) {
|
|
1853
|
+
const v = L.get("portData");
|
|
1854
|
+
c.selected(v), (m = (n = r.getProps()) == null ? void 0 : n.selectPort) == null || m.call(n, v);
|
|
1850
1855
|
}
|
|
1851
|
-
|
|
1852
|
-
} catch (
|
|
1853
|
-
console.log("click---catch",
|
|
1856
|
+
y.preventDefault(), y.stopPropagation();
|
|
1857
|
+
} catch (h) {
|
|
1858
|
+
console.log("click---catch", h);
|
|
1854
1859
|
}
|
|
1855
|
-
}, 150)), u.getView().on("change:resolution",
|
|
1856
|
-
const
|
|
1857
|
-
|
|
1860
|
+
}, 150)), u.getView().on("change:resolution", Ve(() => {
|
|
1861
|
+
const y = u == null ? void 0 : u.getView().getZoom();
|
|
1862
|
+
y && y <= te.shipModelMax && y >= te.shipTriggleMin && s.changeSelectedScale("start");
|
|
1858
1863
|
}, 10));
|
|
1859
1864
|
}, Fo = () => {
|
|
1860
1865
|
const e = St([]);
|
|
1861
1866
|
return {
|
|
1862
|
-
createInstance: (s,
|
|
1867
|
+
createInstance: (s, c) => {
|
|
1863
1868
|
const o = eo();
|
|
1864
|
-
o.initMap(s,
|
|
1865
|
-
const u = o.getInstall(),
|
|
1866
|
-
t.setProps(
|
|
1867
|
-
const n = so(u), m = lo(u, n),
|
|
1868
|
-
To(o, t, n,
|
|
1869
|
-
const
|
|
1870
|
-
const
|
|
1871
|
-
return [
|
|
1869
|
+
o.initMap(s, c);
|
|
1870
|
+
const u = o.getInstall(), y = wo(u), t = xo();
|
|
1871
|
+
t.setProps(c), y.setShowLayerType(c.layerType), y.setGreenTileVisible(c.showGreenLayer);
|
|
1872
|
+
const n = so(u), m = lo(u, n), h = mo(u), N = bo(u), L = Mo(u, t), v = Co(u, t), w = Eo(u);
|
|
1873
|
+
To(o, t, n, h, w, L);
|
|
1874
|
+
const k = () => {
|
|
1875
|
+
const x = u.getView().calculateExtent(o.getSize()), G = ke([x[0], x[1]], J.mercator, J.data), D = ke([x[2], x[3]], J.mercator, J.data);
|
|
1876
|
+
return [G[0], G[1], D[0], D[1]];
|
|
1872
1877
|
}, C = {
|
|
1873
1878
|
id: Symbol("map-instance"),
|
|
1874
1879
|
innerMap: null,
|
|
@@ -1878,8 +1883,8 @@ const nt = (e, r) => {
|
|
|
1878
1883
|
},
|
|
1879
1884
|
methods: {
|
|
1880
1885
|
...o,
|
|
1881
|
-
layer:
|
|
1882
|
-
ship:
|
|
1886
|
+
layer: y,
|
|
1887
|
+
ship: h,
|
|
1883
1888
|
track: n,
|
|
1884
1889
|
carTrack: m,
|
|
1885
1890
|
port: {
|
|
@@ -1888,11 +1893,11 @@ const nt = (e, r) => {
|
|
|
1888
1893
|
selected: w.selected
|
|
1889
1894
|
},
|
|
1890
1895
|
position: N,
|
|
1891
|
-
drawLine:
|
|
1892
|
-
drawPolygon:
|
|
1896
|
+
drawLine: L,
|
|
1897
|
+
drawPolygon: v,
|
|
1893
1898
|
// 子模块
|
|
1894
1899
|
utils: {
|
|
1895
|
-
getCalculateExtent:
|
|
1900
|
+
getCalculateExtent: k,
|
|
1896
1901
|
convertSixHundredThousandToLatLng: je,
|
|
1897
1902
|
calculateCirclePoints: to
|
|
1898
1903
|
}
|
|
@@ -1901,8 +1906,8 @@ const nt = (e, r) => {
|
|
|
1901
1906
|
return e.push(C), C;
|
|
1902
1907
|
},
|
|
1903
1908
|
destroyInstance: (s) => {
|
|
1904
|
-
const
|
|
1905
|
-
|
|
1909
|
+
const c = e.findIndex((o) => o.id === s);
|
|
1910
|
+
c > -1 && (e[c].destroy(), e.splice(c, 1));
|
|
1906
1911
|
},
|
|
1907
1912
|
destroyAll: () => {
|
|
1908
1913
|
e.forEach((s) => s.destroy()), e.splice(0, e.length);
|
|
@@ -1929,16 +1934,16 @@ const nt = (e, r) => {
|
|
|
1929
1934
|
} }
|
|
1930
1935
|
},
|
|
1931
1936
|
setup(e, { expose: r }) {
|
|
1932
|
-
const l =
|
|
1937
|
+
const l = U(), s = U(), c = Fo(), o = U(), u = e, y = U({
|
|
1933
1938
|
getInstall() {
|
|
1934
1939
|
}
|
|
1935
1940
|
});
|
|
1936
1941
|
return Nt(() => {
|
|
1937
1942
|
var t;
|
|
1938
|
-
o.value =
|
|
1943
|
+
o.value = c.createInstance(l.value, u), y.value = o.value.methods, (t = s.value) == null || t.setScaleLine(o.value.map, u.scaleLineUnit);
|
|
1939
1944
|
}), Vt(() => {
|
|
1940
1945
|
var t, n;
|
|
1941
|
-
|
|
1946
|
+
c.destroyInstance((t = o == null ? void 0 : o.value) == null ? void 0 : t.id), (n = o.value) == null || n.destroy();
|
|
1942
1947
|
}), r({
|
|
1943
1948
|
getZoom: () => {
|
|
1944
1949
|
var t;
|