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