zhihao-ui 1.3.11 → 1.3.12
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-Bhin5Xqy.js → BaseInfo-BhnEjLKF.js} +1 -1
- package/dist/es/{BaseItem-BoLcxB-U.js → BaseItem-C4NJy1i4.js} +3 -3
- package/dist/es/{Button-DdMNoo0g.js → Button-CGndQwez.js} +2 -2
- package/dist/es/{DatePicker-sUXbd9V4.js → DatePicker-Dy1K1cJQ.js} +3 -3
- package/dist/es/{DetailHeader--0WANmGX.js → DetailHeader-DaabNj_4.js} +3 -3
- package/dist/es/{DetailSubTitle-BUqZQxrl.js → DetailSubTitle-CzFZPXeE.js} +2 -2
- package/dist/es/{Dialog-BKHohBv4.js → Dialog-BUW6ag1B.js} +3 -3
- package/dist/es/{DiyDataTable-GuaKFrG5.js → DiyDataTable-D-UZVciZ.js} +4 -4
- package/dist/es/{EditInfoPair-CajUIoGj.js → EditInfoPair-B2f6zoGY.js} +3 -3
- package/dist/es/{FileWrapper-CvYOVYx4.js → FileWrapper-D4IxJemr.js} +4 -4
- package/dist/es/{Grid-eLpow9Qb.js → Grid-DIs695lY.js} +2 -2
- package/dist/es/{InfoPair-BoTzSjD8.js → InfoPair-Ce7nDfxD.js} +3 -3
- package/dist/es/{Input-BKzWwcsD.js → Input-C5X2X_YD.js} +3 -3
- package/dist/es/{Loading-3Cz4Wb5p.js → Loading-BgoEv5qE.js} +2 -2
- package/dist/es/Map-BotrSWAZ.js +1994 -0
- package/dist/es/{MessageBox--A4VqZyI.js → MessageBox-DiGH5x51.js} +2 -2
- package/dist/es/{MoneyInput-DeYknAkX.js → MoneyInput-D0kYiOfP.js} +10 -10
- package/dist/es/{PageHeadPanel-8pDHbfnc.js → PageHeadPanel-C6IdOq6I.js} +2 -2
- package/dist/es/{Table-DcnAnAAU.js → Table-B_3YA1mb.js} +5 -5
- package/dist/es/{ToolTips-xwoX6Ww8.js → ToolTips-CiQHxGrw.js} +5 -5
- package/dist/es/index.js +22 -22
- package/dist/es/{utils-pSjFFegY.js → utils-D2wHR1YB.js} +1 -1
- package/dist/es/{vendor-CINc7P9P.js → vendor-D2mv9LHk.js} +8407 -8013
- package/dist/index.css +1 -1
- package/dist/types/components/Map/Map.vue.d.ts +47 -68
- package/dist/types/components/Map/components/scaleLine.vue.d.ts +2 -1
- package/dist/types/components/Map/components/zoomControl.vue.d.ts +13 -1
- package/dist/types/components/Map/function/carTrack.d.ts +7 -14
- package/dist/types/components/Map/function/drawLine.d.ts +4 -4
- package/dist/types/components/Map/function/drawPolygon.d.ts +4 -2
- package/dist/types/components/Map/function/event.d.ts +8 -0
- package/dist/types/components/Map/function/layers.d.ts +8 -5
- package/dist/types/components/Map/function/map.d.ts +14 -10
- package/dist/types/components/Map/function/port.d.ts +8 -6
- package/dist/types/components/Map/function/position.d.ts +1 -7
- package/dist/types/components/Map/function/props.d.ts +5 -2
- package/dist/types/components/Map/function/ship/index.d.ts +8 -28
- package/dist/types/components/Map/function/ship/style.d.ts +36 -4
- package/dist/types/components/Map/function/shipTrack.d.ts +12 -37
- package/dist/types/components/Map/index.d.ts +141 -216
- package/dist/types/components/Map/interface/mapProps.d.ts +5 -5
- package/dist/types/components/Map/useMap.d.ts +17 -0
- package/dist/types/components/Map/utils/shipOverlay.d.ts +12 -0
- package/dist/umd/index.css +1 -1
- package/dist/umd/index.umd.cjs +66 -64
- package/package.json +1 -1
- package/dist/es/Map-Dhm6AjZp.js +0 -1756
|
@@ -0,0 +1,1994 @@
|
|
|
1
|
+
import { defineComponent, openBlock, createElementBlock, createElementVNode, ref, computed, h, createVNode, render, reactive, onMounted, onUnmounted } from "vue";
|
|
2
|
+
import { S as ScaleLine$1, M as Map$2, T as TileLayer, X as XYZ, p as fromLonLat, V as View, q as defaults, t as toLonLat, h as hooks, r as getLength, s as transformExtent, u as Text, F as Fill, v as Style, O as Overlay, P as Point, w as transform, x as debounce, L as LineString, y as buffer, z as Polyline, A as Feature, B as VectorLayer, C as VectorSource, D as Stroke, i as cloneDeep, G as CircleStyle, H as getVectorContext, I as Icon, J as VectorImageLayer, K as Circle, N as DoubleClickZoom, Q as Draw, R as unByKey, U as getUid, W as getArea, Y as getCenter, Z as MultiPoint } from "./vendor-D2mv9LHk.js";
|
|
3
|
+
import { _ as _export_sfc } from "./Button-CGndQwez.js";
|
|
4
|
+
import { w as withInstall } from "./utils-D2wHR1YB.js";
|
|
5
|
+
const _hoisted_1$2 = { id: "scale-line-container" }, _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
6
|
+
__name: "scaleLine",
|
|
7
|
+
setup(e, { expose: n }) {
|
|
8
|
+
return n({
|
|
9
|
+
setScaleLine: (s, a) => {
|
|
10
|
+
a || (a = "metric");
|
|
11
|
+
const o = new ScaleLine$1({
|
|
12
|
+
units: a
|
|
13
|
+
}), f = document.getElementById("scale-line-container");
|
|
14
|
+
f && (o.setTarget(f), s.addControl(o));
|
|
15
|
+
}
|
|
16
|
+
}), (s, a) => (openBlock(), createElementBlock("div", _hoisted_1$2));
|
|
17
|
+
}
|
|
18
|
+
}), ScaleLine = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-2bc5dee8"]]), _hoisted_1$1 = { class: "zoom" }, _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
19
|
+
__name: "zoomControl",
|
|
20
|
+
props: {
|
|
21
|
+
mapInstance: {
|
|
22
|
+
type: Object,
|
|
23
|
+
default: () => null
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
setup(e) {
|
|
27
|
+
const n = e;
|
|
28
|
+
console.log("props", n);
|
|
29
|
+
const l = () => {
|
|
30
|
+
console.log("props");
|
|
31
|
+
const { setZoom: a, getZoom: o, getInstall: f } = n.mapInstance.methods;
|
|
32
|
+
if (!f()) return;
|
|
33
|
+
const t = o();
|
|
34
|
+
t && a(t + 1);
|
|
35
|
+
}, s = () => {
|
|
36
|
+
const { setZoom: a, getZoom: o, getInstall: f } = n.mapInstance.methods;
|
|
37
|
+
if (!f()) return;
|
|
38
|
+
const t = o();
|
|
39
|
+
t && a(t - 1);
|
|
40
|
+
};
|
|
41
|
+
return (a, o) => (openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
42
|
+
createElementVNode("div", {
|
|
43
|
+
class: "button big-button",
|
|
44
|
+
onClick: l
|
|
45
|
+
}, " + "),
|
|
46
|
+
createElementVNode("div", {
|
|
47
|
+
class: "button small-button",
|
|
48
|
+
onClick: s
|
|
49
|
+
}, " - ")
|
|
50
|
+
]));
|
|
51
|
+
}
|
|
52
|
+
}), ZoomControl = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-c39c3075"]]), TIAN_DI_TU_KEY = "a6e8f78974f2581f2ca00485b40c948f", MAP_ZOOM = {
|
|
53
|
+
// 地图默认层级
|
|
54
|
+
default: 13,
|
|
55
|
+
// 地图缩放最小层级
|
|
56
|
+
min: 3,
|
|
57
|
+
// 地图缩放最大层级
|
|
58
|
+
max: 18,
|
|
59
|
+
// 船形图标最小渲染层级
|
|
60
|
+
shipModelMin: 13,
|
|
61
|
+
// 船形图标最小渲染层级
|
|
62
|
+
shipTriggleMin: 16,
|
|
63
|
+
// 船形图标最大渲染层级
|
|
64
|
+
shipModelMax: 18,
|
|
65
|
+
//根据原系统canvas图片转换svg长宽比例计算缩放值
|
|
66
|
+
scaleNum: 0.555
|
|
67
|
+
}, projection = {
|
|
68
|
+
// 经纬度 源数据 地理坐标 WGS84
|
|
69
|
+
data: "EPSG:4326",
|
|
70
|
+
// 墨卡托投影坐标 渲染坐标
|
|
71
|
+
mercator: "EPSG:3857"
|
|
72
|
+
}, MAP_DEFAULT_CENTER = [114.84, 30.52], CDN_URL = "https://static.zhihaoscm.cn/", equatorialCircumference = 2003750834e-2;
|
|
73
|
+
var BASE_MAP_LINK = ((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=${TIAN_DI_TU_KEY}`, 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=${TIAN_DI_TU_KEY}`, 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=${TIAN_DI_TU_KEY}`, 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=${TIAN_DI_TU_KEY}`, e.greenTile = `${CDN_URL}/map/tile/{z}/{x}/{y}.png`, e))(BASE_MAP_LINK || {}), LENGTH_UNIT = /* @__PURE__ */ ((e) => (e[e.M = 1] = "M", e[e.KM = 2] = "KM", e[e.NM = 3] = "NM", e))(LENGTH_UNIT || {});
|
|
74
|
+
function useMapInitializer() {
|
|
75
|
+
const e = ref(), n = () => e.value, l = () => n().getView(), s = () => {
|
|
76
|
+
var m;
|
|
77
|
+
return (m = l()) == null ? void 0 : m.getZoom();
|
|
78
|
+
}, a = (m) => {
|
|
79
|
+
var F;
|
|
80
|
+
(F = l()) == null || F.setZoom(m);
|
|
81
|
+
}, o = (m, F) => {
|
|
82
|
+
var V;
|
|
83
|
+
(V = l()) == null || V.setCenter(fromLonLat([m, F]));
|
|
84
|
+
}, f = () => {
|
|
85
|
+
var F;
|
|
86
|
+
const m = (F = l()) == null ? void 0 : F.getCenter();
|
|
87
|
+
return toLonLat(m);
|
|
88
|
+
}, E = () => {
|
|
89
|
+
var m;
|
|
90
|
+
return (m = n()) == null ? void 0 : m.getSize();
|
|
91
|
+
}, t = new Map$2(), r = (m, F) => {
|
|
92
|
+
y(F);
|
|
93
|
+
const V = {
|
|
94
|
+
zoom: F.zoom,
|
|
95
|
+
center: fromLonLat(F.center),
|
|
96
|
+
minZoom: MAP_ZOOM.min,
|
|
97
|
+
maxZoom: MAP_ZOOM.max,
|
|
98
|
+
constrainResolution: !0,
|
|
99
|
+
enableRotation: !1,
|
|
100
|
+
multiWorld: !0
|
|
101
|
+
}, v = new Map$2({
|
|
102
|
+
target: m,
|
|
103
|
+
controls: defaults({
|
|
104
|
+
zoom: !1
|
|
105
|
+
}),
|
|
106
|
+
layers: [
|
|
107
|
+
t.get("vectorTile"),
|
|
108
|
+
t.get("vectorTileMark"),
|
|
109
|
+
t.get("satelliteImgTile"),
|
|
110
|
+
t.get("satelliteImgTileMark")
|
|
111
|
+
],
|
|
112
|
+
view: new View(V)
|
|
113
|
+
});
|
|
114
|
+
e.value = v;
|
|
115
|
+
}, y = (m) => {
|
|
116
|
+
t.set("vectorTile", new TileLayer({
|
|
117
|
+
source: new XYZ({ url: BASE_MAP_LINK.vectorTile }),
|
|
118
|
+
visible: m.layerType === "vector",
|
|
119
|
+
zIndex: 0,
|
|
120
|
+
preload: 1,
|
|
121
|
+
className: "vector"
|
|
122
|
+
})), t.set("vectorTileMark", new TileLayer({
|
|
123
|
+
source: new XYZ({ url: BASE_MAP_LINK.vectorTileMark }),
|
|
124
|
+
visible: m.layerType === "vector",
|
|
125
|
+
zIndex: 1,
|
|
126
|
+
preload: 1,
|
|
127
|
+
className: "vector"
|
|
128
|
+
})), t.set("satelliteImgTile", new TileLayer({
|
|
129
|
+
source: new XYZ({ url: BASE_MAP_LINK.satelliteImgTile }),
|
|
130
|
+
visible: m.layerType === "satellite",
|
|
131
|
+
zIndex: 0,
|
|
132
|
+
preload: 1,
|
|
133
|
+
className: "satellite"
|
|
134
|
+
})), t.set("satelliteImgTileMark", new TileLayer({
|
|
135
|
+
source: new XYZ({ url: BASE_MAP_LINK.satelliteImgTileMark }),
|
|
136
|
+
visible: m.layerType === "satellite",
|
|
137
|
+
zIndex: 1,
|
|
138
|
+
preload: 1,
|
|
139
|
+
className: "satellite"
|
|
140
|
+
})), t.set("greenMark", new TileLayer({
|
|
141
|
+
source: new XYZ({ url: BASE_MAP_LINK.greenTile }),
|
|
142
|
+
visible: m.showGreenLayer,
|
|
143
|
+
zIndex: 2,
|
|
144
|
+
className: "greenTile"
|
|
145
|
+
}));
|
|
146
|
+
};
|
|
147
|
+
return {
|
|
148
|
+
getInstall: n,
|
|
149
|
+
getView: l,
|
|
150
|
+
getZoom: s,
|
|
151
|
+
setZoom: a,
|
|
152
|
+
setCenter: o,
|
|
153
|
+
getCenter: f,
|
|
154
|
+
getSize: E,
|
|
155
|
+
initMap: r,
|
|
156
|
+
setBaseLayerMap: y
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
const convertSixHundredThousandToLatLng = function(e, n) {
|
|
160
|
+
const l = Number(n) / 6e5;
|
|
161
|
+
return [Number(e) / 6e5, l];
|
|
162
|
+
}, calculateCirclePoints = (e, n) => {
|
|
163
|
+
const l = fromLonLat(e), s = n * 1e3, a = [
|
|
164
|
+
l[0] - s,
|
|
165
|
+
l[1] - s,
|
|
166
|
+
l[0] + s,
|
|
167
|
+
l[1] + s
|
|
168
|
+
], o = transformExtent(a, projection.mercator, projection.data);
|
|
169
|
+
return {
|
|
170
|
+
leftTopPoint: { lng: o[0], lat: o[3] },
|
|
171
|
+
rightTopPoint: { lng: o[2], lat: o[3] },
|
|
172
|
+
rightBottomPoint: { lng: o[2], lat: o[1] },
|
|
173
|
+
leftBottomPoint: { lng: o[0], lat: o[1] }
|
|
174
|
+
};
|
|
175
|
+
}, formatLength = function(e, n) {
|
|
176
|
+
const s = getLength(e);
|
|
177
|
+
let a = "";
|
|
178
|
+
switch (console.log(n, LENGTH_UNIT), n) {
|
|
179
|
+
case LENGTH_UNIT.M:
|
|
180
|
+
a = Math.round(s * 100) / 100 + " m";
|
|
181
|
+
break;
|
|
182
|
+
case LENGTH_UNIT.KM:
|
|
183
|
+
a = Math.round(s / 1e3 * 100) / 100 + " km";
|
|
184
|
+
break;
|
|
185
|
+
case LENGTH_UNIT.NM:
|
|
186
|
+
a = (Math.round(s / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
return a;
|
|
190
|
+
};
|
|
191
|
+
function lonLatToMercator(e) {
|
|
192
|
+
const n = e[0] * equatorialCircumference / 180;
|
|
193
|
+
let l = Math.log(Math.tan((90 + e[1]) * Math.PI / 360)) / (Math.PI / 180);
|
|
194
|
+
return l = l * equatorialCircumference / 180, [n, l];
|
|
195
|
+
}
|
|
196
|
+
function getIconFont(unicode = "") {
|
|
197
|
+
return unicode.indexOf("&") !== -1 && (unicode = unicode.replace("&", "&")), unicode.indexOf("&") !== -1 && (unicode = unicode.replace("&", "&")), eval('("' + unicode.replace("&#x", "\\u").replace(";", "") + '")');
|
|
198
|
+
}
|
|
199
|
+
const getIconStyle = (e) => {
|
|
200
|
+
const n = new Text({
|
|
201
|
+
font: "Normal 14px map-iconfont",
|
|
202
|
+
text: getIconFont(e),
|
|
203
|
+
fill: new Fill({ color: "#fff" }),
|
|
204
|
+
offsetY: -14
|
|
205
|
+
});
|
|
206
|
+
return new Style({
|
|
207
|
+
text: n,
|
|
208
|
+
zIndex: 100
|
|
209
|
+
});
|
|
210
|
+
}, mercatorToLonLat = (e, n = "lonlat") => {
|
|
211
|
+
const l = { lon: 0, lat: 0 }, s = e[0] / equatorialCircumference * 180;
|
|
212
|
+
let a = e[1] / equatorialCircumference * 180;
|
|
213
|
+
return a = 180 / Math.PI * (2 * Math.atan(Math.exp(a * Math.PI / 180)) - Math.PI / 2), l.lon = s, l.lat = a, n === "lonlat" ? l : [s, a];
|
|
214
|
+
}, formatMinutesToDDHHMM = (e) => {
|
|
215
|
+
const n = hooks.duration(e, "minutes"), l = Math.floor(n.asDays()), s = n.hours(), a = n.minutes();
|
|
216
|
+
let o = `${String(a).padStart(2, "0")}分`;
|
|
217
|
+
return s !== 0 && (o = `${String(s).padStart(2, "0")}时${o}`), l !== 0 && (o = `${String(l).padStart(2, "0")}天${o}`), o;
|
|
218
|
+
}, useCarTrackManager = (e, n) => {
|
|
219
|
+
let l = null;
|
|
220
|
+
const s = async (y) => {
|
|
221
|
+
if (!e || (console.log("vehicleInfo", y), !(y != null && y.lon && (y != null && y.lat)))) return;
|
|
222
|
+
const m = Math.abs(Number(y.lon)) > 180 ? convertSixHundredThousandToLatLng(y.lon, y.lat) : [y.lon, y.lat];
|
|
223
|
+
a(y, fromLonLat(m));
|
|
224
|
+
const F = e == null ? void 0 : e.getView(), V = new Point(m);
|
|
225
|
+
F.setCenter(transform(V.getCoordinates(), projection.data, projection.mercator));
|
|
226
|
+
}, a = (y, m) => {
|
|
227
|
+
const F = `${CDN_URL}map/car-icon.gif`;
|
|
228
|
+
l || (l = new Overlay({
|
|
229
|
+
element: document.createElement("div"),
|
|
230
|
+
positioning: "center-center",
|
|
231
|
+
stopEvent: !1
|
|
232
|
+
// 允许交互事件穿透
|
|
233
|
+
}), e.addOverlay(l));
|
|
234
|
+
const V = l.getElement();
|
|
235
|
+
V.style.backgroundImage = `url(${F})`, V.style.width = "80px", V.style.height = "80px";
|
|
236
|
+
const v = (y == null ? void 0 : y.drc) || "";
|
|
237
|
+
V.style.transform = `rotate(${v}deg)`, V.style.backgroundSize = "cover", l == null || l.setPosition(m);
|
|
238
|
+
};
|
|
239
|
+
return {
|
|
240
|
+
location: s,
|
|
241
|
+
remove: () => {
|
|
242
|
+
const y = l == null ? void 0 : l.getElement();
|
|
243
|
+
y && (y.innerHTML = "");
|
|
244
|
+
},
|
|
245
|
+
renderTrack: (y, m, F) => {
|
|
246
|
+
n.render(y, m, F, "truck", 1e3);
|
|
247
|
+
},
|
|
248
|
+
setCenter: (y) => {
|
|
249
|
+
n.setCenter(y);
|
|
250
|
+
},
|
|
251
|
+
closeTrack: () => {
|
|
252
|
+
n.close();
|
|
253
|
+
},
|
|
254
|
+
playTrack: (y, m) => {
|
|
255
|
+
n.play(y, m);
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
};
|
|
259
|
+
var SHIP_SAIL_STATUS = /* @__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))(SHIP_SAIL_STATUS || {}), SHIP_DIRECT = /* @__PURE__ */ ((e) => (e.left = "left", e.right = "right", e.front = "front", e.up = "up", e.down = "down", e.back = "back", e))(SHIP_DIRECT || {});
|
|
260
|
+
const useTrackManager = (e) => {
|
|
261
|
+
const n = /* @__PURE__ */ new Map(), l = {};
|
|
262
|
+
let s = null;
|
|
263
|
+
const a = "--";
|
|
264
|
+
let o = null;
|
|
265
|
+
const f = document.createElement("div"), E = new Overlay({
|
|
266
|
+
element: f,
|
|
267
|
+
positioning: "top-left",
|
|
268
|
+
stopEvent: !1,
|
|
269
|
+
className: "track-label-popup"
|
|
270
|
+
});
|
|
271
|
+
let t, r, y, m, F, V = !1, v = Date.now(), g, T = 0, p = null, C = 20, Z = !1;
|
|
272
|
+
const Y = 5, X = [], H = (i) => {
|
|
273
|
+
var c;
|
|
274
|
+
for (X.unshift(i); X.length > Y; ) {
|
|
275
|
+
const d = X.pop(), w = n.get(d);
|
|
276
|
+
w && ((c = w.getSource()) == null || c.clear(), e == null || e.removeLayer(w), n.delete(d), delete l[d]);
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
let u = "";
|
|
280
|
+
const L = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], S = debounce(() => {
|
|
281
|
+
if (s && l[s] && n.get(s).getVisible() && Z) {
|
|
282
|
+
console.log("reRenderTrackLine------------");
|
|
283
|
+
const i = cloneDeep(P(s, l[s]));
|
|
284
|
+
ce(s, i);
|
|
285
|
+
}
|
|
286
|
+
}, 300), P = (i, c) => {
|
|
287
|
+
let d = [];
|
|
288
|
+
const w = Math.max(1, Math.floor(c.length / C));
|
|
289
|
+
return d = c.filter((b, _) => _ % w === 0).map((b, _) => {
|
|
290
|
+
if (Number(b.lon) > 180 || Number(b.lat) > 180) {
|
|
291
|
+
const [O, A] = convertSixHundredThousandToLatLng(b.lon, b.lat);
|
|
292
|
+
b.lon = O, b.lat = A;
|
|
293
|
+
}
|
|
294
|
+
return b.center = [b.lon, b.lat], b.centerPoint = lonLatToMercator(b.center), b.time = hooks(b.createdAt).format("YYYY-MM-DD HH:mm:ss"), b.id = i, b.index = _, b;
|
|
295
|
+
}), d;
|
|
296
|
+
}, x = async (i, c, d, w = "ship", M = 200) => {
|
|
297
|
+
if (!e || (c = c == null ? void 0 : c.reverse(), E && w === "ship" && (e != null && e.getOverlays().getArray().includes(E) || e.addOverlay(E)), (c == null ? void 0 : c.length) < 2))
|
|
298
|
+
return;
|
|
299
|
+
H(i), s = i, l[i] = c, C = M;
|
|
300
|
+
const b = Object.keys(l).findIndex((_) => _ === i) || 0;
|
|
301
|
+
u = d || L[b > 10 ? 10 : b], Z = !0, await z(), await ne(s);
|
|
302
|
+
}, N = (i) => {
|
|
303
|
+
const c = new VectorSource();
|
|
304
|
+
return new VectorLayer({
|
|
305
|
+
source: c,
|
|
306
|
+
visible: !1,
|
|
307
|
+
// 默认隐藏
|
|
308
|
+
className: `track-layer-${i}`,
|
|
309
|
+
renderBuffer: 1024
|
|
310
|
+
// 增大渲染缓冲区
|
|
311
|
+
});
|
|
312
|
+
}, D = (i) => {
|
|
313
|
+
n.forEach((c, d) => {
|
|
314
|
+
var M;
|
|
315
|
+
const w = d === i;
|
|
316
|
+
c.getVisible() !== w && (c.setVisible(w), e.getLayers().getArray().includes(c) || e.addLayer(c), w || (M = c.getSource()) == null || M.clear());
|
|
317
|
+
}), s = i;
|
|
318
|
+
}, z = async () => {
|
|
319
|
+
const i = s;
|
|
320
|
+
if (!n.has(i)) {
|
|
321
|
+
const b = N(i);
|
|
322
|
+
n.set(i, b);
|
|
323
|
+
}
|
|
324
|
+
await D(i);
|
|
325
|
+
const c = u || "", d = l[i] || [];
|
|
326
|
+
if (!(d && d.length > 1)) return [];
|
|
327
|
+
let w = [];
|
|
328
|
+
w = P(i, d);
|
|
329
|
+
const M = w.map((b) => b.centerPoint);
|
|
330
|
+
w.length >= 2 && await $(i, M, c);
|
|
331
|
+
}, $ = (i, c, d) => {
|
|
332
|
+
const w = new LineString(c), M = n.get(i).getSource(), b = M.getFeatureById(i);
|
|
333
|
+
if (b)
|
|
334
|
+
b.setGeometry(w), b.setId(i), b.setStyle(R(d)), p = b;
|
|
335
|
+
else {
|
|
336
|
+
const _ = new Feature({ geometry: w });
|
|
337
|
+
_.setId(i), _.set("type", "line"), _.setStyle(R(d)), M.addFeature(_), p = _;
|
|
338
|
+
}
|
|
339
|
+
return p;
|
|
340
|
+
}, R = (i) => new Style({
|
|
341
|
+
stroke: new Stroke({
|
|
342
|
+
color: i,
|
|
343
|
+
width: 2
|
|
344
|
+
})
|
|
345
|
+
}), K = (i, c, d) => {
|
|
346
|
+
const w = i == null ? void 0 : i.get("trackId");
|
|
347
|
+
if (i && w && c === "hover") {
|
|
348
|
+
e.getTargetElement().style.cursor = w ? "pointer" : "";
|
|
349
|
+
const M = i.get("data"), b = Q(M), _ = d == null ? void 0 : d.coordinate;
|
|
350
|
+
_ && (f.querySelector(".popup-content"), f.innerHTML = b, E == null || E.setPosition(_));
|
|
351
|
+
} else
|
|
352
|
+
E && E.setPosition(void 0);
|
|
353
|
+
}, Q = (i) => {
|
|
354
|
+
if (!(i != null && i.time)) return;
|
|
355
|
+
let c = "";
|
|
356
|
+
return i != null && i.stayTime && (c = `
|
|
357
|
+
<div class="item w-100">
|
|
358
|
+
<div class="item-label">停泊时间约</div>
|
|
359
|
+
<div class="item-item">${formatMinutesToDDHHMM(Number(i.stayTime))}</div>
|
|
360
|
+
</div>
|
|
361
|
+
`), `
|
|
362
|
+
<div class="track-point-popup">
|
|
363
|
+
<div class="item">
|
|
364
|
+
<div class="item-label">状态</div>
|
|
365
|
+
<div class="item-item">${i != null && i.sailStatus ? SHIP_SAIL_STATUS[i.sailStatus] : a}</div>
|
|
366
|
+
</div>
|
|
367
|
+
<div class="item">
|
|
368
|
+
<div class="item-label">航速</div>
|
|
369
|
+
<div class="item-item">${i.speed || a}</div>
|
|
370
|
+
</div>
|
|
371
|
+
<div class="item">
|
|
372
|
+
<div class="item-label">艏向</div>
|
|
373
|
+
<div class="item-item">${i.hdg || a}</div>
|
|
374
|
+
</div>
|
|
375
|
+
<div class="item">
|
|
376
|
+
<div class="item-label">航向</div>
|
|
377
|
+
<div class="item-item">${i.cog || a}</div>
|
|
378
|
+
</div>
|
|
379
|
+
<div class="item">
|
|
380
|
+
<div class="item-label">经度</div>
|
|
381
|
+
<div class="item-item">${i.lon || a}</div>
|
|
382
|
+
</div>
|
|
383
|
+
<div class="item">
|
|
384
|
+
<div class="item-label">纬度</div>
|
|
385
|
+
<div class="item-item">${i.lat || a}</div>
|
|
386
|
+
</div>
|
|
387
|
+
<div class="item w-100">
|
|
388
|
+
<div class="item-label">时间</div>
|
|
389
|
+
<div class="item-item">${i.time}</div>
|
|
390
|
+
</div>
|
|
391
|
+
${c ?? c}
|
|
392
|
+
</div>`;
|
|
393
|
+
}, ie = (i) => {
|
|
394
|
+
const d = i.map((O) => {
|
|
395
|
+
const A = e.getPixelFromCoordinate(fromLonLat(O.center));
|
|
396
|
+
return {
|
|
397
|
+
...O,
|
|
398
|
+
original: O,
|
|
399
|
+
pixel: A,
|
|
400
|
+
distance: 0
|
|
401
|
+
// 先初始化,后续计算
|
|
402
|
+
};
|
|
403
|
+
});
|
|
404
|
+
let w = 0;
|
|
405
|
+
d[0].distance = 0;
|
|
406
|
+
for (let O = 1; O < d.length; O++) {
|
|
407
|
+
const A = d[O - 1].pixel, B = d[O].pixel, q = B[0] - A[0], k = B[1] - A[1];
|
|
408
|
+
w += Math.sqrt(q * q + k * k), d[O].distance = w;
|
|
409
|
+
}
|
|
410
|
+
const M = d.filter(
|
|
411
|
+
(O, A) => A === 0 || A === d.length - 1
|
|
412
|
+
), b = [];
|
|
413
|
+
for (let O = 0; O < M.length; O++) {
|
|
414
|
+
const A = M[O];
|
|
415
|
+
if (b.push(A), O < M.length - 1) {
|
|
416
|
+
const B = M[O + 1], q = B.distance - A.distance, k = Math.floor(q / 100);
|
|
417
|
+
for (let G = 1; G <= k; G++) {
|
|
418
|
+
const j = A.distance + G * 100;
|
|
419
|
+
if (j >= B.distance) break;
|
|
420
|
+
const W = ae(
|
|
421
|
+
d,
|
|
422
|
+
j
|
|
423
|
+
);
|
|
424
|
+
W && b.push(W);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
return Array.from(
|
|
429
|
+
new Map(b.map((O) => [O.distance.toFixed(2), O])).values()
|
|
430
|
+
).map((O) => ({
|
|
431
|
+
...O.original,
|
|
432
|
+
// 优先保留原始数据
|
|
433
|
+
...O,
|
|
434
|
+
// 覆盖坐标等计算属性
|
|
435
|
+
coord: O.coord,
|
|
436
|
+
// 确保使用插值后的坐标
|
|
437
|
+
pixel: O.pixel,
|
|
438
|
+
distance: O.distance
|
|
439
|
+
}));
|
|
440
|
+
};
|
|
441
|
+
function ae(i, c) {
|
|
442
|
+
for (let d = 1; d < i.length; d++) {
|
|
443
|
+
const w = i[d - 1], M = i[d];
|
|
444
|
+
if (c >= w.distance && c <= M.distance) {
|
|
445
|
+
const b = (c - w.distance) / (M.distance - w.distance), _ = w.pixel[0] + b * (M.pixel[0] - w.pixel[0]), O = w.pixel[1] + b * (M.pixel[1] - w.pixel[1]), A = e == null ? void 0 : e.getCoordinateFromPixel([_, O]);
|
|
446
|
+
return {
|
|
447
|
+
...w,
|
|
448
|
+
// 继承前一个点的属性(可调整)
|
|
449
|
+
coord: A,
|
|
450
|
+
pixel: [_, O],
|
|
451
|
+
distance: c,
|
|
452
|
+
original: void 0
|
|
453
|
+
// 明确标记为插值生成点
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
return null;
|
|
458
|
+
}
|
|
459
|
+
const ce = async (i, c) => {
|
|
460
|
+
await re(), await ge(i);
|
|
461
|
+
const d = ie(c), w = d.map((b) => de(b));
|
|
462
|
+
n.get(i).getSource().addFeatures(w), me(i, d, c, u), d.forEach((b) => {
|
|
463
|
+
const _ = ue(i, u, b);
|
|
464
|
+
e.addOverlay(_);
|
|
465
|
+
});
|
|
466
|
+
}, de = (i) => {
|
|
467
|
+
const c = new Feature({
|
|
468
|
+
geometry: new Point(i.centerPoint),
|
|
469
|
+
data: i
|
|
470
|
+
});
|
|
471
|
+
c.set("type", "track_point"), c.set("trackId", i.id), c.set("data", i);
|
|
472
|
+
let d = [
|
|
473
|
+
...fe(i, u)
|
|
474
|
+
];
|
|
475
|
+
return (i.index === 0 || i.index === l[i.id].length - 1) && (d = [...ve(i)], c.set("type", "track_begin")), i.state !== void 0 && i.state !== null && (d = [...ye(i)], c.set("type", "track_icon")), c.setStyle(d), c;
|
|
476
|
+
}, ue = (i, c, d) => {
|
|
477
|
+
const w = document.createElement("div");
|
|
478
|
+
w.className = "track-overlay-label", w.style.position = "relative", w.style.backgroundColor = "rgba(255,255,255,0.8)", w.style.border = `1px solid ${c}`, w.style.fontSize = "12px", w.innerHTML = `
|
|
479
|
+
<span>${d.time}</span>
|
|
480
|
+
<svg
|
|
481
|
+
style="position: absolute;left: -20px;top: 0;"
|
|
482
|
+
viewBox="0 0 20 20"
|
|
483
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
484
|
+
width="20"
|
|
485
|
+
height="20">
|
|
486
|
+
<line x1="0" y1="20"
|
|
487
|
+
x2="20" y2="0"
|
|
488
|
+
stroke="${c}"
|
|
489
|
+
stroke-width="1" />
|
|
490
|
+
`;
|
|
491
|
+
const M = new Overlay({
|
|
492
|
+
element: w,
|
|
493
|
+
position: fromLonLat(d.center),
|
|
494
|
+
positioning: "top-left",
|
|
495
|
+
offset: [20, -20],
|
|
496
|
+
stopEvent: !1,
|
|
497
|
+
className: "track-label-time-overlay"
|
|
498
|
+
});
|
|
499
|
+
return M.set("class", "track-label-overlay"), M.set("trackId", i), M;
|
|
500
|
+
}, re = () => {
|
|
501
|
+
const i = e == null ? void 0 : e.getOverlays().getArray(), c = i == null ? void 0 : i.filter((d) => d.get("class") === "track-label-overlay");
|
|
502
|
+
c && c.length > 0 && c.forEach((d) => {
|
|
503
|
+
d.setPosition(void 0), d.dispose();
|
|
504
|
+
});
|
|
505
|
+
}, ge = (i) => {
|
|
506
|
+
const c = n.get(i).getSource();
|
|
507
|
+
c.forEachFeature((d) => {
|
|
508
|
+
d.get("type") !== "line" && c.removeFeature(d);
|
|
509
|
+
});
|
|
510
|
+
}, fe = (i, c) => (`${i.time}`, [
|
|
511
|
+
new Style({
|
|
512
|
+
// 扩大交互热区
|
|
513
|
+
image: new CircleStyle({
|
|
514
|
+
stroke: new Stroke({ color: "rgba(0, 0, 0, 0.01)", width: 20 }),
|
|
515
|
+
radius: 3
|
|
516
|
+
})
|
|
517
|
+
}),
|
|
518
|
+
// 轨迹点样式
|
|
519
|
+
new Style({
|
|
520
|
+
image: new CircleStyle({
|
|
521
|
+
fill: new Fill({ color: c }),
|
|
522
|
+
stroke: new Stroke({ color: "#fff", width: 2 }),
|
|
523
|
+
radius: 3
|
|
524
|
+
})
|
|
525
|
+
})
|
|
526
|
+
// textStyle,
|
|
527
|
+
]), ye = (i) => {
|
|
528
|
+
const c = "#E31818", d = "#1890FF", w = "", M = new Style({
|
|
529
|
+
text: new Text({
|
|
530
|
+
font: "Normal 22px map-iconfont",
|
|
531
|
+
text: getIconFont(w),
|
|
532
|
+
offsetY: -10,
|
|
533
|
+
fill: new Fill({
|
|
534
|
+
color: Number(i.state) === 0 ? c : Number(i.state) === 1 ? d : ""
|
|
535
|
+
})
|
|
536
|
+
}),
|
|
537
|
+
zIndex: 99
|
|
538
|
+
}), _ = getIconStyle(""), A = getIconStyle(""), B = [];
|
|
539
|
+
return Number(i.state) === 0 ? B.push(_) : Number(i.state) === 1 && B.push(A), B.push(M), B;
|
|
540
|
+
}, me = (i, c, d, w) => {
|
|
541
|
+
const M = c || [], b = c.length;
|
|
542
|
+
b || (M.push(d[0]), M.push(d[d.length - 1]));
|
|
543
|
+
const _ = [];
|
|
544
|
+
for (let A = 0; A < b - 1; A++) {
|
|
545
|
+
let B;
|
|
546
|
+
const q = c[A], k = (c[A + 1].index + q.index) / 2;
|
|
547
|
+
if (k % 2 === 0)
|
|
548
|
+
B = d[k].centerPoint;
|
|
549
|
+
else {
|
|
550
|
+
const G = d[Math.floor(k)], j = d[Math.ceil(k)];
|
|
551
|
+
if (G && j) {
|
|
552
|
+
const [W, J] = G.centerPoint, [I, ee] = j.centerPoint;
|
|
553
|
+
B = [(W + I) / 2, (J + ee) / 2];
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
if (B) {
|
|
557
|
+
const G = new Feature({
|
|
558
|
+
geometry: new Point(B)
|
|
559
|
+
});
|
|
560
|
+
G.set("type", "track_arrow"), G.setStyle(
|
|
561
|
+
new Style({
|
|
562
|
+
text: new Text({
|
|
563
|
+
font: "700 12px map-iconfont",
|
|
564
|
+
text: getIconFont(""),
|
|
565
|
+
fill: new Fill({ color: w }),
|
|
566
|
+
// 设置箭头旋转 角度转为弧度
|
|
567
|
+
rotation: le(
|
|
568
|
+
c[A].center,
|
|
569
|
+
c[A + 1].center
|
|
570
|
+
) * (Math.PI / 180)
|
|
571
|
+
})
|
|
572
|
+
})
|
|
573
|
+
), _.push(G);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
const O = n.get(i).getSource();
|
|
577
|
+
O == null || O.addFeatures(_);
|
|
578
|
+
}, ne = (i) => {
|
|
579
|
+
var b, _;
|
|
580
|
+
const c = e.getView(), d = (b = n == null ? void 0 : n.get(i)) == null ? void 0 : b.getSource(), w = p || (i ? d == null ? void 0 : d.getFeatureById(i) : null);
|
|
581
|
+
if (!w) return;
|
|
582
|
+
const M = (_ = w == null ? void 0 : w.getGeometry()) == null ? void 0 : _.getExtent();
|
|
583
|
+
if (M != null && M.length)
|
|
584
|
+
try {
|
|
585
|
+
const O = buffer(M, Math.max(M[2] - M[0], M[3] - M[1]) * 0.02);
|
|
586
|
+
c.fit(O);
|
|
587
|
+
} catch (O) {
|
|
588
|
+
console.log(O);
|
|
589
|
+
}
|
|
590
|
+
}, ve = (i) => {
|
|
591
|
+
const c = "", M = i.index === 0 ? "#fcdc3f" : "#ff0000";
|
|
592
|
+
return [new Style({
|
|
593
|
+
text: new Text({
|
|
594
|
+
font: "Normal 14px map-iconfont",
|
|
595
|
+
text: getIconFont(c),
|
|
596
|
+
fill: new Fill({ color: M })
|
|
597
|
+
}),
|
|
598
|
+
zIndex: 101
|
|
599
|
+
})];
|
|
600
|
+
}, he = () => {
|
|
601
|
+
console.log("清除所有的轨迹-----"), U(), n.forEach((c) => {
|
|
602
|
+
var d;
|
|
603
|
+
(d = c.getSource()) == null || d.clear(), e == null || e.removeLayer(c);
|
|
604
|
+
}), Object.keys(l).forEach((c) => {
|
|
605
|
+
n.delete(c), delete l[c];
|
|
606
|
+
}), Z = !1, re();
|
|
607
|
+
}, we = (i) => {
|
|
608
|
+
const c = n.get(i || s);
|
|
609
|
+
c == null || c.setVisible(!1);
|
|
610
|
+
const d = e.getOverlays().getArray();
|
|
611
|
+
for (let w = 0; w < d.length; ) {
|
|
612
|
+
const M = d[w];
|
|
613
|
+
M.get("class") === "track-label-overlay" ? (M.setPosition(void 0), e.removeOverlay(M)) : w++;
|
|
614
|
+
}
|
|
615
|
+
U();
|
|
616
|
+
}, pe = (i, c = LENGTH_UNIT.NM) => {
|
|
617
|
+
const d = {
|
|
618
|
+
id: i,
|
|
619
|
+
length: "--"
|
|
620
|
+
}, M = (l[i] || []).map(
|
|
621
|
+
(_) => transform([_.lon, _.lat], projection.data, projection.mercator)
|
|
622
|
+
), b = new LineString(M);
|
|
623
|
+
return d.length = formatLength(b, c) || "--", d;
|
|
624
|
+
}, Le = (i, c) => {
|
|
625
|
+
xe(String(i), c);
|
|
626
|
+
}, xe = (i, c) => {
|
|
627
|
+
const d = l[String(i)], w = d == null ? void 0 : d.map((M) => [M.lon, M.lat]);
|
|
628
|
+
w && ke(w, c);
|
|
629
|
+
}, te = new Style({
|
|
630
|
+
text: new Text({
|
|
631
|
+
font: "700 20px map-iconfont",
|
|
632
|
+
text: getIconFont(""),
|
|
633
|
+
fill: new Fill({ color: "#ff0000" }),
|
|
634
|
+
rotation: 0
|
|
635
|
+
// 初始旋转角度
|
|
636
|
+
})
|
|
637
|
+
}), Me = (i, c) => {
|
|
638
|
+
var k, G;
|
|
639
|
+
const d = Number(50 * c), w = ((k = i.frameState) == null ? void 0 : k.time) ?? Date.now(), M = w - v;
|
|
640
|
+
if (T = (T + d * M / 1e6) % 2, v = w, T >= 1) {
|
|
641
|
+
U();
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
644
|
+
const b = r.getCoordinateAt(
|
|
645
|
+
T > 1 ? 2 - T : T
|
|
646
|
+
), _ = r.getCoordinateAt(
|
|
647
|
+
T > 1 ? T - 0.01 : T
|
|
648
|
+
), O = r.getCoordinateAt(
|
|
649
|
+
T > 1 ? 2 - T : T + 0.01
|
|
650
|
+
), B = le(
|
|
651
|
+
mercatorToLonLat(_, "array"),
|
|
652
|
+
mercatorToLonLat(O, "array")
|
|
653
|
+
) * Math.PI / 180;
|
|
654
|
+
(G = te.getText()) == null || G.setRotation(B), m.setCoordinates(b);
|
|
655
|
+
const q = getVectorContext(i);
|
|
656
|
+
q.setStyle(te), q.drawGeometry(m), e == null || e.render();
|
|
657
|
+
}, be = () => {
|
|
658
|
+
var i;
|
|
659
|
+
V = !0, v = Date.now(), T = 0, m = ((i = y.getGeometry()) == null ? void 0 : i.clone()) || new Point([0, 0]), o && (g == null || g.on("postrender", o)), F == null || F.setGeometry(void 0);
|
|
660
|
+
}, U = () => {
|
|
661
|
+
V && (V = !1, F == null || F.setGeometry(void 0), o && g && g.un("postrender", o), g && (e == null || e.removeLayer(g)), g = null, F = null);
|
|
662
|
+
}, ke = (i, c) => {
|
|
663
|
+
V && U(), t = new Polyline({
|
|
664
|
+
factor: 1e6
|
|
665
|
+
}).writeGeometry(new LineString(i)), r = new Polyline({
|
|
666
|
+
factor: 1e6
|
|
667
|
+
}).readGeometry(t, {
|
|
668
|
+
dataProjection: projection.data,
|
|
669
|
+
featureProjection: projection.mercator
|
|
670
|
+
}), y = new Feature({
|
|
671
|
+
type: "icon",
|
|
672
|
+
geometry: new Point(r.getFirstCoordinate())
|
|
673
|
+
});
|
|
674
|
+
const d = y.getGeometry();
|
|
675
|
+
m = d ? d.clone() : new Point([0, 0]), F = new Feature({
|
|
676
|
+
type: "geoMarker",
|
|
677
|
+
style: te,
|
|
678
|
+
geometry: m
|
|
679
|
+
}), g = new VectorLayer({
|
|
680
|
+
source: new VectorSource({
|
|
681
|
+
features: [F]
|
|
682
|
+
})
|
|
683
|
+
}), e == null || e.addLayer(g), o = (w) => Me(w, c), be();
|
|
684
|
+
}, le = (i, c, d) => {
|
|
685
|
+
function w(k) {
|
|
686
|
+
return 180 * (k % (2 * Math.PI)) / Math.PI;
|
|
687
|
+
}
|
|
688
|
+
function M(k) {
|
|
689
|
+
return k % 360 * Math.PI / 180;
|
|
690
|
+
}
|
|
691
|
+
function b(k) {
|
|
692
|
+
var G;
|
|
693
|
+
if (!k) throw new Error("Coordinate is required");
|
|
694
|
+
if (!Array.isArray(k)) {
|
|
695
|
+
if ((k == null ? void 0 : k.type) === "Feature" && (k == null ? void 0 : k.geometry) !== null && ((G = k == null ? void 0 : k.geometry) == null ? void 0 : G.type) === "Point")
|
|
696
|
+
return k == null ? void 0 : k.geometry.coordinates;
|
|
697
|
+
if (k.type === "Point") return (k == null ? void 0 : k.coordinates) || [];
|
|
698
|
+
}
|
|
699
|
+
if (Array.isArray(k) && k.length >= 2 && !Array.isArray(k[0]) && !Array.isArray(k[1]))
|
|
700
|
+
return k;
|
|
701
|
+
throw new Error(
|
|
702
|
+
"Coordinate must be GeoJSON Point or an Array of numbers"
|
|
703
|
+
);
|
|
704
|
+
}
|
|
705
|
+
function _(k, G, j = {}) {
|
|
706
|
+
if (j.final)
|
|
707
|
+
return function(Te, Se) {
|
|
708
|
+
return (_(Se, Te) + 180) % 360;
|
|
709
|
+
}(k, G);
|
|
710
|
+
const W = b(k), J = b(G), I = M(W[0]), ee = M(J[0]), se = M(W[1]), oe = M(J[1]), Ce = Math.sin(ee - I) * Math.cos(oe), Ee = Math.cos(se) * Math.sin(oe) - Math.sin(se) * Math.cos(oe) * Math.cos(ee - I);
|
|
711
|
+
return w(Math.atan2(Ce, Ee));
|
|
712
|
+
}
|
|
713
|
+
function O(k) {
|
|
714
|
+
return !isNaN(k) && k !== null && !Array.isArray(k);
|
|
715
|
+
}
|
|
716
|
+
function A(k, G = {}, j = {}) {
|
|
717
|
+
return k || console.log("Coordinates are required"), Array.isArray(k) || console.log("Coordinates must be an Array"), k.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (!O(k[0]) || !O(k[1])) && console.log("Coordinates must contain numbers"), B({ type: "Point", coordinates: k }, G, j);
|
|
718
|
+
}
|
|
719
|
+
function B(k, G = {}, j = {}) {
|
|
720
|
+
const W = {
|
|
721
|
+
type: "Feature",
|
|
722
|
+
id: "",
|
|
723
|
+
properties: {},
|
|
724
|
+
bbox: {},
|
|
725
|
+
geometry: {}
|
|
726
|
+
};
|
|
727
|
+
return j.id !== void 0 && (W.id = j.id), j.bbox && (W.bbox = j.bbox), W.properties = G, W.geometry = k, W;
|
|
728
|
+
}
|
|
729
|
+
const q = _(A(i), A(c), d);
|
|
730
|
+
return q < 0 ? 360 + q : q;
|
|
731
|
+
};
|
|
732
|
+
return {
|
|
733
|
+
render: x,
|
|
734
|
+
remove: he,
|
|
735
|
+
play: Le,
|
|
736
|
+
setCenter: ne,
|
|
737
|
+
close: we,
|
|
738
|
+
getLength: pe,
|
|
739
|
+
handleTrackMapEvent: K,
|
|
740
|
+
reRenderTrackLine: S
|
|
741
|
+
};
|
|
742
|
+
};
|
|
743
|
+
function useShipOverlay(e) {
|
|
744
|
+
const n = ref(null);
|
|
745
|
+
ref(null);
|
|
746
|
+
const l = computed(() => ({
|
|
747
|
+
"--overlay-color": e.color || "#FFF",
|
|
748
|
+
"--bg-color": e.selected ? e.color : "#ffffff",
|
|
749
|
+
position: "relative",
|
|
750
|
+
"pointer-events": "none"
|
|
751
|
+
})), s = computed(() => ({
|
|
752
|
+
position: "relative",
|
|
753
|
+
"border-radius": "1px",
|
|
754
|
+
"background-color": "var(--bg-color)",
|
|
755
|
+
color: "#000",
|
|
756
|
+
"padding-right": "5px",
|
|
757
|
+
font: "500 Normal 12px",
|
|
758
|
+
"font-size": "12px",
|
|
759
|
+
"box-shadow": "0 2px 10px rgba(0, 0, 0, 0.2)",
|
|
760
|
+
"white-space": "nowrap",
|
|
761
|
+
border: "1px solid #FFF",
|
|
762
|
+
"pointer-events": "auto",
|
|
763
|
+
transition: "background-color 0.5s ease, border 0.5s ease",
|
|
764
|
+
"z-index": "1",
|
|
765
|
+
display: "flex",
|
|
766
|
+
"align-items": "center",
|
|
767
|
+
animation: e.selected ? "blink 1.5s ease-in-out infinite" : "none"
|
|
768
|
+
// 动画开关
|
|
769
|
+
})), a = computed(() => ({
|
|
770
|
+
width: "14px",
|
|
771
|
+
height: "14px",
|
|
772
|
+
margin: "1px 5px 1px 1px",
|
|
773
|
+
"background-color": "var(--bg-color)"
|
|
774
|
+
})), o = computed(() => ({
|
|
775
|
+
position: "absolute",
|
|
776
|
+
top: "0px",
|
|
777
|
+
color: "var(--overlay-color)",
|
|
778
|
+
"pointer-events": "none",
|
|
779
|
+
transform: "translateY(-1px)",
|
|
780
|
+
"z-index": "0",
|
|
781
|
+
width: "20px",
|
|
782
|
+
height: "20px",
|
|
783
|
+
overflow: "visible",
|
|
784
|
+
left: "-20px"
|
|
785
|
+
}));
|
|
786
|
+
return () => h("div", {
|
|
787
|
+
ref: n,
|
|
788
|
+
class: "ship-overlay-container",
|
|
789
|
+
style: l.value
|
|
790
|
+
}, [
|
|
791
|
+
h(
|
|
792
|
+
"div",
|
|
793
|
+
{
|
|
794
|
+
class: "ship-overlay-content",
|
|
795
|
+
style: s.value
|
|
796
|
+
},
|
|
797
|
+
[
|
|
798
|
+
h("div", {
|
|
799
|
+
style: e.selected ? a.value : {}
|
|
800
|
+
}, ""),
|
|
801
|
+
h("div", {
|
|
802
|
+
class: "text"
|
|
803
|
+
}, e.name || "未命名船舶"),
|
|
804
|
+
h("div", {
|
|
805
|
+
class: "icons",
|
|
806
|
+
style: {
|
|
807
|
+
color: "#3370ff"
|
|
808
|
+
}
|
|
809
|
+
}, [
|
|
810
|
+
e.existDevice ? h("i", {
|
|
811
|
+
class: "iconfont icon-Frame-19",
|
|
812
|
+
style: {
|
|
813
|
+
fontSize: "12px",
|
|
814
|
+
marginRight: "2px",
|
|
815
|
+
marginLeft: "2px"
|
|
816
|
+
}
|
|
817
|
+
}) : "",
|
|
818
|
+
e.existMobile ? h("i", {
|
|
819
|
+
class: "iconfont icon-Frame13",
|
|
820
|
+
style: {
|
|
821
|
+
fontSize: "12px",
|
|
822
|
+
marginRight: "2px"
|
|
823
|
+
}
|
|
824
|
+
}) : "",
|
|
825
|
+
e.existWaterGauge ? h("i", {
|
|
826
|
+
class: "iconfont icon-a-Frame7",
|
|
827
|
+
style: {
|
|
828
|
+
fontSize: "12px"
|
|
829
|
+
}
|
|
830
|
+
}) : ""
|
|
831
|
+
])
|
|
832
|
+
]
|
|
833
|
+
),
|
|
834
|
+
h("svg", {
|
|
835
|
+
class: "ship-overlay-line",
|
|
836
|
+
style: o.value,
|
|
837
|
+
viewBox: "0 0 20 20",
|
|
838
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
839
|
+
}, [
|
|
840
|
+
h("line", {
|
|
841
|
+
x1: "0",
|
|
842
|
+
y1: "20",
|
|
843
|
+
x2: "20",
|
|
844
|
+
y2: "4",
|
|
845
|
+
stroke: "white",
|
|
846
|
+
"stroke-width": "1"
|
|
847
|
+
})
|
|
848
|
+
])
|
|
849
|
+
]);
|
|
850
|
+
}
|
|
851
|
+
ref([]);
|
|
852
|
+
function addOverlay(e, n, l, s) {
|
|
853
|
+
if (n) {
|
|
854
|
+
const a = new Overlay({
|
|
855
|
+
element: l,
|
|
856
|
+
positioning: "top-left",
|
|
857
|
+
id: "label-" + (s == null ? void 0 : s.id),
|
|
858
|
+
offset: [20, -20],
|
|
859
|
+
autoPan: !1,
|
|
860
|
+
position: n,
|
|
861
|
+
className: s.blinking ? "ship-label-overlay-blinking" : "ship-label-overlay"
|
|
862
|
+
});
|
|
863
|
+
a.set("class", "zh-map-ship-overlay"), e.addOverlay(a);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
const getShipDirectPath = (e) => {
|
|
867
|
+
const { spd: n, hdg: l, cog: s } = e;
|
|
868
|
+
return n ? l !== null && +l != 511 && s !== null ? s - +l >= 3 ? SHIP_DIRECT.right : s - +l <= -3 ? SHIP_DIRECT.left : SHIP_DIRECT.front : SHIP_DIRECT.front : "";
|
|
869
|
+
}, createShipStyle = (e, n) => {
|
|
870
|
+
const { shipData: l } = n.getProperties(), s = getShipType(e), a = getShipScale(e, l, s);
|
|
871
|
+
return initShipStyle(n, a, s);
|
|
872
|
+
}, getShipType = (e) => {
|
|
873
|
+
const n = e == null ? void 0 : e.getView().getZoom();
|
|
874
|
+
return n <= MAP_ZOOM.shipModelMax && n >= MAP_ZOOM.shipTriggleMin ? "ship" : "triangle";
|
|
875
|
+
}, getShipScale = (e, n, l) => {
|
|
876
|
+
if (l === "ship") {
|
|
877
|
+
const { len: s, wid: a } = n, o = 97, f = 20, t = 1 / (e == null ? void 0 : e.getView().getResolution()), r = s * t / o, y = a * t / f;
|
|
878
|
+
return Math.max(r, y);
|
|
879
|
+
}
|
|
880
|
+
return MAP_ZOOM.scaleNum;
|
|
881
|
+
}, initShipStyle = (e, n, l) => {
|
|
882
|
+
const { color: s, direct: a, isHighlight: o, shipData: f } = e.getProperties(), E = ((f == null ? void 0 : f.cog) - 90 + 360) % 360;
|
|
883
|
+
return new Style({
|
|
884
|
+
image: new Icon({
|
|
885
|
+
src: t(),
|
|
886
|
+
scale: n || MAP_ZOOM.scaleNum,
|
|
887
|
+
anchor: [0.5, 0.5],
|
|
888
|
+
rotation: E * Math.PI / 180,
|
|
889
|
+
rotateWithView: !1
|
|
890
|
+
})
|
|
891
|
+
});
|
|
892
|
+
function t() {
|
|
893
|
+
return `data:image/svg+xml;utf8,${encodeURIComponent(r())}`;
|
|
894
|
+
}
|
|
895
|
+
function r() {
|
|
896
|
+
switch (l) {
|
|
897
|
+
case "triangle":
|
|
898
|
+
return `<svg width="41" height="24" viewBox="0 0 41 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
899
|
+
<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"
|
|
900
|
+
fill="${s}" stroke="${o ? "#FF2424" : "black"}" stroke-width="${o ? "2" : "0.578947"}" />
|
|
901
|
+
<!--path船航向左边或者向前-->
|
|
902
|
+
${a === SHIP_DIRECT.left && `<path d="M30 12L40 12L40 8" stroke="${o ? "#FF2424" : "black"}" stroke-width="2"/>`}
|
|
903
|
+
<!--path船航向右边-->
|
|
904
|
+
${a === SHIP_DIRECT.right && `<path d="M30 12L40 12L40 16" stroke="${o ? "#FF2424" : "black"}" stroke-width="2"/>`}
|
|
905
|
+
<!--path黑线无左右-->
|
|
906
|
+
${a === SHIP_DIRECT.front && `<path d="M30 12L40 12" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
907
|
+
</svg>
|
|
908
|
+
`;
|
|
909
|
+
case "ship":
|
|
910
|
+
return `<svg width="97" height="20" viewBox="0 0 97 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
911
|
+
<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"
|
|
912
|
+
fill="${s}" stroke="${o ? "#FF2424" : "black"}" stroke-width="${o ? "4" : "0.578947"}"/>
|
|
913
|
+
${a === SHIP_DIRECT.left && `<path d="M86 10L96 10L96 6" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
914
|
+
${a === SHIP_DIRECT.right && `<path d="M86 10L96 10L96 14" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
915
|
+
${a === SHIP_DIRECT.front && `<path d="M86 10L96 10" stroke="${o ? "#FF2424" : "black"}" stroke-width="1.5"/>`}
|
|
916
|
+
</svg>
|
|
917
|
+
`;
|
|
918
|
+
default:
|
|
919
|
+
return "";
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
}, selectedShipStyle = (e, n) => {
|
|
923
|
+
const l = selectedShipElement(e, n), s = n.id, { lon: a, lat: o } = n, f = new Overlay({
|
|
924
|
+
element: l,
|
|
925
|
+
position: fromLonLat([a, o]),
|
|
926
|
+
id: "selected-" + s,
|
|
927
|
+
positioning: "center-center",
|
|
928
|
+
offset: [0, 5],
|
|
929
|
+
className: "ship-selected-overlay"
|
|
930
|
+
});
|
|
931
|
+
return f.set("class", "ship-overlay-selected"), f;
|
|
932
|
+
}, selectedShipElement = (e, n) => {
|
|
933
|
+
const l = getShipType(e), s = getShipScale(e, n, l), a = l === "ship" ? 109 : 49, o = `
|
|
934
|
+
<svg style="transform:scale(${s});" xmlns="http://www.w3.org/2000/svg" width="${a}" height="${a}" viewBox="0 0 49 49" fill="none">
|
|
935
|
+
<path d="M1.99982 46.9998L1.99982 1.99982L46.9998 1.99982L46.9998 46.9998L1.99982 46.9998Z" fill="#FF2424" fill-opacity="0.2"/>
|
|
936
|
+
<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"/>
|
|
937
|
+
</svg>
|
|
938
|
+
`, f = document.createElement("div");
|
|
939
|
+
return f.className = "ship-overlay-selected", f.innerHTML = o, f;
|
|
940
|
+
}, createLabelStyle = (e, n) => {
|
|
941
|
+
const { shipData: l, blinking: s } = n.getProperties(), { lon: a, lat: o } = l, f = createLabelElement(n);
|
|
942
|
+
a && o && addOverlay(e, fromLonLat([a, o]), f, { ...l, blinking: s });
|
|
943
|
+
}, createLabelElement = (e) => {
|
|
944
|
+
const n = document.createElement("div");
|
|
945
|
+
n.className = "ship-overlay-box", n.style.position = "relative";
|
|
946
|
+
const l = e.getProperties(), { shipData: s, blinking: a, blinkingColor: o, name: f } = l, { lon: E, lat: t } = s, r = createVNode({
|
|
947
|
+
setup() {
|
|
948
|
+
return useShipOverlay({
|
|
949
|
+
selected: a,
|
|
950
|
+
name: f,
|
|
951
|
+
color: o,
|
|
952
|
+
existDevice: s == null ? void 0 : s.existDevice,
|
|
953
|
+
existMobile: s == null ? void 0 : s.existMobile,
|
|
954
|
+
existWaterGauge: s == null ? void 0 : s.existWaterGauge
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
});
|
|
958
|
+
return render(r, n), n;
|
|
959
|
+
}, getRightIcons = (e) => {
|
|
960
|
+
const n = [];
|
|
961
|
+
return e.existDevice && n.push(""), e.existMobile && n.push(""), e.existWaterGauge && n.push(""), n;
|
|
962
|
+
}, createLabelFeatureStyle = (e) => {
|
|
963
|
+
const { name: n, rightIcons: l } = e.getProperties(), s = `${n} ${l.map((y) => getIconFont(y)).join(" ")} `, a = [20, -20], f = -Math.atan2(-a[1], a[0]), E = Math.sqrt(a[0] ** 2 + a[1] ** 2), t = `<svg viewBox="0 0 ${E + 10} 20" width="${E + 10}" height="20" xmlns="http://www.w3.org/2000/svg" >
|
|
964
|
+
<line x1="0" y1="0" x2="${10 + E}" y2="10" stroke="white" stroke-width="1"></line>
|
|
965
|
+
</svg>`;
|
|
966
|
+
return [new Style({
|
|
967
|
+
text: new Text({
|
|
968
|
+
text: s,
|
|
969
|
+
fill: new Fill({ color: "#000000" }),
|
|
970
|
+
stroke: new Stroke({ color: "#ffffff", width: 1 }),
|
|
971
|
+
font: "Normal 12px map-iconfont",
|
|
972
|
+
offsetX: a[0],
|
|
973
|
+
offsetY: a[1],
|
|
974
|
+
backgroundFill: new Fill({ color: "#ffffff" }),
|
|
975
|
+
scale: 1
|
|
976
|
+
}),
|
|
977
|
+
image: new Icon({
|
|
978
|
+
src: `data:image/svg+xml;utf8,${encodeURIComponent(t)}`,
|
|
979
|
+
displacement: [16, -10],
|
|
980
|
+
anchor: [0.5, 0.5],
|
|
981
|
+
rotation: f,
|
|
982
|
+
rotateWithView: !1
|
|
983
|
+
})
|
|
984
|
+
})];
|
|
985
|
+
}, useShipManager = (e) => {
|
|
986
|
+
let n = null, l = null;
|
|
987
|
+
const s = new VectorSource(), a = new VectorImageLayer({
|
|
988
|
+
source: s,
|
|
989
|
+
className: "zh-map--ship-layer",
|
|
990
|
+
renderBuffer: 300,
|
|
991
|
+
zIndex: 101
|
|
992
|
+
}), o = new VectorSource(), f = new VectorLayer({
|
|
993
|
+
source: o,
|
|
994
|
+
className: "zh-map--ship-label-layer",
|
|
995
|
+
zIndex: 102,
|
|
996
|
+
updateWhileInteracting: !1,
|
|
997
|
+
updateWhileAnimating: !1,
|
|
998
|
+
declutter: !0
|
|
999
|
+
});
|
|
1000
|
+
e == null || e.addLayer(a), e == null || e.addLayer(f);
|
|
1001
|
+
let E = "", t = {}, r = {};
|
|
1002
|
+
const y = (u) => {
|
|
1003
|
+
if (!u || !e) return;
|
|
1004
|
+
const L = (l == null ? void 0 : l.id) || (n == null ? void 0 : n.get("id"));
|
|
1005
|
+
if (l) {
|
|
1006
|
+
const S = u.filter((P) => P.id === L);
|
|
1007
|
+
S.length === 0 ? u.push(l) : l = S[0];
|
|
1008
|
+
}
|
|
1009
|
+
V(), v(!0), H(u), F();
|
|
1010
|
+
}, m = (u) => {
|
|
1011
|
+
const L = (l == null ? void 0 : l.id) || (n == null ? void 0 : n.get("id")), S = fromLonLat([u == null ? void 0 : u.lon, u == null ? void 0 : u.lat]), P = u.fill || "#04C900", x = getShipDirectPath(u), N = new Feature({
|
|
1012
|
+
geometry: new Point(S),
|
|
1013
|
+
// 船舶数据
|
|
1014
|
+
shipData: u,
|
|
1015
|
+
id: u.id,
|
|
1016
|
+
name: u.cnname || "未命名船舶",
|
|
1017
|
+
selected: u.id === L,
|
|
1018
|
+
// 图标
|
|
1019
|
+
rightIcons: getRightIcons(u),
|
|
1020
|
+
// 是否闪烁
|
|
1021
|
+
blinking: t[u.id] || !1,
|
|
1022
|
+
// 闪烁颜色
|
|
1023
|
+
blinkingColor: r[u.id] || "",
|
|
1024
|
+
// 船舶颜色
|
|
1025
|
+
color: P,
|
|
1026
|
+
// 船艏向的方向
|
|
1027
|
+
direct: x,
|
|
1028
|
+
// shipType,
|
|
1029
|
+
// scale:scaleNum,
|
|
1030
|
+
// rotation,
|
|
1031
|
+
// 高亮
|
|
1032
|
+
isHighlight: !1
|
|
1033
|
+
});
|
|
1034
|
+
return N.set("clickGeometry", new Circle(S)), N;
|
|
1035
|
+
}, F = async () => {
|
|
1036
|
+
if (!l || !e) return;
|
|
1037
|
+
let L = e.getOverlays().getArray().find((S) => S.get("class") == "ship-overlay-selected");
|
|
1038
|
+
if (console.log("selectedOverlay----------", L), L) {
|
|
1039
|
+
const S = selectedShipElement(e, l);
|
|
1040
|
+
await L.setElement(S), await L.setPosition(fromLonLat([l.lon, l.lat]));
|
|
1041
|
+
} else
|
|
1042
|
+
L = selectedShipStyle(e, l), L && e.addOverlay(L);
|
|
1043
|
+
setTimeout(() => {
|
|
1044
|
+
var S;
|
|
1045
|
+
L && ((S = L.get("element")) != null && S.parentElement) && (L.get("element").parentElement.style.display = "block");
|
|
1046
|
+
}, 20);
|
|
1047
|
+
}, V = () => {
|
|
1048
|
+
e && s && (s.clear(), o.clear(), v());
|
|
1049
|
+
}, v = (u) => {
|
|
1050
|
+
const L = e.getOverlays().getArray().filter((S) => S.get("class") == "zh-map-ship-overlay");
|
|
1051
|
+
if (L && L.length > 0) {
|
|
1052
|
+
for (let S = 0; S < L.length; S++)
|
|
1053
|
+
if (!u && L[S].get("class") !== "ship-overlay-selected") {
|
|
1054
|
+
const P = L[S];
|
|
1055
|
+
P.setPosition(void 0), e.removeOverlay(P), P.dispose();
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
}, g = (u, L) => {
|
|
1059
|
+
t = u, r = L;
|
|
1060
|
+
const S = e.getOverlays().getArray(), P = s.getFeatures();
|
|
1061
|
+
for (const x in t) {
|
|
1062
|
+
const N = t[x], D = S.find(($) => $.getId() === "label-" + x), z = P.find(($) => x === $.get("id"));
|
|
1063
|
+
if (D && z) {
|
|
1064
|
+
z.set("blinking", N), z.set("blinkingColor", r[x] || "");
|
|
1065
|
+
const $ = D.getElement(), R = createLabelElement(z), K = R.querySelector(".ship-overlay-line"), Q = $ == null ? void 0 : $.querySelector(".ship-overlay-line");
|
|
1066
|
+
$ && $ !== R && (Q && K && K.replaceWith(Q), D.setElement(R));
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
}, T = (u) => {
|
|
1070
|
+
if (!e) return;
|
|
1071
|
+
const L = s.getFeatures(), S = n ? n.get("id") : "", P = L.filter((D) => D.get("id") !== S), x = /* @__PURE__ */ new Map();
|
|
1072
|
+
u.forEach((D) => {
|
|
1073
|
+
x.set(D.id, !0);
|
|
1074
|
+
});
|
|
1075
|
+
const N = e.getOverlays().getArray();
|
|
1076
|
+
P.forEach((D) => {
|
|
1077
|
+
const z = D.get("id"), $ = N.find((R) => R.getId() === "label-" + z);
|
|
1078
|
+
if (!x.has(z))
|
|
1079
|
+
D.setStyle([]), $ && ($.get("element").style.visibility = "hidden");
|
|
1080
|
+
else {
|
|
1081
|
+
$ && ($.get("element").style.visibility = "visible");
|
|
1082
|
+
const R = D.getStyle();
|
|
1083
|
+
(R == null ? void 0 : R.length) == 0 && D.setStyle(createShipStyle(e, D));
|
|
1084
|
+
}
|
|
1085
|
+
});
|
|
1086
|
+
}, p = (u) => {
|
|
1087
|
+
if (u) {
|
|
1088
|
+
console.log("选中", u);
|
|
1089
|
+
const L = s.getFeatures().find((S) => S.get("id") === u.id);
|
|
1090
|
+
L && (n = L), l = u, F();
|
|
1091
|
+
} else
|
|
1092
|
+
console.log("取消选中"), l = null, n = null, Y();
|
|
1093
|
+
}, C = debounce((u, L, S) => {
|
|
1094
|
+
if (u) {
|
|
1095
|
+
const P = u.get("shipData"), x = u.get("id");
|
|
1096
|
+
if (e.getTargetElement().style.cursor = x ? "pointer" : "", L === "click" && (p(P), S && S(x)), L === "hover") {
|
|
1097
|
+
E && E !== x && Z(), E = x;
|
|
1098
|
+
const N = s.getFeatures().find((D) => D.get("id") === E);
|
|
1099
|
+
N == null || N.set("isHighlight", !0), N == null || N.setStyle(createShipStyle(e, N));
|
|
1100
|
+
}
|
|
1101
|
+
} else
|
|
1102
|
+
e.getTargetElement().style.cursor = "", Z();
|
|
1103
|
+
}, 10), Z = () => {
|
|
1104
|
+
const u = E ? s.getFeatures().find((L) => L.get("id") === E) : null;
|
|
1105
|
+
E = null, u == null || u.set("isHighlight", !1), u == null || u.setStyle(createShipStyle(e, u));
|
|
1106
|
+
}, Y = () => {
|
|
1107
|
+
try {
|
|
1108
|
+
const L = e.getOverlays().getArray().find((S) => S.get("class") == "ship-overlay-selected");
|
|
1109
|
+
L && L.setPosition(void 0);
|
|
1110
|
+
} catch (u) {
|
|
1111
|
+
console.log(u);
|
|
1112
|
+
}
|
|
1113
|
+
}, X = (u) => {
|
|
1114
|
+
const L = fromLonLat([u == null ? void 0 : u.lon, u == null ? void 0 : u.lat]), S = new Feature({
|
|
1115
|
+
geometry: new Point(L),
|
|
1116
|
+
name: u.cnname || "未命名船舶",
|
|
1117
|
+
// 图标
|
|
1118
|
+
rightIcons: getRightIcons(u)
|
|
1119
|
+
});
|
|
1120
|
+
S.set("id", u.id);
|
|
1121
|
+
const P = createLabelFeatureStyle(S);
|
|
1122
|
+
return S.setStyle(P), S;
|
|
1123
|
+
}, H = (u) => {
|
|
1124
|
+
const L = e.getView().getZoom();
|
|
1125
|
+
u.forEach((S) => {
|
|
1126
|
+
const P = m(S);
|
|
1127
|
+
if (P.setStyle(createShipStyle(e, P)), s.addFeature(P), (l == null ? void 0 : l.id) == S.id || L >= MAP_ZOOM.shipModelMin)
|
|
1128
|
+
if (t[S.id])
|
|
1129
|
+
createLabelStyle(e, P);
|
|
1130
|
+
else {
|
|
1131
|
+
const x = X(S);
|
|
1132
|
+
o.addFeature(x);
|
|
1133
|
+
}
|
|
1134
|
+
});
|
|
1135
|
+
};
|
|
1136
|
+
return {
|
|
1137
|
+
render: y,
|
|
1138
|
+
selected: p,
|
|
1139
|
+
filter: T,
|
|
1140
|
+
blinking: g,
|
|
1141
|
+
clear: V,
|
|
1142
|
+
handleShipMapEvent: C
|
|
1143
|
+
};
|
|
1144
|
+
}, useLayerManager = (e) => {
|
|
1145
|
+
const n = () => e == null ? void 0 : e.getLayers(), l = ref("vector"), s = () => l.value, a = (t) => {
|
|
1146
|
+
l.value = t;
|
|
1147
|
+
const r = n();
|
|
1148
|
+
r && (r == null || r.getArray().forEach((y) => {
|
|
1149
|
+
(y.className_ === "vector" || y.className_ === "satellite") && y.setVisible(y.className_ === t);
|
|
1150
|
+
}));
|
|
1151
|
+
}, o = ref(!1);
|
|
1152
|
+
return {
|
|
1153
|
+
getLayers: n,
|
|
1154
|
+
getGreenTileVisible: () => o.value,
|
|
1155
|
+
setGreenTileVisible: (t) => {
|
|
1156
|
+
if (t !== o.value) {
|
|
1157
|
+
if (t) {
|
|
1158
|
+
const r = n();
|
|
1159
|
+
if (!r.getArray().find((m) => m.className_ === "greenTile")) {
|
|
1160
|
+
const m = new TileLayer({
|
|
1161
|
+
source: new XYZ({ url: BASE_MAP_LINK.greenTile }),
|
|
1162
|
+
visible: t,
|
|
1163
|
+
zIndex: 2,
|
|
1164
|
+
className: "greenTile"
|
|
1165
|
+
});
|
|
1166
|
+
r.push(m);
|
|
1167
|
+
}
|
|
1168
|
+
} else {
|
|
1169
|
+
const r = n(), y = r.getArray().find((m) => m.className_ === "greenTile");
|
|
1170
|
+
y && r.remove(y);
|
|
1171
|
+
}
|
|
1172
|
+
o.value = t;
|
|
1173
|
+
}
|
|
1174
|
+
},
|
|
1175
|
+
getShowLayerType: s,
|
|
1176
|
+
setShowLayerType: a
|
|
1177
|
+
};
|
|
1178
|
+
}, usePropsManager = () => {
|
|
1179
|
+
const e = ref();
|
|
1180
|
+
return {
|
|
1181
|
+
setProps: (s) => {
|
|
1182
|
+
e.value = s;
|
|
1183
|
+
},
|
|
1184
|
+
getProps: () => e.value
|
|
1185
|
+
};
|
|
1186
|
+
}, usePositionManager = (e) => {
|
|
1187
|
+
const n = "zh-map-location-layer";
|
|
1188
|
+
let l, s, a = null, o = null;
|
|
1189
|
+
const f = (v) => {
|
|
1190
|
+
if (!(!v || v.length === 0)) {
|
|
1191
|
+
if (s || (s = new VectorSource()), s.clear(), o) {
|
|
1192
|
+
const g = v.find((T) => T.id === o.id);
|
|
1193
|
+
g ? o = g : v.push(o);
|
|
1194
|
+
}
|
|
1195
|
+
v.forEach((g) => {
|
|
1196
|
+
E(g);
|
|
1197
|
+
}), l || (l = new VectorLayer({
|
|
1198
|
+
className: n,
|
|
1199
|
+
source: s,
|
|
1200
|
+
zIndex: 100
|
|
1201
|
+
}), e == null || e.addLayer(l));
|
|
1202
|
+
}
|
|
1203
|
+
}, E = (v) => {
|
|
1204
|
+
const g = getZoom(), [T, p] = v.latLon.split(","), C = new Feature({
|
|
1205
|
+
geometry: new Point(fromLonLat([Number(T), Number(p)]))
|
|
1206
|
+
});
|
|
1207
|
+
C.setStyle(t(v, g, v.id === (o == null ? void 0 : o.id))), C.set("loactionData", v), s.addFeature(C);
|
|
1208
|
+
}, t = (v, g, T) => {
|
|
1209
|
+
const p = {
|
|
1210
|
+
image: new Icon({
|
|
1211
|
+
src: T && v.selectedPath || v.defaultPath,
|
|
1212
|
+
scale: 0.5 * g / 10
|
|
1213
|
+
})
|
|
1214
|
+
};
|
|
1215
|
+
return v.name && (p.text = new Text({
|
|
1216
|
+
text: v.name,
|
|
1217
|
+
font: "12px sans-serif",
|
|
1218
|
+
fill: new Fill({
|
|
1219
|
+
color: "#000000"
|
|
1220
|
+
}),
|
|
1221
|
+
backgroundFill: new Fill({
|
|
1222
|
+
color: "#FFFFFF"
|
|
1223
|
+
}),
|
|
1224
|
+
offsetY: 30
|
|
1225
|
+
})), new Style(p);
|
|
1226
|
+
}, r = () => {
|
|
1227
|
+
if (a) {
|
|
1228
|
+
const v = a.get("loactionData").id;
|
|
1229
|
+
s.getFeatures().forEach((g) => {
|
|
1230
|
+
g.get("loactionData").id !== v && s.removeFeature(g);
|
|
1231
|
+
});
|
|
1232
|
+
} else
|
|
1233
|
+
s.clear();
|
|
1234
|
+
}, y = () => {
|
|
1235
|
+
const v = a.get("loactionData"), g = getZoom();
|
|
1236
|
+
s.getFeatures().forEach((p) => {
|
|
1237
|
+
p.get("loactionData").id === v.id && (p == null || p.setStyle(t(v, g, !1)));
|
|
1238
|
+
}), o = null, a = null;
|
|
1239
|
+
}, m = (v) => {
|
|
1240
|
+
v ? (F(), V(v)) : clearSelectedPort();
|
|
1241
|
+
}, F = () => {
|
|
1242
|
+
if (a) {
|
|
1243
|
+
const v = a.get("loactionData"), g = getZoom();
|
|
1244
|
+
a.setStyle(t(v, g, !1));
|
|
1245
|
+
}
|
|
1246
|
+
}, V = (v) => {
|
|
1247
|
+
const g = s.getFeatures();
|
|
1248
|
+
o = v, a = g.find((T) => T.get("loactionData").id === v.id);
|
|
1249
|
+
};
|
|
1250
|
+
return {
|
|
1251
|
+
render: f,
|
|
1252
|
+
selected: m,
|
|
1253
|
+
clearSelected: y,
|
|
1254
|
+
clear: r
|
|
1255
|
+
};
|
|
1256
|
+
}, disableDoubleClickZoom = () => {
|
|
1257
|
+
getInstall().getInteractions().forEach((n) => {
|
|
1258
|
+
n instanceof DoubleClickZoom && n.setActive(!1);
|
|
1259
|
+
});
|
|
1260
|
+
}, enableDoubleClickZoom = () => {
|
|
1261
|
+
getInstall().getInteractions().forEach((n) => {
|
|
1262
|
+
n instanceof DoubleClickZoom && n.setActive(!0);
|
|
1263
|
+
});
|
|
1264
|
+
}, useDrawLineManager = (e, n) => {
|
|
1265
|
+
const l = ref([]), s = ref("km"), a = (P) => {
|
|
1266
|
+
s.value = P;
|
|
1267
|
+
};
|
|
1268
|
+
let o;
|
|
1269
|
+
const f = ref(!1), E = () => {
|
|
1270
|
+
y(), disableDoubleClickZoom(), v("pointer"), e.on("pointermove", V), e.getViewport().addEventListener("mouseout", () => {
|
|
1271
|
+
o && o.classList.add("hidden");
|
|
1272
|
+
}), T(), f.value = !0;
|
|
1273
|
+
};
|
|
1274
|
+
let t, r;
|
|
1275
|
+
const y = () => {
|
|
1276
|
+
t = new VectorSource(), r = new VectorLayer({
|
|
1277
|
+
source: t,
|
|
1278
|
+
zIndex: 1e3,
|
|
1279
|
+
style: {
|
|
1280
|
+
"fill-color": "rgba(255, 255, 255, 0.2)",
|
|
1281
|
+
"stroke-color": "#ffcc33",
|
|
1282
|
+
"stroke-width": 2,
|
|
1283
|
+
"circle-radius": 7,
|
|
1284
|
+
"circle-fill-color": "#ffcc33"
|
|
1285
|
+
}
|
|
1286
|
+
}), e == null || e.addLayer(r);
|
|
1287
|
+
};
|
|
1288
|
+
let m, F;
|
|
1289
|
+
const V = (P) => {
|
|
1290
|
+
if (P.dragging)
|
|
1291
|
+
return;
|
|
1292
|
+
let x = "点击选择起点";
|
|
1293
|
+
m && (x = "单击继续,双击结束"), o && (o.innerHTML = x, F.setPosition(P.coordinate), o.classList.remove("hidden"));
|
|
1294
|
+
}, v = (P) => {
|
|
1295
|
+
const x = e == null ? void 0 : e.getTargetElement();
|
|
1296
|
+
x && (x.style.cursor = P);
|
|
1297
|
+
};
|
|
1298
|
+
let g;
|
|
1299
|
+
const T = () => {
|
|
1300
|
+
g = new Draw({
|
|
1301
|
+
source: t,
|
|
1302
|
+
type: "LineString",
|
|
1303
|
+
style: new Style({
|
|
1304
|
+
fill: new Fill({
|
|
1305
|
+
color: "rgba(255, 255, 255, 0.2)"
|
|
1306
|
+
}),
|
|
1307
|
+
stroke: new Stroke({
|
|
1308
|
+
color: "rgba(255,204,51)",
|
|
1309
|
+
lineDash: [10, 10],
|
|
1310
|
+
width: 2
|
|
1311
|
+
}),
|
|
1312
|
+
image: new CircleStyle({
|
|
1313
|
+
radius: 5,
|
|
1314
|
+
stroke: new Stroke({
|
|
1315
|
+
color: "rgba(0, 0, 0, 0.7)"
|
|
1316
|
+
}),
|
|
1317
|
+
fill: new Fill({
|
|
1318
|
+
color: "rgba(255, 255, 255, 0.2)"
|
|
1319
|
+
})
|
|
1320
|
+
})
|
|
1321
|
+
}),
|
|
1322
|
+
// 添加条件函数,判断是否应该出发点绘制
|
|
1323
|
+
condition: (x) => x.originalEvent.target.tagName !== "DIV"
|
|
1324
|
+
}), e == null || e.addInteraction(g), Y(), X();
|
|
1325
|
+
let P;
|
|
1326
|
+
g.on("drawstart", function(x) {
|
|
1327
|
+
var D;
|
|
1328
|
+
m = x.feature, m.set("randomId", p());
|
|
1329
|
+
let N;
|
|
1330
|
+
P = (D = m.getGeometry()) == null ? void 0 : D.on("change", function(z) {
|
|
1331
|
+
const $ = z.target, R = computedDistance($, s.value);
|
|
1332
|
+
N = $.getLastCoordinate(), C && R && (C.innerHTML = R), Z.setPosition(N);
|
|
1333
|
+
});
|
|
1334
|
+
}), g.on("drawend", function() {
|
|
1335
|
+
var x, N, D;
|
|
1336
|
+
if (C && (C.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), C != null && C.innerHTML) {
|
|
1337
|
+
const z = (m == null ? void 0 : m.get("randomId")) || p();
|
|
1338
|
+
l.value.push({ id: z, value: C == null ? void 0 : C.innerHTML }), C.innerHTML = `${C.innerHTML}<div class="ol-tooltip-delete-button" data-id="${z}"><i class="map-iconfont icon-delete"></i></div>`;
|
|
1339
|
+
}
|
|
1340
|
+
(x = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || x.addEventListener("click", (z) => {
|
|
1341
|
+
var R;
|
|
1342
|
+
z.preventDefault(), z.stopPropagation();
|
|
1343
|
+
const $ = (R = z.target) == null ? void 0 : R.getAttribute("data-id");
|
|
1344
|
+
$ && u($);
|
|
1345
|
+
}), Z.setOffset([0, -7]), m = null, C = null, Y(), P && unByKey(P), (D = (N = n.getProps()) == null ? void 0 : N.lineDrawEnd) == null || D.call(N, l.value);
|
|
1346
|
+
});
|
|
1347
|
+
}, p = () => Math.random().toString(36).substring(2, 9);
|
|
1348
|
+
let C, Z;
|
|
1349
|
+
const Y = () => {
|
|
1350
|
+
C != null && C.parentNode && C.parentNode.removeChild(C), C = document.createElement("div"), C.className = "ol-tooltip ol-tooltip-measure", Z = new Overlay({
|
|
1351
|
+
element: C,
|
|
1352
|
+
offset: [0, -15],
|
|
1353
|
+
positioning: "bottom-center",
|
|
1354
|
+
stopEvent: !1,
|
|
1355
|
+
insertFirst: !1
|
|
1356
|
+
}), e == null || e.addOverlay(Z);
|
|
1357
|
+
}, X = () => {
|
|
1358
|
+
o != null && o.parentNode && o.parentNode.removeChild(o), o = document.createElement("div"), o.className = "ol-tooltip hidden", F = new Overlay({
|
|
1359
|
+
element: o,
|
|
1360
|
+
offset: [15, 0],
|
|
1361
|
+
positioning: "center-left"
|
|
1362
|
+
}), e == null || e.addOverlay(F);
|
|
1363
|
+
}, H = () => {
|
|
1364
|
+
l.value.forEach((P, x) => {
|
|
1365
|
+
var z, $;
|
|
1366
|
+
const N = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1367
|
+
N[x] && (($ = (z = N[x]) == null ? void 0 : z.parentNode) == null || $.removeChild(N[x]));
|
|
1368
|
+
const D = t.getFeatures();
|
|
1369
|
+
D[x] && t.removeFeature(D[x]);
|
|
1370
|
+
}), L(), enableDoubleClickZoom(), f.value = !1;
|
|
1371
|
+
}, u = (P) => {
|
|
1372
|
+
var N, D, z, $;
|
|
1373
|
+
const x = l.value.findIndex((R) => R.id === P);
|
|
1374
|
+
if (x !== -1) {
|
|
1375
|
+
l.value.splice(x, 1);
|
|
1376
|
+
const R = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1377
|
+
R[x] && ((D = (N = R[x]) == null ? void 0 : N.parentNode) == null || D.removeChild(R[x]));
|
|
1378
|
+
const K = t.getFeatures();
|
|
1379
|
+
K[x] && t.removeFeature(K[x]);
|
|
1380
|
+
}
|
|
1381
|
+
($ = (z = n.getProps()) == null ? void 0 : z.lineDrawEnd) == null || $.call(z, l.value);
|
|
1382
|
+
}, L = () => {
|
|
1383
|
+
if (l.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((P) => {
|
|
1384
|
+
var x;
|
|
1385
|
+
(x = P == null ? void 0 : P.parentNode) == null || x.removeChild(P);
|
|
1386
|
+
}), t.clear(), g) {
|
|
1387
|
+
const P = e.getInteractions().getArray().find((x) => getUid(x) === getUid(g));
|
|
1388
|
+
P && e.removeInteraction(P);
|
|
1389
|
+
}
|
|
1390
|
+
e.removeLayer(r), o != null && o.parentNode && o.parentNode.removeChild(o), C != null && C.parentNode && C.parentNode.removeChild(C);
|
|
1391
|
+
};
|
|
1392
|
+
return {
|
|
1393
|
+
open: E,
|
|
1394
|
+
close: H,
|
|
1395
|
+
deleteLine: u,
|
|
1396
|
+
setUnit: a,
|
|
1397
|
+
getState: () => f.value
|
|
1398
|
+
};
|
|
1399
|
+
}, computedDistance = (e, n) => {
|
|
1400
|
+
const s = getLength(e);
|
|
1401
|
+
let a = "";
|
|
1402
|
+
switch (n) {
|
|
1403
|
+
case "m":
|
|
1404
|
+
a = `${Math.round(s * 100) / 100} m`;
|
|
1405
|
+
break;
|
|
1406
|
+
case "km":
|
|
1407
|
+
a = `${Math.round(s / 1e3 * 100) / 100} km`;
|
|
1408
|
+
break;
|
|
1409
|
+
case "nm":
|
|
1410
|
+
a = `${Math.round(s / 1.852 * 100) / 100} nm`;
|
|
1411
|
+
break;
|
|
1412
|
+
}
|
|
1413
|
+
return a;
|
|
1414
|
+
}, useDrawPolygonManager = (e, n) => {
|
|
1415
|
+
let l;
|
|
1416
|
+
const s = () => {
|
|
1417
|
+
a();
|
|
1418
|
+
}, a = () => {
|
|
1419
|
+
E(), T(), Z(), F();
|
|
1420
|
+
};
|
|
1421
|
+
let o = null, f = null;
|
|
1422
|
+
const E = () => {
|
|
1423
|
+
if (o || f) return;
|
|
1424
|
+
const H = new VectorSource(), u = new VectorLayer({
|
|
1425
|
+
source: H,
|
|
1426
|
+
style: new Style({
|
|
1427
|
+
stroke: new Stroke({
|
|
1428
|
+
color: "#fbcc33",
|
|
1429
|
+
width: 2
|
|
1430
|
+
})
|
|
1431
|
+
})
|
|
1432
|
+
});
|
|
1433
|
+
o = u, f = H, e.on("pointermove", r), e.addLayer(u), e.on(["dblclick"], function(L) {
|
|
1434
|
+
y && (L.stopPropagation(), L.preventDefault());
|
|
1435
|
+
});
|
|
1436
|
+
};
|
|
1437
|
+
let t;
|
|
1438
|
+
const r = (H) => {
|
|
1439
|
+
if (H.dragging) return;
|
|
1440
|
+
const u = t ? "单击继续,双击结束" : "点击选择起点";
|
|
1441
|
+
p && (p.innerHTML = u, C.setPosition(H.coordinate));
|
|
1442
|
+
};
|
|
1443
|
+
let y, m = !1;
|
|
1444
|
+
const F = () => {
|
|
1445
|
+
if (l) {
|
|
1446
|
+
p != null && p.parentNode && p.parentNode.removeChild(p);
|
|
1447
|
+
const u = l.getGeometry();
|
|
1448
|
+
if (!u) return;
|
|
1449
|
+
const L = V(u, "nm");
|
|
1450
|
+
v && (v.innerHTML = `
|
|
1451
|
+
<span class="text">面积:${L}${m ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1452
|
+
`), v && (v.innerHTML += '<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');
|
|
1453
|
+
const S = u.getCoordinates(), P = S[0][S[0].length - 2];
|
|
1454
|
+
if (g.setPosition(P), o) {
|
|
1455
|
+
const N = o.getSource();
|
|
1456
|
+
N && l && (N.clear(), N.addFeature(l));
|
|
1457
|
+
}
|
|
1458
|
+
setTimeout(() => {
|
|
1459
|
+
var N;
|
|
1460
|
+
(N = document.querySelector(".delete-icon")) == null || N.addEventListener("click", () => {
|
|
1461
|
+
var D, z;
|
|
1462
|
+
console.log("delete"), Y(), (z = (D = n.getProps()) == null ? void 0 : D.areaDrawEnd) == null || z.call(D, []);
|
|
1463
|
+
});
|
|
1464
|
+
}, 0);
|
|
1465
|
+
const x = getCenter(l.getGeometry().getExtent());
|
|
1466
|
+
e == null || e.getView().setCenter(x);
|
|
1467
|
+
return;
|
|
1468
|
+
}
|
|
1469
|
+
y = new Draw({
|
|
1470
|
+
type: "Polygon",
|
|
1471
|
+
source: f,
|
|
1472
|
+
trace: !0,
|
|
1473
|
+
style: [new Style({
|
|
1474
|
+
stroke: new Stroke({
|
|
1475
|
+
color: "rgba(255, 255, 255, 1)",
|
|
1476
|
+
width: 1.5,
|
|
1477
|
+
lineDash: [10, 10]
|
|
1478
|
+
}),
|
|
1479
|
+
fill: new Fill({
|
|
1480
|
+
color: "rgba(255, 255, 255, 0.25)"
|
|
1481
|
+
})
|
|
1482
|
+
}), new Style({
|
|
1483
|
+
image: new CircleStyle({
|
|
1484
|
+
radius: 5,
|
|
1485
|
+
fill: new Fill({
|
|
1486
|
+
color: "rgb(51,112,255, 1)"
|
|
1487
|
+
})
|
|
1488
|
+
}),
|
|
1489
|
+
geometry: function(u) {
|
|
1490
|
+
const L = u.getGeometry().getCoordinates();
|
|
1491
|
+
return new MultiPoint(L);
|
|
1492
|
+
}
|
|
1493
|
+
})]
|
|
1494
|
+
}), e == null || e.addInteraction(y);
|
|
1495
|
+
let H;
|
|
1496
|
+
y.on("drawstart", (u) => {
|
|
1497
|
+
var L;
|
|
1498
|
+
t = u.feature, H = (L = t.getGeometry()) == null ? void 0 : L.on("change", (S) => {
|
|
1499
|
+
const P = S.target, x = V(P, "nm"), D = P.getCoordinates()[0], z = new LineString([D[D.length - 2], D[D.length - 1]]), $ = computedDistance(z, "nm");
|
|
1500
|
+
if (m = Number(getLength(z) / 1e3) > 150, !x) return;
|
|
1501
|
+
const R = '<span class="error pl-4">超出可以绘画的距离</span>';
|
|
1502
|
+
v && (v.innerHTML = `
|
|
1503
|
+
<div class="text">
|
|
1504
|
+
面积:${x}
|
|
1505
|
+
${m ? R : ""}
|
|
1506
|
+
</div>
|
|
1507
|
+
`), p && (p.innerHTML = `
|
|
1508
|
+
<div class="text">
|
|
1509
|
+
面积:${x}
|
|
1510
|
+
</div>
|
|
1511
|
+
<div class="text ${m ? "error" : ""}">
|
|
1512
|
+
线段 ${D.length - 2}: ${$}
|
|
1513
|
+
${m ? R : ""}
|
|
1514
|
+
|
|
1515
|
+
</div>
|
|
1516
|
+
<div>
|
|
1517
|
+
<span class="text">单击继续,双击结束</span>
|
|
1518
|
+
</div>
|
|
1519
|
+
`);
|
|
1520
|
+
});
|
|
1521
|
+
}), y.on("drawend", (u) => {
|
|
1522
|
+
var x, N, D, z;
|
|
1523
|
+
if (!u.feature.getGeometry()) return;
|
|
1524
|
+
l = u.feature, v && (v.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), g.setOffset([10, 0]);
|
|
1525
|
+
const S = u.feature.getGeometry().getCoordinates(), P = S[0][S[0].length - 2];
|
|
1526
|
+
if (g.setPosition(P), p != null && p.parentNode && p.parentNode.removeChild(p), (x = n.getProps()) != null && x.areaDrawEnd) {
|
|
1527
|
+
const $ = S[0].map((R) => transform(R, projection.mercator, projection.data));
|
|
1528
|
+
(D = (N = n.getProps()) == null ? void 0 : N.areaDrawEnd) == null || D.call(N, $);
|
|
1529
|
+
}
|
|
1530
|
+
y && (y.setActive(!1), e == null || e.removeInteraction(y), (e == null ? void 0 : e.getInteractions()).forEach((R) => {
|
|
1531
|
+
R instanceof Draw && (R.setActive(!1), e == null || e.removeInteraction(R));
|
|
1532
|
+
})), H && unByKey(H), (z = document.querySelector(".delete-icon")) == null || z.addEventListener("click", () => {
|
|
1533
|
+
var $, R;
|
|
1534
|
+
Y(), (R = ($ = n.getProps()) == null ? void 0 : $.areaDrawEnd) == null || R.call($, []);
|
|
1535
|
+
});
|
|
1536
|
+
});
|
|
1537
|
+
}, V = (H, u) => {
|
|
1538
|
+
const L = getArea(H);
|
|
1539
|
+
switch (u) {
|
|
1540
|
+
case "km":
|
|
1541
|
+
return L > 1e4 ? Math.round(L / 1e6 * 100) / 100 + " km<sup>2</sup>" : Math.round(L * 100) / 100 + " m<sup>2</sup>";
|
|
1542
|
+
case "nm":
|
|
1543
|
+
return L > 1e4 ? Math.round(L / 1e6 / Math.pow(1.852, 2) * 100) / 100 + " nm<sup>2</sup>" : Math.round(L * 100) / 100 + " m<sup>2</sup>";
|
|
1544
|
+
}
|
|
1545
|
+
};
|
|
1546
|
+
let v, g;
|
|
1547
|
+
const T = () => {
|
|
1548
|
+
v != null && v.parentNode && v.parentNode.removeChild(v), v = document.createElement("div"), v.style.display = "flex", v.className = "ol-tooltip ol-tooltip-draw-polygon", g = new Overlay({
|
|
1549
|
+
element: v,
|
|
1550
|
+
offset: [0, -15],
|
|
1551
|
+
positioning: "bottom-center",
|
|
1552
|
+
stopEvent: !1,
|
|
1553
|
+
insertFirst: !1
|
|
1554
|
+
}), e == null || e.addOverlay(g);
|
|
1555
|
+
};
|
|
1556
|
+
let p, C;
|
|
1557
|
+
const Z = () => {
|
|
1558
|
+
p != null && p.parentNode && p.parentNode.removeChild(p), p = document.createElement("div"), p.className = "ol-tooltip ol-help-tooltip", C = new Overlay({
|
|
1559
|
+
element: p,
|
|
1560
|
+
offset: [15, 0],
|
|
1561
|
+
positioning: "center-left"
|
|
1562
|
+
}), e == null || e.addOverlay(C);
|
|
1563
|
+
}, Y = () => {
|
|
1564
|
+
f == null || f.clear(), l = null, T(), Z(), F();
|
|
1565
|
+
};
|
|
1566
|
+
return {
|
|
1567
|
+
open: s,
|
|
1568
|
+
close: () => {
|
|
1569
|
+
f == null || f.clear(), f = null, o && (e.removeLayer(o), o = null), t = null, y && (y = null, e.getInteractions().forEach((H) => {
|
|
1570
|
+
H instanceof Draw && e.removeInteraction(H);
|
|
1571
|
+
})), p != null && p.parentElement && p.parentElement.removeChild(p), v != null && v.parentElement && v.parentElement.removeChild(v), C && e.removeOverlay(C), g && e.removeOverlay(g);
|
|
1572
|
+
},
|
|
1573
|
+
reset: Y
|
|
1574
|
+
};
|
|
1575
|
+
}, PORT_LAYER_CLASS_NAME = "zh-map-port-layer", usePortManager = (e) => {
|
|
1576
|
+
const n = e.getInstall();
|
|
1577
|
+
let l, s, a = null, o = null;
|
|
1578
|
+
const f = (g) => {
|
|
1579
|
+
if (!(!g || g.length === 0)) {
|
|
1580
|
+
if (s || (s = new VectorSource()), s.clear(), o) {
|
|
1581
|
+
const T = g.find((p) => p.id === o.id);
|
|
1582
|
+
T ? o = T : g.push(o);
|
|
1583
|
+
}
|
|
1584
|
+
g.forEach((T) => {
|
|
1585
|
+
E(T);
|
|
1586
|
+
}), l || (l = new VectorLayer({
|
|
1587
|
+
className: PORT_LAYER_CLASS_NAME,
|
|
1588
|
+
source: s,
|
|
1589
|
+
zIndex: 100
|
|
1590
|
+
}), n.addLayer(l));
|
|
1591
|
+
}
|
|
1592
|
+
}, E = (g) => {
|
|
1593
|
+
const T = e.getZoom(), [p, C] = g.latLon.split(","), Z = new Feature({
|
|
1594
|
+
geometry: new Point(fromLonLat([Number(p), Number(C)]))
|
|
1595
|
+
});
|
|
1596
|
+
Z.setStyle(t(g, T, g.id === (o == null ? void 0 : o.id))), Z.set("portData", g), s.addFeature(Z);
|
|
1597
|
+
}, t = (g, T, p) => {
|
|
1598
|
+
const C = (Y) => `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1599
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M22.6563 44.9304C22.5453 44.8844 22.4445 44.817 22.3595 44.7321C22.3595 44.7321 9.36986 31.7424 9.32952 31.6913C7.09059 29.0791 5.64794 25.8802 5.17255 22.4736C4.69716 19.0671 5.20896 15.5957 6.64728 12.471C8.08561 9.34625 10.3902 6.69909 13.2878 4.84325C16.1855 2.98741 19.5548 2.00068 22.9965 2C26.4381 1.99932 29.8078 2.98473 32.7062 4.83943C35.6046 6.69414 37.9102 9.34039 39.3498 12.4646C40.7893 15.5888 41.3025 19.0599 40.8284 22.4666C40.3544 25.8734 38.913 29.0729 36.6751 31.686C36.6401 31.737 23.6531 44.7321 23.6531 44.7321C23.5682 44.817 23.4674 44.8844 23.3564 44.9304C23.2454 44.9763 23.1265 45 23.0063 45C22.8862 45 22.7673 44.9763 22.6563 44.9304Z" fill="${Y}"/>
|
|
1600
|
+
<g clip-path="url(#clip0_10059_122082)">
|
|
1601
|
+
<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"/>
|
|
1602
|
+
</g>
|
|
1603
|
+
<defs>
|
|
1604
|
+
<clipPath id="clip0_10059_122082">
|
|
1605
|
+
<rect width="26" height="26" fill="white" transform="translate(10 8)"/>
|
|
1606
|
+
</clipPath>
|
|
1607
|
+
</defs>
|
|
1608
|
+
</svg>
|
|
1609
|
+
`, Z = () => `data:image/svg+xml;utf8,${encodeURIComponent(C(p ? "#FF5733" : "#3370FF"))}`;
|
|
1610
|
+
return new Style({
|
|
1611
|
+
text: new Text({
|
|
1612
|
+
text: g.shortName,
|
|
1613
|
+
font: "12px sans-serif",
|
|
1614
|
+
fill: new Fill({
|
|
1615
|
+
color: p ? "#ffffff" : "#000000"
|
|
1616
|
+
}),
|
|
1617
|
+
backgroundFill: new Fill({
|
|
1618
|
+
color: p ? "#FF5733" : "#FFFFFF"
|
|
1619
|
+
}),
|
|
1620
|
+
offsetY: 30
|
|
1621
|
+
}),
|
|
1622
|
+
image: new Icon({
|
|
1623
|
+
src: Z(),
|
|
1624
|
+
scale: 0.5 * T / 10
|
|
1625
|
+
})
|
|
1626
|
+
});
|
|
1627
|
+
}, r = () => {
|
|
1628
|
+
if (a) {
|
|
1629
|
+
console.log("清除非选中的港口");
|
|
1630
|
+
const g = a.get("portData").id;
|
|
1631
|
+
s.getFeatures().forEach((T) => {
|
|
1632
|
+
T.get("portData").id !== g && s.removeFeature(T);
|
|
1633
|
+
});
|
|
1634
|
+
} else
|
|
1635
|
+
console.log("清除所有港口"), s.clear();
|
|
1636
|
+
}, y = () => {
|
|
1637
|
+
const g = a == null ? void 0 : a.get("portData"), T = e.getZoom();
|
|
1638
|
+
g && s.getFeatures().forEach((C) => {
|
|
1639
|
+
C.get("portData").id === g.id && (C == null || C.setStyle(t(g, T, !1)));
|
|
1640
|
+
}), o = null, a = null;
|
|
1641
|
+
}, m = (g) => {
|
|
1642
|
+
g ? (F(), V(g)) : y();
|
|
1643
|
+
}, F = () => {
|
|
1644
|
+
if (a) {
|
|
1645
|
+
const g = a == null ? void 0 : a.get("portData"), T = e.getZoom();
|
|
1646
|
+
a.setStyle(t(g, T, !1));
|
|
1647
|
+
}
|
|
1648
|
+
}, V = (g) => {
|
|
1649
|
+
const T = s.getFeatures();
|
|
1650
|
+
o = g, a = T.find((p) => p.get("portData").id === g.id);
|
|
1651
|
+
};
|
|
1652
|
+
return {
|
|
1653
|
+
render: f,
|
|
1654
|
+
clear: r,
|
|
1655
|
+
selected: m,
|
|
1656
|
+
handlePortHover: (g) => {
|
|
1657
|
+
const T = n == null ? void 0 : n.getTargetElement();
|
|
1658
|
+
g && g.get("portData") && T && (T.style.cursor = "pointer");
|
|
1659
|
+
}
|
|
1660
|
+
};
|
|
1661
|
+
}, useEventManager = (e, n, l, s, a, o) => {
|
|
1662
|
+
const f = e.getInstall();
|
|
1663
|
+
f.on("moveend", () => {
|
|
1664
|
+
var t, r;
|
|
1665
|
+
const E = e.getZoom();
|
|
1666
|
+
(r = (t = n.getProps()).mapMoveEnd) == null || r.call(t, E), l.reRenderTrackLine();
|
|
1667
|
+
}), f.on("pointermove", (E) => {
|
|
1668
|
+
const t = f.getEventPixel(E.originalEvent), r = f.forEachFeatureAtPixel(t, (y) => y);
|
|
1669
|
+
s.handleShipMapEvent(r, "hover"), l.handleTrackMapEvent(r, "hover", E), r && a.handlePortHover(r);
|
|
1670
|
+
}), f.on("movestart", () => {
|
|
1671
|
+
console.log("movestart-----------------------");
|
|
1672
|
+
}), f.on("click", debounce((E) => {
|
|
1673
|
+
var y, m, F;
|
|
1674
|
+
if (console.log("1", o.getState()), o.getState()) return;
|
|
1675
|
+
const t = f.getEventPixel(E.originalEvent), r = f.forEachFeatureAtPixel(
|
|
1676
|
+
t,
|
|
1677
|
+
(V) => {
|
|
1678
|
+
if (V != null && V.get("shipData") || V != null && V.get("portData"))
|
|
1679
|
+
return V;
|
|
1680
|
+
}
|
|
1681
|
+
);
|
|
1682
|
+
if (console.log("2", r), !!r) {
|
|
1683
|
+
if (E.preventDefault(), E.stopPropagation(), r.get("shipData"))
|
|
1684
|
+
s.handleShipMapEvent(r, "click", (y = n.getProps()) == null ? void 0 : y.selectShip);
|
|
1685
|
+
else if (r.get("portData")) {
|
|
1686
|
+
const V = r.get("portData");
|
|
1687
|
+
a.selected(V), (F = (m = n.getProps()) == null ? void 0 : m.selectPort) == null || F.call(m, V);
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
}, 150));
|
|
1691
|
+
}, useMapController = () => {
|
|
1692
|
+
const e = reactive([]);
|
|
1693
|
+
return {
|
|
1694
|
+
createInstance: (s, a) => {
|
|
1695
|
+
const o = useMapInitializer();
|
|
1696
|
+
o.initMap(s, a);
|
|
1697
|
+
const f = o.getInstall(), E = useLayerManager(f), t = usePropsManager();
|
|
1698
|
+
t.setProps(a), E.setShowLayerType(a.layerType), E.setGreenTileVisible(a.showGreenLayer);
|
|
1699
|
+
const r = useTrackManager(f), y = useCarTrackManager(f, r), m = useShipManager(f), F = usePositionManager(f), V = useDrawLineManager(f, t), v = useDrawPolygonManager(f, t), g = usePortManager(o);
|
|
1700
|
+
useEventManager(o, t, r, m, g, V);
|
|
1701
|
+
const T = () => {
|
|
1702
|
+
const C = f.getView().calculateExtent(o.getSize()), Z = transform([C[0], C[1]], projection.mercator, projection.data), Y = transform([C[2], C[3]], projection.mercator, projection.data);
|
|
1703
|
+
return [Z[0], Z[1], Y[0], Y[1]];
|
|
1704
|
+
}, p = {
|
|
1705
|
+
id: Symbol("map-instance"),
|
|
1706
|
+
innerMap: null,
|
|
1707
|
+
map: o.getInstall(),
|
|
1708
|
+
destroy: () => {
|
|
1709
|
+
e.splice(e.indexOf(p), 1), console.log(`实例 ${id.toString()} 已销毁`);
|
|
1710
|
+
},
|
|
1711
|
+
methods: {
|
|
1712
|
+
...o,
|
|
1713
|
+
layer: E,
|
|
1714
|
+
ship: m,
|
|
1715
|
+
track: r,
|
|
1716
|
+
carTrack: y,
|
|
1717
|
+
port: {
|
|
1718
|
+
render: g.render,
|
|
1719
|
+
clear: g.clear,
|
|
1720
|
+
selected: g.selected
|
|
1721
|
+
},
|
|
1722
|
+
position: F,
|
|
1723
|
+
drawLine: V,
|
|
1724
|
+
drawPolygon: v,
|
|
1725
|
+
// 子模块
|
|
1726
|
+
utils: {
|
|
1727
|
+
getCalculateExtent: T,
|
|
1728
|
+
convertSixHundredThousandToLatLng,
|
|
1729
|
+
calculateCirclePoints
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
};
|
|
1733
|
+
return e.push(p), p;
|
|
1734
|
+
},
|
|
1735
|
+
destroyInstance: (s) => {
|
|
1736
|
+
const a = e.findIndex((o) => o.id === s);
|
|
1737
|
+
a > -1 && (e[a].destroy(), e.splice(a, 1));
|
|
1738
|
+
},
|
|
1739
|
+
destroyAll: () => {
|
|
1740
|
+
e.forEach((s) => s.destroy()), e.splice(0, e.length);
|
|
1741
|
+
},
|
|
1742
|
+
getAllInstances: () => [...e]
|
|
1743
|
+
};
|
|
1744
|
+
}, _hoisted_1 = { class: "zh-map-box" }, _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1745
|
+
__name: "Map",
|
|
1746
|
+
props: {
|
|
1747
|
+
zoom: { default: MAP_ZOOM.default },
|
|
1748
|
+
center: { default: MAP_DEFAULT_CENTER },
|
|
1749
|
+
layerType: { default: "vector" },
|
|
1750
|
+
showGreenLayer: { type: Boolean, default: !1 },
|
|
1751
|
+
showScale: { type: Boolean, default: !0 },
|
|
1752
|
+
scaleLineUnit: { default: "metric" },
|
|
1753
|
+
mapMoveEnd: { type: Function, default: () => {
|
|
1754
|
+
} },
|
|
1755
|
+
lineDrawEnd: {},
|
|
1756
|
+
areaDrawEnd: { type: Function, default: () => {
|
|
1757
|
+
} },
|
|
1758
|
+
selectShip: { type: Function, default: () => {
|
|
1759
|
+
} },
|
|
1760
|
+
selectPort: { type: Function, default: () => {
|
|
1761
|
+
} }
|
|
1762
|
+
},
|
|
1763
|
+
setup(e, { expose: n }) {
|
|
1764
|
+
const l = ref(), s = ref(), a = useMapController(), o = ref(), f = e, E = ref({
|
|
1765
|
+
getInstall() {
|
|
1766
|
+
}
|
|
1767
|
+
});
|
|
1768
|
+
return onMounted(() => {
|
|
1769
|
+
var t;
|
|
1770
|
+
o.value = a.createInstance(l.value, f), console.log(" instance.value?.methods", o.value.map), E.value = o.value.methods, (t = s.value) == null || t.setScaleLine(o.value.map, f.scaleLineUnit);
|
|
1771
|
+
}), onUnmounted(() => {
|
|
1772
|
+
var t, r;
|
|
1773
|
+
a.destroyInstance((t = o == null ? void 0 : o.value) == null ? void 0 : t.id), (r = o.value) == null || r.destroy();
|
|
1774
|
+
}), n({
|
|
1775
|
+
getZoom: () => {
|
|
1776
|
+
var t;
|
|
1777
|
+
return (t = o.value) == null ? void 0 : t.methods.getZoom();
|
|
1778
|
+
},
|
|
1779
|
+
setZoom: (t) => {
|
|
1780
|
+
var r;
|
|
1781
|
+
return (r = o.value) == null ? void 0 : r.methods.setZoom(t);
|
|
1782
|
+
},
|
|
1783
|
+
getInstall: () => {
|
|
1784
|
+
var t;
|
|
1785
|
+
return (t = o.value) == null ? void 0 : t.methods.install();
|
|
1786
|
+
},
|
|
1787
|
+
getView: () => {
|
|
1788
|
+
var t;
|
|
1789
|
+
return (t = o.value) == null ? void 0 : t.methods.getView();
|
|
1790
|
+
},
|
|
1791
|
+
setCenter: (t, r) => {
|
|
1792
|
+
var y;
|
|
1793
|
+
return (y = o.value) == null ? void 0 : y.methods.setCenter(t, r);
|
|
1794
|
+
},
|
|
1795
|
+
getSize: () => {
|
|
1796
|
+
var t;
|
|
1797
|
+
return (t = o.value) == null ? void 0 : t.methods.getSize();
|
|
1798
|
+
},
|
|
1799
|
+
layer: {
|
|
1800
|
+
setGreenTileVisible: (t) => {
|
|
1801
|
+
var r;
|
|
1802
|
+
return (r = o.value) == null ? void 0 : r.methods.layer.setGreenTileVisible(t);
|
|
1803
|
+
},
|
|
1804
|
+
getGreenTileVisible: () => {
|
|
1805
|
+
var t;
|
|
1806
|
+
return (t = o.value) == null ? void 0 : t.methods.layer.getGreenTileVisible();
|
|
1807
|
+
},
|
|
1808
|
+
getShowLayerType: () => {
|
|
1809
|
+
var t;
|
|
1810
|
+
return (t = o.value) == null ? void 0 : t.methods.layer.getShowLayerType();
|
|
1811
|
+
},
|
|
1812
|
+
setShowLayerType: (t) => {
|
|
1813
|
+
var r;
|
|
1814
|
+
return (r = o.value) == null ? void 0 : r.methods.layer.setShowLayerType(t);
|
|
1815
|
+
}
|
|
1816
|
+
},
|
|
1817
|
+
ship: {
|
|
1818
|
+
render: (...t) => {
|
|
1819
|
+
var r;
|
|
1820
|
+
return (r = o.value) == null ? void 0 : r.methods.ship.render(...t);
|
|
1821
|
+
},
|
|
1822
|
+
selected: (...t) => {
|
|
1823
|
+
var r;
|
|
1824
|
+
return (r = o.value) == null ? void 0 : r.methods.ship.selected(...t);
|
|
1825
|
+
},
|
|
1826
|
+
filter: (...t) => {
|
|
1827
|
+
var r;
|
|
1828
|
+
return (r = o.value) == null ? void 0 : r.methods.ship.filter(...t);
|
|
1829
|
+
},
|
|
1830
|
+
blinking: (...t) => {
|
|
1831
|
+
var r;
|
|
1832
|
+
return (r = o.value) == null ? void 0 : r.methods.ship.blinking(...t);
|
|
1833
|
+
},
|
|
1834
|
+
clear: () => {
|
|
1835
|
+
var t;
|
|
1836
|
+
return (t = o.value) == null ? void 0 : t.methods.ship.clear();
|
|
1837
|
+
}
|
|
1838
|
+
},
|
|
1839
|
+
track: {
|
|
1840
|
+
render: (...t) => {
|
|
1841
|
+
var r;
|
|
1842
|
+
return (r = o.value) == null ? void 0 : r.methods.track.render(...t);
|
|
1843
|
+
},
|
|
1844
|
+
remove: (...t) => {
|
|
1845
|
+
var r;
|
|
1846
|
+
return (r = o.value) == null ? void 0 : r.methods.track.remove(...t);
|
|
1847
|
+
},
|
|
1848
|
+
play: (...t) => {
|
|
1849
|
+
var r;
|
|
1850
|
+
return (r = o.value) == null ? void 0 : r.methods.track.play(...t);
|
|
1851
|
+
},
|
|
1852
|
+
setCenter: (...t) => {
|
|
1853
|
+
var r;
|
|
1854
|
+
return (r = o.value) == null ? void 0 : r.methods.track.setCenter(...t);
|
|
1855
|
+
},
|
|
1856
|
+
close: (...t) => {
|
|
1857
|
+
var r;
|
|
1858
|
+
return (r = o.value) == null ? void 0 : r.methods.track.close(...t);
|
|
1859
|
+
},
|
|
1860
|
+
getLength: (...t) => {
|
|
1861
|
+
var r;
|
|
1862
|
+
return (r = o.value) == null ? void 0 : r.methods.track.getLength(...t);
|
|
1863
|
+
}
|
|
1864
|
+
},
|
|
1865
|
+
carTrack: {
|
|
1866
|
+
location: (...t) => {
|
|
1867
|
+
var r;
|
|
1868
|
+
return (r = o.value) == null ? void 0 : r.methods.carTrack.location(...t);
|
|
1869
|
+
},
|
|
1870
|
+
remove: (...t) => {
|
|
1871
|
+
var r;
|
|
1872
|
+
return (r = o.value) == null ? void 0 : r.methods.carTrack.remove(...t);
|
|
1873
|
+
},
|
|
1874
|
+
renderTrack: (...t) => {
|
|
1875
|
+
var r;
|
|
1876
|
+
return (r = o.value) == null ? void 0 : r.methods.carTrack.renderTrack(...t);
|
|
1877
|
+
},
|
|
1878
|
+
setCenter: (...t) => {
|
|
1879
|
+
var r;
|
|
1880
|
+
return (r = o.value) == null ? void 0 : r.methods.carTrack.setCenter(...t);
|
|
1881
|
+
},
|
|
1882
|
+
closeTrack: (...t) => {
|
|
1883
|
+
var r;
|
|
1884
|
+
return (r = o.value) == null ? void 0 : r.methods.carTrack.closeTrack(...t);
|
|
1885
|
+
},
|
|
1886
|
+
playTrack: (...t) => {
|
|
1887
|
+
var r;
|
|
1888
|
+
return (r = o.value) == null ? void 0 : r.methods.carTrack.playTrack(...t);
|
|
1889
|
+
}
|
|
1890
|
+
},
|
|
1891
|
+
port: {
|
|
1892
|
+
render: (t) => {
|
|
1893
|
+
var r;
|
|
1894
|
+
return (r = o.value) == null ? void 0 : r.methods.port.render(t);
|
|
1895
|
+
},
|
|
1896
|
+
clear: () => {
|
|
1897
|
+
var t;
|
|
1898
|
+
return (t = o.value) == null ? void 0 : t.methods.port.clear();
|
|
1899
|
+
},
|
|
1900
|
+
selected: (t) => {
|
|
1901
|
+
var r;
|
|
1902
|
+
return (r = o.value) == null ? void 0 : r.methods.port.selected(t);
|
|
1903
|
+
}
|
|
1904
|
+
},
|
|
1905
|
+
position: {
|
|
1906
|
+
render: (...t) => {
|
|
1907
|
+
var r;
|
|
1908
|
+
return (r = o.value) == null ? void 0 : r.methods.position.render(...t);
|
|
1909
|
+
},
|
|
1910
|
+
selected: (...t) => {
|
|
1911
|
+
var r;
|
|
1912
|
+
return (r = o.value) == null ? void 0 : r.methods.position.selected(...t);
|
|
1913
|
+
},
|
|
1914
|
+
clearSelected: (...t) => {
|
|
1915
|
+
var r;
|
|
1916
|
+
return (r = o.value) == null ? void 0 : r.methods.position.clearSelected(...t);
|
|
1917
|
+
},
|
|
1918
|
+
clear: () => {
|
|
1919
|
+
var t;
|
|
1920
|
+
return (t = o.value) == null ? void 0 : t.methods.position.clear();
|
|
1921
|
+
}
|
|
1922
|
+
},
|
|
1923
|
+
drawLine: {
|
|
1924
|
+
open: () => {
|
|
1925
|
+
var t;
|
|
1926
|
+
return (t = o.value) == null ? void 0 : t.methods.drawLine.open();
|
|
1927
|
+
},
|
|
1928
|
+
close: () => {
|
|
1929
|
+
var t;
|
|
1930
|
+
return (t = o.value) == null ? void 0 : t.methods.drawLine.close();
|
|
1931
|
+
},
|
|
1932
|
+
deleteLine: (t) => {
|
|
1933
|
+
var r;
|
|
1934
|
+
return (r = o.value) == null ? void 0 : r.methods.drawLine.deleteLine(t);
|
|
1935
|
+
},
|
|
1936
|
+
setUnit: (t) => {
|
|
1937
|
+
var r;
|
|
1938
|
+
return (r = o.value) == null ? void 0 : r.methods.drawLine.setUnit(t);
|
|
1939
|
+
},
|
|
1940
|
+
getState: () => {
|
|
1941
|
+
var t;
|
|
1942
|
+
return (t = o.value) == null ? void 0 : t.methods.drawLine.getState();
|
|
1943
|
+
}
|
|
1944
|
+
},
|
|
1945
|
+
drawPolygon: {
|
|
1946
|
+
open: () => {
|
|
1947
|
+
var t;
|
|
1948
|
+
return (t = o.value) == null ? void 0 : t.methods.drawPolygon.open();
|
|
1949
|
+
},
|
|
1950
|
+
close: () => {
|
|
1951
|
+
var t;
|
|
1952
|
+
return (t = o.value) == null ? void 0 : t.methods.drawPolygon.close();
|
|
1953
|
+
},
|
|
1954
|
+
reset: () => {
|
|
1955
|
+
var t;
|
|
1956
|
+
return (t = o.value) == null ? void 0 : t.methods.drawPolygon.reset();
|
|
1957
|
+
}
|
|
1958
|
+
},
|
|
1959
|
+
// 子模块
|
|
1960
|
+
utils: {
|
|
1961
|
+
getCalculateExtent: () => {
|
|
1962
|
+
var t;
|
|
1963
|
+
return (t = o.value) == null ? void 0 : t.methods.utils.getCalculateExtent();
|
|
1964
|
+
},
|
|
1965
|
+
convertSixHundredThousandToLatLng: () => {
|
|
1966
|
+
var t;
|
|
1967
|
+
return (t = o.value) == null ? void 0 : t.methods.utils.convertSixHundredThousandToLatLng();
|
|
1968
|
+
},
|
|
1969
|
+
calculateCirclePoints: () => {
|
|
1970
|
+
var t;
|
|
1971
|
+
return (t = o.value) == null ? void 0 : t.methods.utils.calculateCirclePoints();
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
}), (t, r) => (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
1975
|
+
createElementVNode("div", {
|
|
1976
|
+
id: "map",
|
|
1977
|
+
ref_key: "zhMapRef",
|
|
1978
|
+
ref: l,
|
|
1979
|
+
class: "zh-map"
|
|
1980
|
+
}, null, 512),
|
|
1981
|
+
createVNode(ScaleLine, {
|
|
1982
|
+
ref_key: "scaleLineRef",
|
|
1983
|
+
ref: s
|
|
1984
|
+
}, null, 512),
|
|
1985
|
+
createVNode(ZoomControl, {
|
|
1986
|
+
ref: "zoomControlRef",
|
|
1987
|
+
"map-instance": o.value
|
|
1988
|
+
}, null, 8, ["map-instance"])
|
|
1989
|
+
]));
|
|
1990
|
+
}
|
|
1991
|
+
}), Map$1 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-41ce7362"]]), ZhMap = withInstall(Map$1);
|
|
1992
|
+
export {
|
|
1993
|
+
ZhMap as Z
|
|
1994
|
+
};
|