zhihao-ui 1.2.37 → 1.2.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/{Map-BLVl3XBl.js → Map-BM9UCaCC.js} +682 -668
- package/dist/es/index.js +2 -2
- package/dist/index.css +1 -1
- package/dist/umd/index.css +1 -1
- package/dist/umd/index.umd.cjs +6 -6
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ import { g as getForegroundColor } from "./DatePicker-BOkpRWph.js";
|
|
|
8
8
|
import { w as withInstall } from "./utils-DUHqvTHl.js";
|
|
9
9
|
var BaseMapType = /* @__PURE__ */ ((e) => (e[e.vector = 0] = "vector", e[e.satellite = 1] = "satellite", e))(BaseMapType || {}), SEARCH_TYPE = /* @__PURE__ */ ((e) => (e[e.SEARCH_SHIP = 0] = "SEARCH_SHIP", e[e.SEARCH_PORT = 1] = "SEARCH_PORT", e[e.SEARCH_CUSTOM = 2] = "SEARCH_CUSTOM", e))(SEARCH_TYPE || {}), COPY_RIGHT_TYPE = /* @__PURE__ */ ((e) => (e[e.HORIZONTAL = 0] = "HORIZONTAL", e[e.VERTICAL = 1] = "VERTICAL", e))(COPY_RIGHT_TYPE || {}), CAR_COLOR = /* @__PURE__ */ ((e) => (e[e.BLUE = 1] = "BLUE", e[e.YELLOW = 2] = "YELLOW", e[e.Y_GREEN = 3] = "Y_GREEN", e))(CAR_COLOR || {}), DEVICE_TYPE = /* @__PURE__ */ ((e) => (e[e.HOST = 1] = "HOST", e[e.TALK = 2] = "TALK", e[e.STORAGE = 3] = "STORAGE", e[e.INTERNET = 4] = "INTERNET", e[e.CAMERA = 5] = "CAMERA", e[e.LOAD = 6] = "LOAD", e))(DEVICE_TYPE || {}), LENGTH_UNIT = /* @__PURE__ */ ((e) => (e[e.M = 1] = "M", e[e.KM = 2] = "KM", e[e.NM = 3] = "NM", e))(LENGTH_UNIT || {}), SWITCH_BTN = /* @__PURE__ */ ((e) => (e.Camera = "camera", e.Mobile = "mobile", e.WaterGauge = "waterGauge", e))(SWITCH_BTN || {}), 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 || {});
|
|
10
10
|
class ShipMapData {
|
|
11
|
-
constructor(t, o, n, r, i,
|
|
11
|
+
constructor(t, o, n, l, r, i, c, s, m, u, d, f, p, y, h, g, k, M, b, x, F, P, v, L) {
|
|
12
12
|
I(this, "id");
|
|
13
13
|
// mmsi
|
|
14
14
|
I(this, "mmsi");
|
|
@@ -50,40 +50,40 @@ class ShipMapData {
|
|
|
50
50
|
I(this, "existWaterGauge");
|
|
51
51
|
I(this, "selected");
|
|
52
52
|
I(this, "blinkColors");
|
|
53
|
-
this.id = t, this.mmsi = o, this.fill = n, this.shipType =
|
|
53
|
+
this.id = t, this.mmsi = o, this.fill = n, this.shipType = l, this.name = r, this.length = i, this.breadth = c, this.lon = s, this.lat = m, this.createdAt = u, this.speed = d, this.from = f, this.sailStatus = p, this.hdg = y, this.cog = h, this.posType = g, this.type = k, this.angle = M, this.leftIconColor = b, this.existDevice = x, this.existMobile = F, this.existWaterGauge = P, this.selected = v, this.blinkColors = L;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
const formatLength = function(e, t) {
|
|
57
57
|
const n = getLength(e);
|
|
58
|
-
let
|
|
58
|
+
let l = "";
|
|
59
59
|
switch (t) {
|
|
60
60
|
case LENGTH_UNIT.M:
|
|
61
|
-
|
|
61
|
+
l = Math.round(n * 100) / 100 + " m";
|
|
62
62
|
break;
|
|
63
63
|
case LENGTH_UNIT.KM:
|
|
64
|
-
|
|
64
|
+
l = Math.round(n / 1e3 * 100) / 100 + " km";
|
|
65
65
|
break;
|
|
66
66
|
case LENGTH_UNIT.NM:
|
|
67
|
-
|
|
67
|
+
l = (Math.round(n / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
|
|
68
68
|
break;
|
|
69
69
|
}
|
|
70
|
-
return
|
|
70
|
+
return l;
|
|
71
71
|
}, convertSixHundredThousandToLatLng = function(e, t) {
|
|
72
72
|
const o = Number(t) / 6e5;
|
|
73
73
|
return [Number(e) / 6e5, o];
|
|
74
74
|
}, formatArea = (e, t) => {
|
|
75
75
|
const n = getArea(e);
|
|
76
|
-
let
|
|
76
|
+
let l;
|
|
77
77
|
switch (t) {
|
|
78
78
|
case LENGTH_UNIT.KM:
|
|
79
|
-
n > 1e4 ?
|
|
79
|
+
n > 1e4 ? l = Math.round(n / 1e6 * 100) / 100 + " km<sup>2</sup>" : l = Math.round(n * 100) / 100 + " m<sup>2</sup>";
|
|
80
80
|
break;
|
|
81
81
|
case LENGTH_UNIT.NM:
|
|
82
|
-
const
|
|
83
|
-
n > 1e4 ?
|
|
82
|
+
const r = Math.pow(1.852, 2);
|
|
83
|
+
n > 1e4 ? l = Math.round(n / 1e6 / r * 100) / 100 + " nm<sup>2</sup>" : l = Math.round(n * 100) / 100 + " m<sup>2</sup>";
|
|
84
84
|
break;
|
|
85
85
|
}
|
|
86
|
-
return
|
|
86
|
+
return l;
|
|
87
87
|
}, convertShipMapData = (e) => {
|
|
88
88
|
const t = (o) => new ShipMapData(
|
|
89
89
|
o.id,
|
|
@@ -130,10 +130,10 @@ const formatLength = function(e, t) {
|
|
|
130
130
|
}),
|
|
131
131
|
emits: /* @__PURE__ */ mergeModels(["close"], ["update:visible"]),
|
|
132
132
|
setup(e, { expose: t, emit: o }) {
|
|
133
|
-
const n = inject("mapInstance"),
|
|
134
|
-
let
|
|
133
|
+
const n = inject("mapInstance"), l = o, r = useModel(e, "visible"), i = ref("3"), c = ref([]), s = ref(!1), m = new VectorSource();
|
|
134
|
+
let u, d, f, p, y;
|
|
135
135
|
const h = new VectorLayer({
|
|
136
|
-
source:
|
|
136
|
+
source: m,
|
|
137
137
|
style: {
|
|
138
138
|
"fill-color": "rgba(255, 255, 255, 0.2)",
|
|
139
139
|
"stroke-color": "#ffcc33",
|
|
@@ -145,12 +145,12 @@ const formatLength = function(e, t) {
|
|
|
145
145
|
if (S.dragging)
|
|
146
146
|
return;
|
|
147
147
|
let T = "点击选择起点";
|
|
148
|
-
|
|
148
|
+
u && (T = "单击继续,双击结束"), d && (d.innerHTML = T, f.setPosition(S.coordinate), d.classList.remove("hidden"));
|
|
149
149
|
}, k = () => {
|
|
150
150
|
n.value && (n.value.on("pointermove", g), n.value.getViewport().addEventListener("mouseout", function() {
|
|
151
151
|
var S;
|
|
152
|
-
(S =
|
|
153
|
-
}),
|
|
152
|
+
(S = d == null ? void 0 : d.classList) == null || S.add("hidden");
|
|
153
|
+
}), s.value = !0);
|
|
154
154
|
};
|
|
155
155
|
let M;
|
|
156
156
|
const b = new Style({
|
|
@@ -172,52 +172,52 @@ const formatLength = function(e, t) {
|
|
|
172
172
|
})
|
|
173
173
|
})
|
|
174
174
|
});
|
|
175
|
-
function
|
|
175
|
+
function x() {
|
|
176
176
|
var S, T;
|
|
177
177
|
if (n.value) {
|
|
178
|
-
if (
|
|
179
|
-
var
|
|
180
|
-
(
|
|
181
|
-
}),
|
|
182
|
-
const
|
|
183
|
-
|
|
178
|
+
if (c.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((E) => {
|
|
179
|
+
var C;
|
|
180
|
+
(C = E == null ? void 0 : E.parentNode) == null || C.removeChild(E);
|
|
181
|
+
}), m.clear(), M) {
|
|
182
|
+
const E = n.value.getInteractions().getArray().find((C) => C.ol_uid === M.ol_uid);
|
|
183
|
+
E && ((S = n.value) == null || S.removeInteraction(E));
|
|
184
184
|
}
|
|
185
|
-
(T = n.value) == null || T.removeLayer(h),
|
|
185
|
+
(T = n.value) == null || T.removeLayer(h), d != null && d.parentNode && d.parentNode.removeChild(d), p != null && p.parentNode && p.parentNode.removeChild(p);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
function
|
|
189
|
-
var T,
|
|
190
|
-
|
|
191
|
-
source:
|
|
188
|
+
function F() {
|
|
189
|
+
var T, E;
|
|
190
|
+
x(), (T = n.value) == null || T.addLayer(h), M = new Draw({
|
|
191
|
+
source: m,
|
|
192
192
|
type: "LineString",
|
|
193
193
|
style: function() {
|
|
194
194
|
return b;
|
|
195
195
|
}
|
|
196
|
-
}), (
|
|
196
|
+
}), (E = n.value) == null || E.addInteraction(M), v(), P();
|
|
197
197
|
let S;
|
|
198
|
-
M.on("drawstart", function(
|
|
198
|
+
M.on("drawstart", function(C) {
|
|
199
199
|
var N;
|
|
200
|
-
|
|
201
|
-
let
|
|
202
|
-
S = (N =
|
|
200
|
+
u = C.feature;
|
|
201
|
+
let V;
|
|
202
|
+
S = (N = u.getGeometry()) == null ? void 0 : N.on("change", function(A) {
|
|
203
203
|
const $ = A.target;
|
|
204
|
-
let R = formatUtils.formatLength($, Number(
|
|
205
|
-
|
|
204
|
+
let R = formatUtils.formatLength($, Number(i.value));
|
|
205
|
+
V = $.getLastCoordinate(), p && R && (p.innerHTML = R), y.setPosition(V);
|
|
206
206
|
});
|
|
207
207
|
}), M.on("drawend", function() {
|
|
208
|
-
var
|
|
209
|
-
p && (p.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), p != null && p.innerHTML && (
|
|
208
|
+
var C, V;
|
|
209
|
+
p && (p.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), p != null && p.innerHTML && (c.value.push(p == null ? void 0 : p.innerHTML), p.innerHTML = `${p.innerHTML}<div class="ol-tooltip-delete-button" data-index="${((C = c.value) == null ? void 0 : C.length) - 1}"><i class="map-iconfont icon-delete"></i></div>`), (V = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || V.addEventListener("click", (N) => {
|
|
210
210
|
var $;
|
|
211
211
|
N.preventDefault(), N.stopPropagation();
|
|
212
212
|
const A = ($ = N.target) == null ? void 0 : $.getAttribute("data-index");
|
|
213
213
|
A && L(Number(A));
|
|
214
|
-
}), y.setOffset([0, -7]),
|
|
214
|
+
}), y.setOffset([0, -7]), u = null, p = null, v(), S && unByKey(S);
|
|
215
215
|
});
|
|
216
216
|
}
|
|
217
217
|
function P() {
|
|
218
218
|
var S;
|
|
219
|
-
|
|
220
|
-
element:
|
|
219
|
+
d != null && d.parentNode && d.parentNode.removeChild(d), d = document.createElement("div"), d.className = "ol-tooltip hidden", f = new Overlay({
|
|
220
|
+
element: d,
|
|
221
221
|
offset: [15, 0],
|
|
222
222
|
positioning: "center-left"
|
|
223
223
|
}), (S = n.value) == null || S.addOverlay(f);
|
|
@@ -233,21 +233,21 @@ const formatLength = function(e, t) {
|
|
|
233
233
|
}), (S = n.value) == null || S.addOverlay(y);
|
|
234
234
|
}
|
|
235
235
|
const L = (S) => {
|
|
236
|
-
var
|
|
237
|
-
|
|
236
|
+
var C, V;
|
|
237
|
+
c.value[S] && c.value.splice(S, 1);
|
|
238
238
|
const T = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
239
|
-
T[S] && ((
|
|
240
|
-
const
|
|
241
|
-
|
|
239
|
+
T[S] && ((V = (C = T[S]) == null ? void 0 : C.parentNode) == null || V.removeChild(T[S]));
|
|
240
|
+
const E = m.getFeatures();
|
|
241
|
+
E[S] && m.removeFeature(E[S]);
|
|
242
242
|
}, w = () => {
|
|
243
|
-
|
|
243
|
+
l("close");
|
|
244
244
|
};
|
|
245
|
-
return watch(() =>
|
|
246
|
-
|
|
245
|
+
return watch(() => r, () => {
|
|
246
|
+
r.value && !s.value && (k(), F());
|
|
247
247
|
}, { deep: !0, immediate: !0 }), t({
|
|
248
|
-
addInteraction:
|
|
249
|
-
removeInteraction:
|
|
250
|
-
}), (S, T) =>
|
|
248
|
+
addInteraction: F,
|
|
249
|
+
removeInteraction: x
|
|
250
|
+
}), (S, T) => r.value && S.viewMode !== "WxMiniprogram" ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
251
251
|
createElementVNode("div", { class: "header" }, [
|
|
252
252
|
T[1] || (T[1] = createElementVNode("div", { class: "title" }, "测量", -1)),
|
|
253
253
|
createElementVNode("i", {
|
|
@@ -259,8 +259,8 @@ const formatLength = function(e, t) {
|
|
|
259
259
|
T[2] || (T[2] = createElementVNode("div", { class: "tips" }, "在地图上点击多个点测量距离,距离单位", -1)),
|
|
260
260
|
createVNode(unref(ElSelect), {
|
|
261
261
|
class: "select-length-unit",
|
|
262
|
-
modelValue:
|
|
263
|
-
"onUpdate:modelValue": T[0] || (T[0] = (
|
|
262
|
+
modelValue: i.value,
|
|
263
|
+
"onUpdate:modelValue": T[0] || (T[0] = (E) => i.value = E)
|
|
264
264
|
}, {
|
|
265
265
|
default: withCtx(() => [
|
|
266
266
|
createVNode(unref(ElOption), {
|
|
@@ -280,18 +280,18 @@ const formatLength = function(e, t) {
|
|
|
280
280
|
}, 8, ["modelValue"])
|
|
281
281
|
]),
|
|
282
282
|
createElementVNode("div", _hoisted_3$1, [
|
|
283
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(
|
|
283
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(c.value, (E, C) => (openBlock(), createElementBlock("div", {
|
|
284
284
|
class: "measure-history-item",
|
|
285
|
-
key:
|
|
285
|
+
key: C
|
|
286
286
|
}, [
|
|
287
287
|
createElementVNode("div", _hoisted_4, [
|
|
288
288
|
T[3] || (T[3] = createElementVNode("i", { class: "map-iconfont icon-line" }, null, -1)),
|
|
289
|
-
createElementVNode("span", _hoisted_5, "线段" + toDisplayString(
|
|
290
|
-
createElementVNode("span", _hoisted_6, toDisplayString(
|
|
289
|
+
createElementVNode("span", _hoisted_5, "线段" + toDisplayString(C + 1), 1),
|
|
290
|
+
createElementVNode("span", _hoisted_6, toDisplayString(E), 1)
|
|
291
291
|
]),
|
|
292
292
|
createElementVNode("div", {
|
|
293
293
|
class: "delete-button",
|
|
294
|
-
onClick: (
|
|
294
|
+
onClick: (V) => L(C)
|
|
295
295
|
}, T[4] || (T[4] = [
|
|
296
296
|
createElementVNode("i", { class: "map-iconfont icon-delete" }, null, -1)
|
|
297
297
|
]), 8, _hoisted_7)
|
|
@@ -329,36 +329,36 @@ const formatLength = function(e, t) {
|
|
|
329
329
|
// 设置文本背景的内边距
|
|
330
330
|
})
|
|
331
331
|
}), renderMarker = (e, t = !0, o = !0) => {
|
|
332
|
-
var
|
|
332
|
+
var u;
|
|
333
333
|
if (!mapInstance$8.value || !e || e.split(",").length !== 2) return;
|
|
334
|
-
const [n,
|
|
334
|
+
const [n, l] = e.split(",").map(Number);
|
|
335
335
|
marker.value = new Feature({
|
|
336
|
-
geometry: new Point(fromLonLat([n,
|
|
336
|
+
geometry: new Point(fromLonLat([n, l]))
|
|
337
337
|
});
|
|
338
|
-
const
|
|
339
|
-
(
|
|
340
|
-
const
|
|
338
|
+
const r = o ? `${n}, ${l}` : "";
|
|
339
|
+
(u = marker.value) == null || u.setStyle(createIconStyle(r));
|
|
340
|
+
const i = new VectorSource({
|
|
341
341
|
features: [marker.value]
|
|
342
|
-
}),
|
|
343
|
-
source:
|
|
344
|
-
}),
|
|
345
|
-
if (mapInstance$8.value.addLayer(
|
|
346
|
-
const
|
|
347
|
-
layers: [
|
|
342
|
+
}), c = new VectorLayer({
|
|
343
|
+
source: i
|
|
344
|
+
}), s = mapInstance$8.value.getView();
|
|
345
|
+
if (mapInstance$8.value.addLayer(c), t) {
|
|
346
|
+
const d = new Translate({
|
|
347
|
+
layers: [c]
|
|
348
348
|
});
|
|
349
|
-
|
|
349
|
+
d.on("translating", function(f) {
|
|
350
350
|
var h;
|
|
351
351
|
const p = f.features.item(0).getGeometry().getCoordinates(), y = toLonLat(p);
|
|
352
352
|
markerPosition.value = `${y[0].toFixed(6)}, ${y[1].toFixed(6)}`, (h = marker.value) == null || h.setStyle(createIconStyle(markerPosition.value));
|
|
353
|
-
}), mapInstance$8.value.addInteraction(
|
|
353
|
+
}), mapInstance$8.value.addInteraction(d);
|
|
354
354
|
}
|
|
355
|
-
const
|
|
356
|
-
|
|
355
|
+
const m = new Point([n, l]);
|
|
356
|
+
s.setCenter(transform(m.getCoordinates(), projection.data, projection.mercator)), s.setZoom(mapZoom.findShip);
|
|
357
357
|
}, setMarkerPosition = (e) => {
|
|
358
|
-
var
|
|
358
|
+
var l, r;
|
|
359
359
|
if (!mapInstance$8.value) return;
|
|
360
360
|
const t = mapInstance$8.value.getView(), o = e.split(",").map(Number);
|
|
361
|
-
(
|
|
361
|
+
(r = (l = marker.value) == null ? void 0 : l.getGeometry()) == null || r.setCoordinates(fromLonLat([o[0], o[1]]));
|
|
362
362
|
const n = new Point([o[0], o[1]]);
|
|
363
363
|
t.setCenter(transform(n.getCoordinates(), projection.data, projection.mercator)), t.setZoom(mapZoom.markerPosition);
|
|
364
364
|
}, CDN_URL = "https://static.zhihaoscm.cn/", tiandituKey = "a6e8f78974f2581f2ca00485b40c948f", zhongkeKey = "15c81cc0a191a232e0a0ca1a51c3ca81", baseMap = {
|
|
@@ -425,45 +425,45 @@ const multiplyPixelRatio = (e) => {
|
|
|
425
425
|
}),
|
|
426
426
|
zIndex: 100
|
|
427
427
|
}), getRotation = (e, t, o) => {
|
|
428
|
-
function n(
|
|
429
|
-
return 180 * (
|
|
428
|
+
function n(d) {
|
|
429
|
+
return 180 * (d % (2 * Math.PI)) / Math.PI;
|
|
430
430
|
}
|
|
431
|
-
function
|
|
432
|
-
return
|
|
431
|
+
function l(d) {
|
|
432
|
+
return d % 360 * Math.PI / 180;
|
|
433
433
|
}
|
|
434
|
-
function
|
|
435
|
-
if (!
|
|
436
|
-
if (!Array.isArray(
|
|
437
|
-
if (
|
|
438
|
-
return
|
|
439
|
-
if (
|
|
434
|
+
function r(d) {
|
|
435
|
+
if (!d) throw new Error("Coordinate is required");
|
|
436
|
+
if (!Array.isArray(d)) {
|
|
437
|
+
if (d.type === "Feature" && d.geometry !== null && d.geometry.type === "Point")
|
|
438
|
+
return d.geometry.coordinates;
|
|
439
|
+
if (d.type === "Point") return d.coordinates;
|
|
440
440
|
}
|
|
441
|
-
if (Array.isArray(
|
|
442
|
-
return
|
|
441
|
+
if (Array.isArray(d) && d.length >= 2 && !Array.isArray(d[0]) && !Array.isArray(d[1]))
|
|
442
|
+
return d;
|
|
443
443
|
throw new Error(
|
|
444
444
|
"Coordinate must be GeoJSON Point or an Array of numbers"
|
|
445
445
|
);
|
|
446
446
|
}
|
|
447
|
-
function
|
|
447
|
+
function i(d, f, p = {}) {
|
|
448
448
|
if (p.final)
|
|
449
449
|
return function(P, v) {
|
|
450
|
-
return (
|
|
451
|
-
}(
|
|
452
|
-
const y =
|
|
453
|
-
return n(Math.atan2(
|
|
450
|
+
return (i(v, P) + 180) % 360;
|
|
451
|
+
}(d, f);
|
|
452
|
+
const y = r(d), h = r(f), g = l(y[0]), k = l(h[0]), M = l(y[1]), b = l(h[1]), x = Math.sin(k - g) * Math.cos(b), F = Math.cos(M) * Math.sin(b) - Math.sin(M) * Math.cos(b) * Math.cos(k - g);
|
|
453
|
+
return n(Math.atan2(x, F));
|
|
454
454
|
}
|
|
455
|
-
function
|
|
456
|
-
return !isNaN(
|
|
455
|
+
function c(d) {
|
|
456
|
+
return !isNaN(d) && d !== null && !Array.isArray(d);
|
|
457
457
|
}
|
|
458
|
-
function
|
|
459
|
-
return
|
|
458
|
+
function s(d, f = {}, p = {}) {
|
|
459
|
+
return d || console.log("Coordinates are required"), Array.isArray(d) || console.log("Coordinates must be an Array"), d.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (!c(d[0]) || !c(d[1])) && console.log("Coordinates must contain numbers"), m({ type: "Point", coordinates: d }, f, p);
|
|
460
460
|
}
|
|
461
|
-
function d
|
|
461
|
+
function m(d, f = {}, p = {}) {
|
|
462
462
|
const y = { type: "Feature" };
|
|
463
|
-
return p.id !== void 0 && (y.id = p.id), p.bbox && (y.bbox = p.bbox), y.properties = f || {}, y.geometry =
|
|
463
|
+
return p.id !== void 0 && (y.id = p.id), p.bbox && (y.bbox = p.bbox), y.properties = f || {}, y.geometry = d, y;
|
|
464
464
|
}
|
|
465
|
-
const
|
|
466
|
-
return
|
|
465
|
+
const u = i(s(e), s(t), o);
|
|
466
|
+
return u < 0 ? 360 + u : u;
|
|
467
467
|
}, triangleModel = multiplyPixelRatio([
|
|
468
468
|
[0, -8],
|
|
469
469
|
[5, 8],
|
|
@@ -535,130 +535,130 @@ const multiplyPixelRatio = (e) => {
|
|
|
535
535
|
}), mapInstance$7 = ref(), renderShipStyleSetInstance = (e) => mapInstance$7.value = e, speedCondition = [[1, 10], [10, 20], [20, 1 / 0]], drawShipModelByZoom = { 14: [200, 30], 15: [115, 15], 16: [55, 8], 17: [25, 5], 18: [1, 1] }, setShipStyle = (e, t = !1) => new Style({
|
|
536
536
|
renderer: (o, n) => {
|
|
537
537
|
o = o;
|
|
538
|
-
const
|
|
539
|
-
if (!
|
|
540
|
-
if (i != null && i.length) {
|
|
541
|
-
const s = i.length / 2;
|
|
542
|
-
r.beginPath(), r.arc(
|
|
543
|
-
o[0],
|
|
544
|
-
o[1],
|
|
545
|
-
s,
|
|
546
|
-
0,
|
|
547
|
-
2 * Math.PI
|
|
548
|
-
), r.fillStyle = "rgba(0, 0, 0, 0.01)", r.fill();
|
|
549
|
-
}
|
|
538
|
+
const l = n.context, r = n.feature.get("data");
|
|
539
|
+
if (!r) return;
|
|
550
540
|
n.feature.get("index") === 0 && (shipLabels.value = []);
|
|
551
541
|
try {
|
|
552
|
-
const
|
|
553
|
-
|
|
554
|
-
drawSelectBounds(
|
|
555
|
-
}, 50)), drawShipLabel(
|
|
542
|
+
const c = drawShipBody(l, r, o, t);
|
|
543
|
+
c && (drawHeading(l, r, c, t), r.selected = e, e && setTimeout(() => {
|
|
544
|
+
drawSelectBounds(l, c);
|
|
545
|
+
}, 50)), drawShipLabel(l, r, o);
|
|
556
546
|
} catch {
|
|
557
547
|
return !1;
|
|
558
548
|
}
|
|
559
549
|
}
|
|
560
550
|
}), drawShipBody = (e, t, o, n) => {
|
|
561
551
|
if (!mapInstance$7.value) return;
|
|
562
|
-
const
|
|
563
|
-
if (!
|
|
564
|
-
let
|
|
565
|
-
const [
|
|
566
|
-
if (
|
|
567
|
-
|
|
568
|
-
const [f, p] =
|
|
569
|
-
return [
|
|
552
|
+
const l = Math.round(Number(mapInstance$7.value.getView().getZoom()));
|
|
553
|
+
if (!l) return;
|
|
554
|
+
let r = [];
|
|
555
|
+
const [i, c] = drawShipModelByZoom[l] || [0, 0], [s, m] = o;
|
|
556
|
+
if (l <= mapZoom.shipModelMax && l > mapZoom.shipModelMin && t.length >= i && t.breadth >= c)
|
|
557
|
+
r = rotateShapeModel(drawCurrentShipShapeModel(t, l), t.angle).map((d) => {
|
|
558
|
+
const [f, p] = d;
|
|
559
|
+
return [s + f, m + p];
|
|
570
560
|
});
|
|
571
561
|
else {
|
|
572
|
-
const
|
|
573
|
-
o.length === 2 && (
|
|
574
|
-
const [f, p] =
|
|
575
|
-
return [
|
|
562
|
+
const u = rotateShapeModel(triangleModel, t.angle);
|
|
563
|
+
o.length === 2 && (r = u.map((d) => {
|
|
564
|
+
const [f, p] = d;
|
|
565
|
+
return [s + f, m + p];
|
|
576
566
|
}));
|
|
577
567
|
}
|
|
578
|
-
if (!(
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
e.
|
|
582
|
-
|
|
568
|
+
if (!(r.length > 2)) return !1;
|
|
569
|
+
if (t != null && t.length) {
|
|
570
|
+
const u = r.length === 3 ? 30 : t.length * 0.4;
|
|
571
|
+
e.beginPath(), e.arc(
|
|
572
|
+
o[0],
|
|
573
|
+
o[1],
|
|
574
|
+
u,
|
|
575
|
+
0,
|
|
576
|
+
2 * Math.PI
|
|
577
|
+
), e.fillStyle = "rgba(255, 255, 255, 0.001)", e.fill();
|
|
578
|
+
}
|
|
579
|
+
e.save(), e.beginPath(), e.moveTo(r[0][0], r[0][1]);
|
|
580
|
+
for (let u = 1; u < r.length; u++)
|
|
581
|
+
e.lineTo(r[u][0], r[u][1]);
|
|
582
|
+
return e.closePath(), e.strokeStyle = n ? "#ff0000" : "#000", e.lineWidth = n ? 2 : 1, e.stroke(), e.fillStyle = t.fill, e.fill(), e.restore(), r;
|
|
583
583
|
}, drawHeading = (e, t, o, n) => {
|
|
584
|
-
const [
|
|
585
|
-
if (
|
|
586
|
-
const
|
|
587
|
-
const [
|
|
588
|
-
return [
|
|
584
|
+
const [l, r] = o[0], i = getShipDirectPath(t);
|
|
585
|
+
if (i) {
|
|
586
|
+
const c = i.map(function(s) {
|
|
587
|
+
const [m, u] = s;
|
|
588
|
+
return [m + l, u + r];
|
|
589
589
|
});
|
|
590
590
|
if (e.save(), e.beginPath(), t.angle > 0) {
|
|
591
|
-
e.translate(
|
|
592
|
-
const
|
|
593
|
-
e.rotate(
|
|
591
|
+
e.translate(l, r);
|
|
592
|
+
const s = t.angle * Math.PI / 180;
|
|
593
|
+
e.rotate(s), e.translate(-l, -r);
|
|
594
594
|
}
|
|
595
|
-
e.moveTo(
|
|
596
|
-
for (let
|
|
597
|
-
const [
|
|
598
|
-
e.lineTo(
|
|
595
|
+
e.moveTo(l, r);
|
|
596
|
+
for (let s = 1; s < c.length; s++) {
|
|
597
|
+
const [m, u] = c[s];
|
|
598
|
+
e.lineTo(m, u);
|
|
599
599
|
}
|
|
600
600
|
e.strokeStyle = n ? "#ff0000" : "#000", e.lineWidth = n ? 2 : 1, e.stroke(), e.restore();
|
|
601
601
|
}
|
|
602
602
|
}, drawSelectBounds = (e, t) => {
|
|
603
|
-
let [o, n,
|
|
604
|
-
const
|
|
605
|
-
o -=
|
|
606
|
-
const
|
|
607
|
-
e.beginPath(), e.moveTo(o +
|
|
603
|
+
let [o, n, l, r] = getPixelFromCoordinate(t);
|
|
604
|
+
const i = 4;
|
|
605
|
+
o -= i, n -= i, l += i, r += i, e.save(), e.strokeStyle = "#ff0000", e.lineWidth = 4;
|
|
606
|
+
const c = 8;
|
|
607
|
+
e.beginPath(), e.moveTo(o + c, r), e.lineTo(o, r), e.lineTo(o, r - c), e.moveTo(o, n + c), e.lineTo(o, n), e.lineTo(o + c, n), e.moveTo(l - c, n), e.lineTo(l, n), e.lineTo(l, n + c), e.moveTo(l, r - c), e.lineTo(l, r), e.lineTo(l - c, r), e.stroke(), e.restore();
|
|
608
608
|
}, drawShipLabel = (e, t, o) => {
|
|
609
|
-
if (!t.selected && shipLabels.value.find((
|
|
610
|
-
const [n,
|
|
611
|
-
let
|
|
612
|
-
t.leftIconColor && (
|
|
613
|
-
const
|
|
609
|
+
if (!t.selected && shipLabels.value.find((d) => d.name === t.name)) return;
|
|
610
|
+
const [n, l] = o, r = n, i = l, c = t.name;
|
|
611
|
+
let s;
|
|
612
|
+
t.leftIconColor && (s = { color: t.leftIconColor, icon: "" });
|
|
613
|
+
const m = getShipCustomIcon(t), u = {
|
|
614
614
|
id: t.id,
|
|
615
|
-
center: [
|
|
616
|
-
text:
|
|
615
|
+
center: [r, i],
|
|
616
|
+
text: c,
|
|
617
617
|
fill: t.fill,
|
|
618
618
|
color: "#fff",
|
|
619
619
|
textColor: "#000",
|
|
620
620
|
bgColor: "#fff",
|
|
621
|
-
leftIcon:
|
|
622
|
-
rightIcons:
|
|
621
|
+
leftIcon: s,
|
|
622
|
+
rightIcons: m,
|
|
623
623
|
selected: t.selected,
|
|
624
624
|
blinkColors: t.blinkColors,
|
|
625
625
|
type: "ShipName"
|
|
626
626
|
};
|
|
627
|
-
drawLabel(e,
|
|
627
|
+
drawLabel(e, u, shipLabels.value);
|
|
628
628
|
}, drawCurrentShipShapeModel = (e, t) => {
|
|
629
629
|
let o = 0;
|
|
630
630
|
t <= 14 ? o = 0.058 : t === 15 ? o = 0.12 : t === 16 ? o = 0.22 : t === 17 ? o = 0.435 : t === 18 && (o = 0.857);
|
|
631
|
-
const n = e.length / 4 * o,
|
|
632
|
-
let
|
|
633
|
-
return
|
|
631
|
+
const n = e.length / 4 * o, l = e.breadth * o;
|
|
632
|
+
let r = cloneDeep(shipShapeModel);
|
|
633
|
+
return r = r.map(([i, c]) => [i * l, c * n]), r;
|
|
634
634
|
}, getShipDirectPath = (e) => {
|
|
635
635
|
const { speed: t, hdg: o, cog: n } = e;
|
|
636
|
-
let
|
|
637
|
-
if (t && t > 1 && (o !== null && o != 511 && n !== null ? n - o >= 3 ?
|
|
638
|
-
for (let
|
|
639
|
-
const
|
|
640
|
-
if (t >=
|
|
641
|
-
|
|
636
|
+
let l = "", r = null;
|
|
637
|
+
if (t && t > 1 && (o !== null && o != 511 && n !== null ? n - o >= 3 ? l = "left" : n - o <= -3 ? l = "right" : l = "front" : l = "front", l && t))
|
|
638
|
+
for (let i = 0; i < speedCondition.length; i++) {
|
|
639
|
+
const c = speedCondition[i];
|
|
640
|
+
if (t >= c[0] && t < c[1]) {
|
|
641
|
+
r = shipDirectPath[l][i];
|
|
642
642
|
break;
|
|
643
643
|
}
|
|
644
644
|
}
|
|
645
|
-
return
|
|
645
|
+
return r;
|
|
646
646
|
}, getShipCustomIcon = (e) => {
|
|
647
647
|
const t = [];
|
|
648
648
|
return e.existDevice && t.push(""), e.existMobile && t.push(""), e.existWaterGauge && t.push(""), t || [];
|
|
649
649
|
}, mapInstance$6 = ref(), renderShipSetInstance = (e) => mapInstance$6.value = e;
|
|
650
650
|
let shipsMarkerList = [], shipsVectorSource, largeAmountShipsSource;
|
|
651
|
-
const selectedShipData = ref(null);
|
|
651
|
+
const selectedShipData = ref(null), selectedShips = ref([]);
|
|
652
652
|
let selectShipsVectorSource;
|
|
653
653
|
const renderShips = (e) => {
|
|
654
|
-
var o, n,
|
|
654
|
+
var o, n, l, r;
|
|
655
655
|
if (!mapInstance$6.value || showTrackLayer.value) return;
|
|
656
656
|
const t = Math.round(Number(mapInstance$6.value.getView().getZoom()));
|
|
657
657
|
if (selectedShipData.value && nextTick(() => {
|
|
658
658
|
selectSingleShipMarker(selectedShipData.value);
|
|
659
|
-
}).then((
|
|
660
|
-
}), !(!t || t < mapZoom.shipGreenDotMax) && (allShips.value = e, !hiddenOrther.value))
|
|
661
|
-
return t >= mapZoom.shipGreenDotMax && t < mapZoom.shipModelMin ? ((o = shipsLayer.value) == null || o.setVisible(!1), (n = largeAmountShipsLayer.value) == null || n.setVisible(!0), renderLargeAmountShips(
|
|
659
|
+
}).then((i) => {
|
|
660
|
+
}), !(!t || t < mapZoom.shipGreenDotMax) && (allShips.value = [...e, ...selectedShips.value], !hiddenOrther.value))
|
|
661
|
+
return t >= mapZoom.shipGreenDotMax && t < mapZoom.shipModelMin ? ((o = shipsLayer.value) == null || o.setVisible(!1), (n = largeAmountShipsLayer.value) == null || n.setVisible(!0), renderLargeAmountShips(allShips.value)) : ((l = largeAmountShipsLayer.value) == null || l.setVisible(!1), (r = shipsLayer.value) == null || r.setVisible(!0), renderShipsMarker(allShips.value));
|
|
662
662
|
}, renderLargeAmountShips = (e) => {
|
|
663
663
|
if (!mapInstance$6.value) return;
|
|
664
664
|
const t = e.map((o) => ({
|
|
@@ -713,16 +713,16 @@ const renderShips = (e) => {
|
|
|
713
713
|
deleteAllShipMarkers();
|
|
714
714
|
let t = convertShipMapData(e);
|
|
715
715
|
if (t = customFilterShips(t), !!(t != null && t.length))
|
|
716
|
-
return t.forEach((n,
|
|
717
|
-
const
|
|
718
|
-
geometry: new Point(fromLonLat(
|
|
719
|
-
}),
|
|
720
|
-
|
|
716
|
+
return t.forEach((n, l) => {
|
|
717
|
+
const r = [n.lon, n.lat], i = new Feature({
|
|
718
|
+
geometry: new Point(fromLonLat(r))
|
|
719
|
+
}), c = 1;
|
|
720
|
+
i.set("clickGeometry", new Circle(fromLonLat(r), c)), i.set("data", n), i.set("index", l), i.setStyle(
|
|
721
721
|
setShipStyle(!1)
|
|
722
722
|
), shipsMarkerList.push({
|
|
723
723
|
ship: n,
|
|
724
|
-
lonlat:
|
|
725
|
-
feature:
|
|
724
|
+
lonlat: r,
|
|
725
|
+
feature: i
|
|
726
726
|
});
|
|
727
727
|
}), shipsVectorSource = new VectorSource({
|
|
728
728
|
features: shipsMarkerList.map((n) => n.feature)
|
|
@@ -731,36 +731,40 @@ const renderShips = (e) => {
|
|
|
731
731
|
zIndex: 100
|
|
732
732
|
}), (o = mapInstance$6.value) == null || o.addLayer(shipsLayer.value), shipsLayer.value;
|
|
733
733
|
}, onShipsMarkerHover = () => {
|
|
734
|
-
var
|
|
735
|
-
let e = null;
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
if (
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
if (
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
734
|
+
var n;
|
|
735
|
+
let e = null, t = 0;
|
|
736
|
+
const o = 100;
|
|
737
|
+
(n = mapInstance$6.value) == null || n.on("pointermove", function(l) {
|
|
738
|
+
var s, m;
|
|
739
|
+
const r = Date.now();
|
|
740
|
+
if (r - t < o)
|
|
741
|
+
return;
|
|
742
|
+
t = r;
|
|
743
|
+
const i = (s = mapInstance$6.value) == null ? void 0 : s.forEachFeatureAtPixel(l.pixel, (u) => u), c = (m = mapInstance$6.value) == null ? void 0 : m.getTargetElement();
|
|
744
|
+
if (c && (c.style.cursor = i ? "pointer" : ""), e !== i) {
|
|
745
|
+
if (e) {
|
|
746
|
+
const u = e.get("data");
|
|
747
|
+
if (!(u != null && u.mmsi)) return;
|
|
748
|
+
e.setStyle(
|
|
749
|
+
setShipStyle(!1, !1)
|
|
750
|
+
);
|
|
751
|
+
}
|
|
752
|
+
if (i) {
|
|
753
|
+
const u = i.get("data");
|
|
754
|
+
if (!(u != null && u.mmsi)) return;
|
|
755
|
+
e = i, i.setStyle(
|
|
756
|
+
setShipStyle(!1, !0)
|
|
757
|
+
);
|
|
758
|
+
} else
|
|
759
|
+
e = null;
|
|
756
760
|
}
|
|
757
761
|
});
|
|
758
762
|
}, customFilterShips = (e) => {
|
|
759
763
|
let t = cloneDeep(e);
|
|
760
764
|
return t = t.filter((o) => {
|
|
761
|
-
var
|
|
762
|
-
const n = getFilterItem(o).every(({ btnShow:
|
|
763
|
-
return (switchBtnShow.value.camera || switchBtnShow.value.mobile || switchBtnShow.value.waterGauge) && ((
|
|
765
|
+
var l;
|
|
766
|
+
const n = getFilterItem(o).every(({ btnShow: r, value: i }) => r ? !!i : !0);
|
|
767
|
+
return (switchBtnShow.value.camera || switchBtnShow.value.mobile || switchBtnShow.value.waterGauge) && ((l = selectedShipData.value) == null ? void 0 : l.id) === o.id && clearSelectFeature(), n;
|
|
764
768
|
}), t;
|
|
765
769
|
}, getFilterItem = (e) => [
|
|
766
770
|
{ btnShow: switchBtnShow.value.camera, value: e == null ? void 0 : e.existDevice },
|
|
@@ -771,7 +775,7 @@ const renderShips = (e) => {
|
|
|
771
775
|
e.feature && (shipsVectorSource == null || shipsVectorSource.removeFeature(e.feature));
|
|
772
776
|
}), clearAllInterval(), shipsMarkerList = [];
|
|
773
777
|
}, selectSingleShipMarker = (e) => {
|
|
774
|
-
var
|
|
778
|
+
var r;
|
|
775
779
|
if (!mapInstance$6.value) return;
|
|
776
780
|
const t = cloneDeep(selectSingleShipData.value);
|
|
777
781
|
selectSingleShipData.value = convertShipMapData(e);
|
|
@@ -788,37 +792,44 @@ const renderShips = (e) => {
|
|
|
788
792
|
features: [n]
|
|
789
793
|
}), selectShipsLayer.value = new VectorLayer({
|
|
790
794
|
source: selectShipsVectorSource
|
|
791
|
-
}), setVisibleFeatureById(shipsVectorSource, selectSingleShipData.value.id, !0);
|
|
792
|
-
const
|
|
793
|
-
return
|
|
795
|
+
}), shipsVectorSource && setVisibleFeatureById(shipsVectorSource, selectSingleShipData.value.id, !0);
|
|
796
|
+
const l = (r = shipsLayer.value) == null ? void 0 : r.getSource();
|
|
797
|
+
return l && (t && setVisibleFeatureById(l, t.id, !0), setVisibleFeatureById(l, selectSingleShipData.value.id, !1)), mapInstance$6.value.addLayer(selectShipsLayer.value), selectShipsLayer.value.setVisible(!0), selectShipsLayer.value;
|
|
794
798
|
}, setVisibleFeatureById = (e, t, o) => {
|
|
795
799
|
e && e.forEachFeature((n) => {
|
|
796
|
-
const
|
|
797
|
-
|
|
800
|
+
const l = n.get("data");
|
|
801
|
+
l && l.id === t && n.setStyle(o ? setShipStyle(!1, l.id) : setBlankStyle());
|
|
798
802
|
});
|
|
799
803
|
}, findShip = (e, t, o = !0) => {
|
|
800
|
-
var r, i,
|
|
804
|
+
var l, r, i, c, s;
|
|
801
805
|
if (!e || !mapInstance$6.value) return;
|
|
802
|
-
const n = (
|
|
803
|
-
var
|
|
804
|
-
return ((
|
|
806
|
+
const n = (i = (r = (l = shipsLayer.value) == null ? void 0 : l.getSource()) == null ? void 0 : r.getFeatures()) == null ? void 0 : i.find((m) => {
|
|
807
|
+
var u;
|
|
808
|
+
return ((u = m.get("data")) == null ? void 0 : u.id) === e;
|
|
805
809
|
});
|
|
806
|
-
if (n
|
|
810
|
+
if (n)
|
|
811
|
+
selectedShipData.value = n.get("data");
|
|
812
|
+
else if (t)
|
|
813
|
+
selectedShipData.value = t;
|
|
814
|
+
else {
|
|
807
815
|
console.error("找不到船舶");
|
|
808
816
|
return;
|
|
809
817
|
}
|
|
810
|
-
if (
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
818
|
+
if (selectedShips.value.some((m) => {
|
|
819
|
+
var u;
|
|
820
|
+
return m.id === ((u = selectedShipData.value) == null ? void 0 : u.id);
|
|
821
|
+
}) || selectedShips.value.push(selectedShipData.value), o && ((c = selectedShipData.value) != null && c.lon) && ((s = selectedShipData.value) != null && s.lat)) {
|
|
822
|
+
const m = mapInstance$6.value.getView(), u = new Point([selectedShipData.value.lon, selectedShipData.value.lat]);
|
|
823
|
+
m.setCenter(transform(u.getCoordinates(), projection.data, projection.mercator));
|
|
824
|
+
const d = m.getZoom(), f = d < mapZoom.findShipMin ? mapZoom.findShip : d;
|
|
825
|
+
m.setZoom(f);
|
|
815
826
|
}
|
|
816
827
|
return setTimeout(() => {
|
|
817
|
-
selectSingleShipMarker(t);
|
|
828
|
+
t && selectSingleShipMarker(t);
|
|
818
829
|
}, 50), n;
|
|
819
830
|
}, clearSelectFeature = () => {
|
|
820
831
|
var e;
|
|
821
|
-
if (selectedShipData.value) {
|
|
832
|
+
if (selectedShipData.value && shipsVectorSource && selectSingleShipData.value) {
|
|
822
833
|
setVisibleFeatureById(shipsVectorSource, selectSingleShipData.value.id, !1);
|
|
823
834
|
const t = (e = shipsLayer.value) == null ? void 0 : e.getSource();
|
|
824
835
|
t && setVisibleFeatureById(t, selectSingleShipData.value.id, !0);
|
|
@@ -840,124 +851,124 @@ const renderShips = (e) => {
|
|
|
840
851
|
switchBtnShow.value[e] = t, renderShips(allShips.value);
|
|
841
852
|
}, rerenderShip = () => {
|
|
842
853
|
renderShips(allShips.value);
|
|
843
|
-
}, labelAlpha = 0.8, pixelRatio = window.devicePixelRatio || 1, labelFont = `500 ${12 * pixelRatio}px Arial`, labelOutSize = 2 * pixelRatio, labelHeight = 10 * pixelRatio, fillRectRadius = (e, t, o, n, r, i
|
|
844
|
-
e.beginPath(), e.moveTo(t +
|
|
854
|
+
}, labelAlpha = 0.8, pixelRatio = window.devicePixelRatio || 1, labelFont = `500 ${12 * pixelRatio}px Arial`, labelOutSize = 2 * pixelRatio, labelHeight = 10 * pixelRatio, fillRectRadius = (e, t, o, n, l, r, i = 4) => {
|
|
855
|
+
e.beginPath(), e.moveTo(t + i, o), e.arcTo(t + n, o, t + n, o + i, i), e.arcTo(t + n, o + l, t + n - i, o + l, i), e.arcTo(t, o + l, t, o + l - i, i), e.arcTo(t, o, t + i, o, i), e.closePath(), e.fillStyle = r, e.fill();
|
|
845
856
|
}, getPixelFromCoordinate = (e) => {
|
|
846
857
|
if (!e || e.length === 0)
|
|
847
858
|
throw new Error("Points array is empty or invalid.");
|
|
848
|
-
let t = 1 / 0, o = 1 / 0, n = -1 / 0,
|
|
849
|
-
for (const [
|
|
850
|
-
|
|
851
|
-
return [t, o, n,
|
|
859
|
+
let t = 1 / 0, o = 1 / 0, n = -1 / 0, l = -1 / 0;
|
|
860
|
+
for (const [r, i] of e)
|
|
861
|
+
r < t && (t = r), i < o && (o = i), r > n && (n = r), i > l && (l = i);
|
|
862
|
+
return [t, o, n, l];
|
|
852
863
|
}, calculatePolygonCentroid = (e) => {
|
|
853
864
|
if (!Array.isArray(e) || e.length < 3)
|
|
854
865
|
throw new Error("A polygon must have at least 3 coordinates.");
|
|
855
866
|
let t = 0, o = 0, n = 0;
|
|
856
|
-
const
|
|
857
|
-
for (let
|
|
858
|
-
const [
|
|
859
|
-
n += f, t += (
|
|
867
|
+
const l = e.length;
|
|
868
|
+
for (let c = 0; c < l - 1; c++) {
|
|
869
|
+
const [s, m] = e[c], [u, d] = e[c + 1], f = s * d - u * m;
|
|
870
|
+
n += f, t += (s + u) * f, o += (m + d) * f;
|
|
860
871
|
}
|
|
861
872
|
if (n *= 0.5, n === 0)
|
|
862
873
|
throw new Error("多边形面积为零");
|
|
863
|
-
const
|
|
864
|
-
return [
|
|
874
|
+
const r = t / (6 * n), i = o / (6 * n);
|
|
875
|
+
return [r, i];
|
|
865
876
|
}, rotateShapeModel = (e, t) => {
|
|
866
|
-
const [o, n] = calculatePolygonCentroid(e),
|
|
867
|
-
return e.map(([
|
|
868
|
-
const
|
|
869
|
-
return [
|
|
877
|
+
const [o, n] = calculatePolygonCentroid(e), l = t * Math.PI / 180, r = Math.cos(l), i = Math.sin(l);
|
|
878
|
+
return e.map(([c, s]) => {
|
|
879
|
+
const m = c - o, u = s - n, d = m * r - u * i + o, f = m * i + u * r + n;
|
|
880
|
+
return [d, f];
|
|
870
881
|
});
|
|
871
882
|
}, getTopLeftPoint = (e) => [e[0], e[3]], getBottomLeftPoint = (e) => [e[2], e[3]], getBottomRightPoint = (e) => [e[2], e[1]], getTopRighttPoint = (e) => [e[0], e[1]];
|
|
872
|
-
function calculateBounds(e, t, o, n,
|
|
873
|
-
let i,
|
|
874
|
-
const
|
|
883
|
+
function calculateBounds(e, t, o, n, l) {
|
|
884
|
+
let r, i, c, s;
|
|
885
|
+
const m = e[0], u = e[1];
|
|
875
886
|
switch (t) {
|
|
876
887
|
case 0:
|
|
877
|
-
|
|
888
|
+
r = m + l, i = r + o, s = u - l, c = s - n;
|
|
878
889
|
break;
|
|
879
890
|
case 1:
|
|
880
|
-
|
|
891
|
+
r = m + l, i = r + o, s = u + n / 2, c = s - n;
|
|
881
892
|
break;
|
|
882
893
|
case 2:
|
|
883
|
-
|
|
894
|
+
r = m + l, i = r + o, s = u + l + n, c = s - n;
|
|
884
895
|
break;
|
|
885
896
|
case 3:
|
|
886
|
-
|
|
897
|
+
r = m - o / 2, i = r + o, s = u + l + n, c = s - n;
|
|
887
898
|
break;
|
|
888
899
|
case 4:
|
|
889
|
-
|
|
900
|
+
i = m, r = i - o, s = u + l + n, c = s - n;
|
|
890
901
|
break;
|
|
891
902
|
case 5:
|
|
892
|
-
|
|
903
|
+
i = m - l, r = i - o, s = u + n / 2, c = s - n;
|
|
893
904
|
break;
|
|
894
905
|
case 6:
|
|
895
|
-
|
|
906
|
+
i = m, r = i - o, s = u - l, c = s - n;
|
|
896
907
|
break;
|
|
897
908
|
case 7:
|
|
898
|
-
|
|
909
|
+
r = m - o / 2, i = r + o, s = u - l, c = s - n;
|
|
899
910
|
}
|
|
900
|
-
if (!(!
|
|
901
|
-
return [Math.min(
|
|
911
|
+
if (!(!r || !c || !i || !s))
|
|
912
|
+
return [Math.min(r, i), Math.min(c, s), Math.max(r, i), Math.max(c, s) + 1];
|
|
902
913
|
}
|
|
903
|
-
function calculateAnchorPoint(e, t, o = 70, n = 20,
|
|
904
|
-
const
|
|
914
|
+
function calculateAnchorPoint(e, t, o = 70, n = 20, l = 20) {
|
|
915
|
+
const r = [0, 0];
|
|
905
916
|
switch (t) {
|
|
906
917
|
case 0:
|
|
907
|
-
|
|
918
|
+
r[0] = e[0] + l, r[1] = e[1] - l - n / 2;
|
|
908
919
|
break;
|
|
909
920
|
case 1:
|
|
910
|
-
|
|
921
|
+
r[0] = e[0] + l, r[1] = e[1];
|
|
911
922
|
break;
|
|
912
923
|
case 2:
|
|
913
|
-
|
|
924
|
+
r[0] = e[0] + l, r[1] = e[1] + l + n / 2;
|
|
914
925
|
break;
|
|
915
926
|
case 3:
|
|
916
|
-
|
|
927
|
+
r[0] = e[0], r[1] = e[1] + l + n / 4;
|
|
917
928
|
break;
|
|
918
929
|
case 4:
|
|
919
|
-
|
|
930
|
+
r[0] = Math.max(e[0] - l, e[0] - o / 2), r[1] = e[1] + l + n / 4;
|
|
920
931
|
break;
|
|
921
932
|
case 5:
|
|
922
|
-
|
|
933
|
+
r[0] = e[0] - l, r[1] = e[1];
|
|
923
934
|
break;
|
|
924
935
|
case 6:
|
|
925
|
-
|
|
936
|
+
r[0] = Math.max(e[0] - l, e[0] - o / 2), r[1] = e[1] - l - n / 4;
|
|
926
937
|
break;
|
|
927
938
|
case 7:
|
|
928
|
-
|
|
939
|
+
r[0] = e[0], r[1] = e[1] - l - n / 4;
|
|
929
940
|
}
|
|
930
|
-
return
|
|
941
|
+
return r;
|
|
931
942
|
}
|
|
932
943
|
function drawLabelBody(e, t, o) {
|
|
933
944
|
if (!e) return;
|
|
934
945
|
const {
|
|
935
946
|
font: n,
|
|
936
|
-
labelOutSize:
|
|
937
|
-
labelHeight:
|
|
938
|
-
center:
|
|
939
|
-
text:
|
|
940
|
-
leftIcon:
|
|
941
|
-
shipColor:
|
|
942
|
-
lineLength:
|
|
943
|
-
selected:
|
|
947
|
+
labelOutSize: l = 2,
|
|
948
|
+
labelHeight: r,
|
|
949
|
+
center: i,
|
|
950
|
+
text: c,
|
|
951
|
+
leftIcon: s,
|
|
952
|
+
shipColor: m,
|
|
953
|
+
lineLength: u = 20,
|
|
954
|
+
selected: d
|
|
944
955
|
} = o;
|
|
945
956
|
e.save(), n && (e.font = n);
|
|
946
|
-
let f = e.measureText(
|
|
947
|
-
(
|
|
948
|
-
let p, y = 20, h = -1, g =
|
|
949
|
-
if (
|
|
957
|
+
let f = e.measureText(c).width + 4 * l;
|
|
958
|
+
(s || m) && (f += r + 6 * l), e.restore();
|
|
959
|
+
let p, y = 20, h = -1, g = r + 3 * l;
|
|
960
|
+
if (u)
|
|
950
961
|
for (let k = 0; k < 8; k++) {
|
|
951
|
-
p = calculateBounds(
|
|
962
|
+
p = calculateBounds(i, k, f, g, u);
|
|
952
963
|
let M = !1;
|
|
953
964
|
for (let b = 0; b < t.length; ++b) {
|
|
954
|
-
let
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
965
|
+
let x = t[b].bounds, F = [
|
|
966
|
+
x[0] - y,
|
|
967
|
+
x[1] - y,
|
|
968
|
+
x[2] + y,
|
|
969
|
+
x[3] + y
|
|
959
970
|
];
|
|
960
|
-
if (p && isOverlapping(p,
|
|
971
|
+
if (p && isOverlapping(p, F)) {
|
|
961
972
|
M = !0;
|
|
962
973
|
break;
|
|
963
974
|
}
|
|
@@ -968,78 +979,78 @@ function drawLabelBody(e, t, o) {
|
|
|
968
979
|
}
|
|
969
980
|
}
|
|
970
981
|
else
|
|
971
|
-
h = 0, p = calculateBounds(
|
|
972
|
-
if (
|
|
982
|
+
h = 0, p = calculateBounds(i, h, f, g, u);
|
|
983
|
+
if (d && h === -1 && (h = 0), p && h > -1) {
|
|
973
984
|
let k = getBottomLeftPoint(p), M = getTopRighttPoint(p);
|
|
974
985
|
return {
|
|
975
|
-
center:
|
|
976
|
-
x: calculateAnchorPoint(
|
|
986
|
+
center: i,
|
|
987
|
+
x: calculateAnchorPoint(i, h, f, g, u),
|
|
977
988
|
l: M,
|
|
978
989
|
r: k,
|
|
979
990
|
bounds: p,
|
|
980
991
|
position: h,
|
|
981
|
-
name:
|
|
992
|
+
name: c
|
|
982
993
|
};
|
|
983
994
|
} else
|
|
984
995
|
return null;
|
|
985
996
|
}
|
|
986
997
|
const drawText = (e, t) => {
|
|
987
998
|
if (!e) return;
|
|
988
|
-
const { center: o, text: n, textColor:
|
|
999
|
+
const { center: o, text: n, textColor: l, leftIcon: r, rightIcons: i, font: c } = t;
|
|
989
1000
|
e.save(), e.setTransform(1, 0, 0, 1, 0, 0);
|
|
990
|
-
let [
|
|
991
|
-
if (
|
|
992
|
-
e.font = `${
|
|
993
|
-
let
|
|
994
|
-
e.fillStyle =
|
|
1001
|
+
let [s, m] = o;
|
|
1002
|
+
if (r) {
|
|
1003
|
+
e.font = `${18 * pixelRatio}px map-iconfont`;
|
|
1004
|
+
let u = getIconFont(r.icon);
|
|
1005
|
+
e.fillStyle = r.color, e.fillText(u, s + labelOutSize - 3 * pixelRatio, m + 2.6 * pixelRatio), s += 23 * pixelRatio;
|
|
995
1006
|
}
|
|
996
|
-
if (
|
|
1007
|
+
if (i != null && i.length) {
|
|
997
1008
|
e.font = `${12 * pixelRatio}px map-iconfont`, e.fillStyle = "#3370ff";
|
|
998
|
-
const
|
|
999
|
-
|
|
1000
|
-
const p = getIconFont(
|
|
1001
|
-
e.fillText(p,
|
|
1009
|
+
const u = e.measureText(n).width + 6 * pixelRatio;
|
|
1010
|
+
i.forEach((d, f) => {
|
|
1011
|
+
const p = getIconFont(d), y = 20 * pixelRatio * f;
|
|
1012
|
+
e.fillText(p, s + u + y, m);
|
|
1002
1013
|
});
|
|
1003
1014
|
}
|
|
1004
|
-
e.font =
|
|
1015
|
+
e.font = c || labelFont, e.fillStyle = l, e.fillText(n, s + 2, m), e.restore();
|
|
1005
1016
|
}, drawPolygon = (e, t) => {
|
|
1006
1017
|
let {
|
|
1007
1018
|
points: o,
|
|
1008
1019
|
strokeColor: n,
|
|
1009
|
-
fillColor:
|
|
1010
|
-
shouldClosePath:
|
|
1011
|
-
translation:
|
|
1012
|
-
rotation:
|
|
1013
|
-
rotationCenter:
|
|
1014
|
-
scale:
|
|
1015
|
-
globalAlpha:
|
|
1020
|
+
fillColor: l,
|
|
1021
|
+
shouldClosePath: r,
|
|
1022
|
+
translation: i,
|
|
1023
|
+
rotation: c,
|
|
1024
|
+
rotationCenter: s,
|
|
1025
|
+
scale: m,
|
|
1026
|
+
globalAlpha: u
|
|
1016
1027
|
} = t;
|
|
1017
|
-
if (
|
|
1018
|
-
e.save(), e.beginPath(),
|
|
1019
|
-
for (let
|
|
1020
|
-
e.lineTo(o[
|
|
1021
|
-
|
|
1028
|
+
if (u || (u = 1), o && e) {
|
|
1029
|
+
e.save(), e.beginPath(), c && c !== 0 && s == null && e.rotate(c), i && e.translate(i[0], i[1]), c && (s != null && s.length) && e.rotate(c), m && e.scale(m, m), e.moveTo(o[0][0], o[0][1]);
|
|
1030
|
+
for (let d = 1; d < o.length; d++)
|
|
1031
|
+
e.lineTo(o[d][0], o[d][1]);
|
|
1032
|
+
r && e.closePath(), n && (e.strokeStyle = n, e.stroke()), l && r && (u && (e.globalAlpha = u), e.fillStyle = l, e.fill()), e.restore();
|
|
1022
1033
|
}
|
|
1023
1034
|
}, intervalIds = {}, drawLabel = (e, t, o) => {
|
|
1024
|
-
var
|
|
1025
|
-
let { center: n, text:
|
|
1026
|
-
if (n &&
|
|
1035
|
+
var d, f, p, y, h, g, k;
|
|
1036
|
+
let { center: n, text: l, color: r, textColor: i, bgColor: c, leftIcon: s, rightIcons: m, type: u } = t;
|
|
1037
|
+
if (n && l) {
|
|
1027
1038
|
const M = {
|
|
1028
1039
|
font: labelFont,
|
|
1029
1040
|
labelOutSize,
|
|
1030
1041
|
labelHeight,
|
|
1031
1042
|
center: n,
|
|
1032
|
-
text:
|
|
1033
|
-
leftIcon:
|
|
1043
|
+
text: l,
|
|
1044
|
+
leftIcon: s,
|
|
1034
1045
|
selected: t.selected
|
|
1035
1046
|
};
|
|
1036
|
-
(
|
|
1047
|
+
(d = t.blinkColors) != null && d.length && t.fill && (c = t.fill, i = getForegroundColor(t.fill));
|
|
1037
1048
|
const b = drawLabelBody(e, o, M);
|
|
1038
1049
|
if (b) {
|
|
1039
|
-
const { x
|
|
1040
|
-
o.find((
|
|
1041
|
-
points: [n,
|
|
1042
|
-
strokeColor:
|
|
1050
|
+
const { x, bounds: F, l: P } = b, v = [getTopLeftPoint(F), getBottomLeftPoint(F), getBottomRightPoint(F), getTopRighttPoint(F)];
|
|
1051
|
+
o.find((C) => C.name === l) || o.push(b), drawPolygon(e, {
|
|
1052
|
+
points: [n, x],
|
|
1053
|
+
strokeColor: r,
|
|
1043
1054
|
fillColor: "#000",
|
|
1044
1055
|
shouldClosePath: !0,
|
|
1045
1056
|
translation: void 0,
|
|
@@ -1047,24 +1058,24 @@ const drawText = (e, t) => {
|
|
|
1047
1058
|
rotationCenter: void 0,
|
|
1048
1059
|
scale: void 0,
|
|
1049
1060
|
globalAlpha: labelAlpha
|
|
1050
|
-
}),
|
|
1051
|
-
v[1][0] +=
|
|
1061
|
+
}), m != null && m.length && m.forEach((C, V) => {
|
|
1062
|
+
v[1][0] += 34 + V * 2, v[2][0] += 34 + V * 2;
|
|
1052
1063
|
});
|
|
1053
1064
|
const w = {
|
|
1054
1065
|
points: v,
|
|
1055
|
-
strokeColor:
|
|
1056
|
-
fillColor:
|
|
1066
|
+
strokeColor: r,
|
|
1067
|
+
fillColor: c,
|
|
1057
1068
|
shouldClosePath: !0
|
|
1058
|
-
}, [S, T] = P,
|
|
1069
|
+
}, [S, T] = P, E = {
|
|
1059
1070
|
center: [S, T + labelOutSize + labelHeight + 1],
|
|
1060
|
-
text:
|
|
1061
|
-
textColor:
|
|
1062
|
-
leftIcon:
|
|
1063
|
-
rightIcons:
|
|
1071
|
+
text: l,
|
|
1072
|
+
textColor: i,
|
|
1073
|
+
leftIcon: s,
|
|
1074
|
+
rightIcons: m,
|
|
1064
1075
|
blinkColors: t.blinkColors
|
|
1065
1076
|
};
|
|
1066
|
-
if (drawPolygon(e, w), drawText(e,
|
|
1067
|
-
let
|
|
1077
|
+
if (drawPolygon(e, w), drawText(e, E), t != null && t.blinkColors && t.blinkColors.length > 0) {
|
|
1078
|
+
let C = Date.now(), V = 0;
|
|
1068
1079
|
const N = t.blinkColors;
|
|
1069
1080
|
!!!((y = (p = (f = selectShipsLayer.value) == null ? void 0 : f.getSource()) == null ? void 0 : p.getFeatures()) != null && y.find(($) => {
|
|
1070
1081
|
var R;
|
|
@@ -1072,10 +1083,10 @@ const drawText = (e, t) => {
|
|
|
1072
1083
|
}) || (k = (g = (h = shipsLayer.value) == null ? void 0 : h.getSource()) == null ? void 0 : g.getFeatures()) != null && k.find(($) => {
|
|
1073
1084
|
var R;
|
|
1074
1085
|
return ((R = $.get("data")) == null ? void 0 : R.id) === t.id;
|
|
1075
|
-
})) || hiddenOrther.value ? (clearInterval(intervalIds[t.id]), deleteLabelFromArray(o,
|
|
1086
|
+
})) || hiddenOrther.value ? (clearInterval(intervalIds[t.id]), deleteLabelFromArray(o, l)) : (intervalIds[t.id] && clearInterval(intervalIds[t.id]), intervalIds[t.id] = window.setInterval(() => {
|
|
1076
1087
|
var D, G, _;
|
|
1077
1088
|
const $ = Date.now();
|
|
1078
|
-
$ -
|
|
1089
|
+
$ - C >= 500 && (V = (V + 1) % N.length, C = $, w.fillColor = N[V], drawPolygon(e, w), E.textColor = getForegroundColor(w.fillColor), drawText(e, E));
|
|
1079
1090
|
const R = shipsMarkerList == null ? void 0 : shipsMarkerList.some((O) => {
|
|
1080
1091
|
var B;
|
|
1081
1092
|
return ((B = O.ship) == null ? void 0 : B.id) === t.id;
|
|
@@ -1083,10 +1094,10 @@ const drawText = (e, t) => {
|
|
|
1083
1094
|
const B = O.get("data");
|
|
1084
1095
|
return (B == null ? void 0 : B.id) === t.id;
|
|
1085
1096
|
});
|
|
1086
|
-
!R && !Z && (clearInterval(intervalIds[t.id]), deleteLabelFromArray(o,
|
|
1097
|
+
!R && !Z && (clearInterval(intervalIds[t.id]), deleteLabelFromArray(o, l));
|
|
1087
1098
|
}, 10));
|
|
1088
1099
|
} else
|
|
1089
|
-
shipLabels.value.find((
|
|
1100
|
+
shipLabels.value.find((V) => V.name === l) && (clearInterval(intervalIds[t.id]), drawPolygon(e, w), drawText(e, E));
|
|
1090
1101
|
}
|
|
1091
1102
|
}
|
|
1092
1103
|
return null;
|
|
@@ -1114,28 +1125,28 @@ function gcj02ToWgs84(e) {
|
|
|
1114
1125
|
if (outOfChina(t, o))
|
|
1115
1126
|
return `${t.toFixed(6)}, ${o.toFixed(6)}`;
|
|
1116
1127
|
{
|
|
1117
|
-
let n = transformLat(t - 105, o - 35),
|
|
1118
|
-
const
|
|
1119
|
-
let
|
|
1120
|
-
|
|
1121
|
-
const
|
|
1122
|
-
n = n * 180 / (a * (1 - ee) / (
|
|
1123
|
-
const
|
|
1124
|
-
return `${(t * 2 -
|
|
1128
|
+
let n = transformLat(t - 105, o - 35), l = transformLng(t - 105, o - 35);
|
|
1129
|
+
const r = o / 180 * PI;
|
|
1130
|
+
let i = Math.sin(r);
|
|
1131
|
+
i = 1 - ee * i * i;
|
|
1132
|
+
const c = Math.sqrt(i);
|
|
1133
|
+
n = n * 180 / (a * (1 - ee) / (i * c) * PI), l = l * 180 / (a / c * Math.cos(r) * PI);
|
|
1134
|
+
const s = o + n, m = t + l;
|
|
1135
|
+
return `${(t * 2 - m).toFixed(6)}, ${(o * 2 - s).toFixed(6)}`;
|
|
1125
1136
|
}
|
|
1126
1137
|
}
|
|
1127
1138
|
function calculateCirclePoints(e, t) {
|
|
1128
|
-
const o = fromLonLat(e), n = t * 1e3,
|
|
1139
|
+
const o = fromLonLat(e), n = t * 1e3, l = [
|
|
1129
1140
|
o[0] - n,
|
|
1130
1141
|
o[1] - n,
|
|
1131
1142
|
o[0] + n,
|
|
1132
1143
|
o[1] + n
|
|
1133
|
-
],
|
|
1144
|
+
], r = transformExtent(l, projection.mercator, projection.data);
|
|
1134
1145
|
return {
|
|
1135
|
-
leftTopPoint: { lng:
|
|
1136
|
-
rightTopPoint: { lng:
|
|
1137
|
-
rightBottomPoint: { lng:
|
|
1138
|
-
leftBottomPoint: { lng:
|
|
1146
|
+
leftTopPoint: { lng: r[0], lat: r[3] },
|
|
1147
|
+
rightTopPoint: { lng: r[2], lat: r[3] },
|
|
1148
|
+
rightBottomPoint: { lng: r[2], lat: r[1] },
|
|
1149
|
+
leftBottomPoint: { lng: r[0], lat: r[1] }
|
|
1139
1150
|
};
|
|
1140
1151
|
}
|
|
1141
1152
|
const equatorialCircumference = 2003750834e-2;
|
|
@@ -1146,17 +1157,17 @@ function lonLatToMercator(e) {
|
|
|
1146
1157
|
}
|
|
1147
1158
|
function mercatorToLonLat(e, t = "lonlat") {
|
|
1148
1159
|
const o = { lon: 0, lat: 0 }, n = e[0] / equatorialCircumference * 180;
|
|
1149
|
-
let
|
|
1150
|
-
return
|
|
1160
|
+
let l = e[1] / equatorialCircumference * 180;
|
|
1161
|
+
return l = 180 / Math.PI * (2 * Math.atan(Math.exp(l * Math.PI / 180)) - Math.PI / 2), o.lon = n, o.lat = l, t === "lonlat" ? o : [n, l];
|
|
1151
1162
|
}
|
|
1152
1163
|
function calculateBoundingBox(e) {
|
|
1153
|
-
let t = 1 / 0, o = -1 / 0, n = 1 / 0,
|
|
1164
|
+
let t = 1 / 0, o = -1 / 0, n = 1 / 0, l = -1 / 0;
|
|
1154
1165
|
e.forEach((h) => {
|
|
1155
1166
|
const [g, k] = h;
|
|
1156
|
-
t = Math.min(t, k), o = Math.max(o, k), n = Math.min(n, g),
|
|
1167
|
+
t = Math.min(t, k), o = Math.max(o, k), n = Math.min(n, g), l = Math.max(l, g);
|
|
1157
1168
|
});
|
|
1158
|
-
const
|
|
1159
|
-
return [f, p,
|
|
1169
|
+
const r = l - n, i = o - t, c = Math.max(r, i), s = (n + l) / 2, m = (t + o) / 2, u = c / 2, d = s - u, f = s + u, p = m - u, y = m + u;
|
|
1170
|
+
return [f, p, d, y];
|
|
1160
1171
|
}
|
|
1161
1172
|
const transformUtils = {
|
|
1162
1173
|
gcj02ToWgs84,
|
|
@@ -1167,29 +1178,30 @@ const transformUtils = {
|
|
|
1167
1178
|
}, mapInstance$5 = ref(), renderTrackStyleSetInstance = (e) => mapInstance$5.value = e, stopIcon = "", stopColor = "#E31818", slowIcon = "", slowColor = "#1890FF", dropletsIcon = "", trackList$1 = ref([]);
|
|
1168
1179
|
let animationFeature;
|
|
1169
1180
|
const renderTrackLine = (e, t, o) => {
|
|
1170
|
-
var
|
|
1181
|
+
var r, i, c;
|
|
1171
1182
|
const n = e[t];
|
|
1172
1183
|
if (!n) return;
|
|
1173
|
-
allTracks.value[t] = n, trackList$1.value = [], trackList$1.value = n.map((
|
|
1174
|
-
const
|
|
1175
|
-
if (
|
|
1176
|
-
const
|
|
1177
|
-
|
|
1184
|
+
allTracks.value[t] = n, trackList$1.value = [], trackList$1.value = n.map((s, m) => (s.center = [s.lon, s.lat], s.centerPoint = transformUtils.lonLatToMercator(s.center), s.id = t, s.index = m, s.time = hooks(s.createdAt).format("YYYY-MM-DD HH:mm:ss"), s));
|
|
1185
|
+
const l = trackList$1.value.map((s) => s.centerPoint);
|
|
1186
|
+
if (l.length >= 2) {
|
|
1187
|
+
const s = new LineString(l), m = new Feature({ geometry: s });
|
|
1188
|
+
m.setStyle(
|
|
1178
1189
|
new Style({
|
|
1179
1190
|
stroke: new Stroke({
|
|
1180
1191
|
color: o,
|
|
1181
1192
|
width: 2
|
|
1182
1193
|
})
|
|
1183
1194
|
})
|
|
1184
|
-
),
|
|
1185
|
-
const
|
|
1186
|
-
|
|
1187
|
-
const
|
|
1195
|
+
), m.setId(t), m.set("type", "line"), (i = (r = shipTrackVectorLayer.value) == null ? void 0 : r.getSource()) == null || i.clear(), shipTrackLineFeatures.value = [];
|
|
1196
|
+
const u = shipTrackLineFeatures.value.findIndex((f) => f.getId() === t);
|
|
1197
|
+
u >= 0 ? shipTrackLineFeatures.value[u] = m : shipTrackLineFeatures.value.push(m);
|
|
1198
|
+
const d = createAnimatedIconFeature(o, l);
|
|
1188
1199
|
trackLineVectorSource.value = new VectorSource({
|
|
1189
1200
|
features: [...shipTrackLineFeatures.value]
|
|
1190
|
-
}), animationFeature =
|
|
1191
|
-
source: trackLineVectorSource.value
|
|
1192
|
-
|
|
1201
|
+
}), animationFeature = d, console.log(animationFeature), shipTrackVectorLayer.value = new VectorLayer({
|
|
1202
|
+
source: trackLineVectorSource.value,
|
|
1203
|
+
zIndex: 102
|
|
1204
|
+
}), renderPoint(o), (c = mapInstance$5.value) == null || c.addLayer(shipTrackVectorLayer.value);
|
|
1193
1205
|
}
|
|
1194
1206
|
}, handlePlay = (e, t) => {
|
|
1195
1207
|
const o = allTracks.value[String(e)];
|
|
@@ -1223,33 +1235,33 @@ let polyline, linePath, startMarker, position, geoMarker, vectorLayer;
|
|
|
1223
1235
|
const trackAnimating = ref(!1);
|
|
1224
1236
|
let distance = 0, lastTime = Date.now(), moveFeatureHandler = null;
|
|
1225
1237
|
const moveFeature = (e, t) => {
|
|
1226
|
-
var
|
|
1227
|
-
const o = Number(50 * t), n = ((
|
|
1228
|
-
if (distance = (distance + o *
|
|
1238
|
+
var d, f, p;
|
|
1239
|
+
const o = Number(50 * t), n = ((d = e.frameState) == null ? void 0 : d.time) ?? Date.now(), l = n - lastTime;
|
|
1240
|
+
if (distance = (distance + o * l / 1e6) % 2, lastTime = n, distance >= 1) {
|
|
1229
1241
|
stopAnimation();
|
|
1230
1242
|
return;
|
|
1231
1243
|
}
|
|
1232
|
-
const
|
|
1244
|
+
const r = linePath.getCoordinateAt(
|
|
1233
1245
|
distance > 1 ? 2 - distance : distance
|
|
1234
|
-
),
|
|
1246
|
+
), i = linePath.getCoordinateAt(
|
|
1235
1247
|
distance > 1 ? distance - 0.01 : distance
|
|
1236
|
-
),
|
|
1248
|
+
), c = linePath.getCoordinateAt(
|
|
1237
1249
|
distance > 1 ? 2 - distance : distance + 0.01
|
|
1238
|
-
),
|
|
1239
|
-
transformUtils.mercatorToLonLat(
|
|
1240
|
-
transformUtils.mercatorToLonLat(
|
|
1250
|
+
), m = getRotation(
|
|
1251
|
+
transformUtils.mercatorToLonLat(i, "array"),
|
|
1252
|
+
transformUtils.mercatorToLonLat(c, "array")
|
|
1241
1253
|
) * Math.PI / 180;
|
|
1242
|
-
(f = geoMarkerStyle.getText()) == null || f.setRotation(
|
|
1243
|
-
const
|
|
1244
|
-
|
|
1254
|
+
(f = geoMarkerStyle.getText()) == null || f.setRotation(m), position.setCoordinates(r);
|
|
1255
|
+
const u = getVectorContext(e);
|
|
1256
|
+
u.context_.save(), u.setStyle(geoMarkerStyle), u.drawGeometry(position), u.context_.restore(), (p = mapInstance$5.value) == null || p.render();
|
|
1245
1257
|
}, startAnimation = () => {
|
|
1246
1258
|
var e;
|
|
1247
|
-
trackAnimating.value = !0, showTrackAnimatMarker.value = !0, lastTime = Date.now(), distance = 0, position = ((e = startMarker.getGeometry()) == null ? void 0 : e.clone()) || new Point([0, 0]), vectorLayer.on("postrender", moveFeatureHandler), geoMarker.setGeometry(void 0);
|
|
1259
|
+
trackAnimating.value = !0, showTrackAnimatMarker.value = !0, lastTime = Date.now(), distance = 0, position = ((e = startMarker.getGeometry()) == null ? void 0 : e.clone()) || new Point([0, 0]), moveFeatureHandler && (vectorLayer == null || vectorLayer.on("postrender", moveFeatureHandler)), geoMarker == null || geoMarker.setGeometry(void 0);
|
|
1248
1260
|
}, stopAnimation = () => {
|
|
1249
1261
|
var e;
|
|
1250
|
-
trackAnimating.value && (trackAnimating.value = !1, geoMarker.setGeometry(void 0), vectorLayer.un("postrender", moveFeatureHandler), (e = mapInstance$5.value) == null || e.removeLayer(vectorLayer), vectorLayer = null, geoMarker = null);
|
|
1262
|
+
trackAnimating.value && (trackAnimating.value = !1, geoMarker == null || geoMarker.setGeometry(void 0), moveFeatureHandler && vectorLayer && vectorLayer.un("postrender", moveFeatureHandler), vectorLayer && ((e = mapInstance$5.value) == null || e.removeLayer(vectorLayer)), vectorLayer = null, geoMarker = null);
|
|
1251
1263
|
}, playAnimation = (e, t) => {
|
|
1252
|
-
var
|
|
1264
|
+
var n;
|
|
1253
1265
|
trackAnimating.value && stopAnimation(), polyline = new Polyline({
|
|
1254
1266
|
factor: 1e6
|
|
1255
1267
|
}).writeGeometry(new LineString(e)), linePath = new Polyline({
|
|
@@ -1260,7 +1272,9 @@ const moveFeature = (e, t) => {
|
|
|
1260
1272
|
}), startMarker = new Feature({
|
|
1261
1273
|
type: "icon",
|
|
1262
1274
|
geometry: new Point(linePath.getFirstCoordinate())
|
|
1263
|
-
})
|
|
1275
|
+
});
|
|
1276
|
+
const o = startMarker.getGeometry();
|
|
1277
|
+
position = o ? o.clone() : new Point([0, 0]), geoMarker = new Feature({
|
|
1264
1278
|
type: "geoMarker",
|
|
1265
1279
|
style: geoMarkerStyle,
|
|
1266
1280
|
geometry: position
|
|
@@ -1268,42 +1282,42 @@ const moveFeature = (e, t) => {
|
|
|
1268
1282
|
source: new VectorSource({
|
|
1269
1283
|
features: [geoMarker]
|
|
1270
1284
|
})
|
|
1271
|
-
}), (
|
|
1285
|
+
}), (n = mapInstance$5.value) == null || n.addLayer(vectorLayer), moveFeatureHandler = (l) => moveFeature(l, t), startAnimation();
|
|
1272
1286
|
}, renderPoint = (e) => {
|
|
1273
1287
|
if (!mapInstance$5.value) return;
|
|
1274
1288
|
const t = trackList$1.value || [];
|
|
1275
1289
|
if (!(t && t.length > 1)) return [];
|
|
1276
|
-
const o = { 16: 24, 17: 15, default: 4 }, n = [],
|
|
1277
|
-
for (let
|
|
1278
|
-
t[
|
|
1279
|
-
const
|
|
1280
|
-
if (
|
|
1281
|
-
let
|
|
1282
|
-
|
|
1283
|
-
const
|
|
1284
|
-
if (!
|
|
1285
|
-
if (
|
|
1286
|
-
const f = o[
|
|
1287
|
-
|
|
1290
|
+
const o = { 16: 24, 17: 15, default: 4 }, n = [], l = t.length;
|
|
1291
|
+
for (let c = 0; c < l; c++) {
|
|
1292
|
+
t[c].index = c;
|
|
1293
|
+
const s = mapInstance$5.value.getPixelFromCoordinate(t[c].centerPoint);
|
|
1294
|
+
if (s) {
|
|
1295
|
+
let m = s.concat(s);
|
|
1296
|
+
m = adjustBounds(m, [20, 20]);
|
|
1297
|
+
const u = mapInstance$5.value.getView().getZoom();
|
|
1298
|
+
if (!u) return;
|
|
1299
|
+
if (u > 15) {
|
|
1300
|
+
const f = o[u] || o.default;
|
|
1301
|
+
m = adjustBounds(m, [f, f]);
|
|
1288
1302
|
}
|
|
1289
|
-
let
|
|
1290
|
-
if (t[
|
|
1303
|
+
let d = !0;
|
|
1304
|
+
if (t[c].state !== "0") {
|
|
1291
1305
|
for (let f = 0; f < n.length; f++)
|
|
1292
|
-
if (isOverlapping(
|
|
1293
|
-
|
|
1306
|
+
if (isOverlapping(m, n[f].bounds)) {
|
|
1307
|
+
d = !1;
|
|
1294
1308
|
break;
|
|
1295
1309
|
}
|
|
1296
1310
|
}
|
|
1297
|
-
|
|
1311
|
+
d && (t[c].bounds = m, n.push(t[c]));
|
|
1298
1312
|
}
|
|
1299
1313
|
}
|
|
1300
|
-
const
|
|
1301
|
-
n.forEach((
|
|
1302
|
-
var
|
|
1303
|
-
const
|
|
1304
|
-
geometry: new Point(
|
|
1314
|
+
const r = getIconStyle(stopIcon), i = getIconStyle(slowIcon);
|
|
1315
|
+
n.forEach((c, s) => {
|
|
1316
|
+
var d, f;
|
|
1317
|
+
const m = new Feature({
|
|
1318
|
+
geometry: new Point(c.centerPoint)
|
|
1305
1319
|
});
|
|
1306
|
-
|
|
1320
|
+
m.set("type", "track_point"), m.set("data", c), m.setStyle([
|
|
1307
1321
|
new Style({
|
|
1308
1322
|
// 扩大交互热区
|
|
1309
1323
|
image: new CircleStyle({
|
|
@@ -1319,15 +1333,15 @@ const moveFeature = (e, t) => {
|
|
|
1319
1333
|
radius: 3
|
|
1320
1334
|
})
|
|
1321
1335
|
})
|
|
1322
|
-
]), trackLineVectorSource.value.addFeature(
|
|
1323
|
-
const
|
|
1324
|
-
geometry: new Point(fromLonLat(
|
|
1336
|
+
]), trackLineVectorSource.value.addFeature(m);
|
|
1337
|
+
const u = new Feature({
|
|
1338
|
+
geometry: new Point(fromLonLat(c.center))
|
|
1325
1339
|
});
|
|
1326
|
-
if (
|
|
1327
|
-
setTrackLabelStyle(
|
|
1328
|
-
), trackLineVectorSource.value.addFeature(
|
|
1340
|
+
if (u.set("type", "track_label"), u.set("track_label_index", s), u.setStyle(
|
|
1341
|
+
setTrackLabelStyle(c, e)
|
|
1342
|
+
), trackLineVectorSource.value.addFeature(u), typeof c == "object" && c.hasOwnProperty("state")) {
|
|
1329
1343
|
const p = new Feature({
|
|
1330
|
-
geometry: new Point(
|
|
1344
|
+
geometry: new Point(c.centerPoint)
|
|
1331
1345
|
});
|
|
1332
1346
|
p.set("type", "track_icon");
|
|
1333
1347
|
const y = new Style({
|
|
@@ -1338,29 +1352,29 @@ const moveFeature = (e, t) => {
|
|
|
1338
1352
|
}),
|
|
1339
1353
|
zIndex: 99
|
|
1340
1354
|
}), h = [];
|
|
1341
|
-
Number(
|
|
1355
|
+
Number(c.state) === 0 ? ((d = y.getText()) == null || d.setFill(new Fill({ color: stopColor })), h.push(r)) : Number(c.state) === 1 && ((f = y.getText()) == null || f.setFill(new Fill({ color: slowColor })), h.push(i)), h.push(y), p.setStyle(h), trackLineVectorSource.value.addFeature(p);
|
|
1342
1356
|
}
|
|
1343
1357
|
}), renderArrow(n, e), renderIconPoint();
|
|
1344
1358
|
}, renderArrow = (e, t) => {
|
|
1345
1359
|
const o = e.length;
|
|
1346
1360
|
o || (e.push(trackList$1.value[0]), e.push(trackList$1.value[trackList$1.value.length - 1]));
|
|
1347
1361
|
for (let n = 0; n < o - 1; n++) {
|
|
1348
|
-
let
|
|
1349
|
-
const
|
|
1350
|
-
if (
|
|
1351
|
-
|
|
1362
|
+
let l;
|
|
1363
|
+
const r = e[n], i = (e[n + 1].index + r.index) / 2;
|
|
1364
|
+
if (i % 2 === 0)
|
|
1365
|
+
l = trackList$1.value[i].centerPoint;
|
|
1352
1366
|
else {
|
|
1353
|
-
const
|
|
1354
|
-
if (
|
|
1355
|
-
const [
|
|
1356
|
-
|
|
1367
|
+
const c = trackList$1.value[Math.floor(i)], s = trackList$1.value[Math.ceil(i)];
|
|
1368
|
+
if (c && s) {
|
|
1369
|
+
const [m, u] = c.centerPoint, [d, f] = s.centerPoint;
|
|
1370
|
+
l = [(m + d) / 2, (u + f) / 2];
|
|
1357
1371
|
}
|
|
1358
1372
|
}
|
|
1359
|
-
if (
|
|
1360
|
-
const
|
|
1361
|
-
geometry: new Point(
|
|
1373
|
+
if (l) {
|
|
1374
|
+
const c = new Feature({
|
|
1375
|
+
geometry: new Point(l)
|
|
1362
1376
|
});
|
|
1363
|
-
|
|
1377
|
+
c.set("type", "track_arrow"), c.setStyle(
|
|
1364
1378
|
new Style({
|
|
1365
1379
|
text: new Text({
|
|
1366
1380
|
font: "700 14px map-iconfont",
|
|
@@ -1373,31 +1387,31 @@ const moveFeature = (e, t) => {
|
|
|
1373
1387
|
) * (Math.PI / 180)
|
|
1374
1388
|
})
|
|
1375
1389
|
})
|
|
1376
|
-
), trackLineVectorSource.value.addFeature(
|
|
1390
|
+
), trackLineVectorSource.value.addFeature(c);
|
|
1377
1391
|
}
|
|
1378
1392
|
}
|
|
1379
1393
|
}, renderIconPoint = () => {
|
|
1380
1394
|
const e = "", t = "#fcdc3f", o = "#ff0000";
|
|
1381
|
-
(trackList$1.value.length < 2 ? [trackList$1.value[0]] : [trackList$1.value[0], trackList$1.value[trackList$1.value.length - 1]]).forEach((
|
|
1382
|
-
const
|
|
1383
|
-
geometry: new Point(
|
|
1395
|
+
(trackList$1.value.length < 2 ? [trackList$1.value[0]] : [trackList$1.value[0], trackList$1.value[trackList$1.value.length - 1]]).forEach((l) => {
|
|
1396
|
+
const r = new Feature({
|
|
1397
|
+
geometry: new Point(l.centerPoint)
|
|
1384
1398
|
});
|
|
1385
|
-
|
|
1386
|
-
const
|
|
1387
|
-
|
|
1399
|
+
r.set("type", "track_begin"), r.set("data", l);
|
|
1400
|
+
const i = l.index === 0 && trackList$1.value.length >= 2 ? t : o;
|
|
1401
|
+
r.setStyle(
|
|
1388
1402
|
new Style({
|
|
1389
1403
|
text: new Text({
|
|
1390
1404
|
font: "Normal 14px map-iconfont",
|
|
1391
1405
|
text: getIconFont(e),
|
|
1392
|
-
fill: new Fill({ color:
|
|
1406
|
+
fill: new Fill({ color: i })
|
|
1393
1407
|
}),
|
|
1394
1408
|
zIndex: 101
|
|
1395
1409
|
})
|
|
1396
|
-
), trackLineVectorSource.value.addFeature(
|
|
1410
|
+
), trackLineVectorSource.value.addFeature(r);
|
|
1397
1411
|
});
|
|
1398
1412
|
}, setTrackLabelStyle = (e, t) => new Style({
|
|
1399
1413
|
renderer: (o, n) => {
|
|
1400
|
-
const
|
|
1414
|
+
const l = n.context, c = {
|
|
1401
1415
|
id: e.id || "",
|
|
1402
1416
|
center: o,
|
|
1403
1417
|
text: e.time,
|
|
@@ -1407,79 +1421,79 @@ const moveFeature = (e, t) => {
|
|
|
1407
1421
|
selected: !0,
|
|
1408
1422
|
type: "TrackTime"
|
|
1409
1423
|
};
|
|
1410
|
-
drawLabel(
|
|
1424
|
+
drawLabel(l, c, trackLabels.value);
|
|
1411
1425
|
}
|
|
1412
|
-
}), mapInstance$4 = ref(), renderCustomOverlaySetInstance = (e) => mapInstance$4.value = e, drawCustomContent = (e, t, o, n = "top-left",
|
|
1413
|
-
var
|
|
1426
|
+
}), mapInstance$4 = ref(), renderCustomOverlaySetInstance = (e) => mapInstance$4.value = e, drawCustomContent = (e, t, o, n = "top-left", l = !1) => {
|
|
1427
|
+
var u, d;
|
|
1414
1428
|
if (!t || !mapInstance$4.value) return;
|
|
1415
1429
|
document.querySelectorAll(".truck-custom-content").forEach((f) => {
|
|
1416
1430
|
var p;
|
|
1417
1431
|
return (p = f.parentNode) == null ? void 0 : p.removeChild(f);
|
|
1418
1432
|
});
|
|
1419
|
-
const
|
|
1420
|
-
|
|
1421
|
-
const
|
|
1422
|
-
element:
|
|
1433
|
+
const r = document.createElement("div");
|
|
1434
|
+
r.innerHTML = o;
|
|
1435
|
+
const i = new Overlay({
|
|
1436
|
+
element: r,
|
|
1423
1437
|
position: t,
|
|
1424
1438
|
// 初始位置
|
|
1425
1439
|
positioning: n,
|
|
1426
|
-
stopEvent:
|
|
1440
|
+
stopEvent: l
|
|
1427
1441
|
// 设置不阻拦事件
|
|
1428
1442
|
});
|
|
1429
|
-
if (
|
|
1443
|
+
if (l) {
|
|
1430
1444
|
let f = !1, p = [0, 0], y = [0, 0], h = 0, g = 0;
|
|
1431
|
-
|
|
1445
|
+
r.addEventListener("mousedown", function(k) {
|
|
1432
1446
|
var b;
|
|
1433
1447
|
f = !0, h = k.clientX, g = k.clientY;
|
|
1434
1448
|
const M = (b = mapInstance$4.value) == null ? void 0 : b.getCoordinateFromPixel([k.clientX - 200, k.clientY - 200]);
|
|
1435
1449
|
M && (p = M), y = [
|
|
1436
|
-
k.clientX -
|
|
1437
|
-
k.clientY -
|
|
1450
|
+
k.clientX - r.getBoundingClientRect().left + 160,
|
|
1451
|
+
k.clientY - r.getBoundingClientRect().top + 84
|
|
1438
1452
|
], k.preventDefault(), console.log(e, h, g);
|
|
1439
1453
|
}), document.addEventListener("mousemove", function(k) {
|
|
1440
1454
|
var M;
|
|
1441
1455
|
if (f) {
|
|
1442
|
-
const b = (M = mapInstance$4.value) == null ? void 0 : M.getCoordinateFromPixel([k.clientX - y[0], k.clientY - y[1]]),
|
|
1443
|
-
|
|
1456
|
+
const b = (M = mapInstance$4.value) == null ? void 0 : M.getCoordinateFromPixel([k.clientX - y[0], k.clientY - y[1]]), x = b[0] - p[0], F = b[1] - p[1];
|
|
1457
|
+
i.setPosition([p[0] + x, p[1] + F]);
|
|
1444
1458
|
}
|
|
1445
1459
|
}), document.addEventListener("mouseup", function() {
|
|
1446
1460
|
f = !1;
|
|
1447
1461
|
});
|
|
1448
1462
|
}
|
|
1449
|
-
(
|
|
1450
|
-
const
|
|
1451
|
-
|
|
1463
|
+
(u = mapInstance$4.value) == null || u.addOverlay(i);
|
|
1464
|
+
const c = r.querySelector(".close-button");
|
|
1465
|
+
c && c.addEventListener("click", () => {
|
|
1452
1466
|
var f, p;
|
|
1453
|
-
(f = mapInstance$4.value) == null || f.removeOverlay(
|
|
1467
|
+
(f = mapInstance$4.value) == null || f.removeOverlay(i), (p = r.parentNode) == null || p.removeChild(r);
|
|
1454
1468
|
});
|
|
1455
|
-
const
|
|
1456
|
-
return
|
|
1469
|
+
const s = JSON.parse(JSON.stringify(t)), m = (d = mapInstance$4.value) == null ? void 0 : d.getCoordinateFromPixel(s);
|
|
1470
|
+
return i.setPosition(m), i;
|
|
1457
1471
|
}, mapInstance$3 = ref(), renderTrackSetInstance = (e) => mapInstance$3.value = e, showTracks = ref([]), trackList = ref([]);
|
|
1458
1472
|
ref(null);
|
|
1459
|
-
const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n,
|
|
1460
|
-
var
|
|
1461
|
-
if (nextTick(() => {
|
|
1473
|
+
const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, l = "ship") => {
|
|
1474
|
+
var u;
|
|
1475
|
+
if (console.log(l), nextTick(() => {
|
|
1462
1476
|
hiddenAllShips();
|
|
1463
|
-
}).then((
|
|
1477
|
+
}).then((d) => {
|
|
1464
1478
|
}), (t == null ? void 0 : t.length) < 2) {
|
|
1465
|
-
((
|
|
1479
|
+
((u = showTracks.value) == null ? void 0 : u.findIndex((d) => d.id === e)) < 0 && showTracks.value.push({ id: e, length: "" });
|
|
1466
1480
|
return;
|
|
1467
1481
|
}
|
|
1468
|
-
const
|
|
1469
|
-
t.forEach((
|
|
1470
|
-
|
|
1471
|
-
}), trackId.value = e,
|
|
1472
|
-
const
|
|
1473
|
-
(
|
|
1474
|
-
),
|
|
1482
|
+
const r = {};
|
|
1483
|
+
t.forEach((d) => {
|
|
1484
|
+
d.state ? d.state = Number(d.state) : delete d.state;
|
|
1485
|
+
}), trackId.value = e, r[e] = t, trackList.value = t;
|
|
1486
|
+
const i = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], c = r[e].map(
|
|
1487
|
+
(d) => transform([d.lon, d.lat], projection.data, projection.mercator)
|
|
1488
|
+
), s = new LineString(c), m = formatUtils.formatLength(s, n) || "--";
|
|
1475
1489
|
nextTick(() => {
|
|
1476
1490
|
var f, p;
|
|
1477
|
-
const
|
|
1478
|
-
|
|
1491
|
+
const d = (f = showTracks.value) == null ? void 0 : f.findIndex((y) => y.id === e);
|
|
1492
|
+
d < 0 ? showTracks.value.push({ id: e, length: m }) : showTracks.value[d].length = m, ++cursor.value, cursor.value > i.length && (cursor.value = 0), renderTrackLine(r, e, o), nextTick(() => {
|
|
1479
1493
|
resetTrackView(e);
|
|
1480
1494
|
}).then(() => {
|
|
1481
1495
|
}), (p = mapInstance$3.value) == null || p.on("moveend", () => {
|
|
1482
|
-
showTrackLayer.value && (trackLabels.value = [], renderTrackLine(
|
|
1496
|
+
showTrackLayer.value && (trackLabels.value = [], renderTrackLine(r, e, o));
|
|
1483
1497
|
}), renderTrackPointPopup();
|
|
1484
1498
|
}).then(() => {
|
|
1485
1499
|
});
|
|
@@ -1487,54 +1501,57 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, r = "ship")
|
|
|
1487
1501
|
var t;
|
|
1488
1502
|
const e = ref(null);
|
|
1489
1503
|
(t = mapInstance$3.value) == null || t.on("pointermove", (o) => {
|
|
1490
|
-
var r, i,
|
|
1491
|
-
e.value && ((
|
|
1492
|
-
const n = (
|
|
1504
|
+
var l, r, i, c;
|
|
1505
|
+
e.value && ((l = mapInstance$3.value) == null || l.removeOverlay(e.value));
|
|
1506
|
+
const n = (r = mapInstance$3.value) == null ? void 0 : r.forEachFeatureAtPixel(o.pixel, (s) => s);
|
|
1493
1507
|
if (n) {
|
|
1494
|
-
const
|
|
1495
|
-
if (!(
|
|
1496
|
-
let
|
|
1497
|
-
|
|
1508
|
+
const s = n.get("data");
|
|
1509
|
+
if (!(s != null && s.time)) return;
|
|
1510
|
+
let m = "";
|
|
1511
|
+
s != null && s.stayTime && (m = `
|
|
1498
1512
|
<div class="item w-100">
|
|
1499
1513
|
<div class="item-label">停泊时间约</div>
|
|
1500
|
-
<div class="item-item">${formatMinutesToDDHHMM(Number(
|
|
1514
|
+
<div class="item-item">${formatMinutesToDDHHMM(Number(s.stayTime))}</div>
|
|
1501
1515
|
</div>
|
|
1502
1516
|
`);
|
|
1503
|
-
const
|
|
1517
|
+
const u = `
|
|
1504
1518
|
<div class="track-point-popup">
|
|
1505
1519
|
<div class="item">
|
|
1506
1520
|
<div class="item-label">状态</div>
|
|
1507
|
-
<div class="item-item">${
|
|
1521
|
+
<div class="item-item">${s != null && s.sailStatus ? SHIP_SAIL_STATUS[s.sailStatus] : DEFAULT_VALUE}</div>
|
|
1508
1522
|
</div>
|
|
1509
1523
|
<div class="item">
|
|
1510
1524
|
<div class="item-label">航速</div>
|
|
1511
|
-
<div class="item-item">${
|
|
1525
|
+
<div class="item-item">${s.speed || DEFAULT_VALUE}</div>
|
|
1512
1526
|
</div>
|
|
1513
1527
|
<div class="item">
|
|
1514
1528
|
<div class="item-label">艏向</div>
|
|
1515
|
-
<div class="item-item">${
|
|
1529
|
+
<div class="item-item">${s.hdg || DEFAULT_VALUE}</div>
|
|
1516
1530
|
</div>
|
|
1517
1531
|
<div class="item">
|
|
1518
1532
|
<div class="item-label">航向</div>
|
|
1519
|
-
<div class="item-item">${
|
|
1533
|
+
<div class="item-item">${s.cog || DEFAULT_VALUE}</div>
|
|
1520
1534
|
</div>
|
|
1521
1535
|
<div class="item">
|
|
1522
1536
|
<div class="item-label">经度</div>
|
|
1523
|
-
<div class="item-item">${
|
|
1537
|
+
<div class="item-item">${s.lon || DEFAULT_VALUE}</div>
|
|
1524
1538
|
</div>
|
|
1525
1539
|
<div class="item">
|
|
1526
1540
|
<div class="item-label">纬度</div>
|
|
1527
|
-
<div class="item-item">${
|
|
1541
|
+
<div class="item-item">${s.lat || DEFAULT_VALUE}</div>
|
|
1528
1542
|
</div>
|
|
1529
1543
|
<div class="item w-100">
|
|
1530
1544
|
<div class="item-label">时间</div>
|
|
1531
|
-
<div class="item-item">${
|
|
1545
|
+
<div class="item-item">${s.time}</div>
|
|
1532
1546
|
</div>
|
|
1533
|
-
${
|
|
1534
|
-
</div>`,
|
|
1535
|
-
|
|
1547
|
+
${m ?? m}
|
|
1548
|
+
</div>`, d = (i = mapInstance$3.value) == null ? void 0 : i.getPixelFromCoordinate(o.coordinate);
|
|
1549
|
+
if (d) {
|
|
1550
|
+
const f = drawCustomContent(s.time, d, u, "top-left");
|
|
1551
|
+
f && (e.value = f);
|
|
1552
|
+
}
|
|
1536
1553
|
} else
|
|
1537
|
-
(
|
|
1554
|
+
e.value && ((c = mapInstance$3.value) == null || c.removeOverlay(e.value));
|
|
1538
1555
|
});
|
|
1539
1556
|
}, removeAllTrackLayer = () => {
|
|
1540
1557
|
var e;
|
|
@@ -1542,21 +1559,21 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, r = "ship")
|
|
|
1542
1559
|
}, playTrack = (e, t) => {
|
|
1543
1560
|
handlePlay(String(e), t);
|
|
1544
1561
|
}, resetTrackView = (e) => {
|
|
1545
|
-
var
|
|
1546
|
-
const t = mapInstance$3.value.getView(), o = e ? shipTrackLineFeatures.value.find((
|
|
1562
|
+
var l;
|
|
1563
|
+
const t = mapInstance$3.value.getView(), o = e ? shipTrackLineFeatures.value.find((r) => r.getId() === e) : shipTrackLineFeatures.value[0];
|
|
1547
1564
|
if (!o) return;
|
|
1548
|
-
const n = (
|
|
1565
|
+
const n = (l = o == null ? void 0 : o.getGeometry()) == null ? void 0 : l.getExtent();
|
|
1549
1566
|
if (n != null && n.length)
|
|
1550
1567
|
try {
|
|
1551
|
-
const
|
|
1552
|
-
t.fit(
|
|
1553
|
-
} catch (
|
|
1554
|
-
console.log(
|
|
1568
|
+
const r = buffer(n, Math.max(n[2] - n[0], n[3] - n[1]) * 0.02);
|
|
1569
|
+
t.fit(r);
|
|
1570
|
+
} catch (r) {
|
|
1571
|
+
console.log(r);
|
|
1555
1572
|
}
|
|
1556
1573
|
}, formatMinutesToDDHHMM = (e) => {
|
|
1557
|
-
const t = hooks.duration(e, "minutes"), o = Math.floor(t.asDays()), n = t.hours(),
|
|
1558
|
-
let
|
|
1559
|
-
return o !== 0 && (
|
|
1574
|
+
const t = hooks.duration(e, "minutes"), o = Math.floor(t.asDays()), n = t.hours(), l = t.minutes();
|
|
1575
|
+
let r = `${String(l).padStart(2, "0")}分`;
|
|
1576
|
+
return n !== 0 && (r = `${String(n).padStart(2, "0")}时${r}`), o !== 0 && (r = `${String(o).padStart(2, "0")}天${r}`), r;
|
|
1560
1577
|
}, _hoisted_1$3 = {
|
|
1561
1578
|
key: 0,
|
|
1562
1579
|
class: "more-tool-panel"
|
|
@@ -1572,16 +1589,16 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, r = "ship")
|
|
|
1572
1589
|
emits: ["switchGreenDot", "switchMapTile"],
|
|
1573
1590
|
setup(e, { emit: t }) {
|
|
1574
1591
|
var p, y;
|
|
1575
|
-
const o = inject("mapInstance"), n = e,
|
|
1576
|
-
n.disableGreenDot ||
|
|
1577
|
-
}, m = () => {
|
|
1578
|
-
r("switchMapTile", n.mapTileMode === BaseMapType.vector ? BaseMapType.satellite : BaseMapType.vector);
|
|
1592
|
+
const o = inject("mapInstance"), n = e, l = t, r = ref(((y = (p = o.value) == null ? void 0 : p.getView()) == null ? void 0 : y.getZoom()) || mapZoom.default), i = ref(!1), c = ref(null), s = ref(!0), m = () => {
|
|
1593
|
+
n.disableGreenDot || r.value >= mapZoom.shipGreenDotMax || (s.value = !s.value, l("switchGreenDot", s.value));
|
|
1579
1594
|
}, u = () => {
|
|
1595
|
+
l("switchMapTile", n.mapTileMode === BaseMapType.vector ? BaseMapType.satellite : BaseMapType.vector);
|
|
1596
|
+
}, d = () => {
|
|
1580
1597
|
var h, g;
|
|
1581
|
-
|
|
1598
|
+
i.value ? (h = c.value) == null || h.removeInteraction() : (g = c.value) == null || g.addInteraction(), i.value = !i.value;
|
|
1582
1599
|
}, f = () => {
|
|
1583
1600
|
var h;
|
|
1584
|
-
(h =
|
|
1601
|
+
(h = c.value) == null || h.removeInteraction(), i.value = !1;
|
|
1585
1602
|
};
|
|
1586
1603
|
return onMounted(() => {
|
|
1587
1604
|
nextTick(() => {
|
|
@@ -1589,7 +1606,7 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, r = "ship")
|
|
|
1589
1606
|
(h = o.value) == null || h.on("moveend", () => {
|
|
1590
1607
|
var k, M;
|
|
1591
1608
|
const g = (M = (k = o.value) == null ? void 0 : k.getView()) == null ? void 0 : M.getZoom();
|
|
1592
|
-
g && (
|
|
1609
|
+
g && (r.value = g);
|
|
1593
1610
|
});
|
|
1594
1611
|
});
|
|
1595
1612
|
}), (h, g) => (openBlock(), createElementBlock(Fragment, null, [
|
|
@@ -1600,16 +1617,16 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, r = "ship")
|
|
|
1600
1617
|
createElementVNode("div", _hoisted_2$1, [
|
|
1601
1618
|
h.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
|
|
1602
1619
|
key: 0,
|
|
1603
|
-
class: normalizeClass(["switch-btn", `${
|
|
1604
|
-
onClick:
|
|
1620
|
+
class: normalizeClass(["switch-btn", `${i.value && "active"}`]),
|
|
1621
|
+
onClick: d
|
|
1605
1622
|
}, g[5] || (g[5] = [
|
|
1606
1623
|
createElementVNode("i", { class: "map-iconfont icon-measure" }, null, -1),
|
|
1607
1624
|
createElementVNode("div", { class: "button-text" }, "测距", -1)
|
|
1608
1625
|
]), 2)) : createCommentVNode("", !0),
|
|
1609
1626
|
h.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
|
|
1610
1627
|
key: 1,
|
|
1611
|
-
class: normalizeClass(`switch-btn ${
|
|
1612
|
-
onClick:
|
|
1628
|
+
class: normalizeClass(`switch-btn ${s.value && "active"} ${(h.disableGreenDot || r.value >= unref(mapZoom).shipGreenDotMax) && "disabled"}`),
|
|
1629
|
+
onClick: m
|
|
1613
1630
|
}, g[6] || (g[6] = [
|
|
1614
1631
|
createElementVNode("i", { class: "map-iconfont icon-ship" }, null, -1),
|
|
1615
1632
|
createElementVNode("div", { class: "button-text" }, "绿点", -1)
|
|
@@ -1617,7 +1634,7 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, r = "ship")
|
|
|
1617
1634
|
h.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
|
|
1618
1635
|
key: 2,
|
|
1619
1636
|
class: normalizeClass(`switch-btn ${h.mapTileMode === unref(BaseMapType).satellite && "active"}`),
|
|
1620
|
-
onClick: g[0] || (g[0] = (k) =>
|
|
1637
|
+
onClick: g[0] || (g[0] = (k) => u())
|
|
1621
1638
|
}, g[7] || (g[7] = [
|
|
1622
1639
|
createElementVNode("i", { class: "map-iconfont icon-space" }, null, -1),
|
|
1623
1640
|
createElementVNode("div", { class: "button-text" }, "图层", -1)
|
|
@@ -1625,7 +1642,7 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, r = "ship")
|
|
|
1625
1642
|
h.vehicleMode === "truck" ? (openBlock(), createElementBlock("div", {
|
|
1626
1643
|
key: 3,
|
|
1627
1644
|
class: normalizeClass(`switch-btn ${h.mapTileMode === unref(BaseMapType).satellite && "active"}`),
|
|
1628
|
-
onClick: g[1] || (g[1] = (k) =>
|
|
1645
|
+
onClick: g[1] || (g[1] = (k) => u())
|
|
1629
1646
|
}, g[8] || (g[8] = [
|
|
1630
1647
|
createElementVNode("i", { class: "map-iconfont icon-space" }, null, -1),
|
|
1631
1648
|
createElementVNode("div", { class: "button-text" }, "卫星", -1)
|
|
@@ -1651,16 +1668,16 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, r = "ship")
|
|
|
1651
1668
|
])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
1652
1669
|
h.vehicleMode === "ship" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
1653
1670
|
createElementVNode("div", {
|
|
1654
|
-
class: normalizeClass(["switch-btn", `${
|
|
1655
|
-
onClick:
|
|
1671
|
+
class: normalizeClass(["switch-btn", `${i.value && "active"}`]),
|
|
1672
|
+
onClick: d
|
|
1656
1673
|
}, g[11] || (g[11] = [
|
|
1657
1674
|
createElementVNode("i", { class: "map-iconfont icon-measure" }, null, -1),
|
|
1658
1675
|
createElementVNode("div", { class: "button-text" }, "测距", -1)
|
|
1659
1676
|
]), 2),
|
|
1660
1677
|
h.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
|
|
1661
1678
|
key: 0,
|
|
1662
|
-
class: normalizeClass(`switch-btn ${
|
|
1663
|
-
onClick:
|
|
1679
|
+
class: normalizeClass(`switch-btn ${s.value && "active"} ${(h.disableGreenDot || r.value >= unref(mapZoom).shipGreenDotMax) && "disabled"}`),
|
|
1680
|
+
onClick: m
|
|
1664
1681
|
}, g[12] || (g[12] = [
|
|
1665
1682
|
createElementVNode("i", { class: "map-iconfont icon-ship" }, null, -1),
|
|
1666
1683
|
createElementVNode("div", { class: "button-text" }, "绿点", -1)
|
|
@@ -1668,7 +1685,7 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, r = "ship")
|
|
|
1668
1685
|
], 64)) : createCommentVNode("", !0),
|
|
1669
1686
|
createElementVNode("div", {
|
|
1670
1687
|
class: normalizeClass(["switch-btn", { active: h.mapTileMode === unref(BaseMapType).satellite }]),
|
|
1671
|
-
onClick:
|
|
1688
|
+
onClick: u
|
|
1672
1689
|
}, g[13] || (g[13] = [
|
|
1673
1690
|
createElementVNode("i", { class: "map-iconfont icon-space" }, null, -1),
|
|
1674
1691
|
createElementVNode("div", { class: "button-text" }, "卫星", -1)
|
|
@@ -1676,12 +1693,12 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, r = "ship")
|
|
|
1676
1693
|
], 64))
|
|
1677
1694
|
], 2),
|
|
1678
1695
|
createElementVNode("div", _hoisted_3, [
|
|
1679
|
-
|
|
1696
|
+
i.value ? (openBlock(), createBlock(Measure, {
|
|
1680
1697
|
key: 0,
|
|
1681
1698
|
ref_key: "measureRef",
|
|
1682
|
-
ref:
|
|
1683
|
-
visible:
|
|
1684
|
-
"onUpdate:visible": g[4] || (g[4] = (k) =>
|
|
1699
|
+
ref: c,
|
|
1700
|
+
visible: i.value,
|
|
1701
|
+
"onUpdate:visible": g[4] || (g[4] = (k) => i.value = k),
|
|
1685
1702
|
onClose: f,
|
|
1686
1703
|
"view-mode": h.viewMode
|
|
1687
1704
|
}, null, 8, ["visible", "view-mode"])) : createCommentVNode("", !0)
|
|
@@ -1693,15 +1710,15 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, r = "ship")
|
|
|
1693
1710
|
setup(e, { expose: t }) {
|
|
1694
1711
|
const o = inject("mapInstance");
|
|
1695
1712
|
return t({
|
|
1696
|
-
setScaleLine: (
|
|
1697
|
-
var
|
|
1698
|
-
|
|
1699
|
-
const
|
|
1700
|
-
units:
|
|
1701
|
-
}),
|
|
1702
|
-
|
|
1713
|
+
setScaleLine: (l) => {
|
|
1714
|
+
var c;
|
|
1715
|
+
l || (l = "metric");
|
|
1716
|
+
const r = new ScaleLine$1({
|
|
1717
|
+
units: l
|
|
1718
|
+
}), i = document.getElementById("scale-line-container");
|
|
1719
|
+
i && (r.setTarget(i), (c = o == null ? void 0 : o.value) == null || c.addControl(r));
|
|
1703
1720
|
}
|
|
1704
|
-
}), (
|
|
1721
|
+
}), (l, r) => (openBlock(), createElementBlock("div", _hoisted_1$2));
|
|
1705
1722
|
}
|
|
1706
1723
|
}), ScaleLine = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-d666f80d"]]), _hoisted_1$1 = { class: "zoom" }, _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
1707
1724
|
__name: "zoomControl",
|
|
@@ -1713,14 +1730,14 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, r = "ship")
|
|
|
1713
1730
|
setup(e) {
|
|
1714
1731
|
const t = inject("mapInstance"), o = () => {
|
|
1715
1732
|
if (!t.value) return;
|
|
1716
|
-
const
|
|
1717
|
-
|
|
1733
|
+
const l = t.value.getView(), r = l.getZoom();
|
|
1734
|
+
r && l.setZoom(r + 1);
|
|
1718
1735
|
}, n = () => {
|
|
1719
1736
|
if (!t.value) return;
|
|
1720
|
-
const
|
|
1721
|
-
|
|
1737
|
+
const l = t.value.getView(), r = l.getZoom();
|
|
1738
|
+
r && l.setZoom(r - 1);
|
|
1722
1739
|
};
|
|
1723
|
-
return (
|
|
1740
|
+
return (l, r) => (openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
1724
1741
|
createElementVNode("div", {
|
|
1725
1742
|
onClick: o,
|
|
1726
1743
|
class: "button big-button"
|
|
@@ -1737,11 +1754,11 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, r = "ship")
|
|
|
1737
1754
|
type: { default: COPY_RIGHT_TYPE.HORIZONTAL }
|
|
1738
1755
|
},
|
|
1739
1756
|
setup(e) {
|
|
1740
|
-
useCssVars((
|
|
1741
|
-
"4bfada56":
|
|
1757
|
+
useCssVars((r) => ({
|
|
1758
|
+
"4bfada56": l.value
|
|
1742
1759
|
}));
|
|
1743
|
-
const t = e, o = computed(() => t.type === COPY_RIGHT_TYPE.HORIZONTAL ? "map/tdt-copyright-h.svg" : `map/tdt-copyright-v${mapTile === "satellite" ? "-w" : ""}.svg`), n = computed(() => t.type === COPY_RIGHT_TYPE.HORIZONTAL ? "400px" : "168px"),
|
|
1744
|
-
return (
|
|
1760
|
+
const t = e, o = computed(() => t.type === COPY_RIGHT_TYPE.HORIZONTAL ? "map/tdt-copyright-h.svg" : `map/tdt-copyright-v${mapTile === "satellite" ? "-w" : ""}.svg`), n = computed(() => t.type === COPY_RIGHT_TYPE.HORIZONTAL ? "400px" : "168px"), l = computed(() => t.type === COPY_RIGHT_TYPE.HORIZONTAL ? "auto auto 0 5px" : "0 auto auto 5px");
|
|
1761
|
+
return (r, i) => (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
1745
1762
|
createElementVNode("img", {
|
|
1746
1763
|
src: unref(CDN_URL) + o.value,
|
|
1747
1764
|
width: n.value,
|
|
@@ -1763,30 +1780,30 @@ const loadImage = new Image();
|
|
|
1763
1780
|
loadImage.src = `${CDN_URL}/map/map-load.svg`;
|
|
1764
1781
|
loadImage.crossOrigin = "anonymous";
|
|
1765
1782
|
const setTruckStyle = (e, t, o, n) => new Style({
|
|
1766
|
-
renderer: (
|
|
1767
|
-
const
|
|
1768
|
-
|
|
1769
|
-
let
|
|
1770
|
-
|
|
1771
|
-
let [
|
|
1772
|
-
|
|
1773
|
-
const
|
|
1783
|
+
renderer: (l, r) => {
|
|
1784
|
+
const i = r.context;
|
|
1785
|
+
i.save();
|
|
1786
|
+
let c = 1;
|
|
1787
|
+
i.scale(c, c);
|
|
1788
|
+
let [s, m] = l;
|
|
1789
|
+
s = Number(s) / c - 20, m = Number(m) / c;
|
|
1790
|
+
const u = s - 70, d = m - 68;
|
|
1774
1791
|
let f = 180;
|
|
1775
1792
|
const p = 56, y = "#FFFFFF";
|
|
1776
1793
|
let h = 176;
|
|
1777
1794
|
const g = 52;
|
|
1778
1795
|
let k = "#164AFF", M = "#FFFFFF";
|
|
1779
|
-
o === CAR_COLOR.YELLOW ? (h = 176, k = "#FFC81E", M = "rgba(0,0,0,0.88)") : o === CAR_COLOR.Y_GREEN && (f = 200, h = 196, k = "#8FED7C", M = "rgba(0,0,0,0.88)"), n != null && n.length && (f += n.length * 56), fillRectRadius(
|
|
1796
|
+
o === CAR_COLOR.YELLOW ? (h = 176, k = "#FFC81E", M = "rgba(0,0,0,0.88)") : o === CAR_COLOR.Y_GREEN && (f = 200, h = 196, k = "#8FED7C", M = "rgba(0,0,0,0.88)"), n != null && n.length && (f += n.length * 56), fillRectRadius(i, u, d, f, p, y), fillRectRadius(i, u + 2, d + 2, h, g, k), o === CAR_COLOR.Y_GREEN && fillRectRadius(i, u + 2, d + 2, 68, g, "#FFC81E"), i.save(), i.restore(), i.fillStyle = M, i.font = "bold 28px Arial", i.textAlign = "left", i.textBaseline = "middle";
|
|
1780
1797
|
const b = `${t.slice(0, 2) + " · " + t.slice(2)}`;
|
|
1781
|
-
if (
|
|
1782
|
-
const
|
|
1798
|
+
if (i.fillText(b, u + 12, d + 32), i.save(), i.restore(), n != null && n.length) {
|
|
1799
|
+
const F = i.measureText(b).width + 12;
|
|
1783
1800
|
let P = 0;
|
|
1784
1801
|
n.forEach((v) => {
|
|
1785
|
-
v === DEVICE_TYPE.CAMERA && (
|
|
1802
|
+
v === DEVICE_TYPE.CAMERA && (i.drawImage(cameraImage, s - 54 + F + P * 56, m - 64, 50, 50), ++P), v === DEVICE_TYPE.LOAD && (i.drawImage(loadImage, s - 54 + F + P * 56, m - 64, 50, 50), ++P);
|
|
1786
1803
|
});
|
|
1787
1804
|
}
|
|
1788
|
-
const
|
|
1789
|
-
|
|
1805
|
+
const x = dotImage$1;
|
|
1806
|
+
i.drawImage(x, s + f / 2 - 90, m, 50 / c, 50 / c), i.restore();
|
|
1790
1807
|
}
|
|
1791
1808
|
}), mapInstance$2 = ref(), renderDashboardSetInstance = (e) => mapInstance$2.value = e;
|
|
1792
1809
|
ref([]);
|
|
@@ -1798,7 +1815,7 @@ const renderTrucksMarker = (e) => {
|
|
|
1798
1815
|
geometry: new Point(fromLonLat(o))
|
|
1799
1816
|
});
|
|
1800
1817
|
n.set("data", t), n.setStyle(
|
|
1801
|
-
setTruckStyle(!1, t.vno, t
|
|
1818
|
+
setTruckStyle(!1, t.vno, t.vclColor ?? 0, t.icons ?? [])
|
|
1802
1819
|
), truckMarkerList.push({
|
|
1803
1820
|
name: t.vno,
|
|
1804
1821
|
lonlat: o,
|
|
@@ -1814,12 +1831,11 @@ const renderTrucksMarker = (e) => {
|
|
|
1814
1831
|
e.feature && (trucksVectorSource == null || trucksVectorSource.removeFeature(e.feature));
|
|
1815
1832
|
}), truckMarkerList = [];
|
|
1816
1833
|
}, mapInstance$1 = ref(), renderTruckSetInstance = (e) => mapInstance$1.value = e, vehicle = ref(null), focusShipData = ref(), currentTruckOverlay = ref(null), findTruck = async (e) => {
|
|
1817
|
-
if (!mapInstance$1.value) return;
|
|
1818
|
-
focusShipData.value = e;
|
|
1834
|
+
if (!mapInstance$1.value || (focusShipData.value = e, !(e != null && e.lon && (e != null && e.lat)))) return;
|
|
1819
1835
|
const t = formatUtils.convertSixHundredThousandToLatLng(e.lon, e.lat), o = mapInstance$1.value.getPixelFromCoordinate(transform(t, projection.data, projection.mercator));
|
|
1820
|
-
currentTruckOverlay.value = drawTruckIcon(e.vno, o, e == null ? void 0 : e.drc);
|
|
1821
|
-
const n = mapInstance$1.value.getView(),
|
|
1822
|
-
n.setCenter(transform(
|
|
1836
|
+
currentTruckOverlay.value = e ? drawTruckIcon(e.vno, o, (e == null ? void 0 : e.drc) ?? "") ?? null : null;
|
|
1837
|
+
const n = mapInstance$1.value.getView(), l = new Point(t);
|
|
1838
|
+
n.setCenter(transform(l.getCoordinates(), projection.data, projection.mercator));
|
|
1823
1839
|
}, clearAllTruck = () => {
|
|
1824
1840
|
vehicle.value.clearAllShip();
|
|
1825
1841
|
}, drawTruckIcon = (e, t, o) => {
|
|
@@ -1832,15 +1848,15 @@ const renderTrucksMarker = (e) => {
|
|
|
1832
1848
|
const e = (t = currentTruckOverlay.value) == null ? void 0 : t.getElement();
|
|
1833
1849
|
e && (e.innerHTML = "");
|
|
1834
1850
|
}, zoomTruckIcon = () => {
|
|
1835
|
-
var
|
|
1851
|
+
var r;
|
|
1836
1852
|
if (!mapInstance$1.value) return;
|
|
1837
1853
|
const e = mapInstance$1.value.getView().getZoom(), t = 120, o = 60;
|
|
1838
|
-
function n(
|
|
1839
|
-
return
|
|
1854
|
+
function n(i) {
|
|
1855
|
+
return i < 14 ? o : i >= 14 && i <= 18 ? Math.round((i - 14) * (t - o) / 4 + o) : t;
|
|
1840
1856
|
}
|
|
1841
|
-
const
|
|
1842
|
-
(
|
|
1843
|
-
|
|
1857
|
+
const l = n(e);
|
|
1858
|
+
(r = document.querySelectorAll(".truck-custom-content")) == null || r.forEach((i) => {
|
|
1859
|
+
i.style.width = `${l}px`, i.style.height = `${l}px`;
|
|
1844
1860
|
});
|
|
1845
1861
|
}, mapInstance = ref(), drawPolygonSetInstance = (e) => mapInstance.value = e;
|
|
1846
1862
|
let layerState = "drawn", drawnState = "undrawn";
|
|
@@ -1886,13 +1902,13 @@ function createHelpTooltip() {
|
|
|
1886
1902
|
}
|
|
1887
1903
|
let squareLimitError = !1, lineLimitError = !1;
|
|
1888
1904
|
const validateSquareLimit = (e) => {
|
|
1889
|
-
let o = 1 / 0, n = -1 / 0,
|
|
1890
|
-
e == null || e.forEach((
|
|
1891
|
-
const
|
|
1892
|
-
o = Math.min(o,
|
|
1905
|
+
let o = 1 / 0, n = -1 / 0, l = 1 / 0, r = -1 / 0;
|
|
1906
|
+
e == null || e.forEach((s) => {
|
|
1907
|
+
const m = transform(s, projection.mercator, projection.data), u = m[0], d = m[1];
|
|
1908
|
+
o = Math.min(o, d), n = Math.max(n, d), l = Math.min(l, u), r = Math.max(r, u);
|
|
1893
1909
|
});
|
|
1894
|
-
const
|
|
1895
|
-
squareLimitError =
|
|
1910
|
+
const i = (n - o) * 111, c = (r - l) * 111;
|
|
1911
|
+
squareLimitError = i > 150 || c > 150;
|
|
1896
1912
|
};
|
|
1897
1913
|
let storeFeature, callbackFunction = null;
|
|
1898
1914
|
const addInteraction = (e) => {
|
|
@@ -1904,41 +1920,40 @@ const addInteraction = (e) => {
|
|
|
1904
1920
|
style: [drawPolygonStyle.drawing, circleStyle]
|
|
1905
1921
|
}), (n = mapInstance.value) == null || n.addInteraction(draw), createMeasureTooltip(), createHelpTooltip();
|
|
1906
1922
|
let t;
|
|
1907
|
-
draw.on("drawstart", function(
|
|
1908
|
-
var
|
|
1909
|
-
layerState = "drawn", sketch =
|
|
1910
|
-
const
|
|
1911
|
-
if (lineLimitError = Number(getLength(
|
|
1912
|
-
<span class="text">面积:${
|
|
1913
|
-
`), helpTooltipElement &&
|
|
1923
|
+
draw.on("drawstart", function(l) {
|
|
1924
|
+
var r;
|
|
1925
|
+
layerState = "drawn", sketch = l.feature, t = (r = sketch.getGeometry()) == null ? void 0 : r.on("change", function(i) {
|
|
1926
|
+
const c = i.target, s = formatUtils.formatArea(c, LENGTH_UNIT.NM), u = c.getCoordinates()[0], d = new LineString([u[u.length - 2], u[u.length - 1]]), f = formatUtils.formatLength(d, LENGTH_UNIT.NM);
|
|
1927
|
+
if (lineLimitError = Number(getLength(d) / 1e3) > 150, validateSquareLimit(u), measureTooltipElement && s && (measureTooltipElement.innerHTML = `
|
|
1928
|
+
<span class="text">面积:${s}${lineLimitError || squareLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1929
|
+
`), helpTooltipElement && s) {
|
|
1914
1930
|
let p = "";
|
|
1915
|
-
parseFloat(
|
|
1916
|
-
<div class="text ${squareLimitError ? "error" : ""}">面积:${
|
|
1917
|
-
<span class="text ${lineLimitError ? "error" : ""}">线段${
|
|
1931
|
+
parseFloat(s) > 0 && (p = `
|
|
1932
|
+
<div class="text ${squareLimitError ? "error" : ""}">面积:${s}${squareLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</div>`), helpTooltipElement.innerHTML = `${p}
|
|
1933
|
+
<span class="text ${lineLimitError ? "error" : ""}">线段${u.length - 2}:${f}${lineLimitError ? '<span class="error pl-4">超出可以绘画的距离</span>' : ""}</span>
|
|
1918
1934
|
<div><span class="text">单击继续,双击结束</span></div>
|
|
1919
1935
|
`;
|
|
1920
1936
|
}
|
|
1921
1937
|
}), drawnState = "drawing";
|
|
1922
|
-
}), draw.on("drawend", function(
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
l != null && l.length && callbackFunction && callbackFunction(l);
|
|
1938
|
+
}), draw.on("drawend", function(l) {
|
|
1939
|
+
if (l.feature.getGeometry()) {
|
|
1940
|
+
storeFeature = l.feature;
|
|
1941
|
+
const r = endFn(l.feature);
|
|
1942
|
+
r != null && r.length && callbackFunction && callbackFunction(r);
|
|
1928
1943
|
}
|
|
1929
|
-
if (sketch = null, measureTooltipElement = null, createMeasureTooltip(), t && unByKey(t), drawnState = "drawend", draw) {
|
|
1930
|
-
const
|
|
1931
|
-
|
|
1944
|
+
if (sketch = null, measureTooltipElement = null, createMeasureTooltip(), t && unByKey(t), drawnState = "drawend", draw && mapInstance.value) {
|
|
1945
|
+
const r = mapInstance.value.getInteractions().getArray().find((i) => getUid(i) === getUid(draw));
|
|
1946
|
+
r && mapInstance.value.removeInteraction(r), helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement);
|
|
1932
1947
|
}
|
|
1933
1948
|
});
|
|
1934
1949
|
}, removeInteraction = () => {
|
|
1935
1950
|
var e, t, o;
|
|
1936
1951
|
if (mapInstance.value) {
|
|
1937
1952
|
if (document.querySelectorAll(".ol-tooltip.ol-tooltip-draw-polygon").forEach((n) => {
|
|
1938
|
-
var
|
|
1939
|
-
(
|
|
1953
|
+
var l;
|
|
1954
|
+
(l = n == null ? void 0 : n.parentNode) == null || l.removeChild(n);
|
|
1940
1955
|
}), source.clear(), (e = mapInstance.value) == null || e.removeLayer(drawVector), helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement), ((t = mapInstance.value) == null ? void 0 : t.getTargetElement()).style.cursor = "", document.querySelector("#map").style.cursor = "", draw) {
|
|
1941
|
-
const n = mapInstance.value.getInteractions().getArray().find((
|
|
1956
|
+
const n = mapInstance.value.getInteractions().getArray().find((l) => getUid(l) === getUid(draw));
|
|
1942
1957
|
n && ((o = mapInstance.value) == null || o.removeInteraction(n));
|
|
1943
1958
|
}
|
|
1944
1959
|
drawnState = "undrawn", layerState = "destroyed";
|
|
@@ -1946,15 +1961,15 @@ const addInteraction = (e) => {
|
|
|
1946
1961
|
}, endFn = (e) => {
|
|
1947
1962
|
var t, o, n;
|
|
1948
1963
|
if (e.getGeometry()) {
|
|
1949
|
-
const
|
|
1950
|
-
(t =
|
|
1951
|
-
|
|
1964
|
+
const l = [], i = e.getGeometry().getCoordinates();
|
|
1965
|
+
(t = i[0]) == null || t.forEach((s) => {
|
|
1966
|
+
l.push(transform(s, projection.mercator, projection.data));
|
|
1952
1967
|
});
|
|
1953
|
-
const
|
|
1954
|
-
if (
|
|
1968
|
+
const c = i[0][i[0].length - 2];
|
|
1969
|
+
if (c && measureTooltip.setPosition(c), measureTooltip.setOffset([10, 0]), measureTooltipElement && (measureTooltipElement.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), (o = document.querySelector(".delete-icon")) == null || o.addEventListener("click", () => {
|
|
1955
1970
|
reset();
|
|
1956
1971
|
}), !lineLimitError && !squareLimitError)
|
|
1957
|
-
return
|
|
1972
|
+
return l;
|
|
1958
1973
|
draw && ((n = mapInstance.value) == null || n.removeInteraction(draw)), helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement);
|
|
1959
1974
|
}
|
|
1960
1975
|
}, initFeature = (e) => {
|
|
@@ -1962,14 +1977,14 @@ const addInteraction = (e) => {
|
|
|
1962
1977
|
if (e && (callbackFunction = e), layerState = "drawn", storeFeature) {
|
|
1963
1978
|
const n = storeFeature.getGeometry();
|
|
1964
1979
|
if (!n) return;
|
|
1965
|
-
const
|
|
1980
|
+
const l = formatUtils.formatArea(n, LENGTH_UNIT.NM);
|
|
1966
1981
|
measureTooltipElement && (measureTooltipElement.innerHTML = `
|
|
1967
|
-
<span class="text">面积:${
|
|
1982
|
+
<span class="text">面积:${l}${lineLimitError || squareLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1968
1983
|
`), (t = drawVector.getSource()) == null || t.addFeature(storeFeature);
|
|
1969
|
-
const
|
|
1970
|
-
|
|
1971
|
-
const
|
|
1972
|
-
(o = mapInstance.value) == null || o.getView().setCenter(
|
|
1984
|
+
const r = endFn(storeFeature);
|
|
1985
|
+
r != null && r.length && callbackFunction && callbackFunction(r);
|
|
1986
|
+
const i = getCenter(storeFeature.getGeometry().getExtent());
|
|
1987
|
+
(o = mapInstance.value) == null || o.getView().setCenter(i);
|
|
1973
1988
|
}
|
|
1974
1989
|
}, pointerMoveHandler = function(e) {
|
|
1975
1990
|
var o;
|
|
@@ -1995,7 +2010,7 @@ const addInteraction = (e) => {
|
|
|
1995
2010
|
}), mapInstance.value.on("pointermove", pointerMoveHandler), mapInstance.value.getViewport().addEventListener("mouseout", function() {
|
|
1996
2011
|
var e;
|
|
1997
2012
|
(e = helpTooltipElement == null ? void 0 : helpTooltipElement.classList) == null || e.add("hidden");
|
|
1998
|
-
}), mapInstance.value.on("dblclick", function(e) {
|
|
2013
|
+
}), mapInstance.value.on(["dblclick"], function(e) {
|
|
1999
2014
|
drawnState !== "undrawn" && (e.stopPropagation(), e.preventDefault());
|
|
2000
2015
|
}));
|
|
2001
2016
|
}, reset = () => {
|
|
@@ -2010,21 +2025,20 @@ dotImage.crossOrigin = "anonymous";
|
|
|
2010
2025
|
const dotActiveImage = new Image();
|
|
2011
2026
|
dotActiveImage.crossOrigin = "anonymous";
|
|
2012
2027
|
const setPointStyle = (e, t, o) => {
|
|
2013
|
-
const { color: n, url:
|
|
2014
|
-
return (
|
|
2015
|
-
renderer: (
|
|
2016
|
-
const
|
|
2017
|
-
|
|
2018
|
-
const
|
|
2019
|
-
d
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
if (fillRectRadius(d, y, h + 30, g, k, M), d.save(), d.restore(), d.fillStyle = e ? "#FFFFFF" : "#000000", d.textAlign = "center", d.textBaseline = "middle", d.fillText(t, y + (p + 4) / 2, h + 41), d.save(), d.restore(), r || i) {
|
|
2028
|
+
const { color: n, url: l, activeUrl: r, activeColor: i } = o;
|
|
2029
|
+
return (r || l) && (e ? dotActiveImage.src = CDN_URL + (r || l) : dotImage.src = CDN_URL + (l || r)), new Style({
|
|
2030
|
+
renderer: (c, s) => {
|
|
2031
|
+
const m = s.context;
|
|
2032
|
+
m.save();
|
|
2033
|
+
const u = window.devicePixelRatio || 1;
|
|
2034
|
+
let [d, f] = c;
|
|
2035
|
+
d = Number(d), f = Number(f), m.font = `${12 * u}px Arial`;
|
|
2036
|
+
const p = m.measureText(t).width, y = d - p / 2 + 6, h = f + 6 * u, g = p + 4, k = 16 * u, M = e && i || n;
|
|
2037
|
+
if (fillRectRadius(m, y, h + 30, g, k, M), m.save(), m.restore(), m.fillStyle = e ? "#FFFFFF" : "#000000", m.textAlign = "center", m.textBaseline = "middle", m.fillText(t, y + (p + 4) / 2, h + 24 * u), m.save(), m.restore(), l || r) {
|
|
2024
2038
|
const b = e ? dotActiveImage : dotImage;
|
|
2025
|
-
|
|
2039
|
+
m.drawImage(b, d - b.width / 2, f - b.height / 2, 30 * u, 30 * u);
|
|
2026
2040
|
}
|
|
2027
|
-
|
|
2041
|
+
m.restore();
|
|
2028
2042
|
}
|
|
2029
2043
|
});
|
|
2030
2044
|
};
|
|
@@ -2067,9 +2081,9 @@ class PointMarkerClass {
|
|
|
2067
2081
|
if (this.deleteAllPointMarkers(), !this.mapInstance) return;
|
|
2068
2082
|
let o = {};
|
|
2069
2083
|
t.forEach((n) => {
|
|
2070
|
-
var
|
|
2071
|
-
const
|
|
2072
|
-
if (((
|
|
2084
|
+
var r;
|
|
2085
|
+
const l = [n.lon, n.lat];
|
|
2086
|
+
if (((r = this.highlightPoint) == null ? void 0 : r.id) === n.id)
|
|
2073
2087
|
o = {
|
|
2074
2088
|
id: n.id,
|
|
2075
2089
|
name: n.name,
|
|
@@ -2077,12 +2091,12 @@ class PointMarkerClass {
|
|
|
2077
2091
|
pointType: n.pointType
|
|
2078
2092
|
};
|
|
2079
2093
|
else {
|
|
2080
|
-
const
|
|
2094
|
+
const i = this.getFeature(n, l);
|
|
2081
2095
|
this.pointMarkerList.push({
|
|
2082
2096
|
id: n.id,
|
|
2083
2097
|
name: n.name,
|
|
2084
2098
|
lonlat: [Number(n.lon), Number(n.lat)],
|
|
2085
|
-
feature:
|
|
2099
|
+
feature: i,
|
|
2086
2100
|
pointType: n.pointType
|
|
2087
2101
|
});
|
|
2088
2102
|
}
|
|
@@ -2128,23 +2142,23 @@ class PointMarkerClass {
|
|
|
2128
2142
|
*/
|
|
2129
2143
|
highlightPointMarker(t) {
|
|
2130
2144
|
if (!this.mapInstance) return;
|
|
2131
|
-
const { id: o, name: n, fullName:
|
|
2145
|
+
const { id: o, name: n, fullName: l, lon: r, lat: i, pointType: c } = t, s = [Number(r), Number(i)];
|
|
2132
2146
|
this.highlightPoint = {
|
|
2133
2147
|
id: o,
|
|
2134
2148
|
name: n,
|
|
2135
|
-
fullName:
|
|
2136
|
-
lonlat:
|
|
2137
|
-
pointType:
|
|
2138
|
-
}, this.setPointCenter(
|
|
2149
|
+
fullName: l,
|
|
2150
|
+
lonlat: s,
|
|
2151
|
+
pointType: c
|
|
2152
|
+
}, this.setPointCenter(s);
|
|
2139
2153
|
}
|
|
2140
2154
|
// 获取feature
|
|
2141
2155
|
getFeature(t, o) {
|
|
2142
|
-
var
|
|
2156
|
+
var l;
|
|
2143
2157
|
const n = new Feature({
|
|
2144
2158
|
geometry: new Point(fromLonLat(o))
|
|
2145
2159
|
});
|
|
2146
2160
|
return n.set("data", t), n.setStyle(
|
|
2147
|
-
setPointStyle(((
|
|
2161
|
+
setPointStyle(((l = this.highlightPoint) == null ? void 0 : l.id) === t.id, t.name, this.options)
|
|
2148
2162
|
), n;
|
|
2149
2163
|
}
|
|
2150
2164
|
/**
|
|
@@ -2157,10 +2171,10 @@ class PointMarkerClass {
|
|
|
2157
2171
|
*/
|
|
2158
2172
|
setPointCenter(t, o = { customZoom: mapZoom.findShip, type: 1 }) {
|
|
2159
2173
|
if (!this.mapInstance) return;
|
|
2160
|
-
const { customZoom: n = mapZoom.findShip, type:
|
|
2161
|
-
(
|
|
2162
|
-
const
|
|
2163
|
-
|
|
2174
|
+
const { customZoom: n = mapZoom.findShip, type: l = 1 } = o, r = this.mapInstance.getView(), i = r.getZoom();
|
|
2175
|
+
(l === 1 || i > n && l === 2 || i < n && l === 3) && r.setZoom(n);
|
|
2176
|
+
const c = new Point(t);
|
|
2177
|
+
r.setCenter(transform(c.getCoordinates(), projection.data, projection.mercator));
|
|
2164
2178
|
}
|
|
2165
2179
|
}
|
|
2166
2180
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
@@ -2178,7 +2192,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2178
2192
|
setup(e, { expose: t, emit: o }) {
|
|
2179
2193
|
const n = ref();
|
|
2180
2194
|
provide("mapInstance", n);
|
|
2181
|
-
const
|
|
2195
|
+
const l = ref(null), r = ref(null), i = ref(null), c = o, s = e, m = ref(s.zoom || mapZoom.default), u = ref(!1), d = ref(!0), f = ref(!0), p = {
|
|
2182
2196
|
tiandituTile: new TileLayer({ source: new XYZ({ url: baseMap.tiandituTile }) }),
|
|
2183
2197
|
tiandituTileMark: new TileLayer({ source: new XYZ({ url: baseMap.tiandituTileMark }) }),
|
|
2184
2198
|
tiandituImgTile: new TileLayer({ source: new XYZ({ url: baseMap.tiandituImgTile }), visible: !1 }),
|
|
@@ -2189,13 +2203,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2189
2203
|
const v = {
|
|
2190
2204
|
projection: projection.mercator,
|
|
2191
2205
|
// 地图投影坐标系
|
|
2192
|
-
zoom:
|
|
2206
|
+
zoom: s.zoom || (s.vehicleMode === "ship" ? mapZoom.default : mapZoom.truckDefault),
|
|
2193
2207
|
// 地图缩放级别(打开页面时默认级别)
|
|
2194
2208
|
minZoom: mapZoom.min,
|
|
2195
2209
|
// 地图缩放最小级别
|
|
2196
2210
|
maxZoom: mapZoom.max,
|
|
2197
2211
|
// 地图缩放最大级别
|
|
2198
|
-
center: transformUtils.lonLatToMercator(
|
|
2212
|
+
center: transformUtils.lonLatToMercator(s.center || mapDefaultCenter),
|
|
2199
2213
|
// 地图中心坐标
|
|
2200
2214
|
constrainResolution: !0,
|
|
2201
2215
|
// 需设为true禁用平滑缩放,zoom值为整数
|
|
@@ -2215,8 +2229,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2215
2229
|
p.greenMark
|
|
2216
2230
|
],
|
|
2217
2231
|
view: new View(v)
|
|
2218
|
-
}), h(), (L =
|
|
2219
|
-
findShip(String(
|
|
2232
|
+
}), h(), (L = r.value) == null || L.setScaleLine(s.vehicleMode === "ship" ? "nautical" : "metric"), (w = n.value) == null || w.on("moveend", b), g(v.zoom < mapZoom.shipGreenDotMax), M(s.vehicleMode === "ship" || s.viewMode === "findShip" ? BaseMapType.satellite : BaseMapType.vector), s.viewMode === "findShip" && s.mmsi && s.shipData && nextTick(() => {
|
|
2233
|
+
findShip(String(s.mmsi), s.shipData);
|
|
2220
2234
|
}), onShipsMarkerHover();
|
|
2221
2235
|
};
|
|
2222
2236
|
onMounted(() => {
|
|
@@ -2226,8 +2240,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2226
2240
|
n.value && (renderCustomOverlaySetInstance(n.value), renderTruckSetInstance(n.value), drawPolygonSetInstance(n.value), renderShipStyleSetInstance(n.value), renderTrackStyleSetInstance(n.value), renderDashboardSetInstance(n.value), renderMarkerSetInstance(n.value), renderShipSetInstance(n.value), renderTrackSetInstance(n.value));
|
|
2227
2241
|
}, g = (v) => {
|
|
2228
2242
|
var L;
|
|
2229
|
-
|
|
2230
|
-
getUid(w) === getUid(p.greenMark) && (w.setVisible(v),
|
|
2243
|
+
s.vehicleMode !== "ship" && (v = !1), (L = n.value) == null || L.getLayers().forEach((w) => {
|
|
2244
|
+
getUid(w) === getUid(p.greenMark) && (w.setVisible(v), d.value = v);
|
|
2231
2245
|
});
|
|
2232
2246
|
}, k = ref(BaseMapType.satellite), M = (v) => {
|
|
2233
2247
|
var L;
|
|
@@ -2236,17 +2250,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2236
2250
|
});
|
|
2237
2251
|
}, b = () => {
|
|
2238
2252
|
const v = n.value.getView(), L = v.getZoom();
|
|
2239
|
-
L &&
|
|
2253
|
+
L && x(L);
|
|
2240
2254
|
const w = v.calculateExtent(n.value.getSize());
|
|
2241
|
-
w && L &&
|
|
2242
|
-
},
|
|
2243
|
-
var S, T,
|
|
2244
|
-
|
|
2245
|
-
const L = (S = n.value) == null ? void 0 : S.getLayers(), w =
|
|
2246
|
-
showTrackLayer.value ? (f.value = !1, w == null || w.setVisible(!1), (T = shipsLayer.value) == null || T.setVisible(!1), (
|
|
2247
|
-
},
|
|
2255
|
+
w && L && F(w, L);
|
|
2256
|
+
}, x = (v) => {
|
|
2257
|
+
var S, T, E, C, V;
|
|
2258
|
+
m.value = v, g(v < mapZoom.shipGreenDotMax);
|
|
2259
|
+
const L = (S = n.value) == null ? void 0 : S.getLayers(), w = s.vehicleMode === "ship" ? L == null ? void 0 : L.getArray().find((N) => getUid(N) === getUid(p.greenMark)) : void 0;
|
|
2260
|
+
showTrackLayer.value ? (f.value = !1, w == null || w.setVisible(!1), (T = shipsLayer.value) == null || T.setVisible(!1), (E = largeAmountShipsLayer.value) == null || E.setVisible(!1)) : !u.value && d.value && v <= mapZoom.shipGreenDotMax ? (f.value = !0, w == null || w.setVisible(!0), (C = shipsLayer.value) == null || C.setVisible(!1), (V = largeAmountShipsLayer.value) == null || V.setVisible(!1)) : (f.value = !1, w == null || w.setVisible(!1)), c("zoomChanged", v);
|
|
2261
|
+
}, F = (v, L) => {
|
|
2248
2262
|
const w = transform([v[0], v[1]], projection.mercator, projection.data), S = transform([v[2], v[3]], projection.mercator, projection.data);
|
|
2249
|
-
|
|
2263
|
+
c("extentChanged", { extent: [w, S], zoom: L });
|
|
2250
2264
|
};
|
|
2251
2265
|
return t({
|
|
2252
2266
|
mapInstance: n,
|
|
@@ -2256,14 +2270,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2256
2270
|
renderShip: renderShips,
|
|
2257
2271
|
renderTrack: (v, L, w) => {
|
|
2258
2272
|
var S, T;
|
|
2259
|
-
currentTrackId.value = v, showTrackLayer.value = !0,
|
|
2273
|
+
currentTrackId.value = v, showTrackLayer.value = !0, u.value = !0, hiddenAllShips(), (T = (S = largeAmountShipsLayer.value) == null ? void 0 : S.getSource()) == null || T.clear(), renderTrack(v, s.vehicleMode === "ship" ? L.reverse() : L, w, LENGTH_UNIT.NM);
|
|
2260
2274
|
},
|
|
2261
2275
|
findTruck,
|
|
2262
2276
|
removeTruckIcon,
|
|
2263
2277
|
clearAllTruck,
|
|
2264
2278
|
closeTrack: () => {
|
|
2265
2279
|
var v, L;
|
|
2266
|
-
showTrackLayer.value = !1, (v = shipTrackVectorLayer.value) == null || v.setVisible(!1), (L = selectShipsLayer.value) == null || L.setVisible(!0),
|
|
2280
|
+
showTrackLayer.value = !1, (v = shipTrackVectorLayer.value) == null || v.setVisible(!1), (L = selectShipsLayer.value) == null || L.setVisible(!0), u.value = !1, g(m.value < mapZoom.shipGreenDotMax), allTracks.value = [], stopAnimation();
|
|
2267
2281
|
},
|
|
2268
2282
|
closeTruckTrack: () => {
|
|
2269
2283
|
var v, L;
|
|
@@ -2289,7 +2303,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2289
2303
|
removerLayer: removeShipTrackLineFeatureByIndex,
|
|
2290
2304
|
renderMarker,
|
|
2291
2305
|
setMarkerPosition: (v) => {
|
|
2292
|
-
|
|
2306
|
+
u.value = !0, setMarkerPosition(v);
|
|
2293
2307
|
},
|
|
2294
2308
|
getZoomAndCenter: () => {
|
|
2295
2309
|
var T;
|
|
@@ -2318,7 +2332,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2318
2332
|
}), (v, L) => (openBlock(), createElementBlock("div", {
|
|
2319
2333
|
class: "map-page map-container",
|
|
2320
2334
|
ref_key: "pageRef",
|
|
2321
|
-
ref:
|
|
2335
|
+
ref: l
|
|
2322
2336
|
}, [
|
|
2323
2337
|
L[0] || (L[0] = createElementVNode("div", {
|
|
2324
2338
|
id: "map",
|
|
@@ -2327,7 +2341,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2327
2341
|
createVNode(ToolPanel, {
|
|
2328
2342
|
"vehicle-mode": v.vehicleMode,
|
|
2329
2343
|
"view-mode": v.viewMode,
|
|
2330
|
-
"disable-green-dot":
|
|
2344
|
+
"disable-green-dot": u.value,
|
|
2331
2345
|
"show-track-layer": unref(showTrackLayer),
|
|
2332
2346
|
"map-tile-mode": k.value,
|
|
2333
2347
|
onSwitchGreenDot: g,
|
|
@@ -2341,11 +2355,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2341
2355
|
v.viewMode !== "WxMiniprogram" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2342
2356
|
createVNode(ScaleLine, {
|
|
2343
2357
|
ref_key: "scaleLineControl",
|
|
2344
|
-
ref:
|
|
2358
|
+
ref: r
|
|
2345
2359
|
}, null, 512),
|
|
2346
2360
|
createVNode(ZoomControl, {
|
|
2347
2361
|
ref_key: "zoomControl",
|
|
2348
|
-
ref:
|
|
2362
|
+
ref: i
|
|
2349
2363
|
}, null, 512)
|
|
2350
2364
|
], 64)) : createCommentVNode("", !0),
|
|
2351
2365
|
createVNode(Copyright, {
|
|
@@ -2354,7 +2368,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2354
2368
|
}, null, 8, ["type", "map-tile"])
|
|
2355
2369
|
], 512));
|
|
2356
2370
|
}
|
|
2357
|
-
}), Map = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
2371
|
+
}), Map = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-be15323e"]]), ZhMap = withInstall(Map);
|
|
2358
2372
|
export {
|
|
2359
2373
|
BaseMapType as B,
|
|
2360
2374
|
CDN_URL as C,
|