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