zhihao-ui 1.3.63 → 1.3.64
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/{BaseInfo-aiVRbjTP.js → BaseInfo-DRE7tqhe.js} +2 -2
- package/dist/es/{BaseItem-B_4mwWHs.js → BaseItem-B9hyAgCm.js} +3 -3
- package/dist/es/{Button-BFA52ivn.js → Button-CSE0Mb4I.js} +2 -2
- package/dist/es/{CascaderLoadMore-C6micaqI.js → CascaderLoadMore-DlIfow9Z.js} +2 -2
- package/dist/es/{DatePicker-DyqXtiRa.js → DatePicker-DRO5YMZ8.js} +3 -3
- package/dist/es/{DetailHeader-pQXMyG5I.js → DetailHeader-WPFCQJFq.js} +3 -3
- package/dist/es/{DetailSubTitle-B-DcaPqI.js → DetailSubTitle-BWOpKhxk.js} +2 -2
- package/dist/es/{Dialog-BptDzN8n.js → Dialog-CAiA_v3J.js} +3 -3
- package/dist/es/{DiyDataTable-BzNrVInw.js → DiyDataTable-SdMOvzzG.js} +4 -4
- package/dist/es/{EditInfoPair-DCjZGPkz.js → EditInfoPair-CZ_m9ph_.js} +3 -3
- package/dist/es/{FileWrapper-xu2XFTT8.js → FileWrapper-Dk5178uk.js} +4 -4
- package/dist/es/{Grid-DEbsTV3v.js → Grid-DXdd3Eqi.js} +2 -2
- package/dist/es/{InfoPair-B9nTZ_iX.js → InfoPair-C8tc2XjH.js} +3 -3
- package/dist/es/{Input-FPnMJc-X.js → Input-CCkgPIDm.js} +3 -3
- package/dist/es/{Loading-D1OYqPWU.js → Loading-CtaMdigH.js} +2 -2
- package/dist/es/Map-BTJrG_eT.js +2536 -0
- package/dist/es/{MessageBox-CvwRq0Fw.js → MessageBox-DdmHDM2f.js} +2 -2
- package/dist/es/{MoneyInput-DJ5g8rhm.js → MoneyInput-CsELS7YH.js} +5 -5
- package/dist/es/{PageHeadPanel-BV5qQLDj.js → PageHeadPanel-TzAwDM3_.js} +2 -2
- package/dist/es/{Table-D49FFXP7.js → Table-DELBhqxN.js} +6 -6
- package/dist/es/{ToolTips-B9Z_U4WM.js → ToolTips-BsqDNvAz.js} +3 -3
- package/dist/es/index.js +23 -23
- package/dist/es/{utils-COxKH46Q.js → utils-SutTRvhl.js} +1 -1
- package/dist/es/{vendor-CbeG2C4c.js → vendor-BnoIpJXx.js} +3 -3
- package/dist/index.css +1 -1
- package/dist/types/components/Map/Map.vue.d.ts +3 -0
- package/dist/types/components/Map/function/port.d.ts +3 -0
- package/dist/types/components/Map/index.d.ts +9 -0
- package/dist/umd/index.css +1 -1
- package/dist/umd/index.umd.cjs +50 -50
- package/package.json +1 -1
- package/dist/es/Map-JC-tR-ga.js +0 -2474
|
@@ -0,0 +1,2536 @@
|
|
|
1
|
+
import { defineComponent as vt, openBlock as ot, createElementBlock as nt, createElementVNode as rt, ref as fe, computed as Ie, h as xe, createVNode as ht, render as Xt, reactive as qt, onMounted as _t, onUnmounted as Kt, createCommentVNode as jt } from "vue";
|
|
2
|
+
import { S as Qt, M as Mt, T as ze, X as Ve, t as he, V as Jt, u as Ut, D as yt, v as It, j as $t, w as wt, x as Oe, F as ge, y as ne, z as eo, O as ke, A as zt, B as Xe, L as Ge, G as to, P as Ct, H as ye, I as ue, J as Me, K as pe, N as Pe, Q as lt, R as Se, U as oo, W as tt, Y as mt, Z as Lt, _ as no, $ as ro, a0 as lo, a1 as so, a2 as io, a3 as co } from "./vendor-BnoIpJXx.js";
|
|
3
|
+
import { _ as xt } from "./Button-CSE0Mb4I.js";
|
|
4
|
+
import { w as ao } from "./utils-SutTRvhl.js";
|
|
5
|
+
const uo = { id: "scale-line-container" }, go = /* @__PURE__ */ vt({
|
|
6
|
+
__name: "scaleLine",
|
|
7
|
+
setup(e, { expose: r }) {
|
|
8
|
+
return r({
|
|
9
|
+
setScaleLine: (l, s) => {
|
|
10
|
+
s || (s = "metric");
|
|
11
|
+
const i = new Qt({
|
|
12
|
+
units: s
|
|
13
|
+
}), o = document.getElementById("scale-line-container");
|
|
14
|
+
o && (i.setTarget(o), l.addControl(i));
|
|
15
|
+
}
|
|
16
|
+
}), (l, s) => (ot(), nt("div", uo));
|
|
17
|
+
}
|
|
18
|
+
}), fo = /* @__PURE__ */ xt(go, [["__scopeId", "data-v-2bc5dee8"]]), ho = { class: "zoom" }, mo = /* @__PURE__ */ vt({
|
|
19
|
+
__name: "zoomControl",
|
|
20
|
+
props: {
|
|
21
|
+
mapInstance: {
|
|
22
|
+
type: Object,
|
|
23
|
+
default: () => null
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
setup(e) {
|
|
27
|
+
const r = e;
|
|
28
|
+
console.log("props", r);
|
|
29
|
+
const c = () => {
|
|
30
|
+
console.log("props");
|
|
31
|
+
const { setZoom: s, getZoom: i, getInstall: o } = r.mapInstance.methods;
|
|
32
|
+
if (!o()) return;
|
|
33
|
+
const w = i();
|
|
34
|
+
w && s(w + 1);
|
|
35
|
+
}, l = () => {
|
|
36
|
+
const { setZoom: s, getZoom: i, getInstall: o } = r.mapInstance.methods;
|
|
37
|
+
if (!o()) return;
|
|
38
|
+
const w = i();
|
|
39
|
+
w && s(w - 1);
|
|
40
|
+
};
|
|
41
|
+
return (s, i) => (ot(), nt("div", ho, [
|
|
42
|
+
rt("div", {
|
|
43
|
+
class: "button big-button",
|
|
44
|
+
onClick: c
|
|
45
|
+
}, " + "),
|
|
46
|
+
rt("div", {
|
|
47
|
+
class: "button small-button",
|
|
48
|
+
onClick: l
|
|
49
|
+
}, " - ")
|
|
50
|
+
]));
|
|
51
|
+
}
|
|
52
|
+
}), vo = /* @__PURE__ */ xt(mo, [["__scopeId", "data-v-78a81741"]]), et = "a6e8f78974f2581f2ca00485b40c948f", ae = {
|
|
53
|
+
// 地图默认层级
|
|
54
|
+
default: 13,
|
|
55
|
+
// 地图缩放最小层级
|
|
56
|
+
min: 3,
|
|
57
|
+
// 地图缩放最大层级
|
|
58
|
+
max: 18,
|
|
59
|
+
// 查看船舶详情时地图缩放层级
|
|
60
|
+
findShipMin: 10,
|
|
61
|
+
findShip: 13,
|
|
62
|
+
// 查看车辆详情时地图缩放层级
|
|
63
|
+
findTruck: 14,
|
|
64
|
+
// 船舶绿点图最大显示层级
|
|
65
|
+
shipGreenDotMax: 11,
|
|
66
|
+
// 查车图标显示层级
|
|
67
|
+
truckDefault: 14,
|
|
68
|
+
// 统计图标显示层级
|
|
69
|
+
truckStatistics: 8,
|
|
70
|
+
// 船形图标最小渲染层级
|
|
71
|
+
shipModelMin: 13,
|
|
72
|
+
// 船形图标最小渲染层级
|
|
73
|
+
shipTriggleMin: 16,
|
|
74
|
+
// 船形图标最大渲染层级
|
|
75
|
+
shipModelMax: 18,
|
|
76
|
+
markerPosition: 14,
|
|
77
|
+
//根据原系统canvas图片转换svg长宽比例计算缩放值
|
|
78
|
+
scaleNum: 0.555
|
|
79
|
+
}, ce = {
|
|
80
|
+
// 经纬度 源数据 地理坐标 WGS84
|
|
81
|
+
data: "EPSG:4326",
|
|
82
|
+
// 墨卡托投影坐标 渲染坐标
|
|
83
|
+
mercator: "EPSG:3857"
|
|
84
|
+
}, Et = [114.84, 30.52], Vt = "https://static.zhihaoscm.cn/", st = 2003750834e-2;
|
|
85
|
+
var Ee = ((e) => (e.vectorTile = `https://t0.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${et}`, 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=${et}`, 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=${et}`, 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=${et}`, e.greenTile = `${Vt}/map/tile/{z}/{x}/{y}.png`, e))(Ee || {}), Ae = /* @__PURE__ */ ((e) => (e[e.M = 1] = "M", e[e.KM = 2] = "KM", e[e.NM = 3] = "NM", e))(Ae || {}), ie = /* @__PURE__ */ ((e) => (e.PORT = "port", e.SHIP = "ship", e.TRACK = "track", e.DELETE = "delete", e.PATH = "path", e))(ie || {});
|
|
86
|
+
function yo() {
|
|
87
|
+
const e = fe(), r = fe(!0), c = () => e.value, l = () => c().getView(), s = (L) => {
|
|
88
|
+
r.value = L;
|
|
89
|
+
}, i = () => r.value, o = () => {
|
|
90
|
+
var L;
|
|
91
|
+
return (L = l()) == null ? void 0 : L.getZoom();
|
|
92
|
+
}, d = (L) => {
|
|
93
|
+
var u;
|
|
94
|
+
(u = l()) == null || u.setZoom(L);
|
|
95
|
+
}, w = (L, u) => {
|
|
96
|
+
var f;
|
|
97
|
+
(f = l()) == null || f.setCenter(he([L, u]));
|
|
98
|
+
}, P = () => {
|
|
99
|
+
var u;
|
|
100
|
+
const L = (u = l()) == null ? void 0 : u.getCenter();
|
|
101
|
+
return It(L);
|
|
102
|
+
}, t = () => {
|
|
103
|
+
var L;
|
|
104
|
+
return (L = c()) == null ? void 0 : L.getSize();
|
|
105
|
+
}, n = () => {
|
|
106
|
+
const L = window.navigator.userAgent, u = /iPad|iPhone|iPod/.test(L), f = /Safari/.test(L) && !/CriOS/.test(L), E = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(L);
|
|
107
|
+
return u && (f || E);
|
|
108
|
+
}, x = new Mt(), R = (L, u) => {
|
|
109
|
+
A(u);
|
|
110
|
+
const f = {
|
|
111
|
+
zoom: u.zoom,
|
|
112
|
+
center: he(u.center),
|
|
113
|
+
minZoom: ae.min,
|
|
114
|
+
maxZoom: ae.max,
|
|
115
|
+
constrainResolution: !0,
|
|
116
|
+
enableRotation: !1,
|
|
117
|
+
multiWorld: !0
|
|
118
|
+
};
|
|
119
|
+
let E = {
|
|
120
|
+
target: L,
|
|
121
|
+
controls: Ut({
|
|
122
|
+
zoom: !1
|
|
123
|
+
}),
|
|
124
|
+
layers: [
|
|
125
|
+
x.get("vectorTile"),
|
|
126
|
+
x.get("vectorTileMark"),
|
|
127
|
+
x.get("satelliteImgTile"),
|
|
128
|
+
x.get("satelliteImgTileMark")
|
|
129
|
+
],
|
|
130
|
+
view: new Jt(f)
|
|
131
|
+
};
|
|
132
|
+
const b = new Mt(E);
|
|
133
|
+
if (n()) {
|
|
134
|
+
const Z = new yt({
|
|
135
|
+
handleEvent: function(W) {
|
|
136
|
+
if (W.type === "dblclick") {
|
|
137
|
+
console.log("IOS Browser---dblclick"), W.originalEvent.preventDefault();
|
|
138
|
+
const p = b.getView(), N = p.getZoom();
|
|
139
|
+
return p.setZoom(N + 1), !1;
|
|
140
|
+
}
|
|
141
|
+
return !0;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
b.addInteraction(Z);
|
|
145
|
+
}
|
|
146
|
+
e.value = b;
|
|
147
|
+
}, A = (L) => {
|
|
148
|
+
x.set("vectorTile", new ze({
|
|
149
|
+
source: new Ve({ url: Ee.vectorTile }),
|
|
150
|
+
visible: L.layerType === "vector",
|
|
151
|
+
zIndex: 0,
|
|
152
|
+
preload: 1,
|
|
153
|
+
className: "vector"
|
|
154
|
+
})), x.set("vectorTileMark", new ze({
|
|
155
|
+
source: new Ve({ url: Ee.vectorTileMark }),
|
|
156
|
+
visible: L.layerType === "vector",
|
|
157
|
+
zIndex: 1,
|
|
158
|
+
preload: 1,
|
|
159
|
+
className: "vector"
|
|
160
|
+
})), x.set("satelliteImgTile", new ze({
|
|
161
|
+
source: new Ve({ url: Ee.satelliteImgTile }),
|
|
162
|
+
visible: L.layerType === "satellite",
|
|
163
|
+
zIndex: 0,
|
|
164
|
+
preload: 1,
|
|
165
|
+
className: "satellite"
|
|
166
|
+
})), x.set("satelliteImgTileMark", new ze({
|
|
167
|
+
source: new Ve({ url: Ee.satelliteImgTileMark }),
|
|
168
|
+
visible: L.layerType === "satellite",
|
|
169
|
+
zIndex: 1,
|
|
170
|
+
preload: 1,
|
|
171
|
+
className: "satellite"
|
|
172
|
+
})), x.set("greenMark", new ze({
|
|
173
|
+
source: new Ve({ url: Ee.greenTile }),
|
|
174
|
+
visible: L.showGreenLayer,
|
|
175
|
+
zIndex: 2,
|
|
176
|
+
className: "greenTile"
|
|
177
|
+
}));
|
|
178
|
+
};
|
|
179
|
+
return {
|
|
180
|
+
getInstall: c,
|
|
181
|
+
getView: l,
|
|
182
|
+
getZoom: o,
|
|
183
|
+
setZoom: d,
|
|
184
|
+
setCenter: w,
|
|
185
|
+
getCenter: P,
|
|
186
|
+
getSize: t,
|
|
187
|
+
initMap: R,
|
|
188
|
+
setBaseLayerMap: A,
|
|
189
|
+
setMapClick: s,
|
|
190
|
+
getMapClick: i
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
const bt = function(e, r) {
|
|
194
|
+
const c = Number(r) / 6e5;
|
|
195
|
+
return [Number(e) / 6e5, c];
|
|
196
|
+
}, wo = (e, r) => {
|
|
197
|
+
const c = he(e), l = r * 1e3, s = [
|
|
198
|
+
c[0] - l,
|
|
199
|
+
c[1] - l,
|
|
200
|
+
c[0] + l,
|
|
201
|
+
c[1] + l
|
|
202
|
+
], i = eo(s, ce.mercator, ce.data);
|
|
203
|
+
return {
|
|
204
|
+
leftTopPoint: { lng: i[0], lat: i[3] },
|
|
205
|
+
rightTopPoint: { lng: i[2], lat: i[3] },
|
|
206
|
+
rightBottomPoint: { lng: i[2], lat: i[1] },
|
|
207
|
+
leftBottomPoint: { lng: i[0], lat: i[1] }
|
|
208
|
+
};
|
|
209
|
+
}, xo = function(e, r) {
|
|
210
|
+
const l = wt(e);
|
|
211
|
+
let s = "";
|
|
212
|
+
switch (console.log(r, Ae), r) {
|
|
213
|
+
case Ae.M:
|
|
214
|
+
s = Math.round(l * 100) / 100 + " m";
|
|
215
|
+
break;
|
|
216
|
+
case Ae.KM:
|
|
217
|
+
s = Math.round(l / 1e3 * 100) / 100 + " km";
|
|
218
|
+
break;
|
|
219
|
+
case Ae.NM:
|
|
220
|
+
s = (Math.round(l / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
return s;
|
|
224
|
+
};
|
|
225
|
+
function bo(e) {
|
|
226
|
+
const r = e[0] * st / 180;
|
|
227
|
+
let c = Math.log(Math.tan((90 + e[1]) * Math.PI / 360)) / (Math.PI / 180);
|
|
228
|
+
return c = c * st / 180, [r, c];
|
|
229
|
+
}
|
|
230
|
+
function Te(e = "") {
|
|
231
|
+
let r = e.replace(/&?/g, "&");
|
|
232
|
+
return r = r.replace(/&#x([0-9a-fA-F]+);?/g, (c, l) => {
|
|
233
|
+
const s = parseInt(l, 16);
|
|
234
|
+
return String.fromCodePoint(s);
|
|
235
|
+
}), r;
|
|
236
|
+
}
|
|
237
|
+
const Tt = (e) => {
|
|
238
|
+
const r = new Oe({
|
|
239
|
+
font: "Normal 14px map-iconfont",
|
|
240
|
+
text: Te(e),
|
|
241
|
+
fill: new ge({ color: "#fff" }),
|
|
242
|
+
offsetY: -14
|
|
243
|
+
});
|
|
244
|
+
return new ne({
|
|
245
|
+
text: r,
|
|
246
|
+
zIndex: 100
|
|
247
|
+
});
|
|
248
|
+
}, Pt = (e, r = "lonlat") => {
|
|
249
|
+
const c = { lon: 0, lat: 0 }, l = e[0] / st * 180;
|
|
250
|
+
let s = e[1] / st * 180;
|
|
251
|
+
return s = 180 / Math.PI * (2 * Math.atan(Math.exp(s * Math.PI / 180)) - Math.PI / 2), c.lon = l, c.lat = s, r === "lonlat" ? c : [l, s];
|
|
252
|
+
}, po = (e) => {
|
|
253
|
+
const r = $t.duration(e, "minutes"), c = Math.floor(r.asDays()), l = r.hours(), s = r.minutes();
|
|
254
|
+
let i = `${String(s).padStart(2, "0")}分`;
|
|
255
|
+
return l !== 0 && (i = `${String(l).padStart(2, "0")}时${i}`), c !== 0 && (i = `${String(c).padStart(2, "0")}天${i}`), i;
|
|
256
|
+
};
|
|
257
|
+
var Ot = /* @__PURE__ */ ((e) => (e[e.发动机使用中 = 0] = "发动机使用中", e[e.锚泊 = 1] = "锚泊", e[e.未操作 = 2] = "未操作", e[e.操纵能力受限 = 3] = "操纵能力受限", e[e.吃水受限 = 4] = "吃水受限", e[e.系泊 = 5] = "系泊", e[e.搁浅 = 6] = "搁浅", e[e.从事捕捞 = 7] = "从事捕捞", e[e.航行中 = 8] = "航行中", e[e.留作将来修正导航状态 = 9] = "留作将来修正导航状态", e[e.高速船留用 = 10] = "高速船留用", e[e.机动船尾推作业 = 11] = "机动船尾推作业", e[e.机动船顶推或侧推作业 = 12] = "机动船顶推或侧推作业", e[e.飞翼船留用 = 13] = "飞翼船留用", e[e.现行的 = 14] = "现行的", e[e.未定义 = 15] = "未定义", e))(Ot || {}), we = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.front = "front", e.up = "up", e.down = "down", e.back = "back", e))(we || {});
|
|
258
|
+
const ko = (e) => {
|
|
259
|
+
const r = /* @__PURE__ */ new Map(), c = {}, l = {};
|
|
260
|
+
let s = null;
|
|
261
|
+
const i = "--";
|
|
262
|
+
let o = null;
|
|
263
|
+
const d = document.createElement("div"), w = new ke({
|
|
264
|
+
element: d,
|
|
265
|
+
positioning: "top-left",
|
|
266
|
+
className: "track-label-popup"
|
|
267
|
+
});
|
|
268
|
+
let P, t, n, x, R, A = !1, L = Date.now(), u, f = 0, E = null, b = 20;
|
|
269
|
+
const Z = 8, W = [], p = (a) => {
|
|
270
|
+
var h;
|
|
271
|
+
for (W.unshift(a); W.length > Z; ) {
|
|
272
|
+
const y = W.pop(), k = r.get(y);
|
|
273
|
+
k && ((h = k.getSource()) == null || h.clear(), e == null || e.removeLayer(k), r.delete(y), delete c[y], delete l[y]);
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
let N = "";
|
|
277
|
+
const z = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], M = zt(async () => {
|
|
278
|
+
if (s && c[s] && r.get(s).getVisible()) {
|
|
279
|
+
console.log("reRenderTrackLine1------------"), await oe(s);
|
|
280
|
+
const a = S(s, c[s]), h = l[s] || { showTime: !0, lineWidth: 2, showPopup: !0 }, y = a.map((k) => k.centerPoint);
|
|
281
|
+
a.length >= 2 && await X(s, y, N, h.lineWidth), await _e(s, a, h);
|
|
282
|
+
}
|
|
283
|
+
}, 100), v = () => s && c[s] && r.get(s).getVisible(), S = (a, h) => {
|
|
284
|
+
let y = [];
|
|
285
|
+
const k = Math.max(1, Math.floor(h.length / b));
|
|
286
|
+
return y = h.filter((T, C) => C % k === 0).map((T, C) => {
|
|
287
|
+
if (Number(T.lon) > 180 || Number(T.lat) > 180) {
|
|
288
|
+
const [G, j] = bt(T.lon, T.lat);
|
|
289
|
+
T.lon = G, T.lat = j;
|
|
290
|
+
}
|
|
291
|
+
return T.center = [T.lon, T.lat], T.centerPoint = bo(T.center), T.time = $t(T.createdAt).format("YYYY-MM-DD HH:mm:ss"), T.id = a, T.index = C, T;
|
|
292
|
+
}), y.filter(
|
|
293
|
+
(T, C, G) => C === G.findIndex(
|
|
294
|
+
(j) => Math.abs(j.lon - T.lon) < 1e-6 && Math.abs(j.lat - T.lat) < 1e-6
|
|
295
|
+
)
|
|
296
|
+
);
|
|
297
|
+
}, Y = async (a, h, y, k = {}, m = "ship", H = 200) => {
|
|
298
|
+
const { showTime: T = !0, lineWidth: C = 2, showPopup: G = !0 } = k;
|
|
299
|
+
if (!e || JSON.stringify(c[a]) === JSON.stringify(h) && s === a || (m === "ship" && (h = h == null ? void 0 : h.reverse()), w && m === "ship" && (e != null && e.getOverlays().getArray().includes(w) || e.addOverlay(w)), (h == null ? void 0 : h.length) < 2))
|
|
300
|
+
return;
|
|
301
|
+
p(a), s = a, c[a] = h, b = H;
|
|
302
|
+
const j = Object.keys(c).findIndex((F) => F === a) || 0;
|
|
303
|
+
N = y || z[j > 10 ? 10 : j];
|
|
304
|
+
const re = {
|
|
305
|
+
showTime: T,
|
|
306
|
+
lineWidth: C,
|
|
307
|
+
showPopup: G
|
|
308
|
+
};
|
|
309
|
+
l[a] = re, await _(re), await ve(s);
|
|
310
|
+
}, D = (a) => {
|
|
311
|
+
const h = new pe();
|
|
312
|
+
return new Me({
|
|
313
|
+
source: h,
|
|
314
|
+
visible: !1,
|
|
315
|
+
// 默认隐藏
|
|
316
|
+
className: `track-layer-${a}`,
|
|
317
|
+
renderBuffer: 1024,
|
|
318
|
+
properties: { layerType: ie.TRACK },
|
|
319
|
+
zIndex: 10
|
|
320
|
+
});
|
|
321
|
+
}, q = (a) => {
|
|
322
|
+
r.forEach((h, y) => {
|
|
323
|
+
var m;
|
|
324
|
+
const k = y === a;
|
|
325
|
+
h.getVisible() !== k && (h.setVisible(k), e.getLayers().getArray().includes(h) || e.addLayer(h), k || (m = h.getSource()) == null || m.clear());
|
|
326
|
+
}), s = a;
|
|
327
|
+
}, _ = async (a) => {
|
|
328
|
+
const h = s;
|
|
329
|
+
if (!r.has(h)) {
|
|
330
|
+
const T = D(h);
|
|
331
|
+
r.set(h, T);
|
|
332
|
+
}
|
|
333
|
+
await q(h);
|
|
334
|
+
const y = N || "", k = c[h] || [];
|
|
335
|
+
if (!(k && k.length > 1)) return [];
|
|
336
|
+
let m = [];
|
|
337
|
+
m = S(h, k);
|
|
338
|
+
const H = m.map((T) => T.centerPoint);
|
|
339
|
+
m.length >= 2 && (await X(h, H, y, a == null ? void 0 : a.lineWidth), await _e(h, m, a));
|
|
340
|
+
}, X = (a, h, y, k) => {
|
|
341
|
+
const m = new Ge(h), H = r.get(a).getSource(), T = H.getFeatureById(a);
|
|
342
|
+
if (T)
|
|
343
|
+
T.setGeometry(m), T.setId(a), T.setStyle(Q(y, k)), E = T;
|
|
344
|
+
else {
|
|
345
|
+
const C = new ye({ geometry: m });
|
|
346
|
+
C.setId(a), C.set("type", "line"), C.setStyle(Q(y, k)), H.addFeature(C), E = C;
|
|
347
|
+
}
|
|
348
|
+
return E;
|
|
349
|
+
}, Q = (a, h) => new ne({
|
|
350
|
+
stroke: new Pe({
|
|
351
|
+
color: a,
|
|
352
|
+
width: h || 2
|
|
353
|
+
})
|
|
354
|
+
}), de = (a, h, y) => {
|
|
355
|
+
try {
|
|
356
|
+
const k = a == null ? void 0 : a.get("data"), m = (a == null ? void 0 : a.get("showPopup")) ?? !0;
|
|
357
|
+
if (a && k && h === "hover" && m) {
|
|
358
|
+
e.getTargetElement().style.cursor = k ? "pointer" : "";
|
|
359
|
+
const H = le(k), T = y == null ? void 0 : y.coordinate;
|
|
360
|
+
T && (d.querySelector(".popup-content"), d.innerHTML = H, w == null || w.setPosition(T));
|
|
361
|
+
} else
|
|
362
|
+
w && w.setPosition(void 0);
|
|
363
|
+
} catch (k) {
|
|
364
|
+
console.error("handleTrackMapEvent", k);
|
|
365
|
+
}
|
|
366
|
+
}, le = (a) => {
|
|
367
|
+
if (!(a != null && a.time)) return;
|
|
368
|
+
let h = "";
|
|
369
|
+
return a != null && a.stayTime && (h = `
|
|
370
|
+
<div class="item w-100">
|
|
371
|
+
<div class="item-label">停泊时间约</div>
|
|
372
|
+
<div class="item-item">${po(Number(a.stayTime))}</div>
|
|
373
|
+
</div>
|
|
374
|
+
`), `
|
|
375
|
+
<div class="track-point-popup">
|
|
376
|
+
<div class="item">
|
|
377
|
+
<div class="item-label">状态</div>
|
|
378
|
+
<div class="item-item">${a != null && a.sailStatus ? Ot[a.sailStatus] : i}</div>
|
|
379
|
+
</div>
|
|
380
|
+
<div class="item">
|
|
381
|
+
<div class="item-label">航速</div>
|
|
382
|
+
<div class="item-item">${a.speed || i}</div>
|
|
383
|
+
</div>
|
|
384
|
+
<div class="item">
|
|
385
|
+
<div class="item-label">艏向</div>
|
|
386
|
+
<div class="item-item">${a.hdg || i}</div>
|
|
387
|
+
</div>
|
|
388
|
+
<div class="item">
|
|
389
|
+
<div class="item-label">航向</div>
|
|
390
|
+
<div class="item-item">${a.cog || i}</div>
|
|
391
|
+
</div>
|
|
392
|
+
<div class="item">
|
|
393
|
+
<div class="item-label">经度</div>
|
|
394
|
+
<div class="item-item">${a.lon || i}</div>
|
|
395
|
+
</div>
|
|
396
|
+
<div class="item">
|
|
397
|
+
<div class="item-label">纬度</div>
|
|
398
|
+
<div class="item-item">${a.lat || i}</div>
|
|
399
|
+
</div>
|
|
400
|
+
<div class="item w-100">
|
|
401
|
+
<div class="item-label">时间</div>
|
|
402
|
+
<div class="item-item">${a.time}</div>
|
|
403
|
+
</div>
|
|
404
|
+
${h ?? h}
|
|
405
|
+
</div>`;
|
|
406
|
+
}, se = (a) => {
|
|
407
|
+
const y = a.map((C) => {
|
|
408
|
+
const G = e.getPixelFromCoordinate(he(C.center));
|
|
409
|
+
return {
|
|
410
|
+
...C,
|
|
411
|
+
original: C,
|
|
412
|
+
coord: C.centerPoint,
|
|
413
|
+
// 添加必需的coord属性
|
|
414
|
+
pixel: G,
|
|
415
|
+
distance: 0
|
|
416
|
+
// 先初始化,后续计算
|
|
417
|
+
};
|
|
418
|
+
});
|
|
419
|
+
let k = 0;
|
|
420
|
+
y[0].distance = 0;
|
|
421
|
+
for (let C = 1; C < y.length; C++) {
|
|
422
|
+
const G = y[C - 1].pixel, j = y[C].pixel, re = j[0] - G[0], F = j[1] - G[1];
|
|
423
|
+
k += Math.sqrt(re * re + F * F), y[C].distance = k;
|
|
424
|
+
}
|
|
425
|
+
const m = y.filter(
|
|
426
|
+
(C, G) => G === 0 || G === y.length - 1
|
|
427
|
+
), H = [];
|
|
428
|
+
for (let C = 0; C < m.length; C++) {
|
|
429
|
+
const G = m[C];
|
|
430
|
+
if (H.push(G), C < m.length - 1) {
|
|
431
|
+
const j = m[C + 1], re = j.distance - G.distance, F = Math.floor(re / 100);
|
|
432
|
+
for (let J = 1; J <= F; J++) {
|
|
433
|
+
const te = G.distance + J * 100;
|
|
434
|
+
if (te >= j.distance) break;
|
|
435
|
+
const U = qe(
|
|
436
|
+
y,
|
|
437
|
+
te
|
|
438
|
+
);
|
|
439
|
+
U && H.push(U);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
return Array.from(
|
|
444
|
+
new Map(H.map((C) => [C.distance.toFixed(2), C])).values()
|
|
445
|
+
).map((C) => ({
|
|
446
|
+
...C.original,
|
|
447
|
+
// 优先保留原始数据
|
|
448
|
+
...C,
|
|
449
|
+
// 覆盖坐标等计算属性
|
|
450
|
+
coord: C.coord || C.centerPoint,
|
|
451
|
+
// 确保使用插值后的坐标,如果没有则使用centerPoint
|
|
452
|
+
pixel: C.pixel,
|
|
453
|
+
distance: C.distance
|
|
454
|
+
}));
|
|
455
|
+
};
|
|
456
|
+
function qe(a, h) {
|
|
457
|
+
for (let y = 1; y < a.length; y++) {
|
|
458
|
+
const k = a[y - 1], m = a[y];
|
|
459
|
+
if (h >= k.distance && h <= m.distance) {
|
|
460
|
+
const H = (h - k.distance) / (m.distance - k.distance), T = k.pixel[0] + H * (m.pixel[0] - k.pixel[0]), C = k.pixel[1] + H * (m.pixel[1] - k.pixel[1]), G = e == null ? void 0 : e.getCoordinateFromPixel([T, C]);
|
|
461
|
+
return {
|
|
462
|
+
...k,
|
|
463
|
+
// 继承前一个点的属性(可调整)
|
|
464
|
+
coord: G,
|
|
465
|
+
pixel: [T, C],
|
|
466
|
+
distance: h,
|
|
467
|
+
original: void 0
|
|
468
|
+
// 明确标记为插值生成点
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
return null;
|
|
473
|
+
}
|
|
474
|
+
const _e = async (a, h, y) => {
|
|
475
|
+
if (!h || h.length === 0) return [];
|
|
476
|
+
const k = se(h), m = r.get(a).getSource(), H = k.map((C) => at(C, y == null ? void 0 : y.showPopup));
|
|
477
|
+
if (H && H.length > 0 && m.addFeatures(H), (y == null ? void 0 : y.showTime) === !0) {
|
|
478
|
+
const C = k.map((G) => ee(G, N));
|
|
479
|
+
C && C.length > 0 && m.addFeatures(C);
|
|
480
|
+
}
|
|
481
|
+
const T = me(k, h, N);
|
|
482
|
+
T && T.length > 0 && m.addFeatures(T);
|
|
483
|
+
}, at = (a, h = !0) => {
|
|
484
|
+
const y = new ye({
|
|
485
|
+
geometry: new ue(a.centerPoint),
|
|
486
|
+
data: a
|
|
487
|
+
});
|
|
488
|
+
y.set("type", "track_point"), y.set("trackId", a.id), y.set("data", a), y.set("showPopup", h);
|
|
489
|
+
let k = [
|
|
490
|
+
...K(N)
|
|
491
|
+
];
|
|
492
|
+
return (a.index === 0 || a.index === c[a.id].length - 1) && (k = [...be(a)], y.set("type", "track_begin")), a.state !== void 0 && a.state !== null && (k = [...O(a)], y.set("type", "track_icon")), y.setStyle(k), y;
|
|
493
|
+
}, g = window.devicePixelRatio || 1, V = /* @__PURE__ */ new Map();
|
|
494
|
+
let $ = null, B = null;
|
|
495
|
+
function I(a, h) {
|
|
496
|
+
const y = `${a}`;
|
|
497
|
+
if (V.has(y))
|
|
498
|
+
return V.get(y);
|
|
499
|
+
if (!$) {
|
|
500
|
+
$ = document.createElement("canvas");
|
|
501
|
+
try {
|
|
502
|
+
B = $.getContext("2d", {
|
|
503
|
+
willReadFrequently: !0
|
|
504
|
+
});
|
|
505
|
+
} catch (kt) {
|
|
506
|
+
console.log("e", kt), B = $.getContext("2d");
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
const k = $, m = B;
|
|
510
|
+
if (!m) return "";
|
|
511
|
+
k.width = 0, k.height = 0;
|
|
512
|
+
const H = 2, T = 8, C = 16, G = window.devicePixelRatio || 1, j = "500 12px Arial";
|
|
513
|
+
m.font = j;
|
|
514
|
+
const F = m.measureText(a).width, J = T + F + T, te = H + 14 + H;
|
|
515
|
+
let U = 0, Fe = 0, Ze = 0, We = 0, De = 0, Re = 0, Le = 0, Ne = 0;
|
|
516
|
+
U = C + J, Fe = C + te, Ze = J, We = te, De = J + C, Re = 0, Le = 0, Ne = C, k.width = Math.round(U * G), k.height = Math.round(Fe * G), m.scale(G, G), m.clearRect(0, 0, U, Fe), m.beginPath(), m.moveTo(Ze, We), m.lineTo(De, Re), m.strokeStyle = h || "#FFF", m.lineWidth = 1, m.stroke(), m.fillStyle = "#FFF", m.fillRect(Le, Ne, J, te), m.strokeStyle = h || "#FFF", m.lineWidth = 1, m.strokeRect(Le, Ne, J, te), m.font = j, m.textBaseline = "middle";
|
|
517
|
+
const Je = Ne + H / 2 + te / 2;
|
|
518
|
+
m.strokeStyle = "#ffffff", m.lineWidth = 1, m.strokeText(a, Le + T, Je), m.fillStyle = "#000000", m.fillText(a, Le + T, Je);
|
|
519
|
+
const Ue = k.toDataURL("image/png");
|
|
520
|
+
return V.set(y, Ue), Ue;
|
|
521
|
+
}
|
|
522
|
+
const ee = (a, h) => {
|
|
523
|
+
const y = I(a.time, h), k = new ye({
|
|
524
|
+
geometry: new ue(a.centerPoint),
|
|
525
|
+
data: a
|
|
526
|
+
});
|
|
527
|
+
k.set("type", "track_point_label");
|
|
528
|
+
const m = new ne({
|
|
529
|
+
image: new Se({
|
|
530
|
+
src: y,
|
|
531
|
+
anchor: [1, 0],
|
|
532
|
+
displacement: [0, 0],
|
|
533
|
+
scale: 1 / g,
|
|
534
|
+
anchorXUnits: "fraction",
|
|
535
|
+
anchorYUnits: "fraction"
|
|
536
|
+
}),
|
|
537
|
+
zIndex: 100
|
|
538
|
+
});
|
|
539
|
+
return k.setStyle(m), k;
|
|
540
|
+
}, oe = (a) => {
|
|
541
|
+
const h = r.get(a).getSource();
|
|
542
|
+
h.forEachFeature((y) => {
|
|
543
|
+
y.get("type") !== "line" && h.removeFeature(y);
|
|
544
|
+
});
|
|
545
|
+
}, K = (a) => [
|
|
546
|
+
new ne({
|
|
547
|
+
// 扩大交互热区
|
|
548
|
+
image: new lt({
|
|
549
|
+
stroke: new Pe({ color: "rgba(0, 0, 0, 0.01)", width: 20 }),
|
|
550
|
+
radius: 3
|
|
551
|
+
})
|
|
552
|
+
}),
|
|
553
|
+
// 轨迹点样式
|
|
554
|
+
new ne({
|
|
555
|
+
image: new lt({
|
|
556
|
+
fill: new ge({ color: a }),
|
|
557
|
+
stroke: new Pe({ color: "#fff", width: 2 }),
|
|
558
|
+
radius: 3
|
|
559
|
+
})
|
|
560
|
+
})
|
|
561
|
+
], O = (a) => {
|
|
562
|
+
const h = "#E31818", y = "#1890FF", k = "", m = new ne({
|
|
563
|
+
text: new Oe({
|
|
564
|
+
font: "Normal 22px map-iconfont",
|
|
565
|
+
text: Te(k),
|
|
566
|
+
offsetY: -10,
|
|
567
|
+
fill: new ge({
|
|
568
|
+
color: Number(a.state) === 0 ? h : Number(a.state) === 1 ? y : ""
|
|
569
|
+
})
|
|
570
|
+
}),
|
|
571
|
+
zIndex: 99
|
|
572
|
+
}), T = Tt(""), G = Tt(""), j = [];
|
|
573
|
+
return Number(a.state) === 0 ? j.push(T) : Number(a.state) === 1 && j.push(G), j.push(m), j;
|
|
574
|
+
}, me = (a, h, y) => {
|
|
575
|
+
const k = [];
|
|
576
|
+
if (a.length < 2)
|
|
577
|
+
return k;
|
|
578
|
+
for (let m = 0; m < a.length - 1; m++)
|
|
579
|
+
try {
|
|
580
|
+
const H = a[m], T = a[m + 1], C = h.findIndex(
|
|
581
|
+
(U) => U.lon === H.lon && U.lat === H.lat
|
|
582
|
+
), G = h.findIndex(
|
|
583
|
+
(U) => U.lon === T.lon && U.lat === T.lat
|
|
584
|
+
);
|
|
585
|
+
if (C === -1 || G === -1 || C >= G)
|
|
586
|
+
continue;
|
|
587
|
+
const j = h.slice(C, G + 1).map((U) => U.centerPoint), F = new Ge(j).getCoordinateAt(0.5), J = pt(a[m].center, a[m + 1].center) * (Math.PI / 180), te = new ye({
|
|
588
|
+
geometry: new ue(F)
|
|
589
|
+
});
|
|
590
|
+
te.set("type", "track_arrow"), te.setStyle(
|
|
591
|
+
new ne({
|
|
592
|
+
text: new Oe({
|
|
593
|
+
font: "700 12px map-iconfont",
|
|
594
|
+
text: Te(""),
|
|
595
|
+
fill: new ge({ color: y }),
|
|
596
|
+
rotation: J,
|
|
597
|
+
offsetX: 0,
|
|
598
|
+
offsetY: 0
|
|
599
|
+
})
|
|
600
|
+
})
|
|
601
|
+
), k.push(te);
|
|
602
|
+
} catch (H) {
|
|
603
|
+
console.warn("Failed to create arrow at distance", H);
|
|
604
|
+
}
|
|
605
|
+
return k;
|
|
606
|
+
}, ve = (a) => {
|
|
607
|
+
var H, T;
|
|
608
|
+
const h = e.getView(), y = (H = r == null ? void 0 : r.get(a)) == null ? void 0 : H.getSource(), k = E || (a ? y == null ? void 0 : y.getFeatureById(a) : null);
|
|
609
|
+
if (!k) return;
|
|
610
|
+
const m = (T = k == null ? void 0 : k.getGeometry()) == null ? void 0 : T.getExtent();
|
|
611
|
+
if (!m || m[0] === m[2] || m[1] === m[3]) {
|
|
612
|
+
console.warn("Invalid track extent");
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
try {
|
|
616
|
+
const C = m[2] - m[0], G = m[3] - m[1], j = 1e-4;
|
|
617
|
+
if (C < j || G < j) {
|
|
618
|
+
const F = [(m[0] + m[2]) / 2, (m[1] + m[3]) / 2];
|
|
619
|
+
h.setCenter(F);
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
const re = to(m, Math.max(C, G) * 0.1);
|
|
623
|
+
h.fit(re, {
|
|
624
|
+
maxZoom: ae.max,
|
|
625
|
+
padding: [30, 30, 30, 30]
|
|
626
|
+
// 添加边距
|
|
627
|
+
});
|
|
628
|
+
} catch (C) {
|
|
629
|
+
console.error("setTrackViewCenter error:", C);
|
|
630
|
+
}
|
|
631
|
+
}, be = (a) => {
|
|
632
|
+
const h = "", m = a.index === 0 ? "#fcdc3f" : "#ff0000";
|
|
633
|
+
return [new ne({
|
|
634
|
+
text: new Oe({
|
|
635
|
+
font: "Normal 14px map-iconfont",
|
|
636
|
+
text: Te(h),
|
|
637
|
+
fill: new ge({ color: m })
|
|
638
|
+
}),
|
|
639
|
+
zIndex: 101
|
|
640
|
+
})];
|
|
641
|
+
}, dt = () => {
|
|
642
|
+
console.log("清除所有的轨迹-----"), Qe(), r.forEach((h) => {
|
|
643
|
+
var y;
|
|
644
|
+
(y = h.getSource()) == null || y.clear(), e == null || e.removeLayer(h);
|
|
645
|
+
}), Object.keys(c).forEach((h) => {
|
|
646
|
+
r.delete(h), delete c[h], delete l[h];
|
|
647
|
+
});
|
|
648
|
+
}, Ke = (a) => {
|
|
649
|
+
const h = r.get(a || s);
|
|
650
|
+
h == null || h.setVisible(!1);
|
|
651
|
+
const y = e.getOverlays().getArray();
|
|
652
|
+
for (let k = 0; k < y.length; ) {
|
|
653
|
+
const m = y[k];
|
|
654
|
+
m.get("class") === "track-label-overlay" ? (m.setPosition(void 0), m.dispose()) : k++;
|
|
655
|
+
}
|
|
656
|
+
Qe();
|
|
657
|
+
}, je = (a, h = Ae.NM) => {
|
|
658
|
+
const y = {
|
|
659
|
+
id: a,
|
|
660
|
+
length: "--"
|
|
661
|
+
}, m = (c[a] || []).map(
|
|
662
|
+
(T) => Xe([T.lon, T.lat], ce.data, ce.mercator)
|
|
663
|
+
), H = new Ge(m);
|
|
664
|
+
return y.length = xo(H, h) || "--", y;
|
|
665
|
+
}, Dt = (a, h) => {
|
|
666
|
+
Ht(String(a), h);
|
|
667
|
+
}, Ht = (a, h) => {
|
|
668
|
+
const y = c[String(a)], k = y == null ? void 0 : y.map((m) => [m.lon, m.lat]);
|
|
669
|
+
k && Bt(k, h);
|
|
670
|
+
}, ut = new ne({
|
|
671
|
+
text: new Oe({
|
|
672
|
+
font: "700 20px map-iconfont",
|
|
673
|
+
text: Te(""),
|
|
674
|
+
fill: new ge({ color: "#ff0000" }),
|
|
675
|
+
rotation: 0
|
|
676
|
+
// 初始旋转角度
|
|
677
|
+
})
|
|
678
|
+
}), Gt = (a, h) => {
|
|
679
|
+
var F, J;
|
|
680
|
+
const y = Number(50 * h), k = ((F = a.frameState) == null ? void 0 : F.time) ?? Date.now(), m = k - L;
|
|
681
|
+
if (f = (f + y * m / 1e6) % 2, L = k, f >= 1) {
|
|
682
|
+
Qe();
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
685
|
+
const H = t.getCoordinateAt(
|
|
686
|
+
f > 1 ? 2 - f : f
|
|
687
|
+
), T = t.getCoordinateAt(
|
|
688
|
+
f > 1 ? f - 0.01 : f
|
|
689
|
+
), C = t.getCoordinateAt(
|
|
690
|
+
f > 1 ? 2 - f : f + 0.01
|
|
691
|
+
), j = pt(
|
|
692
|
+
Pt(T, "array"),
|
|
693
|
+
Pt(C, "array")
|
|
694
|
+
) * Math.PI / 180;
|
|
695
|
+
(J = ut.getText()) == null || J.setRotation(j), x.setCoordinates(H);
|
|
696
|
+
const re = oo(a);
|
|
697
|
+
re.setStyle(ut), re.drawGeometry(x), e == null || e.render();
|
|
698
|
+
}, Yt = () => {
|
|
699
|
+
var a;
|
|
700
|
+
A = !0, L = Date.now(), f = 0, x = ((a = n.getGeometry()) == null ? void 0 : a.clone()) || new ue([0, 0]), o && (u == null || u.on("postrender", o)), R == null || R.setGeometry(void 0);
|
|
701
|
+
}, Qe = () => {
|
|
702
|
+
A && (A = !1, R == null || R.setGeometry(void 0), o && u && u.un("postrender", o), u && (e == null || e.removeLayer(u)), u = null, R = null);
|
|
703
|
+
}, Bt = (a, h) => {
|
|
704
|
+
A && Qe(), P = new Ct({
|
|
705
|
+
factor: 1e6
|
|
706
|
+
}).writeGeometry(new Ge(a)), t = new Ct({
|
|
707
|
+
factor: 1e6
|
|
708
|
+
}).readGeometry(P, {
|
|
709
|
+
dataProjection: ce.data,
|
|
710
|
+
featureProjection: ce.mercator
|
|
711
|
+
}), n = new ye({
|
|
712
|
+
type: "icon",
|
|
713
|
+
geometry: new ue(t.getFirstCoordinate())
|
|
714
|
+
});
|
|
715
|
+
const y = n.getGeometry();
|
|
716
|
+
x = y ? y.clone() : new ue([0, 0]), R = new ye({
|
|
717
|
+
type: "geoMarker",
|
|
718
|
+
style: ut,
|
|
719
|
+
geometry: x
|
|
720
|
+
}), u = new Me({
|
|
721
|
+
source: new pe({
|
|
722
|
+
features: [R]
|
|
723
|
+
})
|
|
724
|
+
}), e == null || e.addLayer(u), o = (k) => Gt(k, h), Yt();
|
|
725
|
+
}, pt = (a, h, y) => {
|
|
726
|
+
function k(F) {
|
|
727
|
+
return 180 * (F % (2 * Math.PI)) / Math.PI;
|
|
728
|
+
}
|
|
729
|
+
function m(F) {
|
|
730
|
+
return F % 360 * Math.PI / 180;
|
|
731
|
+
}
|
|
732
|
+
function H(F) {
|
|
733
|
+
var J;
|
|
734
|
+
if (!F) throw new Error("Coordinate is required");
|
|
735
|
+
if (!Array.isArray(F)) {
|
|
736
|
+
if ((F == null ? void 0 : F.type) === "Feature" && (F == null ? void 0 : F.geometry) !== null && ((J = F == null ? void 0 : F.geometry) == null ? void 0 : J.type) === "Point")
|
|
737
|
+
return F == null ? void 0 : F.geometry.coordinates;
|
|
738
|
+
if (F.type === "Point") return (F == null ? void 0 : F.coordinates) || [];
|
|
739
|
+
}
|
|
740
|
+
if (Array.isArray(F) && F.length >= 2 && !Array.isArray(F[0]) && !Array.isArray(F[1]))
|
|
741
|
+
return F;
|
|
742
|
+
throw new Error(
|
|
743
|
+
"Coordinate must be GeoJSON Point or an Array of numbers"
|
|
744
|
+
);
|
|
745
|
+
}
|
|
746
|
+
function T(F, J, te = {}) {
|
|
747
|
+
if (te.final)
|
|
748
|
+
return function(Je, Ue) {
|
|
749
|
+
return (T(Ue, Je) + 180) % 360;
|
|
750
|
+
}(F, J);
|
|
751
|
+
const U = H(F), Fe = H(J), Ze = m(U[0]), We = m(Fe[0]), De = m(U[1]), Re = m(Fe[1]), Le = Math.sin(We - Ze) * Math.cos(Re), Ne = Math.cos(De) * Math.sin(Re) - Math.sin(De) * Math.cos(Re) * Math.cos(We - Ze);
|
|
752
|
+
return k(Math.atan2(Le, Ne));
|
|
753
|
+
}
|
|
754
|
+
function C(F) {
|
|
755
|
+
return !isNaN(F) && F !== null && !Array.isArray(F);
|
|
756
|
+
}
|
|
757
|
+
function G(F, J = {}, te = {}) {
|
|
758
|
+
return F || console.log("Coordinates are required"), Array.isArray(F) || console.log("Coordinates must be an Array"), F.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (!C(F[0]) || !C(F[1])) && console.log("Coordinates must contain numbers"), j({ type: "Point", coordinates: F }, J, te);
|
|
759
|
+
}
|
|
760
|
+
function j(F, J = {}, te = {}) {
|
|
761
|
+
const U = {
|
|
762
|
+
type: "Feature",
|
|
763
|
+
id: "",
|
|
764
|
+
properties: {},
|
|
765
|
+
bbox: {},
|
|
766
|
+
geometry: {}
|
|
767
|
+
};
|
|
768
|
+
return te.id !== void 0 && (U.id = te.id), te.bbox && (U.bbox = te.bbox), U.properties = J, U.geometry = F, U;
|
|
769
|
+
}
|
|
770
|
+
const re = T(G(a), G(h), y);
|
|
771
|
+
return re < 0 ? 360 + re : re;
|
|
772
|
+
};
|
|
773
|
+
return {
|
|
774
|
+
render: Y,
|
|
775
|
+
remove: dt,
|
|
776
|
+
play: Dt,
|
|
777
|
+
setCenter: ve,
|
|
778
|
+
close: Ke,
|
|
779
|
+
getLength: je,
|
|
780
|
+
handleTrackMapEvent: de,
|
|
781
|
+
reRenderTrackLine: M,
|
|
782
|
+
getTrackStatus: v
|
|
783
|
+
};
|
|
784
|
+
}, Mo = (e, r) => {
|
|
785
|
+
let c = null;
|
|
786
|
+
const l = async (t) => {
|
|
787
|
+
if (!e || (console.log("vehicleInfo", t), !(t != null && t.lon && (t != null && t.lat)))) return;
|
|
788
|
+
const n = Math.abs(Number(t.lon)) > 180 ? bt(t.lon, t.lat) : [t.lon, t.lat];
|
|
789
|
+
s(t, he(n));
|
|
790
|
+
const x = e == null ? void 0 : e.getView(), R = new ue(n);
|
|
791
|
+
x.setCenter(Xe(R.getCoordinates(), ce.data, ce.mercator));
|
|
792
|
+
}, s = (t, n) => {
|
|
793
|
+
const x = `${Vt}map/car-icon.gif`;
|
|
794
|
+
c || (c = new ke({
|
|
795
|
+
element: document.createElement("div"),
|
|
796
|
+
positioning: "center-center",
|
|
797
|
+
stopEvent: !1
|
|
798
|
+
// 允许交互事件穿透
|
|
799
|
+
}), e.addOverlay(c));
|
|
800
|
+
const R = c.getElement();
|
|
801
|
+
R.style.backgroundImage = `url(${x})`, R.style.width = "80px", R.style.height = "80px";
|
|
802
|
+
const A = (t == null ? void 0 : t.drc) || "";
|
|
803
|
+
R.style.transform = `rotate(${A}deg)`, R.style.backgroundSize = "cover", c == null || c.setPosition(n);
|
|
804
|
+
};
|
|
805
|
+
return {
|
|
806
|
+
location: l,
|
|
807
|
+
remove: () => {
|
|
808
|
+
const t = c == null ? void 0 : c.getElement();
|
|
809
|
+
t && (t.innerHTML = "");
|
|
810
|
+
},
|
|
811
|
+
renderTrack: (t, n, x, R) => {
|
|
812
|
+
r.render(t, n, x, "truck", R || 1e3);
|
|
813
|
+
},
|
|
814
|
+
setCenter: (t) => {
|
|
815
|
+
r.setCenter(t);
|
|
816
|
+
},
|
|
817
|
+
closeTrack: () => {
|
|
818
|
+
r.close();
|
|
819
|
+
},
|
|
820
|
+
playTrack: (t, n) => {
|
|
821
|
+
r.play(t, n);
|
|
822
|
+
}
|
|
823
|
+
};
|
|
824
|
+
}, Co = () => {
|
|
825
|
+
const e = fe();
|
|
826
|
+
return {
|
|
827
|
+
setProps: (l) => {
|
|
828
|
+
e.value = l;
|
|
829
|
+
},
|
|
830
|
+
getProps: () => e.value
|
|
831
|
+
};
|
|
832
|
+
};
|
|
833
|
+
function Lo(e) {
|
|
834
|
+
const r = fe(null), c = Ie(() => ({
|
|
835
|
+
"--overlay-color": "#FFF",
|
|
836
|
+
"--bg-color1": e.colors && e.colors[0] ? e.colors[0] : "#ffffff",
|
|
837
|
+
// 默认第一个颜色
|
|
838
|
+
"--bg-color2": e.colors && e.colors[1] ? e.colors[1] : "#ffffff",
|
|
839
|
+
"--bg-color": "#ffffff",
|
|
840
|
+
position: "relative",
|
|
841
|
+
"pointer-events": "none"
|
|
842
|
+
})), l = Ie(() => {
|
|
843
|
+
var o;
|
|
844
|
+
return {
|
|
845
|
+
position: "relative",
|
|
846
|
+
"border-radius": "1px",
|
|
847
|
+
"background-color": "var(--content-bg)",
|
|
848
|
+
color: "#000",
|
|
849
|
+
padding: "2px 5px 2px 0px",
|
|
850
|
+
font: "500 Normal 12px",
|
|
851
|
+
"font-size": "12px",
|
|
852
|
+
"box-shadow": "0 2px 10px rgba(0, 0, 0, 0.2)",
|
|
853
|
+
"white-space": "nowrap",
|
|
854
|
+
border: "1px solid #FFF",
|
|
855
|
+
"pointer-events": "auto",
|
|
856
|
+
// 'transition': 'background-color 0.5s ease, border 0.5s ease',
|
|
857
|
+
"z-index": "1",
|
|
858
|
+
display: "flex",
|
|
859
|
+
"align-items": "center",
|
|
860
|
+
animation: e.selected ? e.colors && ((o = e.colors) == null ? void 0 : o.length) >= 2 ? "blink-dual 2s ease-in-out infinite" : "blink-single 1.5s ease-in-out infinite" : "none"
|
|
861
|
+
// "animation": props.selected ? 'blink 1.5s ease-in-out infinite' : 'none', // 动画开关
|
|
862
|
+
};
|
|
863
|
+
}), s = Ie(() => ({
|
|
864
|
+
width: "14px",
|
|
865
|
+
height: "14px",
|
|
866
|
+
margin: "1px 5px 1px 1px",
|
|
867
|
+
"background-color": "var(--attention-bg)"
|
|
868
|
+
})), i = Ie(() => ({
|
|
869
|
+
position: "absolute",
|
|
870
|
+
top: "0px",
|
|
871
|
+
color: "var(--overlay-color)",
|
|
872
|
+
"pointer-events": "none",
|
|
873
|
+
transform: "translateY(-1px)",
|
|
874
|
+
"z-index": "0",
|
|
875
|
+
width: "20px",
|
|
876
|
+
height: "20px",
|
|
877
|
+
overflow: "visible",
|
|
878
|
+
left: "-20px"
|
|
879
|
+
}));
|
|
880
|
+
return () => xe("div", {
|
|
881
|
+
ref: r,
|
|
882
|
+
class: "ship-overlay-container",
|
|
883
|
+
"data-id": e.id,
|
|
884
|
+
style: c.value
|
|
885
|
+
}, [
|
|
886
|
+
xe(
|
|
887
|
+
"div",
|
|
888
|
+
{
|
|
889
|
+
class: "ship-overlay-content",
|
|
890
|
+
style: l.value,
|
|
891
|
+
"data-id": e.id
|
|
892
|
+
},
|
|
893
|
+
[
|
|
894
|
+
xe("div", {
|
|
895
|
+
"data-id": e.id,
|
|
896
|
+
style: e.selected ? s.value : {}
|
|
897
|
+
}, ""),
|
|
898
|
+
xe("div", {
|
|
899
|
+
class: "text",
|
|
900
|
+
"data-id": e.id,
|
|
901
|
+
style: {
|
|
902
|
+
fontSize: "12px",
|
|
903
|
+
fontWeight: 500,
|
|
904
|
+
fontFamily: "Arial"
|
|
905
|
+
}
|
|
906
|
+
}, e.name || "未命名船舶"),
|
|
907
|
+
xe("div", {
|
|
908
|
+
class: "icons",
|
|
909
|
+
"data-id": e.id,
|
|
910
|
+
style: {
|
|
911
|
+
color: "#3370ff",
|
|
912
|
+
marginLeft: "6px"
|
|
913
|
+
}
|
|
914
|
+
}, [
|
|
915
|
+
e.existDevice ? xe("i", {
|
|
916
|
+
class: "map-iconfont icon-camera",
|
|
917
|
+
"data-id": e.id,
|
|
918
|
+
style: {
|
|
919
|
+
fontSize: "12px",
|
|
920
|
+
marginRight: "6px"
|
|
921
|
+
}
|
|
922
|
+
}) : "",
|
|
923
|
+
e.existMobile ? xe("i", {
|
|
924
|
+
"data-id": e.id,
|
|
925
|
+
class: "map-iconfont icon-tele",
|
|
926
|
+
style: {
|
|
927
|
+
fontSize: "12px",
|
|
928
|
+
marginRight: "6px"
|
|
929
|
+
}
|
|
930
|
+
}) : "",
|
|
931
|
+
e.existWaterGauge ? xe("i", {
|
|
932
|
+
"data-id": e.id,
|
|
933
|
+
class: "map-iconfont icon-ruler",
|
|
934
|
+
style: {
|
|
935
|
+
fontSize: "12px",
|
|
936
|
+
marginRight: "6px"
|
|
937
|
+
}
|
|
938
|
+
}) : ""
|
|
939
|
+
])
|
|
940
|
+
]
|
|
941
|
+
),
|
|
942
|
+
xe("svg", {
|
|
943
|
+
class: "ship-overlay-line",
|
|
944
|
+
style: i.value,
|
|
945
|
+
viewBox: "0 0 20 20",
|
|
946
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
947
|
+
}, [
|
|
948
|
+
xe("line", {
|
|
949
|
+
x1: "0",
|
|
950
|
+
y1: "20",
|
|
951
|
+
x2: "20",
|
|
952
|
+
y2: "4",
|
|
953
|
+
stroke: "white",
|
|
954
|
+
"stroke-width": "1"
|
|
955
|
+
})
|
|
956
|
+
])
|
|
957
|
+
]);
|
|
958
|
+
}
|
|
959
|
+
const At = (e) => {
|
|
960
|
+
const { spd: r, hdg: c, cog: l } = e;
|
|
961
|
+
return r ? c !== null && +c != 511 && l !== null ? l - +c >= 3 ? we.right : l - +c <= -3 ? we.left : we.front : we.front : "";
|
|
962
|
+
};
|
|
963
|
+
function Eo(e, r) {
|
|
964
|
+
const { isHighlight: c, shipData: l, color: s } = e.getProperties(), i = it(r), o = ct(r, l, i), d = ((l == null ? void 0 : l.cog) - 90 + 360) % 360, w = At(l);
|
|
965
|
+
return {
|
|
966
|
+
featureId: l.id,
|
|
967
|
+
shipType: i,
|
|
968
|
+
isHighlight: !!c,
|
|
969
|
+
scale: o,
|
|
970
|
+
fill: s,
|
|
971
|
+
deg: d,
|
|
972
|
+
direct: w
|
|
973
|
+
};
|
|
974
|
+
}
|
|
975
|
+
const Ye = /* @__PURE__ */ new Map();
|
|
976
|
+
function To(e) {
|
|
977
|
+
return `${e.featureId}_${e.shipType}_${e.isHighlight}_${e.scale}_${e.fill}_${e.deg}_${e.direct}`;
|
|
978
|
+
}
|
|
979
|
+
const $e = (e, r) => {
|
|
980
|
+
const c = Eo(r, e), l = To(c);
|
|
981
|
+
if (Ye.has(l))
|
|
982
|
+
return Ye.get(l);
|
|
983
|
+
const { shipData: s } = r.getProperties(), i = it(e), o = ct(e, s, i), d = Po(r, o, i);
|
|
984
|
+
return Ye.set(l, d), d;
|
|
985
|
+
}, it = (e) => {
|
|
986
|
+
const r = e == null ? void 0 : e.getView().getZoom();
|
|
987
|
+
return r && r <= ae.shipModelMax && r >= ae.shipTriggleMin ? "ship" : "triangle";
|
|
988
|
+
};
|
|
989
|
+
let St = null;
|
|
990
|
+
const ct = (e, r, c) => {
|
|
991
|
+
if (c === "triangle")
|
|
992
|
+
return ae.scaleNum;
|
|
993
|
+
const l = e == null ? void 0 : e.getView().getResolution();
|
|
994
|
+
if (St === l && c === "triangle")
|
|
995
|
+
return ae.scaleNum;
|
|
996
|
+
if (St = l, c === "ship") {
|
|
997
|
+
const { len: s, wid: i } = r, o = 97, d = 20, w = 1 / l, P = s * w / o, t = i * w / d, n = Math.min(P, t);
|
|
998
|
+
return Math.max(0.2, Math.min(2, n));
|
|
999
|
+
}
|
|
1000
|
+
return ae.scaleNum;
|
|
1001
|
+
}, Po = (e, r, c) => {
|
|
1002
|
+
const { color: l, direct: s, isHighlight: i, shipData: o } = e.getProperties(), d = ((o == null ? void 0 : o.cog) - 90 + 360) % 360;
|
|
1003
|
+
return new ne({
|
|
1004
|
+
image: new Se({
|
|
1005
|
+
src: w(),
|
|
1006
|
+
scale: r || ae.scaleNum,
|
|
1007
|
+
anchor: [0.5, 0.5],
|
|
1008
|
+
rotation: d * Math.PI / 180,
|
|
1009
|
+
rotateWithView: !1
|
|
1010
|
+
})
|
|
1011
|
+
});
|
|
1012
|
+
function w() {
|
|
1013
|
+
return `data:image/svg+xml;utf8,${encodeURIComponent(P())}`;
|
|
1014
|
+
}
|
|
1015
|
+
function P() {
|
|
1016
|
+
switch (c) {
|
|
1017
|
+
case "triangle":
|
|
1018
|
+
return `<svg width="41" height="24" viewBox="0 0 41 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1019
|
+
<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"
|
|
1020
|
+
fill="${l}" stroke="${i ? "#FF2424" : "black"}" stroke-width="${i ? "2" : "0.578947"}" />
|
|
1021
|
+
<!--path船航向左边或者向前-->
|
|
1022
|
+
${s === we.left && `<path d="M30 12L40 12L40 8" stroke="${i ? "#FF2424" : "black"}" stroke-width="2"/>`}
|
|
1023
|
+
<!--path船航向右边-->
|
|
1024
|
+
${s === we.right && `<path d="M30 12L40 12L40 16" stroke="${i ? "#FF2424" : "black"}" stroke-width="2"/>`}
|
|
1025
|
+
<!--path黑线无左右-->
|
|
1026
|
+
${s === we.front && `<path d="M30 12L40 12" stroke="${i ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
1027
|
+
</svg>
|
|
1028
|
+
`;
|
|
1029
|
+
case "ship":
|
|
1030
|
+
return `<svg width="97" height="20" viewBox="0 0 97 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1031
|
+
<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"
|
|
1032
|
+
fill="${l}" stroke="${i ? "#FF2424" : "black"}" stroke-width="${i ? "4" : "0.578947"}"/>
|
|
1033
|
+
${s === we.left && `<path d="M86 10L96 10L96 6" stroke="${i ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
1034
|
+
${s === we.right && `<path d="M86 10L96 10L96 14" stroke="${i ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
1035
|
+
${s === we.front && `<path d="M86 10L96 10" stroke="${i ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
1036
|
+
</svg>
|
|
1037
|
+
`;
|
|
1038
|
+
default:
|
|
1039
|
+
return "";
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
}, Be = /* @__PURE__ */ new Map();
|
|
1043
|
+
function So(e, r) {
|
|
1044
|
+
const c = it(r), l = ct(r, e, c);
|
|
1045
|
+
return `${c}_${l}_${c === "ship" ? 109 : 49}`;
|
|
1046
|
+
}
|
|
1047
|
+
const Ft = (e, r) => {
|
|
1048
|
+
const c = So(r, e);
|
|
1049
|
+
if (Be.has(c))
|
|
1050
|
+
return Be.get(c);
|
|
1051
|
+
const l = it(e), s = ct(e, r, l), i = l === "ship" ? 109 : 49, o = `
|
|
1052
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="${i}" height="${i}" viewBox="0 0 49 49" fill="none">
|
|
1053
|
+
<path d="M1.99982 46.9998L1.99982 1.99982L46.9998 1.99982L46.9998 46.9998L1.99982 46.9998Z" fill="#FF2424" fill-opacity="0.2"/>
|
|
1054
|
+
<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"/>
|
|
1055
|
+
</svg>
|
|
1056
|
+
`, d = new ne({
|
|
1057
|
+
image: new Se({
|
|
1058
|
+
src: `data:image/svg+xml;utf8,${encodeURIComponent(o)}`,
|
|
1059
|
+
scale: s,
|
|
1060
|
+
anchorXUnits: "fraction",
|
|
1061
|
+
anchorYUnits: "fraction"
|
|
1062
|
+
})
|
|
1063
|
+
});
|
|
1064
|
+
return Be.set(c, d), d;
|
|
1065
|
+
};
|
|
1066
|
+
function Fo(e, r, c, l) {
|
|
1067
|
+
if (r) {
|
|
1068
|
+
const s = new ke({
|
|
1069
|
+
element: c,
|
|
1070
|
+
positioning: "top-left",
|
|
1071
|
+
id: "label-" + (l == null ? void 0 : l.id),
|
|
1072
|
+
offset: [20, -20],
|
|
1073
|
+
autoPan: !1,
|
|
1074
|
+
position: r,
|
|
1075
|
+
stopEvent: !1,
|
|
1076
|
+
className: l != null && l.blinking ? "ship-label-overlay-blinking" : "ship-label-overlay"
|
|
1077
|
+
});
|
|
1078
|
+
s.set("class", "zh-map-ship-overlay"), e.addOverlay(s);
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
const Ro = (e, r) => {
|
|
1082
|
+
const { lon: c, lat: l, blinking: s } = r, i = Zt(r);
|
|
1083
|
+
c && l && Fo(e, he([c, l]), i, { ...r, blinking: s });
|
|
1084
|
+
}, Zt = (e) => {
|
|
1085
|
+
const r = document.createElement("div");
|
|
1086
|
+
r.className = "ship-overlay-box", r.style.position = "relative";
|
|
1087
|
+
const { lon: c, lat: l, blinking: s, blinkingColors: i, name: o } = e, d = ht({
|
|
1088
|
+
setup() {
|
|
1089
|
+
return Lo({
|
|
1090
|
+
id: e == null ? void 0 : e.id,
|
|
1091
|
+
selected: s,
|
|
1092
|
+
name: o,
|
|
1093
|
+
colors: i || [],
|
|
1094
|
+
existDevice: e == null ? void 0 : e.existDevice,
|
|
1095
|
+
existMobile: e == null ? void 0 : e.existMobile,
|
|
1096
|
+
existWaterGauge: e == null ? void 0 : e.existWaterGauge
|
|
1097
|
+
});
|
|
1098
|
+
}
|
|
1099
|
+
});
|
|
1100
|
+
return Xt(d, r), r;
|
|
1101
|
+
}, Rt = (e) => {
|
|
1102
|
+
const r = [];
|
|
1103
|
+
return e.existDevice && r.push(""), e.existMobile && r.push(""), e.existWaterGauge && r.push(""), r;
|
|
1104
|
+
};
|
|
1105
|
+
function No() {
|
|
1106
|
+
const e = [
|
|
1107
|
+
"left-top",
|
|
1108
|
+
"left-middle",
|
|
1109
|
+
"left-bottom",
|
|
1110
|
+
"right-top",
|
|
1111
|
+
"right-middle",
|
|
1112
|
+
"right-bottom"
|
|
1113
|
+
];
|
|
1114
|
+
return e[Math.floor(Math.random() * e.length)];
|
|
1115
|
+
}
|
|
1116
|
+
const $o = window.devicePixelRatio || 1, gt = /* @__PURE__ */ new Map();
|
|
1117
|
+
let He = null, ft = null;
|
|
1118
|
+
function zo(e, r, c = "left-bottom", l = 10) {
|
|
1119
|
+
const s = `${e}-${r.join(",")}-${c}-${l}`;
|
|
1120
|
+
if (gt.has(s))
|
|
1121
|
+
return gt.get(s);
|
|
1122
|
+
if (!He) {
|
|
1123
|
+
He = document.createElement("canvas");
|
|
1124
|
+
try {
|
|
1125
|
+
ft = He.getContext("2d", {
|
|
1126
|
+
willReadFrequently: !0
|
|
1127
|
+
});
|
|
1128
|
+
} catch {
|
|
1129
|
+
ft = He.getContext("2d");
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
const i = He, o = ft;
|
|
1133
|
+
if (!o) return "";
|
|
1134
|
+
i.width = 0, i.height = 0;
|
|
1135
|
+
const d = 2, w = 4, P = 16, t = window.devicePixelRatio || 1, n = "500 12px Arial", x = "12px map-iconfont";
|
|
1136
|
+
o.font = n;
|
|
1137
|
+
const A = o.measureText(e).width;
|
|
1138
|
+
o.font = x;
|
|
1139
|
+
const L = r.map((X) => ({ width: o.measureText(Te(X)).width, height: 14 })), u = L.reduce((X, Q) => X + Q.width, 0), f = r.length * l, E = w + A + u + f + w, b = d + 14 + d * 2;
|
|
1140
|
+
let Z, W, p = 0, N = 0, z = 0, M = 0, v = 0, S = 0;
|
|
1141
|
+
switch (Z = P + E, c) {
|
|
1142
|
+
case "right-top":
|
|
1143
|
+
W = P + b, p = 0, N = P + b, z = P, M = 0, v = P, S = 0;
|
|
1144
|
+
break;
|
|
1145
|
+
case "right-middle":
|
|
1146
|
+
W = b, p = 0, N = b / 2, z = P, M = b / 2, v = P, S = 0;
|
|
1147
|
+
break;
|
|
1148
|
+
case "right-bottom":
|
|
1149
|
+
W = P + b, p = 0, N = 0, z = P, M = P, v = P, S = P;
|
|
1150
|
+
break;
|
|
1151
|
+
case "left-top":
|
|
1152
|
+
W = P + b, p = E, N = P, z = E + P, M = b + P, v = 0, S = 0;
|
|
1153
|
+
break;
|
|
1154
|
+
case "left-middle":
|
|
1155
|
+
W = b, p = E, N = b / 2, z = E + P, M = b / 2, v = 0, S = 0;
|
|
1156
|
+
break;
|
|
1157
|
+
case "left-bottom":
|
|
1158
|
+
W = P + b, p = E, N = b, z = E + P, M = 0, v = 0, S = P;
|
|
1159
|
+
break;
|
|
1160
|
+
}
|
|
1161
|
+
W = W + d, i.width = Math.round(Z * t), i.height = Math.round(W * t), o.scale(t, t), o.clearRect(0, 0, Z, W), o.beginPath(), o.moveTo(p, N), o.lineTo(z, M), o.strokeStyle = "#FFF", o.lineWidth = 1, o.stroke(), o.fillStyle = "#FFF", o.fillRect(v, S, E, b), o.font = n, o.textBaseline = "middle";
|
|
1162
|
+
const Y = S + d / 2 + b / 2;
|
|
1163
|
+
o.strokeStyle = "#ffffff", o.lineWidth = 1, o.strokeText(e, v + w, Y), o.fillStyle = "#000000", o.fillText(e, v + w, Y), o.font = x, o.fillStyle = "#3370ff";
|
|
1164
|
+
let D = v + w + A + l;
|
|
1165
|
+
const q = S + b / 2;
|
|
1166
|
+
r.length > 0 && r.forEach((X, Q) => {
|
|
1167
|
+
o.fillText(Te(X), D, q), D += L[Q].width + l;
|
|
1168
|
+
});
|
|
1169
|
+
const _ = i.toDataURL("image/png");
|
|
1170
|
+
return gt.set(s, _), _;
|
|
1171
|
+
}
|
|
1172
|
+
const Nt = (e, r) => {
|
|
1173
|
+
const { name: c, rightIcons: l, selected: s } = e.getProperties(), i = r !== 1 ? No() : "right-top", o = zo(c, l, i);
|
|
1174
|
+
let d = [0, 0];
|
|
1175
|
+
switch (i) {
|
|
1176
|
+
case "right-top":
|
|
1177
|
+
d = [0, 1];
|
|
1178
|
+
break;
|
|
1179
|
+
case "right-middle":
|
|
1180
|
+
d = [0, 0.5];
|
|
1181
|
+
break;
|
|
1182
|
+
case "right-bottom":
|
|
1183
|
+
d = [0, 0];
|
|
1184
|
+
break;
|
|
1185
|
+
case "left-top":
|
|
1186
|
+
d = [1, 1];
|
|
1187
|
+
break;
|
|
1188
|
+
case "left-middle":
|
|
1189
|
+
d = [1, 0.5];
|
|
1190
|
+
break;
|
|
1191
|
+
case "left-bottom":
|
|
1192
|
+
d = [1, 0];
|
|
1193
|
+
break;
|
|
1194
|
+
}
|
|
1195
|
+
return new ne({
|
|
1196
|
+
image: new Se({
|
|
1197
|
+
src: o,
|
|
1198
|
+
anchor: d,
|
|
1199
|
+
displacement: [0, 0],
|
|
1200
|
+
scale: 1 / $o,
|
|
1201
|
+
anchorXUnits: "fraction",
|
|
1202
|
+
anchorYUnits: "fraction"
|
|
1203
|
+
}),
|
|
1204
|
+
zIndex: s ? 100 : 10
|
|
1205
|
+
});
|
|
1206
|
+
}, Vo = (e) => {
|
|
1207
|
+
e.getInteractions().forEach((r) => {
|
|
1208
|
+
r instanceof yt && r.setActive(!1);
|
|
1209
|
+
});
|
|
1210
|
+
}, Oo = (e) => {
|
|
1211
|
+
e.getInteractions().forEach((r) => {
|
|
1212
|
+
r instanceof yt && r.setActive(!0);
|
|
1213
|
+
});
|
|
1214
|
+
}, Ce = (e, r) => {
|
|
1215
|
+
const c = e.getViewport();
|
|
1216
|
+
c && (c.style.cursor = r);
|
|
1217
|
+
}, Ao = (e, r) => {
|
|
1218
|
+
const c = fe([]), l = fe("km"), s = (M) => {
|
|
1219
|
+
l.value = M;
|
|
1220
|
+
};
|
|
1221
|
+
let i, o = "close";
|
|
1222
|
+
const d = () => {
|
|
1223
|
+
Ce(e, "crosshair"), t(), Vo(e), e.on("pointermove", R), e.getViewport().addEventListener("mouseout", () => {
|
|
1224
|
+
i && i.classList.add("hidden");
|
|
1225
|
+
}), L(), o = "open";
|
|
1226
|
+
};
|
|
1227
|
+
let w, P;
|
|
1228
|
+
const t = () => {
|
|
1229
|
+
w = new pe(), P = new Me({
|
|
1230
|
+
source: w,
|
|
1231
|
+
zIndex: 1e3,
|
|
1232
|
+
style: {
|
|
1233
|
+
"fill-color": "rgba(255, 255, 255, 0.2)",
|
|
1234
|
+
"stroke-color": "#ffcc33",
|
|
1235
|
+
"stroke-width": 2,
|
|
1236
|
+
"circle-radius": 7,
|
|
1237
|
+
"circle-fill-color": "#ffcc33"
|
|
1238
|
+
}
|
|
1239
|
+
}), e == null || e.addLayer(P);
|
|
1240
|
+
};
|
|
1241
|
+
let n, x;
|
|
1242
|
+
const R = (M) => {
|
|
1243
|
+
if (M.dragging)
|
|
1244
|
+
return;
|
|
1245
|
+
let v = "点击选择起点";
|
|
1246
|
+
n && (v = "单击继续,双击结束"), i && (i.innerHTML = v, x.setPosition(M.coordinate), i.classList.remove("hidden"));
|
|
1247
|
+
};
|
|
1248
|
+
let A;
|
|
1249
|
+
const L = () => {
|
|
1250
|
+
A = new tt({
|
|
1251
|
+
source: w,
|
|
1252
|
+
type: "LineString",
|
|
1253
|
+
style: new ne({
|
|
1254
|
+
fill: new ge({
|
|
1255
|
+
color: "rgba(255, 255, 255, 0.2)"
|
|
1256
|
+
}),
|
|
1257
|
+
stroke: new Pe({
|
|
1258
|
+
color: "rgba(255,204,51)",
|
|
1259
|
+
lineDash: [10, 10],
|
|
1260
|
+
width: 2
|
|
1261
|
+
}),
|
|
1262
|
+
image: new lt({
|
|
1263
|
+
radius: 5,
|
|
1264
|
+
stroke: new Pe({
|
|
1265
|
+
color: "rgba(0, 0, 0, 0.7)"
|
|
1266
|
+
}),
|
|
1267
|
+
fill: new ge({
|
|
1268
|
+
color: "rgba(255, 255, 255, 0.2)"
|
|
1269
|
+
})
|
|
1270
|
+
})
|
|
1271
|
+
}),
|
|
1272
|
+
// 添加条件函数,判断是否应该出发点绘制
|
|
1273
|
+
condition: (v) => {
|
|
1274
|
+
const S = v.originalEvent.target;
|
|
1275
|
+
return S.className !== "ol-tooltip-measure" && S.className !== "ol-tooltip-delete-button";
|
|
1276
|
+
}
|
|
1277
|
+
}), e == null || e.addInteraction(A), b(), Z();
|
|
1278
|
+
let M;
|
|
1279
|
+
A.on("drawstart", function(v) {
|
|
1280
|
+
var Y;
|
|
1281
|
+
n = v.feature, n.set("randomId", u());
|
|
1282
|
+
let S;
|
|
1283
|
+
M = (Y = n.getGeometry()) == null ? void 0 : Y.on("change", function(D) {
|
|
1284
|
+
const q = D.target, _ = Wt(q, l.value);
|
|
1285
|
+
S = q.getLastCoordinate(), f && _ && (f.innerHTML = _), E.setPosition(S);
|
|
1286
|
+
});
|
|
1287
|
+
}), A.on("drawend", function() {
|
|
1288
|
+
var v, S, Y;
|
|
1289
|
+
if (f && (f.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), f != null && f.innerHTML) {
|
|
1290
|
+
const D = (n == null ? void 0 : n.get("randomId")) || u();
|
|
1291
|
+
c.value.push({ id: D, value: f == null ? void 0 : f.innerHTML }), f.innerHTML = `${f.innerHTML}<div class="ol-tooltip-delete-button" data-id="${D}"><i class="map-iconfont icon-delete"></i></div>`;
|
|
1292
|
+
}
|
|
1293
|
+
(v = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || v.addEventListener("click", (D) => {
|
|
1294
|
+
var _;
|
|
1295
|
+
D.preventDefault(), D.stopPropagation();
|
|
1296
|
+
const q = (_ = D.target) == null ? void 0 : _.getAttribute("data-id");
|
|
1297
|
+
q && p(q);
|
|
1298
|
+
}), E.setOffset([0, -7]), n = null, f = null, b(), M && mt(M), (Y = (S = r.getProps()) == null ? void 0 : S.lineDrawEnd) == null || Y.call(S, c.value), i.innerHTML = "";
|
|
1299
|
+
});
|
|
1300
|
+
}, u = () => Math.random().toString(36).substring(2, 9);
|
|
1301
|
+
let f, E;
|
|
1302
|
+
const b = () => {
|
|
1303
|
+
f != null && f.parentNode && f.parentNode.removeChild(f), f = document.createElement("div"), f.className = "ol-tooltip ol-tooltip-measure", E = new ke({
|
|
1304
|
+
element: f,
|
|
1305
|
+
offset: [0, -15],
|
|
1306
|
+
positioning: "bottom-center",
|
|
1307
|
+
stopEvent: !1,
|
|
1308
|
+
insertFirst: !1
|
|
1309
|
+
}), e == null || e.addOverlay(E);
|
|
1310
|
+
}, Z = () => {
|
|
1311
|
+
i != null && i.parentNode && i.parentNode.removeChild(i), i = document.createElement("div"), i.className = "ol-tooltip hidden", x = new ke({
|
|
1312
|
+
element: i,
|
|
1313
|
+
offset: [15, 0],
|
|
1314
|
+
positioning: "center-left",
|
|
1315
|
+
stopEvent: !1
|
|
1316
|
+
}), e == null || e.addOverlay(x);
|
|
1317
|
+
}, W = () => {
|
|
1318
|
+
c.value.forEach((M, v) => {
|
|
1319
|
+
var D, q;
|
|
1320
|
+
const S = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1321
|
+
S[v] && ((q = (D = S[v]) == null ? void 0 : D.parentNode) == null || q.removeChild(S[v]));
|
|
1322
|
+
const Y = w.getFeatures();
|
|
1323
|
+
Y[v] && w.removeFeature(Y[v]);
|
|
1324
|
+
}), N(), Oo(e), o = "close", Ce(e, "grab");
|
|
1325
|
+
}, p = (M) => {
|
|
1326
|
+
var S, Y, D, q;
|
|
1327
|
+
const v = c.value.findIndex((_) => _.id === M);
|
|
1328
|
+
if (v !== -1) {
|
|
1329
|
+
c.value.splice(v, 1);
|
|
1330
|
+
const _ = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1331
|
+
_[v] && ((Y = (S = _[v]) == null ? void 0 : S.parentNode) == null || Y.removeChild(_[v]));
|
|
1332
|
+
const X = w.getFeatures();
|
|
1333
|
+
X[v] && w.removeFeature(X[v]);
|
|
1334
|
+
}
|
|
1335
|
+
(q = (D = r.getProps()) == null ? void 0 : D.lineDrawEnd) == null || q.call(D, c.value);
|
|
1336
|
+
}, N = () => {
|
|
1337
|
+
if (c.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((M) => {
|
|
1338
|
+
var v;
|
|
1339
|
+
(v = M == null ? void 0 : M.parentNode) == null || v.removeChild(M);
|
|
1340
|
+
}), w == null || w.clear(), A) {
|
|
1341
|
+
const M = e.getInteractions().getArray().find((v) => Lt(v) === Lt(A));
|
|
1342
|
+
M && e.removeInteraction(M);
|
|
1343
|
+
}
|
|
1344
|
+
e.removeLayer(P), i != null && i.parentNode && i.parentNode.removeChild(i), f != null && f.parentNode && f.parentNode.removeChild(f);
|
|
1345
|
+
};
|
|
1346
|
+
return {
|
|
1347
|
+
open: d,
|
|
1348
|
+
close: W,
|
|
1349
|
+
deleteLine: p,
|
|
1350
|
+
setUnit: s,
|
|
1351
|
+
getState: () => o
|
|
1352
|
+
};
|
|
1353
|
+
}, Wt = (e, r) => {
|
|
1354
|
+
const l = wt(e);
|
|
1355
|
+
let s = "";
|
|
1356
|
+
switch (r) {
|
|
1357
|
+
case "m":
|
|
1358
|
+
s = `${Math.round(l * 100) / 100} m`;
|
|
1359
|
+
break;
|
|
1360
|
+
case "km":
|
|
1361
|
+
s = `${Math.round(l / 1e3 * 100) / 100} km`;
|
|
1362
|
+
break;
|
|
1363
|
+
case "nm":
|
|
1364
|
+
s = (Math.round(l / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
|
|
1365
|
+
break;
|
|
1366
|
+
}
|
|
1367
|
+
return s;
|
|
1368
|
+
}, Zo = (e, r) => {
|
|
1369
|
+
let c, l, s = "close";
|
|
1370
|
+
const i = () => {
|
|
1371
|
+
N(), s = "open", o(), Ce(e, "crosshair");
|
|
1372
|
+
}, o = () => {
|
|
1373
|
+
P(), E(), W(), A();
|
|
1374
|
+
};
|
|
1375
|
+
let d = null, w = null;
|
|
1376
|
+
const P = () => {
|
|
1377
|
+
if (d && w) return;
|
|
1378
|
+
const M = new pe(), v = new Me({
|
|
1379
|
+
source: M,
|
|
1380
|
+
style: new ne({
|
|
1381
|
+
stroke: new Pe({
|
|
1382
|
+
color: "#fbcc33",
|
|
1383
|
+
width: 2
|
|
1384
|
+
})
|
|
1385
|
+
}),
|
|
1386
|
+
zIndex: 1e3
|
|
1387
|
+
});
|
|
1388
|
+
d = v, w = M, e.on("pointermove", n), e.addLayer(v), e.on(["dblclick"], function(S) {
|
|
1389
|
+
x && (S.stopPropagation(), S.preventDefault());
|
|
1390
|
+
});
|
|
1391
|
+
};
|
|
1392
|
+
let t;
|
|
1393
|
+
const n = (M) => {
|
|
1394
|
+
if (M.dragging) return;
|
|
1395
|
+
const v = t ? "单击继续,双击结束" : "点击选择起点";
|
|
1396
|
+
b && (b.innerHTML = v, Z.setPosition(M.coordinate));
|
|
1397
|
+
};
|
|
1398
|
+
let x, R = !1;
|
|
1399
|
+
const A = () => {
|
|
1400
|
+
if (c) {
|
|
1401
|
+
b != null && b.parentNode && b.parentNode.removeChild(b);
|
|
1402
|
+
const v = c.getGeometry();
|
|
1403
|
+
if (!v) return;
|
|
1404
|
+
const S = L(v, "nm");
|
|
1405
|
+
u && (u.innerHTML = `
|
|
1406
|
+
<span class="text">面积:${S}${R ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1407
|
+
`), u && (u.innerHTML += '<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');
|
|
1408
|
+
const Y = v.getCoordinates(), D = Y[0][Y[0].length - 2];
|
|
1409
|
+
if (f.setPosition(D), d) {
|
|
1410
|
+
const _ = d.getSource();
|
|
1411
|
+
_ && c && (_.clear(), _.addFeature(c));
|
|
1412
|
+
}
|
|
1413
|
+
setTimeout(() => {
|
|
1414
|
+
var _;
|
|
1415
|
+
(_ = document.querySelector(".delete-icon")) == null || _.addEventListener("click", () => {
|
|
1416
|
+
var X, Q;
|
|
1417
|
+
p(), (Q = (X = r.getProps()) == null ? void 0 : X.areaDrawEnd) == null || Q.call(X, []);
|
|
1418
|
+
});
|
|
1419
|
+
}, 0);
|
|
1420
|
+
const q = ro(c.getGeometry().getExtent());
|
|
1421
|
+
e == null || e.getView().setCenter(q);
|
|
1422
|
+
return;
|
|
1423
|
+
}
|
|
1424
|
+
const M = {
|
|
1425
|
+
type: "Polygon",
|
|
1426
|
+
trace: !0,
|
|
1427
|
+
style: [new ne({
|
|
1428
|
+
stroke: new Pe({
|
|
1429
|
+
color: "rgba(255, 255, 255, 1)",
|
|
1430
|
+
width: 1.5,
|
|
1431
|
+
lineDash: [10, 10]
|
|
1432
|
+
}),
|
|
1433
|
+
fill: new ge({
|
|
1434
|
+
color: "rgba(255, 255, 255, 0.25)"
|
|
1435
|
+
})
|
|
1436
|
+
}), new ne({
|
|
1437
|
+
image: new lt({
|
|
1438
|
+
radius: 5,
|
|
1439
|
+
fill: new ge({
|
|
1440
|
+
color: "rgb(51,112,255, 1)"
|
|
1441
|
+
})
|
|
1442
|
+
}),
|
|
1443
|
+
geometry: function(v) {
|
|
1444
|
+
const S = v.getGeometry().getCoordinates();
|
|
1445
|
+
return new lo(S);
|
|
1446
|
+
}
|
|
1447
|
+
})]
|
|
1448
|
+
};
|
|
1449
|
+
M.source = w, x = new tt(M), e == null || e.addInteraction(x), x.on("drawstart", (v) => {
|
|
1450
|
+
var S;
|
|
1451
|
+
t = v.feature, l = (S = t.getGeometry()) == null ? void 0 : S.on("change", (Y) => {
|
|
1452
|
+
const D = Y.target, q = L(D, "nm"), X = D.getCoordinates()[0], Q = new Ge([X[X.length - 2], X[X.length - 1]]), de = Wt(Q, "nm");
|
|
1453
|
+
if (R = Number(wt(Q) / 1e3) > 150, !q) return;
|
|
1454
|
+
const le = '<span class="error pl-4">超出可以绘画的距离</span>';
|
|
1455
|
+
u && (u.innerHTML = `
|
|
1456
|
+
<div class="text">
|
|
1457
|
+
面积:${q}
|
|
1458
|
+
${R ? le : ""}
|
|
1459
|
+
</div>
|
|
1460
|
+
`), b && (b.innerHTML = `
|
|
1461
|
+
<div class="text">
|
|
1462
|
+
面积:${q}
|
|
1463
|
+
</div>
|
|
1464
|
+
<div class="text ${R ? "error" : ""}">
|
|
1465
|
+
线段 ${X.length - 2}: ${de}
|
|
1466
|
+
${R ? le : ""}
|
|
1467
|
+
</div>
|
|
1468
|
+
<div>
|
|
1469
|
+
<span class="text">单击继续,双击结束</span>
|
|
1470
|
+
</div>
|
|
1471
|
+
`);
|
|
1472
|
+
});
|
|
1473
|
+
}), x.on("drawend", (v) => {
|
|
1474
|
+
var _, X, Q, de;
|
|
1475
|
+
if (!v.feature.getGeometry()) return;
|
|
1476
|
+
u && !c && (u.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), c = v.feature, f.setOffset([10, 0]);
|
|
1477
|
+
const D = v.feature.getGeometry().getCoordinates(), q = D[0][D[0].length - 2];
|
|
1478
|
+
if (f.setPosition(q), b != null && b.parentNode && b.parentNode.removeChild(b), (_ = r.getProps()) != null && _.areaDrawEnd) {
|
|
1479
|
+
const le = D[0].map((se) => Xe(se, ce.mercator, ce.data));
|
|
1480
|
+
(Q = (X = r.getProps()) == null ? void 0 : X.areaDrawEnd) == null || Q.call(X, le);
|
|
1481
|
+
}
|
|
1482
|
+
x && (x.setActive(!1), e == null || e.removeInteraction(x), (e == null ? void 0 : e.getInteractions()).forEach((se) => {
|
|
1483
|
+
se instanceof tt && (se.setActive(!1), e == null || e.removeInteraction(se));
|
|
1484
|
+
})), l && mt(l), (de = document.querySelector(".delete-icon")) == null || de.addEventListener("click", () => {
|
|
1485
|
+
var le, se;
|
|
1486
|
+
p(), (se = (le = r.getProps()) == null ? void 0 : le.areaDrawEnd) == null || se.call(le, []);
|
|
1487
|
+
});
|
|
1488
|
+
});
|
|
1489
|
+
}, L = (M, v) => {
|
|
1490
|
+
const S = no(M);
|
|
1491
|
+
switch (v) {
|
|
1492
|
+
case "km":
|
|
1493
|
+
return S > 1e4 ? Math.round(S / 1e6 * 100) / 100 + " km<sup>2</sup>" : Math.round(S * 100) / 100 + " m<sup>2</sup>";
|
|
1494
|
+
case "nm": {
|
|
1495
|
+
if (S < 0.01)
|
|
1496
|
+
return "0 nm<sup>2</sup>";
|
|
1497
|
+
const Y = S / (1852 * 1852);
|
|
1498
|
+
return Y >= 0.01 ? (Math.round(Y * 100) / 100).toFixed(2) + " nm<sup>2</sup>" : S >= 1 ? (Math.round(S * 100) / 100).toFixed(2) + " m<sup>2</sup>" : (Math.round(S * 1e4) / 100).toFixed(2) + " cm<sup>2</sup>";
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
};
|
|
1502
|
+
let u, f;
|
|
1503
|
+
const E = () => {
|
|
1504
|
+
u != null && u.parentNode && u.parentNode.removeChild(u), u = document.createElement("div"), u.style.display = "flex", u.className = "ol-tooltip ol-tooltip-draw-polygon", f = new ke({
|
|
1505
|
+
element: u,
|
|
1506
|
+
offset: [0, -15],
|
|
1507
|
+
positioning: "bottom-center",
|
|
1508
|
+
stopEvent: !1,
|
|
1509
|
+
insertFirst: !1
|
|
1510
|
+
}), e == null || e.addOverlay(f);
|
|
1511
|
+
};
|
|
1512
|
+
let b, Z;
|
|
1513
|
+
const W = () => {
|
|
1514
|
+
b != null && b.parentNode && (b.parentNode.removeChild(b), b.parentNode.addEventListener("click", (M) => {
|
|
1515
|
+
M.preventDefault(), M.stopPropagation();
|
|
1516
|
+
})), b = document.createElement("div"), b.className = "ol-tooltip ol-help-tooltip pointer-none", Z = new ke({
|
|
1517
|
+
element: b,
|
|
1518
|
+
offset: [15, 0],
|
|
1519
|
+
positioning: "center-left",
|
|
1520
|
+
stopEvent: !1
|
|
1521
|
+
}), e == null || e.addOverlay(Z);
|
|
1522
|
+
}, p = () => {
|
|
1523
|
+
c = null, i();
|
|
1524
|
+
}, N = () => {
|
|
1525
|
+
s = "close", e.un("pointermove", n), t = null, x && (x.abortDrawing(), console.log("abortDrawing"), x.setActive(!1), (e == null ? void 0 : e.getInteractions()).forEach((v) => {
|
|
1526
|
+
v instanceof tt && (v.setActive(!1), e == null || e.removeInteraction(v));
|
|
1527
|
+
}), x = null), l && mt(l), l = void 0, w == null || w.clear(), w = null, d && e.getAllLayers().includes(d) && (e.removeLayer(d), d = null), b != null && b.parentElement && (b.innerHTML = "", b.parentElement.removeChild(b), b = null), u != null && u.parentElement && (u.innerHTML = "", u.parentElement.removeChild(u), u = null), Z && e.removeOverlay(Z), f && e.removeOverlay(f), Ce(e, "grab");
|
|
1528
|
+
};
|
|
1529
|
+
return {
|
|
1530
|
+
open: i,
|
|
1531
|
+
close: N,
|
|
1532
|
+
reset: p,
|
|
1533
|
+
getState: () => s
|
|
1534
|
+
};
|
|
1535
|
+
}, Wo = (e, r, c, l, s, i) => {
|
|
1536
|
+
let o = null, d = null;
|
|
1537
|
+
const w = new pe(), P = new so({
|
|
1538
|
+
source: w,
|
|
1539
|
+
className: "zh-map--ship-layer",
|
|
1540
|
+
renderBuffer: 300,
|
|
1541
|
+
zIndex: 101,
|
|
1542
|
+
properties: { layerType: ie.SHIP }
|
|
1543
|
+
}), t = new pe(), n = new Me({
|
|
1544
|
+
source: t,
|
|
1545
|
+
className: "zh-map--ship-label-layer",
|
|
1546
|
+
zIndex: 102,
|
|
1547
|
+
updateWhileInteracting: !1,
|
|
1548
|
+
updateWhileAnimating: !1,
|
|
1549
|
+
properties: { layerType: ie.SHIP },
|
|
1550
|
+
declutter: i
|
|
1551
|
+
}), x = new pe(), R = new Me({
|
|
1552
|
+
source: x,
|
|
1553
|
+
className: "zh-map--ship-selected-layer",
|
|
1554
|
+
zIndex: 999
|
|
1555
|
+
});
|
|
1556
|
+
e == null || e.addLayer(P), e == null || e.addLayer(n), e == null || e.addLayer(R);
|
|
1557
|
+
let A = null, L = null, u = null, f = "", E = {}, b = {};
|
|
1558
|
+
const Z = (g) => {
|
|
1559
|
+
if (!g || !e) return;
|
|
1560
|
+
const V = (d == null ? void 0 : d.id) || (o == null ? void 0 : o.get("id"));
|
|
1561
|
+
if (d) {
|
|
1562
|
+
const $ = g.filter((B) => B.id === V);
|
|
1563
|
+
$.length === 0 ? g.push(d) : d = $[0];
|
|
1564
|
+
}
|
|
1565
|
+
v(), se(g), z(), W(g);
|
|
1566
|
+
}, W = (g) => {
|
|
1567
|
+
Array.from(Ye.keys()).forEach((V) => {
|
|
1568
|
+
const $ = V.split("_")[0];
|
|
1569
|
+
g.find((I) => I.id === $) || Ye.delete(V);
|
|
1570
|
+
});
|
|
1571
|
+
}, p = () => {
|
|
1572
|
+
Array.from(Be.keys()).forEach((g) => {
|
|
1573
|
+
Be.delete(g);
|
|
1574
|
+
});
|
|
1575
|
+
}, N = (g) => {
|
|
1576
|
+
var O;
|
|
1577
|
+
const V = (d == null ? void 0 : d.id) || (o == null ? void 0 : o.get("id")), $ = he([g == null ? void 0 : g.lon, g == null ? void 0 : g.lat]), B = ((O = b[g.id]) == null ? void 0 : O.blinkColors) || [], ee = B[B.length - 1] || g.fill || "#04C900", oe = At(g), K = new ye({
|
|
1578
|
+
geometry: new ue($),
|
|
1579
|
+
// 船舶数据
|
|
1580
|
+
shipData: g,
|
|
1581
|
+
id: g.id,
|
|
1582
|
+
name: g.cnname || g.enname || g.name || g.id || "未命名船舶",
|
|
1583
|
+
selected: g.id === V,
|
|
1584
|
+
// 图标
|
|
1585
|
+
rightIcons: Rt(g),
|
|
1586
|
+
// 船舶颜色
|
|
1587
|
+
color: ee,
|
|
1588
|
+
// 船艏向的方向
|
|
1589
|
+
direct: oe,
|
|
1590
|
+
// 高亮
|
|
1591
|
+
isHighlight: !1
|
|
1592
|
+
});
|
|
1593
|
+
return K.set("clickGeometry", new co($)), K;
|
|
1594
|
+
}, z = () => {
|
|
1595
|
+
if (d && e && d) {
|
|
1596
|
+
x.getFeatures().length > 0 && x.clear();
|
|
1597
|
+
const g = he([d == null ? void 0 : d.lon, d == null ? void 0 : d.lat]), V = new ye({
|
|
1598
|
+
geometry: new ue(g),
|
|
1599
|
+
id: d.id
|
|
1600
|
+
});
|
|
1601
|
+
V.setStyle(Ft(e, d)), x.addFeature(V);
|
|
1602
|
+
}
|
|
1603
|
+
}, M = () => {
|
|
1604
|
+
const g = w.getFeatures(), V = 100;
|
|
1605
|
+
let $ = 0;
|
|
1606
|
+
const B = () => {
|
|
1607
|
+
const oe = Math.min($ + V, g.length);
|
|
1608
|
+
for (; $ < oe; $++) {
|
|
1609
|
+
const K = g[$], O = $e(e, K);
|
|
1610
|
+
K.setStyle(O);
|
|
1611
|
+
}
|
|
1612
|
+
$ < g.length && requestAnimationFrame(B);
|
|
1613
|
+
};
|
|
1614
|
+
B();
|
|
1615
|
+
const ee = x.getFeatures()[0];
|
|
1616
|
+
if (ee && d) {
|
|
1617
|
+
const oe = Ft(e, d);
|
|
1618
|
+
ee.setStyle(oe);
|
|
1619
|
+
}
|
|
1620
|
+
}, v = () => {
|
|
1621
|
+
e && w && (S(), w.clear(), t.clear(), x.clear());
|
|
1622
|
+
}, S = () => {
|
|
1623
|
+
const g = e.getOverlays().getArray().filter((V) => V.get("class") == "zh-map-ship-overlay");
|
|
1624
|
+
if (g && g.length > 0)
|
|
1625
|
+
for (let V = 0; V < g.length; V++) {
|
|
1626
|
+
const $ = g[V];
|
|
1627
|
+
$.setPosition(void 0), e.removeOverlay($), $.dispose();
|
|
1628
|
+
}
|
|
1629
|
+
}, Y = (g, V) => {
|
|
1630
|
+
E = g, b = V;
|
|
1631
|
+
const $ = e.getOverlays().getArray(), B = w.getFeatures();
|
|
1632
|
+
for (const I in E) {
|
|
1633
|
+
const ee = E[I], oe = $.find((O) => (O == null ? void 0 : O.getId()) === "label-" + I), K = B.find((O) => I === O.get("id"));
|
|
1634
|
+
if (oe && K) {
|
|
1635
|
+
const O = V[I].blinkColors || [], { shipData: me, name: ve, color: be } = K.getProperties();
|
|
1636
|
+
K.set("blinking", ee), O[(O == null ? void 0 : O.length) - 1] && be !== O[(O == null ? void 0 : O.length) - 1] && (K.set("color", O[(O == null ? void 0 : O.length) - 1] || ""), K.setStyle($e(e, K)));
|
|
1637
|
+
const dt = {
|
|
1638
|
+
...me,
|
|
1639
|
+
blinking: ee,
|
|
1640
|
+
blinkingColors: O || [],
|
|
1641
|
+
name: ve + "(" + V[I].shipState + ")"
|
|
1642
|
+
}, Ke = oe.getElement(), je = Zt(dt);
|
|
1643
|
+
Ke && Ke !== je && oe.setElement(je);
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
}, D = (g) => {
|
|
1647
|
+
if (!e) return;
|
|
1648
|
+
const V = w.getFeatures(), $ = t.getFeatures(), B = o ? o.get("id") : "", I = V.filter((O) => O.get("id") !== B), ee = $ == null ? void 0 : $.filter((O) => O.get("id") !== B), oe = /* @__PURE__ */ new Map();
|
|
1649
|
+
g.forEach((O) => {
|
|
1650
|
+
oe.set(O.id, !0);
|
|
1651
|
+
});
|
|
1652
|
+
const K = e.getOverlays().getArray();
|
|
1653
|
+
I.forEach((O) => {
|
|
1654
|
+
const me = O.get("id");
|
|
1655
|
+
if (!oe.has(me))
|
|
1656
|
+
O.setStyle([]);
|
|
1657
|
+
else {
|
|
1658
|
+
const be = O.getStyle();
|
|
1659
|
+
(be == null ? void 0 : be.length) == 0 && O.setStyle($e(e, O));
|
|
1660
|
+
}
|
|
1661
|
+
const ve = K.find((be) => be.getId() === "label-" + me);
|
|
1662
|
+
ve && ve.setPosition(void 0);
|
|
1663
|
+
}), ee.forEach((O) => {
|
|
1664
|
+
const me = O.get("id");
|
|
1665
|
+
if (!oe.has(me))
|
|
1666
|
+
O.setStyle([]);
|
|
1667
|
+
else {
|
|
1668
|
+
const ve = O.getStyle();
|
|
1669
|
+
(ve == null ? void 0 : ve.length) == 0 && O.setStyle(Nt(O, g.length));
|
|
1670
|
+
}
|
|
1671
|
+
});
|
|
1672
|
+
}, q = (g) => {
|
|
1673
|
+
if (g) {
|
|
1674
|
+
console.log("选中", g);
|
|
1675
|
+
const V = w.getFeatures().find((B) => B.get("id") === g.id), $ = t.getFeatures().find((B) => B.get("id") === g.id);
|
|
1676
|
+
V && (o = V), $ && $.set("selected", !0), d = g, z();
|
|
1677
|
+
} else
|
|
1678
|
+
console.log("取消选中"), d = null, o = null, de(), p();
|
|
1679
|
+
}, _ = (g, V, $) => {
|
|
1680
|
+
L = g, u = V, A = $;
|
|
1681
|
+
}, X = io((g, V, $) => {
|
|
1682
|
+
try {
|
|
1683
|
+
if (g) {
|
|
1684
|
+
const B = g.get("shipData"), I = g.get("id");
|
|
1685
|
+
if (V === "click" && (q(B), $ && $(I)), V === "hover") {
|
|
1686
|
+
f && f !== I && Q(), f = I;
|
|
1687
|
+
const ee = w.getFeatures().find((oe) => oe.get("id") === f);
|
|
1688
|
+
ee == null || ee.set("isHighlight", !0), ee == null || ee.setStyle($e(e, ee));
|
|
1689
|
+
}
|
|
1690
|
+
} else
|
|
1691
|
+
Q();
|
|
1692
|
+
} catch (B) {
|
|
1693
|
+
console.log("handleShipMapEvent", B);
|
|
1694
|
+
}
|
|
1695
|
+
}, 10), Q = () => {
|
|
1696
|
+
const g = f ? w.getFeatures().find((V) => V.get("id") === f) : null;
|
|
1697
|
+
f = null, g == null || g.set("isHighlight", !1), g == null || g.setStyle($e(e, g));
|
|
1698
|
+
}, de = () => {
|
|
1699
|
+
try {
|
|
1700
|
+
x.clear();
|
|
1701
|
+
} catch (g) {
|
|
1702
|
+
console.log(g);
|
|
1703
|
+
}
|
|
1704
|
+
}, le = (g, V) => {
|
|
1705
|
+
const $ = he([g == null ? void 0 : g.lon, g == null ? void 0 : g.lat]), B = new ye({
|
|
1706
|
+
geometry: new ue($),
|
|
1707
|
+
name: g.cnname || g.enname || g.name || g.id || "未命名船舶",
|
|
1708
|
+
// 图标
|
|
1709
|
+
rightIcons: Rt(g),
|
|
1710
|
+
selected: (g == null ? void 0 : g.id) === (d == null ? void 0 : d.id),
|
|
1711
|
+
shipData: g
|
|
1712
|
+
});
|
|
1713
|
+
B.set("id", g.id);
|
|
1714
|
+
const I = Nt(B, V);
|
|
1715
|
+
return B.setStyle(I), B;
|
|
1716
|
+
}, se = (g) => {
|
|
1717
|
+
const V = e.getView().getZoom(), $ = [], B = [];
|
|
1718
|
+
g.forEach((K) => {
|
|
1719
|
+
const O = N(K);
|
|
1720
|
+
O.setStyle($e(e, O)), w.addFeature(O), E[K.id] && $.push(K), (d == null ? void 0 : d.id) == K.id && (d = K), !E[K.id] && (d == null ? void 0 : d.id) !== K.id && B.push(K);
|
|
1721
|
+
}), (u !== null ? u : (d == null ? void 0 : d.id) && E[d == null ? void 0 : d.id] || V && V >= ae.shipModelMin) && $.map((K) => {
|
|
1722
|
+
at(K);
|
|
1723
|
+
}), d && (A !== null ? A : !0) && !E[d == null ? void 0 : d.id] && qe(d, g), (L !== null ? L : V && V >= ae.shipModelMin) && B.map((K) => {
|
|
1724
|
+
qe(K, g);
|
|
1725
|
+
});
|
|
1726
|
+
}, qe = (g, V) => {
|
|
1727
|
+
const $ = le(g, V.length);
|
|
1728
|
+
t.addFeature($);
|
|
1729
|
+
}, _e = (g) => {
|
|
1730
|
+
var $;
|
|
1731
|
+
const V = w.getFeatures().find((B) => B.get("id") === g);
|
|
1732
|
+
V && X(V, "click", ($ = r.getProps()) == null ? void 0 : $.selectShip);
|
|
1733
|
+
}, at = (g) => {
|
|
1734
|
+
var V;
|
|
1735
|
+
if (g.id && b[g == null ? void 0 : g.id]) {
|
|
1736
|
+
const $ = b[g == null ? void 0 : g.id] || {}, B = ($ == null ? void 0 : $.blinkColors) || [], I = ($ == null ? void 0 : $.shipState) || "", ee = (g.cnname || g.enname || g.name || g.id || "未命名船舶") + "(" + I + ")", oe = {
|
|
1737
|
+
...g,
|
|
1738
|
+
name: ee,
|
|
1739
|
+
blinking: E[g.id],
|
|
1740
|
+
blinkingColors: B || []
|
|
1741
|
+
};
|
|
1742
|
+
Ro(e, oe), (V = document.querySelector(".ship-label-overlay-blinking")) == null || V.addEventListener("click", (K) => {
|
|
1743
|
+
var me;
|
|
1744
|
+
if (l.getState() === "open" || s.getState() === "open" || !c.getMapClick()) return;
|
|
1745
|
+
const O = (me = K.target) == null ? void 0 : me.getAttribute("data-id");
|
|
1746
|
+
K.preventDefault(), O && _e(O);
|
|
1747
|
+
});
|
|
1748
|
+
}
|
|
1749
|
+
};
|
|
1750
|
+
return {
|
|
1751
|
+
render: Z,
|
|
1752
|
+
selected: q,
|
|
1753
|
+
filter: D,
|
|
1754
|
+
blinking: Y,
|
|
1755
|
+
clear: v,
|
|
1756
|
+
setLableStatus: _,
|
|
1757
|
+
handleShipMapEvent: X,
|
|
1758
|
+
changeShipScale: M
|
|
1759
|
+
};
|
|
1760
|
+
}, Do = (e) => {
|
|
1761
|
+
const r = () => e == null ? void 0 : e.getLayers(), c = fe("vector"), l = () => c.value, s = (w) => {
|
|
1762
|
+
c.value = w;
|
|
1763
|
+
const P = r();
|
|
1764
|
+
P && (P == null || P.getArray().forEach((t) => {
|
|
1765
|
+
(t.className_ === "vector" || t.className_ === "satellite") && t.setVisible(t.className_ === w);
|
|
1766
|
+
}));
|
|
1767
|
+
}, i = fe(!1);
|
|
1768
|
+
return {
|
|
1769
|
+
getLayers: r,
|
|
1770
|
+
getGreenTileVisible: () => i.value,
|
|
1771
|
+
setGreenTileVisible: (w) => {
|
|
1772
|
+
if (w !== i.value) {
|
|
1773
|
+
if (w) {
|
|
1774
|
+
const P = r();
|
|
1775
|
+
if (!P.getArray().find((n) => n.className_ === "greenTile")) {
|
|
1776
|
+
const n = new ze({
|
|
1777
|
+
source: new Ve({ url: Ee.greenTile }),
|
|
1778
|
+
visible: w,
|
|
1779
|
+
zIndex: 2,
|
|
1780
|
+
className: "greenTile"
|
|
1781
|
+
});
|
|
1782
|
+
P.push(n);
|
|
1783
|
+
}
|
|
1784
|
+
} else {
|
|
1785
|
+
const P = r(), t = P.getArray().find((n) => n.className_ === "greenTile");
|
|
1786
|
+
t && P.remove(t);
|
|
1787
|
+
}
|
|
1788
|
+
i.value = w;
|
|
1789
|
+
}
|
|
1790
|
+
},
|
|
1791
|
+
getShowLayerType: l,
|
|
1792
|
+
setShowLayerType: s
|
|
1793
|
+
};
|
|
1794
|
+
}, Ho = (e) => {
|
|
1795
|
+
const r = "zh-map-location-layer";
|
|
1796
|
+
let c;
|
|
1797
|
+
const l = new pe();
|
|
1798
|
+
let s = null, i = null;
|
|
1799
|
+
const o = (u) => {
|
|
1800
|
+
if (!(!u || u.length === 0)) {
|
|
1801
|
+
if (l.clear(), i) {
|
|
1802
|
+
const f = u.find((E) => E.id === (i == null ? void 0 : i.id));
|
|
1803
|
+
f ? i = f : u.push(i);
|
|
1804
|
+
}
|
|
1805
|
+
u.forEach((f) => {
|
|
1806
|
+
d(f);
|
|
1807
|
+
}), c || (c = new Me({
|
|
1808
|
+
className: r,
|
|
1809
|
+
source: l,
|
|
1810
|
+
zIndex: 100
|
|
1811
|
+
}), e == null || e.addLayer(c));
|
|
1812
|
+
}
|
|
1813
|
+
}, d = (u) => {
|
|
1814
|
+
const f = e == null ? void 0 : e.getView().getZoom(), [E, b] = u.latLon.split(","), Z = new ye({
|
|
1815
|
+
geometry: new ue(he([Number(E), Number(b)]))
|
|
1816
|
+
});
|
|
1817
|
+
Z.setStyle(w(u, f, u.id === (i == null ? void 0 : i.id))), Z.set("loactionData", u), l.addFeature(Z);
|
|
1818
|
+
}, w = (u, f, E) => {
|
|
1819
|
+
let b = {
|
|
1820
|
+
src: E && u.selectedPath || u.defaultPath
|
|
1821
|
+
};
|
|
1822
|
+
u != null && u.width && (u != null && u.height) ? b = {
|
|
1823
|
+
...b,
|
|
1824
|
+
width: u.width,
|
|
1825
|
+
height: u.height
|
|
1826
|
+
} : b = {
|
|
1827
|
+
...b,
|
|
1828
|
+
scale: 0.5 * f / 10
|
|
1829
|
+
};
|
|
1830
|
+
let Z = {
|
|
1831
|
+
image: new Se(b)
|
|
1832
|
+
};
|
|
1833
|
+
return u.name && (Z = {
|
|
1834
|
+
...Z,
|
|
1835
|
+
text: new Oe({
|
|
1836
|
+
text: u.name,
|
|
1837
|
+
font: "12px sans-serif",
|
|
1838
|
+
fill: new ge({
|
|
1839
|
+
color: "#000000"
|
|
1840
|
+
}),
|
|
1841
|
+
backgroundFill: new ge({
|
|
1842
|
+
color: "#FFFFFF"
|
|
1843
|
+
}),
|
|
1844
|
+
offsetY: 30
|
|
1845
|
+
})
|
|
1846
|
+
}), new ne(Z);
|
|
1847
|
+
}, P = () => {
|
|
1848
|
+
if (s) {
|
|
1849
|
+
const u = s.get("loactionData").id;
|
|
1850
|
+
l.getFeatures().forEach((f) => {
|
|
1851
|
+
f.get("loactionData").id !== u && l.removeFeature(f);
|
|
1852
|
+
});
|
|
1853
|
+
} else
|
|
1854
|
+
l.clear();
|
|
1855
|
+
}, t = () => {
|
|
1856
|
+
var b;
|
|
1857
|
+
const u = s == null ? void 0 : s.get("loactionData"), f = (b = e == null ? void 0 : e.getView()) == null ? void 0 : b.getZoom();
|
|
1858
|
+
l.getFeatures().forEach((Z) => {
|
|
1859
|
+
Z.get("loactionData").id === u.id && (Z == null || Z.setStyle(w(u, f, !1)));
|
|
1860
|
+
}), i = null, s = null;
|
|
1861
|
+
}, n = (u) => {
|
|
1862
|
+
u ? (x(), R(u)) : t();
|
|
1863
|
+
}, x = () => {
|
|
1864
|
+
var u;
|
|
1865
|
+
if (s) {
|
|
1866
|
+
const f = s.get("loactionData"), E = (u = e == null ? void 0 : e.getView()) == null ? void 0 : u.getZoom();
|
|
1867
|
+
s.setStyle(w(f, E, !1));
|
|
1868
|
+
}
|
|
1869
|
+
}, R = (u) => {
|
|
1870
|
+
const f = l.getFeatures();
|
|
1871
|
+
i = u, s = f.find((E) => E.get("loactionData").id === u.id);
|
|
1872
|
+
};
|
|
1873
|
+
return {
|
|
1874
|
+
render: o,
|
|
1875
|
+
renderHtml: (u, f, E, b) => {
|
|
1876
|
+
const Z = document.createElement("div");
|
|
1877
|
+
Z.innerHTML = E;
|
|
1878
|
+
let W = {
|
|
1879
|
+
element: Z,
|
|
1880
|
+
// 覆盖层的DOM元素
|
|
1881
|
+
positioning: "top-center",
|
|
1882
|
+
// 相对于位置点的定位
|
|
1883
|
+
stopEvent: !1,
|
|
1884
|
+
// 是否阻止事件传播
|
|
1885
|
+
offset: [0, -20],
|
|
1886
|
+
id: "position-" + u
|
|
1887
|
+
};
|
|
1888
|
+
b && (W = {
|
|
1889
|
+
...W,
|
|
1890
|
+
...b
|
|
1891
|
+
});
|
|
1892
|
+
const p = new ke(W);
|
|
1893
|
+
p.setPosition(he(f)), e.addOverlay(p);
|
|
1894
|
+
},
|
|
1895
|
+
removeHtml: (u) => {
|
|
1896
|
+
const f = e.getOverlays().getArray().find((E) => E.getId() === "position-" + u);
|
|
1897
|
+
f && (f.setPosition(void 0), e.removeOverlay(f));
|
|
1898
|
+
},
|
|
1899
|
+
selected: n,
|
|
1900
|
+
clearSelected: t,
|
|
1901
|
+
clear: P
|
|
1902
|
+
};
|
|
1903
|
+
}, Go = "zh-map-port-layer", Yo = (e) => {
|
|
1904
|
+
const r = new pe(), c = new Me({
|
|
1905
|
+
className: Go,
|
|
1906
|
+
source: r,
|
|
1907
|
+
zIndex: 100,
|
|
1908
|
+
updateWhileInteracting: !0,
|
|
1909
|
+
updateWhileAnimating: !0,
|
|
1910
|
+
properties: { layerType: ie.PORT }
|
|
1911
|
+
});
|
|
1912
|
+
e == null || e.addLayer(c);
|
|
1913
|
+
let l = null, s = null, i = [], o = [];
|
|
1914
|
+
const d = (p, N = !0) => {
|
|
1915
|
+
if (!p || p.length === 0) return;
|
|
1916
|
+
if (r.clear(), s) {
|
|
1917
|
+
const M = p.find((v) => v.id === (s == null ? void 0 : s.id));
|
|
1918
|
+
M ? s = M : p.push(s);
|
|
1919
|
+
}
|
|
1920
|
+
o.length > 0 && o.forEach((M) => {
|
|
1921
|
+
p.find((S) => S.id === M.id) || p.push(M);
|
|
1922
|
+
});
|
|
1923
|
+
const z = [];
|
|
1924
|
+
p.forEach((M) => {
|
|
1925
|
+
const [v, S] = M.latLon.split(","), Y = new ye({
|
|
1926
|
+
geometry: new ue(he([Number(v), Number(S)])),
|
|
1927
|
+
portData: M,
|
|
1928
|
+
id: M.id,
|
|
1929
|
+
select: M.id === (s == null ? void 0 : s.id),
|
|
1930
|
+
isRed: o.some((q) => q.id === M.id),
|
|
1931
|
+
showTitle: M.id === (s == null ? void 0 : s.id) || N
|
|
1932
|
+
}), D = x(Y);
|
|
1933
|
+
Y.setStyle(D), z.push(Y);
|
|
1934
|
+
}), r.addFeatures(z), i = z.filter((M) => M.get("isRed"));
|
|
1935
|
+
};
|
|
1936
|
+
let w = null, P = null;
|
|
1937
|
+
const t = /* @__PURE__ */ new Map(), n = (p, N) => {
|
|
1938
|
+
w || (w = document.createElement("canvas"), P = w.getContext("2d", {
|
|
1939
|
+
willReadFrequently: !0
|
|
1940
|
+
}));
|
|
1941
|
+
const z = `${p}-${N}`;
|
|
1942
|
+
if (t.has(z))
|
|
1943
|
+
return t.get(z);
|
|
1944
|
+
const M = w, v = P;
|
|
1945
|
+
if (!v) return "";
|
|
1946
|
+
M.width = 0, M.height = 0;
|
|
1947
|
+
const S = 2, Y = 8, D = window.devicePixelRatio || 1, q = "12px sans-serif";
|
|
1948
|
+
v.font = q;
|
|
1949
|
+
const X = v.measureText(p).width, Q = Y + X + Y, de = S + 12 + S * 2;
|
|
1950
|
+
M.width = Math.round(Q * D), M.height = Math.round(de * D), v.scale(D, D), v.clearRect(0, 0, Q, de), v.fillStyle = N ? "#F32D2D" : "#FFF", v.beginPath(), v.roundRect(0, 0, Q, de, 4), v.fill(), v.font = q, v.textBaseline = "middle";
|
|
1951
|
+
const le = de / 2;
|
|
1952
|
+
v.strokeStyle = N ? "#000" : "#ffffff", v.lineWidth = 1, v.strokeText(p, Y, le), v.fillStyle = N ? "#FFF" : "#000000", v.fillText(p, Y, le);
|
|
1953
|
+
const se = M.toDataURL("image/png");
|
|
1954
|
+
return t.set(z, se), se;
|
|
1955
|
+
}, x = (p) => {
|
|
1956
|
+
const { select: N, isRed: z, showTitle: M } = p.getProperties(), v = (Q) => `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1957
|
+
<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="${Q}"/>
|
|
1958
|
+
<g clip-path="url(#clip0_10059_122082)">
|
|
1959
|
+
<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"/>
|
|
1960
|
+
</g>
|
|
1961
|
+
<defs>
|
|
1962
|
+
<clipPath id="clip0_10059_122082">
|
|
1963
|
+
<rect width="26" height="26" fill="white" transform="translate(10 8)"/>
|
|
1964
|
+
</clipPath>
|
|
1965
|
+
</defs>
|
|
1966
|
+
</svg>
|
|
1967
|
+
`, S = () => {
|
|
1968
|
+
let Q = "#3370FF";
|
|
1969
|
+
return (N || z) && (Q = "#F32D2D"), `data:image/svg+xml;utf8,${encodeURIComponent(v(Q))}`;
|
|
1970
|
+
}, Y = e.getView().getZoom(), D = p.get("portData"), q = window.devicePixelRatio || 1, _ = new ne({
|
|
1971
|
+
image: new Se({
|
|
1972
|
+
src: S(),
|
|
1973
|
+
scale: 0.5 * Y / 10
|
|
1974
|
+
}),
|
|
1975
|
+
zIndex: N ? 110 : 100
|
|
1976
|
+
}), X = new ne({
|
|
1977
|
+
image: new Se({
|
|
1978
|
+
src: n(D.shortName, N || z),
|
|
1979
|
+
anchor: [0.5, 0.5],
|
|
1980
|
+
displacement: [0, -30],
|
|
1981
|
+
scale: 1 / q,
|
|
1982
|
+
anchorXUnits: "fraction",
|
|
1983
|
+
anchorYUnits: "fraction"
|
|
1984
|
+
}),
|
|
1985
|
+
zIndex: N || z ? 110 : 100
|
|
1986
|
+
// text: new Text({
|
|
1987
|
+
// text: port.shortName,
|
|
1988
|
+
// font: '12px sans-serif',
|
|
1989
|
+
// fill: new Fill({
|
|
1990
|
+
// color: select ? "#ffffff" : "#000000"
|
|
1991
|
+
// }),
|
|
1992
|
+
// backgroundFill: new Fill({
|
|
1993
|
+
// color: "#FFF",
|
|
1994
|
+
// }),
|
|
1995
|
+
// offsetY: 30,
|
|
1996
|
+
// }),
|
|
1997
|
+
});
|
|
1998
|
+
return !M && !N && !z ? _ : [_, X];
|
|
1999
|
+
}, R = () => {
|
|
2000
|
+
if (r)
|
|
2001
|
+
if (l) {
|
|
2002
|
+
console.log("清除非选中的港口");
|
|
2003
|
+
const p = l.get("portData").id;
|
|
2004
|
+
r.getFeatures().forEach((N) => {
|
|
2005
|
+
N.get("portData").id !== p && r.removeFeature(N);
|
|
2006
|
+
});
|
|
2007
|
+
} else
|
|
2008
|
+
console.log("清除所有港口", r), r == null || r.clear();
|
|
2009
|
+
}, A = (p) => {
|
|
2010
|
+
if (r) {
|
|
2011
|
+
if (!p)
|
|
2012
|
+
return b();
|
|
2013
|
+
(l == null ? void 0 : l.get("portData").id) !== p.id && (b(), Z(p));
|
|
2014
|
+
}
|
|
2015
|
+
}, L = (p) => {
|
|
2016
|
+
if (r) {
|
|
2017
|
+
if (!p)
|
|
2018
|
+
return u();
|
|
2019
|
+
if (o.some((N) => N.id === p.id)) {
|
|
2020
|
+
const N = i.find((z) => z.get("portData").id === p.id);
|
|
2021
|
+
N && (N.set("isRed", !1), N.setStyle(x(N))), i = i.filter((z) => z.get("portData").id !== p.id), o = o.filter((z) => z.id !== p.id);
|
|
2022
|
+
}
|
|
2023
|
+
E(p);
|
|
2024
|
+
}
|
|
2025
|
+
}, u = () => {
|
|
2026
|
+
i.forEach((p) => {
|
|
2027
|
+
p.set("isRed", !1), p.setStyle(x(p));
|
|
2028
|
+
}), i = [], o = [];
|
|
2029
|
+
}, f = () => {
|
|
2030
|
+
if (!r) return;
|
|
2031
|
+
const p = r.getFeatures(), N = [];
|
|
2032
|
+
p.forEach((z) => {
|
|
2033
|
+
const M = z.get("isRed"), v = z.get("select");
|
|
2034
|
+
!M && !v && N.push(z);
|
|
2035
|
+
}), N.forEach((z) => {
|
|
2036
|
+
r.removeFeature(z);
|
|
2037
|
+
}), console.log(`清理了 ${N.length} 个非变红港口,保留了 ${p.length - N.length} 个港口`);
|
|
2038
|
+
}, E = (p) => {
|
|
2039
|
+
if (!r) return;
|
|
2040
|
+
const z = r.getFeatures().find((M) => M.get("portData").id === p.id);
|
|
2041
|
+
z && (z.set("isRed", !0), z.setStyle(x(z)), i.push(z), o.push(p));
|
|
2042
|
+
}, b = () => {
|
|
2043
|
+
var p;
|
|
2044
|
+
if (l) {
|
|
2045
|
+
const N = l == null ? void 0 : l.get("portData"), z = (p = r.getFeatures()) == null ? void 0 : p.find((M) => M.get("portData").id === N.id);
|
|
2046
|
+
z && (z.set("select", !1), z.setStyle(x(z)), l = null, s = null);
|
|
2047
|
+
}
|
|
2048
|
+
}, Z = (p) => {
|
|
2049
|
+
if (!r) return;
|
|
2050
|
+
const N = r.getFeatures();
|
|
2051
|
+
s = p, l = N.find((z) => z.get("portData").id === p.id), l && (l.set("select", !0), l.setStyle(x(l)));
|
|
2052
|
+
};
|
|
2053
|
+
return {
|
|
2054
|
+
render: d,
|
|
2055
|
+
clear: R,
|
|
2056
|
+
selected: A,
|
|
2057
|
+
setRed: L,
|
|
2058
|
+
clearRed: u,
|
|
2059
|
+
clearNonRed: f,
|
|
2060
|
+
handlePortHover: (p) => {
|
|
2061
|
+
p && p.get("portData") ? Ce(e, "pointer") : Ce(e, "grab");
|
|
2062
|
+
}
|
|
2063
|
+
};
|
|
2064
|
+
}, Bo = (e, r, c, l, s, i, o) => {
|
|
2065
|
+
const d = e.getInstall();
|
|
2066
|
+
d.on("moveend", () => {
|
|
2067
|
+
var n, x;
|
|
2068
|
+
try {
|
|
2069
|
+
const R = e.getZoom();
|
|
2070
|
+
(x = (n = r.getProps()).mapMoveEnd) == null || x.call(n, R), R >= ae.min && R <= ae.max && c.reRenderTrackLine(), l.changeShipScale();
|
|
2071
|
+
} catch (R) {
|
|
2072
|
+
console.log("moveend---catch", R);
|
|
2073
|
+
}
|
|
2074
|
+
});
|
|
2075
|
+
const w = {
|
|
2076
|
+
[ie.PORT]: null,
|
|
2077
|
+
[ie.SHIP]: null,
|
|
2078
|
+
[ie.TRACK]: null,
|
|
2079
|
+
[ie.DELETE]: null
|
|
2080
|
+
}, P = (n, x, R) => {
|
|
2081
|
+
switch (n) {
|
|
2082
|
+
case ie.SHIP:
|
|
2083
|
+
l == null || l.handleShipMapEvent(x, "hover");
|
|
2084
|
+
break;
|
|
2085
|
+
case ie.PORT:
|
|
2086
|
+
break;
|
|
2087
|
+
case ie.TRACK:
|
|
2088
|
+
c == null || c.handleTrackMapEvent(x, "hover", R);
|
|
2089
|
+
break;
|
|
2090
|
+
}
|
|
2091
|
+
}, t = (n) => {
|
|
2092
|
+
switch (n) {
|
|
2093
|
+
case ie.PORT:
|
|
2094
|
+
break;
|
|
2095
|
+
case ie.SHIP:
|
|
2096
|
+
l == null || l.handleShipMapEvent(null, "hover");
|
|
2097
|
+
break;
|
|
2098
|
+
case ie.TRACK:
|
|
2099
|
+
c == null || c.handleTrackMapEvent(null, "hover");
|
|
2100
|
+
break;
|
|
2101
|
+
}
|
|
2102
|
+
};
|
|
2103
|
+
d.on("pointermove", (n) => {
|
|
2104
|
+
if (o.getState() !== "open" && i.getState() !== "open" && e.getMapClick() && !d.getView().getAnimating())
|
|
2105
|
+
try {
|
|
2106
|
+
let x = !1, R = !1;
|
|
2107
|
+
const A = d.getLayers().getArray().filter((L) => L.get("layerType"));
|
|
2108
|
+
try {
|
|
2109
|
+
A && A.length > 0 && A.forEach((L) => {
|
|
2110
|
+
if (R) return;
|
|
2111
|
+
const u = d == null ? void 0 : d.getEventPixel(n.originalEvent), f = L == null ? void 0 : L.get("layerType"), E = d == null ? void 0 : d.forEachFeatureAtPixel(u, (b) => b, {
|
|
2112
|
+
layerFilter: (b) => b === L,
|
|
2113
|
+
// 严格图层过滤
|
|
2114
|
+
hitTolerance: 5
|
|
2115
|
+
});
|
|
2116
|
+
E !== w[f] && (w[f] && t(f, w[f]), w[f] = E, E && (P(f, E, n), R = !0)), E && (x = !0);
|
|
2117
|
+
}), x ? Ce(d, "pointer") : Ce(d, "grab");
|
|
2118
|
+
} catch (L) {
|
|
2119
|
+
console.log("pointermove----", L);
|
|
2120
|
+
}
|
|
2121
|
+
} catch (x) {
|
|
2122
|
+
console.log("pointermove----", x);
|
|
2123
|
+
}
|
|
2124
|
+
}), d.on("click", zt((n) => {
|
|
2125
|
+
if (o.getState() !== "open" && i.getState() !== "open" && e.getMapClick() && !d.getView().getAnimating())
|
|
2126
|
+
try {
|
|
2127
|
+
let x = !1;
|
|
2128
|
+
const R = d.getLayers().getArray().filter((A) => A.get("layerType"));
|
|
2129
|
+
R && R.length > 0 && R.forEach((A) => {
|
|
2130
|
+
var L, u, f, E, b;
|
|
2131
|
+
if (!x)
|
|
2132
|
+
try {
|
|
2133
|
+
if (((u = (L = A == null ? void 0 : A.getSource()) == null ? void 0 : L.getFeatures()) == null ? void 0 : u.length) > 0) {
|
|
2134
|
+
const Z = d == null ? void 0 : d.getEventPixel(n.originalEvent), W = d == null ? void 0 : d.forEachFeatureAtPixel(Z, (p) => {
|
|
2135
|
+
if (p.get("shipData") || p.get("portData") || p.get("polygonData") || p.get("pathData"))
|
|
2136
|
+
return p;
|
|
2137
|
+
}, {
|
|
2138
|
+
layerFilter: (p) => p === A,
|
|
2139
|
+
// 严格图层过滤
|
|
2140
|
+
hitTolerance: 10
|
|
2141
|
+
});
|
|
2142
|
+
if (console.log("clickFeature", W), W) {
|
|
2143
|
+
if (W != null && W.get("shipData"))
|
|
2144
|
+
c.getTrackStatus() || l.handleShipMapEvent(W, "click", (f = r.getProps()) == null ? void 0 : f.selectShip);
|
|
2145
|
+
else if (W != null && W.get("portData")) {
|
|
2146
|
+
const p = W == null ? void 0 : W.get("portData");
|
|
2147
|
+
s.selected(p), (b = (E = r.getProps()) == null ? void 0 : E.selectPort) == null || b.call(E, p);
|
|
2148
|
+
}
|
|
2149
|
+
x = !0;
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
} catch (Z) {
|
|
2153
|
+
console.log("click--", Z);
|
|
2154
|
+
}
|
|
2155
|
+
});
|
|
2156
|
+
} catch (x) {
|
|
2157
|
+
console.log("click----", x);
|
|
2158
|
+
}
|
|
2159
|
+
}, 150)), d.getView().on("change:resolution", () => {
|
|
2160
|
+
l.changeShipScale();
|
|
2161
|
+
});
|
|
2162
|
+
}, Xo = () => {
|
|
2163
|
+
const e = qt([]);
|
|
2164
|
+
return {
|
|
2165
|
+
createInstance: (l, s) => {
|
|
2166
|
+
const i = yo();
|
|
2167
|
+
i.initMap(l, s);
|
|
2168
|
+
const o = i.getInstall(), d = Do(o), w = Co();
|
|
2169
|
+
w.setProps(s), d.setShowLayerType(s.layerType), d.setGreenTileVisible(s.showGreenLayer);
|
|
2170
|
+
const P = ko(o), t = Mo(o, P), n = Ao(o, w), x = Zo(o, w), R = Wo(o, w, i, x, n, s.declutter), A = Ho(o), L = Yo(o);
|
|
2171
|
+
Bo(i, w, P, R, L, n, x);
|
|
2172
|
+
const u = () => {
|
|
2173
|
+
const E = o.getView().calculateExtent(i.getSize()), b = Xe([E[0], E[1]], ce.mercator, ce.data), Z = Xe([E[2], E[3]], ce.mercator, ce.data);
|
|
2174
|
+
return [b[0], b[1], Z[0], Z[1]];
|
|
2175
|
+
}, f = {
|
|
2176
|
+
id: Symbol("map-instance"),
|
|
2177
|
+
innerMap: null,
|
|
2178
|
+
map: i.getInstall(),
|
|
2179
|
+
destroy: () => {
|
|
2180
|
+
e.splice(e.indexOf(f), 1);
|
|
2181
|
+
},
|
|
2182
|
+
methods: {
|
|
2183
|
+
...i,
|
|
2184
|
+
layer: d,
|
|
2185
|
+
ship: R,
|
|
2186
|
+
track: P,
|
|
2187
|
+
carTrack: t,
|
|
2188
|
+
port: {
|
|
2189
|
+
render: L.render,
|
|
2190
|
+
clear: L.clear,
|
|
2191
|
+
selected: L.selected,
|
|
2192
|
+
setRed: L.setRed,
|
|
2193
|
+
clearNonRed: L.clearNonRed,
|
|
2194
|
+
clearRed: L.clearRed
|
|
2195
|
+
},
|
|
2196
|
+
position: A,
|
|
2197
|
+
drawLine: n,
|
|
2198
|
+
drawPolygon: x,
|
|
2199
|
+
// 子模块
|
|
2200
|
+
utils: {
|
|
2201
|
+
getCalculateExtent: u,
|
|
2202
|
+
convertSixHundredThousandToLatLng: bt,
|
|
2203
|
+
calculateCirclePoints: wo
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
2206
|
+
};
|
|
2207
|
+
return e.push(f), f;
|
|
2208
|
+
},
|
|
2209
|
+
destroyInstance: (l) => {
|
|
2210
|
+
const s = e.findIndex((i) => i.id === l);
|
|
2211
|
+
s > -1 && (e[s].destroy(), e.splice(s, 1));
|
|
2212
|
+
},
|
|
2213
|
+
destroyAll: () => {
|
|
2214
|
+
e.forEach((l) => l.destroy()), e.splice(0, e.length);
|
|
2215
|
+
},
|
|
2216
|
+
getAllInstances: () => [...e]
|
|
2217
|
+
};
|
|
2218
|
+
}, qo = { class: "zh-map-box" }, _o = {
|
|
2219
|
+
key: 0,
|
|
2220
|
+
class: "map-copyright"
|
|
2221
|
+
}, Ko = ["src"], jo = /* @__PURE__ */ vt({
|
|
2222
|
+
__name: "Map",
|
|
2223
|
+
props: {
|
|
2224
|
+
zoom: { default: ae.default },
|
|
2225
|
+
center: { default: Et },
|
|
2226
|
+
layerType: { default: "vector" },
|
|
2227
|
+
showGreenLayer: { type: Boolean, default: !1 },
|
|
2228
|
+
showScale: { type: Boolean, default: !0 },
|
|
2229
|
+
scaleLineUnit: { default: "metric" },
|
|
2230
|
+
mapMoveEnd: { type: Function, default: () => {
|
|
2231
|
+
} },
|
|
2232
|
+
lineDrawEnd: {},
|
|
2233
|
+
areaDrawEnd: { type: Function, default: () => {
|
|
2234
|
+
} },
|
|
2235
|
+
selectShip: { type: Function, default: () => {
|
|
2236
|
+
} },
|
|
2237
|
+
selectPort: { type: Function, default: () => {
|
|
2238
|
+
} },
|
|
2239
|
+
declutter: { type: Boolean, default: !0 },
|
|
2240
|
+
copyrightImgUrl: {}
|
|
2241
|
+
},
|
|
2242
|
+
setup(e, { expose: r }) {
|
|
2243
|
+
function c() {
|
|
2244
|
+
return new Promise((t) => {
|
|
2245
|
+
document.fonts ? document.fonts.load("12px map-iconfont").then(t) : setTimeout(t, 300);
|
|
2246
|
+
});
|
|
2247
|
+
}
|
|
2248
|
+
c();
|
|
2249
|
+
const l = fe(), s = fe(), i = Xo(), o = fe(), d = e, w = fe({
|
|
2250
|
+
getInstall() {
|
|
2251
|
+
}
|
|
2252
|
+
});
|
|
2253
|
+
_t(() => {
|
|
2254
|
+
var t;
|
|
2255
|
+
o.value = i.createInstance(l.value, d), w.value = o.value.methods, (t = s.value) == null || t.setScaleLine(o.value.map, d.scaleLineUnit), window.addEventListener("nativeDoubleTap", function() {
|
|
2256
|
+
P();
|
|
2257
|
+
});
|
|
2258
|
+
});
|
|
2259
|
+
function P() {
|
|
2260
|
+
var n, x, R, A, L;
|
|
2261
|
+
if (((n = o.value) == null ? void 0 : n.methods.drawPolygon.getState()) === "open" || ((x = o.value) == null ? void 0 : x.methods.drawLine.getState()) === "open" || !((R = o.value) != null && R.methods.getMapClick()))
|
|
2262
|
+
return;
|
|
2263
|
+
let t = (A = o.value) == null ? void 0 : A.methods.getZoom();
|
|
2264
|
+
(L = o.value) == null || L.methods.setZoom(t + 1);
|
|
2265
|
+
}
|
|
2266
|
+
return Kt(() => {
|
|
2267
|
+
var t, n;
|
|
2268
|
+
i.destroyInstance((t = o == null ? void 0 : o.value) == null ? void 0 : t.id), (n = o.value) == null || n.destroy();
|
|
2269
|
+
}), r({
|
|
2270
|
+
getZoom: () => {
|
|
2271
|
+
var t;
|
|
2272
|
+
return (t = o.value) == null ? void 0 : t.methods.getZoom();
|
|
2273
|
+
},
|
|
2274
|
+
setZoom: (t) => {
|
|
2275
|
+
var n;
|
|
2276
|
+
return (n = o.value) == null ? void 0 : n.methods.setZoom(t);
|
|
2277
|
+
},
|
|
2278
|
+
getInstall: () => {
|
|
2279
|
+
var t;
|
|
2280
|
+
return (t = o.value) == null ? void 0 : t.methods.getInstall();
|
|
2281
|
+
},
|
|
2282
|
+
setMapClick: (...t) => {
|
|
2283
|
+
var n;
|
|
2284
|
+
return (n = o.value) == null ? void 0 : n.methods.setMapClick(...t);
|
|
2285
|
+
},
|
|
2286
|
+
getMapClick: () => {
|
|
2287
|
+
var t;
|
|
2288
|
+
return (t = o.value) == null ? void 0 : t.methods.getMapClick();
|
|
2289
|
+
},
|
|
2290
|
+
getView: () => {
|
|
2291
|
+
var t;
|
|
2292
|
+
return (t = o.value) == null ? void 0 : t.methods.getView();
|
|
2293
|
+
},
|
|
2294
|
+
setCenter: (t, n) => {
|
|
2295
|
+
var x;
|
|
2296
|
+
return (x = o.value) == null ? void 0 : x.methods.setCenter(t, n);
|
|
2297
|
+
},
|
|
2298
|
+
getSize: () => {
|
|
2299
|
+
var t;
|
|
2300
|
+
return (t = o.value) == null ? void 0 : t.methods.getSize();
|
|
2301
|
+
},
|
|
2302
|
+
getCenter: () => {
|
|
2303
|
+
var t;
|
|
2304
|
+
return (t = o.value) == null ? void 0 : t.methods.getCenter();
|
|
2305
|
+
},
|
|
2306
|
+
layer: {
|
|
2307
|
+
setGreenTileVisible: (t) => {
|
|
2308
|
+
var n;
|
|
2309
|
+
return (n = o.value) == null ? void 0 : n.methods.layer.setGreenTileVisible(t);
|
|
2310
|
+
},
|
|
2311
|
+
getGreenTileVisible: () => {
|
|
2312
|
+
var t;
|
|
2313
|
+
return (t = o.value) == null ? void 0 : t.methods.layer.getGreenTileVisible();
|
|
2314
|
+
},
|
|
2315
|
+
getShowLayerType: () => {
|
|
2316
|
+
var t;
|
|
2317
|
+
return (t = o.value) == null ? void 0 : t.methods.layer.getShowLayerType();
|
|
2318
|
+
},
|
|
2319
|
+
setShowLayerType: (t) => {
|
|
2320
|
+
var n;
|
|
2321
|
+
return (n = o.value) == null ? void 0 : n.methods.layer.setShowLayerType(t);
|
|
2322
|
+
}
|
|
2323
|
+
},
|
|
2324
|
+
ship: {
|
|
2325
|
+
render: (...t) => {
|
|
2326
|
+
var n;
|
|
2327
|
+
return (n = o.value) == null ? void 0 : n.methods.ship.render(...t);
|
|
2328
|
+
},
|
|
2329
|
+
selected: (...t) => {
|
|
2330
|
+
var n;
|
|
2331
|
+
return (n = o.value) == null ? void 0 : n.methods.ship.selected(...t);
|
|
2332
|
+
},
|
|
2333
|
+
filter: (...t) => {
|
|
2334
|
+
var n;
|
|
2335
|
+
return (n = o.value) == null ? void 0 : n.methods.ship.filter(...t);
|
|
2336
|
+
},
|
|
2337
|
+
blinking: (...t) => {
|
|
2338
|
+
var n;
|
|
2339
|
+
return (n = o.value) == null ? void 0 : n.methods.ship.blinking(...t);
|
|
2340
|
+
},
|
|
2341
|
+
clear: () => {
|
|
2342
|
+
var t;
|
|
2343
|
+
return (t = o.value) == null ? void 0 : t.methods.ship.clear();
|
|
2344
|
+
},
|
|
2345
|
+
setLableStatus: (...t) => {
|
|
2346
|
+
var n;
|
|
2347
|
+
return (n = o.value) == null ? void 0 : n.methods.ship.setLableStatus(...t);
|
|
2348
|
+
}
|
|
2349
|
+
},
|
|
2350
|
+
track: {
|
|
2351
|
+
render: (...t) => {
|
|
2352
|
+
var n;
|
|
2353
|
+
return (n = o.value) == null ? void 0 : n.methods.track.render(...t);
|
|
2354
|
+
},
|
|
2355
|
+
remove: (...t) => {
|
|
2356
|
+
var n;
|
|
2357
|
+
return (n = o.value) == null ? void 0 : n.methods.track.remove(...t);
|
|
2358
|
+
},
|
|
2359
|
+
play: (...t) => {
|
|
2360
|
+
var n;
|
|
2361
|
+
return (n = o.value) == null ? void 0 : n.methods.track.play(...t);
|
|
2362
|
+
},
|
|
2363
|
+
setCenter: (...t) => {
|
|
2364
|
+
var n;
|
|
2365
|
+
return (n = o.value) == null ? void 0 : n.methods.track.setCenter(...t);
|
|
2366
|
+
},
|
|
2367
|
+
close: (...t) => {
|
|
2368
|
+
var n;
|
|
2369
|
+
return (n = o.value) == null ? void 0 : n.methods.track.close(...t);
|
|
2370
|
+
},
|
|
2371
|
+
getLength: (...t) => {
|
|
2372
|
+
var n;
|
|
2373
|
+
return (n = o.value) == null ? void 0 : n.methods.track.getLength(...t);
|
|
2374
|
+
}
|
|
2375
|
+
},
|
|
2376
|
+
carTrack: {
|
|
2377
|
+
location: (...t) => {
|
|
2378
|
+
var n;
|
|
2379
|
+
return (n = o.value) == null ? void 0 : n.methods.carTrack.location(...t);
|
|
2380
|
+
},
|
|
2381
|
+
remove: (...t) => {
|
|
2382
|
+
var n;
|
|
2383
|
+
return (n = o.value) == null ? void 0 : n.methods.carTrack.remove(...t);
|
|
2384
|
+
},
|
|
2385
|
+
renderTrack: (...t) => {
|
|
2386
|
+
var n;
|
|
2387
|
+
return (n = o.value) == null ? void 0 : n.methods.carTrack.renderTrack(...t);
|
|
2388
|
+
},
|
|
2389
|
+
setCenter: (...t) => {
|
|
2390
|
+
var n;
|
|
2391
|
+
return (n = o.value) == null ? void 0 : n.methods.carTrack.setCenter(...t);
|
|
2392
|
+
},
|
|
2393
|
+
closeTrack: () => {
|
|
2394
|
+
var t;
|
|
2395
|
+
return (t = o.value) == null ? void 0 : t.methods.carTrack.closeTrack();
|
|
2396
|
+
},
|
|
2397
|
+
playTrack: (...t) => {
|
|
2398
|
+
var n;
|
|
2399
|
+
return (n = o.value) == null ? void 0 : n.methods.carTrack.playTrack(...t);
|
|
2400
|
+
}
|
|
2401
|
+
},
|
|
2402
|
+
port: {
|
|
2403
|
+
render: (t, n) => {
|
|
2404
|
+
var x;
|
|
2405
|
+
return (x = o.value) == null ? void 0 : x.methods.port.render(t, n);
|
|
2406
|
+
},
|
|
2407
|
+
clear: () => {
|
|
2408
|
+
var t;
|
|
2409
|
+
return (t = o.value) == null ? void 0 : t.methods.port.clear();
|
|
2410
|
+
},
|
|
2411
|
+
selected: (t) => {
|
|
2412
|
+
var n;
|
|
2413
|
+
return (n = o.value) == null ? void 0 : n.methods.port.selected(t);
|
|
2414
|
+
},
|
|
2415
|
+
setRed: (t) => {
|
|
2416
|
+
var n;
|
|
2417
|
+
return (n = o.value) == null ? void 0 : n.methods.port.setRed(t);
|
|
2418
|
+
},
|
|
2419
|
+
clearRed: () => {
|
|
2420
|
+
var t;
|
|
2421
|
+
return (t = o.value) == null ? void 0 : t.methods.port.clearRed();
|
|
2422
|
+
},
|
|
2423
|
+
clearNonRed: () => {
|
|
2424
|
+
var t;
|
|
2425
|
+
return (t = o.value) == null ? void 0 : t.methods.port.clearNonRed();
|
|
2426
|
+
}
|
|
2427
|
+
},
|
|
2428
|
+
position: {
|
|
2429
|
+
render: (...t) => {
|
|
2430
|
+
var n;
|
|
2431
|
+
return (n = o.value) == null ? void 0 : n.methods.position.render(...t);
|
|
2432
|
+
},
|
|
2433
|
+
selected: (...t) => {
|
|
2434
|
+
var n;
|
|
2435
|
+
return (n = o.value) == null ? void 0 : n.methods.position.selected(...t);
|
|
2436
|
+
},
|
|
2437
|
+
clearSelected: (...t) => {
|
|
2438
|
+
var n;
|
|
2439
|
+
return (n = o.value) == null ? void 0 : n.methods.position.clearSelected(...t);
|
|
2440
|
+
},
|
|
2441
|
+
clear: () => {
|
|
2442
|
+
var t;
|
|
2443
|
+
return (t = o.value) == null ? void 0 : t.methods.position.clear();
|
|
2444
|
+
},
|
|
2445
|
+
renderHtml: (...t) => {
|
|
2446
|
+
var n;
|
|
2447
|
+
return (n = o.value) == null ? void 0 : n.methods.position.renderHtml(...t);
|
|
2448
|
+
},
|
|
2449
|
+
removeHtml: (...t) => {
|
|
2450
|
+
var n;
|
|
2451
|
+
return (n = o.value) == null ? void 0 : n.methods.position.removeHtml(...t);
|
|
2452
|
+
}
|
|
2453
|
+
},
|
|
2454
|
+
drawLine: {
|
|
2455
|
+
open: () => {
|
|
2456
|
+
var t;
|
|
2457
|
+
return (t = o.value) == null ? void 0 : t.methods.drawLine.open();
|
|
2458
|
+
},
|
|
2459
|
+
close: () => {
|
|
2460
|
+
var t;
|
|
2461
|
+
return (t = o.value) == null ? void 0 : t.methods.drawLine.close();
|
|
2462
|
+
},
|
|
2463
|
+
deleteLine: (t) => {
|
|
2464
|
+
var n;
|
|
2465
|
+
return (n = o.value) == null ? void 0 : n.methods.drawLine.deleteLine(t);
|
|
2466
|
+
},
|
|
2467
|
+
setUnit: (t) => {
|
|
2468
|
+
var n;
|
|
2469
|
+
return (n = o.value) == null ? void 0 : n.methods.drawLine.setUnit(t);
|
|
2470
|
+
},
|
|
2471
|
+
getState: () => {
|
|
2472
|
+
var t;
|
|
2473
|
+
return (t = o.value) == null ? void 0 : t.methods.drawLine.getState();
|
|
2474
|
+
}
|
|
2475
|
+
},
|
|
2476
|
+
drawPolygon: {
|
|
2477
|
+
open: (...t) => {
|
|
2478
|
+
var n;
|
|
2479
|
+
return (n = o.value) == null ? void 0 : n.methods.drawPolygon.open(...t);
|
|
2480
|
+
},
|
|
2481
|
+
close: () => {
|
|
2482
|
+
var t;
|
|
2483
|
+
return (t = o.value) == null ? void 0 : t.methods.drawPolygon.close();
|
|
2484
|
+
},
|
|
2485
|
+
reset: () => {
|
|
2486
|
+
var t;
|
|
2487
|
+
return (t = o.value) == null ? void 0 : t.methods.drawPolygon.reset();
|
|
2488
|
+
}
|
|
2489
|
+
},
|
|
2490
|
+
// 子模块
|
|
2491
|
+
utils: {
|
|
2492
|
+
getCalculateExtent: (...t) => {
|
|
2493
|
+
var n;
|
|
2494
|
+
return (n = o.value) == null ? void 0 : n.methods.utils.getCalculateExtent(...t);
|
|
2495
|
+
},
|
|
2496
|
+
convertSixHundredThousandToLatLng: (...t) => {
|
|
2497
|
+
var n;
|
|
2498
|
+
return (n = o.value) == null ? void 0 : n.methods.utils.convertSixHundredThousandToLatLng(...t);
|
|
2499
|
+
},
|
|
2500
|
+
calculateCirclePoints: (t, n) => {
|
|
2501
|
+
var x;
|
|
2502
|
+
return (x = o.value) == null ? void 0 : x.methods.utils.calculateCirclePoints(t, n);
|
|
2503
|
+
}
|
|
2504
|
+
},
|
|
2505
|
+
config: {
|
|
2506
|
+
MAP_DEFAULT_CENTER: Et,
|
|
2507
|
+
MAP_ZOOM: ae,
|
|
2508
|
+
projection: ce
|
|
2509
|
+
}
|
|
2510
|
+
}), (t, n) => (ot(), nt("div", qo, [
|
|
2511
|
+
rt("div", {
|
|
2512
|
+
id: "map",
|
|
2513
|
+
ref_key: "zhMapRef",
|
|
2514
|
+
ref: l,
|
|
2515
|
+
class: "zh-map"
|
|
2516
|
+
}, null, 512),
|
|
2517
|
+
ht(fo, {
|
|
2518
|
+
ref_key: "scaleLineRef",
|
|
2519
|
+
ref: s
|
|
2520
|
+
}, null, 512),
|
|
2521
|
+
ht(vo, {
|
|
2522
|
+
ref: "zoomControlRef",
|
|
2523
|
+
"map-instance": o.value
|
|
2524
|
+
}, null, 8, ["map-instance"]),
|
|
2525
|
+
t.copyrightImgUrl ? (ot(), nt("div", _o, [
|
|
2526
|
+
rt("img", {
|
|
2527
|
+
src: t.copyrightImgUrl,
|
|
2528
|
+
alt: "copyright"
|
|
2529
|
+
}, null, 8, Ko)
|
|
2530
|
+
])) : jt("", !0)
|
|
2531
|
+
]));
|
|
2532
|
+
}
|
|
2533
|
+
}), Qo = /* @__PURE__ */ xt(jo, [["__scopeId", "data-v-e976a370"]]), tn = ao(Qo);
|
|
2534
|
+
export {
|
|
2535
|
+
tn as Z
|
|
2536
|
+
};
|