zhihao-ui 1.2.27 → 1.2.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/{Map-Drzg1DDm.js → Map-Bq9kPMot.js} +729 -480
- package/dist/es/index.js +53 -42
- package/dist/index.css +1 -1
- package/dist/types/components/Map/enum/ship.d.ts +40 -0
- package/dist/types/components/Map/index.d.ts +26 -24
- package/dist/types/components/Map/interface/entity/point.d.ts +10 -0
- package/dist/types/components/Map/interface/entity/render.d.ts +2 -0
- package/dist/types/components/Map/interface/entity/shipInfoVo.d.ts +2 -0
- package/dist/types/components/Map/interface/entity/shipMapData.d.ts +2 -1
- package/dist/types/components/Map/render/canvasRender/renderPointStyle.d.ts +8 -0
- package/dist/types/components/Map/render/renderPoint.d.ts +80 -0
- package/dist/umd/index.css +1 -1
- package/dist/umd/index.umd.cjs +47 -11
- package/package.json +1 -1
|
@@ -1,114 +1,117 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { defineComponent, inject, useModel, ref, watch, openBlock, createElementBlock, createElementVNode, createVNode, unref, withCtx, Fragment, renderList, toDisplayString, createCommentVNode, mergeModels, nextTick, onMounted, normalizeClass, renderSlot, createBlock, provide } from "vue";
|
|
1
|
+
var R = Object.defineProperty;
|
|
2
|
+
var A = (e, t, n) => t in e ? R(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var S = (e, t, n) => A(e, typeof t != "symbol" ? t + "" : t, n);
|
|
5
4
|
import { n as getArea, o as getLength, V as VectorSource, p as VectorLayer, S as Style, C as CircleStyle, F as Fill, q as Stroke, D as Draw, O as Overlay, u as unByKey, r as ElSelect, s as ElOption, T as Text, t as fromLonLat, v as transformExtent, h as hooks, L as LineString, w as Feature, P as Point, x as Polyline, y as getVectorContext, e as cloneDeep, G as GeoJSON, W as WebGLPointsLayer, z as Circle, A as transform, B as buffer, H as ScaleLine$1, I as Icon, J as Translate, K as toLonLat, M as MultiPoint, N as getCenter, Q as TileLayer, X as XYZ, R as Map$1, U as View } from "./vendor-BhAIOWbw.js";
|
|
5
|
+
import { defineComponent, inject, useModel, ref, watch, openBlock, createElementBlock, createElementVNode, createVNode, unref, withCtx, Fragment, renderList, toDisplayString, createCommentVNode, mergeModels, nextTick, onMounted, normalizeClass, renderSlot, createBlock, provide } from "vue";
|
|
6
6
|
import { _ as _export_sfc } from "./Button-CzjgaPIL.js";
|
|
7
7
|
import { w as withInstall } from "./utils-BIGjF-zg.js";
|
|
8
|
-
var BaseMapType = /* @__PURE__ */ ((e) => (e[e.vector = 0] = "vector", e[e.satellite = 1] = "satellite", e))(BaseMapType || {}), 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 || {});
|
|
8
|
+
var BaseMapType = /* @__PURE__ */ ((e) => (e[e.vector = 0] = "vector", e[e.satellite = 1] = "satellite", e))(BaseMapType || {}), 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 || {});
|
|
9
9
|
class ShipMapData {
|
|
10
|
-
constructor(t,
|
|
11
|
-
|
|
10
|
+
constructor(t, n, o, r, l, i, s, c, d, m, u, f, p, y, h, g, M, T, b, C, x, v, w, k) {
|
|
11
|
+
S(this, "id");
|
|
12
12
|
// mmsi
|
|
13
|
-
|
|
13
|
+
S(this, "mmsi");
|
|
14
14
|
// 船舶三角形填充色
|
|
15
|
-
|
|
15
|
+
S(this, "fill");
|
|
16
16
|
// 船类型 "7": "货船",
|
|
17
|
-
|
|
17
|
+
S(this, "shipType");
|
|
18
18
|
// 船名
|
|
19
|
-
|
|
19
|
+
S(this, "name");
|
|
20
20
|
// 长度
|
|
21
|
-
|
|
21
|
+
S(this, "length");
|
|
22
22
|
// 宽度
|
|
23
|
-
|
|
23
|
+
S(this, "breadth");
|
|
24
24
|
// 经度
|
|
25
|
-
|
|
25
|
+
S(this, "lon");
|
|
26
26
|
// 纬度
|
|
27
|
-
|
|
27
|
+
S(this, "lat");
|
|
28
28
|
// 时间
|
|
29
|
-
|
|
29
|
+
S(this, "createdAt");
|
|
30
30
|
// 速度
|
|
31
|
-
|
|
31
|
+
S(this, "speed");
|
|
32
32
|
// 来源
|
|
33
|
-
|
|
33
|
+
S(this, "from");
|
|
34
34
|
// 船状态 "stop":"静止","sail":"航行","work":"作业","danger":"危险","other":"其他"
|
|
35
|
-
|
|
35
|
+
S(this, "sailStatus");
|
|
36
36
|
// 船艏向
|
|
37
|
-
|
|
37
|
+
S(this, "hdg");
|
|
38
38
|
// 航迹向
|
|
39
|
-
|
|
39
|
+
S(this, "cog");
|
|
40
40
|
// 设备定位类型
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
S(this, "posType");
|
|
42
|
+
S(this, "type");
|
|
43
43
|
// 航向角度
|
|
44
|
-
|
|
44
|
+
S(this, "angle");
|
|
45
45
|
// 左侧是否显示色块
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
this
|
|
46
|
+
S(this, "leftIconColor");
|
|
47
|
+
S(this, "existDevice");
|
|
48
|
+
S(this, "existMobile");
|
|
49
|
+
S(this, "existWaterGauge");
|
|
50
|
+
S(this, "selected");
|
|
51
|
+
S(this, "blinkColors");
|
|
52
|
+
this.id = t, this.mmsi = n, this.fill = o, this.shipType = r, this.name = l, this.length = i, this.breadth = s, this.lon = c, this.lat = d, this.createdAt = m, this.speed = u, this.from = f, this.sailStatus = p, this.hdg = y, this.cog = h, this.posType = g, this.type = M, this.angle = T, this.leftIconColor = b, this.existDevice = C, this.existMobile = x, this.existWaterGauge = v, this.selected = w, this.blinkColors = k;
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
const formatLength = function(e, t) {
|
|
55
|
-
const
|
|
56
|
+
const o = getLength(e);
|
|
56
57
|
let r = "";
|
|
57
58
|
switch (t) {
|
|
58
59
|
case LENGTH_UNIT.M:
|
|
59
|
-
r = Math.round(
|
|
60
|
+
r = Math.round(o * 100) / 100 + " m";
|
|
60
61
|
break;
|
|
61
62
|
case LENGTH_UNIT.KM:
|
|
62
|
-
r = Math.round(
|
|
63
|
+
r = Math.round(o / 1e3 * 100) / 100 + " km";
|
|
63
64
|
break;
|
|
64
65
|
case LENGTH_UNIT.NM:
|
|
65
|
-
r = (Math.round(
|
|
66
|
+
r = (Math.round(o / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
|
|
66
67
|
break;
|
|
67
68
|
}
|
|
68
69
|
return r;
|
|
69
70
|
}, convertSixHundredThousandToLatLng = function(e, t) {
|
|
70
|
-
const
|
|
71
|
-
return [Number(e) / 6e5,
|
|
71
|
+
const n = Number(t) / 6e5;
|
|
72
|
+
return [Number(e) / 6e5, n];
|
|
72
73
|
}, formatArea = (e, t) => {
|
|
73
|
-
const
|
|
74
|
+
const o = getArea(e);
|
|
74
75
|
let r;
|
|
75
76
|
switch (t) {
|
|
76
77
|
case LENGTH_UNIT.KM:
|
|
77
|
-
|
|
78
|
+
o > 1e4 ? r = Math.round(o / 1e6 * 100) / 100 + " km<sup>2</sup>" : r = Math.round(o * 100) / 100 + " m<sup>2</sup>";
|
|
78
79
|
break;
|
|
79
80
|
case LENGTH_UNIT.NM:
|
|
80
81
|
const l = Math.pow(1.852, 2);
|
|
81
|
-
|
|
82
|
+
o > 1e4 ? r = Math.round(o / 1e6 / l * 100) / 100 + " nm<sup>2</sup>" : r = Math.round(o * 100) / 100 + " m<sup>2</sup>";
|
|
82
83
|
break;
|
|
83
84
|
}
|
|
84
85
|
return r;
|
|
85
86
|
}, convertShipMapData = (e) => {
|
|
86
|
-
const t = (
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
const t = (n) => new ShipMapData(
|
|
88
|
+
n.id,
|
|
89
|
+
n.id,
|
|
89
90
|
// 船舶三角形填充色
|
|
90
|
-
|
|
91
|
+
n.fill || "#04C900",
|
|
91
92
|
"70",
|
|
92
|
-
(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
(n.cnname || n.enname || n.name) + `${n.existName ? n.existName : ""}`,
|
|
94
|
+
n.len || n.length,
|
|
95
|
+
n.wid || n.breadth,
|
|
96
|
+
n.lon,
|
|
97
|
+
n.lat,
|
|
97
98
|
(/* @__PURE__ */ new Date()).getTime(),
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
Number(
|
|
102
|
-
|
|
103
|
-
Number(
|
|
99
|
+
n.spd,
|
|
100
|
+
n.from,
|
|
101
|
+
n.status,
|
|
102
|
+
Number(n.hdg),
|
|
103
|
+
n.cog,
|
|
104
|
+
Number(n.postype),
|
|
104
105
|
"other",
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
n.cog,
|
|
107
|
+
n.leftIconColor,
|
|
108
|
+
n.existDevice,
|
|
109
|
+
n.existMobile,
|
|
110
|
+
n.existWaterGauge,
|
|
111
|
+
n.selected,
|
|
112
|
+
n.blinkColors
|
|
110
113
|
);
|
|
111
|
-
return Array.isArray(e) ? e.map((
|
|
114
|
+
return Array.isArray(e) ? e.map((n) => t(n)) : t(e);
|
|
112
115
|
}, formatUtils = {
|
|
113
116
|
formatLength,
|
|
114
117
|
convertSixHundredThousandToLatLng,
|
|
@@ -125,8 +128,8 @@ const formatLength = function(e, t) {
|
|
|
125
128
|
visibleModifiers: {}
|
|
126
129
|
}),
|
|
127
130
|
emits: /* @__PURE__ */ mergeModels(["close"], ["update:visible"]),
|
|
128
|
-
setup(e, { expose: t, emit:
|
|
129
|
-
const
|
|
131
|
+
setup(e, { expose: t, emit: n }) {
|
|
132
|
+
const o = inject("mapInstance"), r = n, l = useModel(e, "visible"), i = ref("3"), s = ref([]), c = ref(!1), d = new VectorSource();
|
|
130
133
|
let m, u, f, p, y;
|
|
131
134
|
const h = new VectorLayer({
|
|
132
135
|
source: d,
|
|
@@ -137,15 +140,15 @@ const formatLength = function(e, t) {
|
|
|
137
140
|
"circle-radius": 7,
|
|
138
141
|
"circle-fill-color": "#ffcc33"
|
|
139
142
|
}
|
|
140
|
-
}), g = function(
|
|
141
|
-
if (
|
|
143
|
+
}), g = function(L) {
|
|
144
|
+
if (L.dragging)
|
|
142
145
|
return;
|
|
143
|
-
let
|
|
144
|
-
m && (
|
|
145
|
-
},
|
|
146
|
-
|
|
147
|
-
var
|
|
148
|
-
(
|
|
146
|
+
let I = "点击选择起点";
|
|
147
|
+
m && (I = "单击继续,双击结束"), u && (u.innerHTML = I, f.setPosition(L.coordinate), u.classList.remove("hidden"));
|
|
148
|
+
}, M = () => {
|
|
149
|
+
o.value && (o.value.on("pointermove", g), o.value.getViewport().addEventListener("mouseout", function() {
|
|
150
|
+
var L;
|
|
151
|
+
(L = u == null ? void 0 : u.classList) == null || L.add("hidden");
|
|
149
152
|
}), c.value = !0);
|
|
150
153
|
};
|
|
151
154
|
let T;
|
|
@@ -169,88 +172,88 @@ const formatLength = function(e, t) {
|
|
|
169
172
|
})
|
|
170
173
|
});
|
|
171
174
|
function C() {
|
|
172
|
-
var
|
|
173
|
-
if (
|
|
175
|
+
var L, I;
|
|
176
|
+
if (o.value) {
|
|
174
177
|
if (s.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((E) => {
|
|
175
178
|
var F;
|
|
176
179
|
(F = E == null ? void 0 : E.parentNode) == null || F.removeChild(E);
|
|
177
180
|
}), d.clear(), T) {
|
|
178
|
-
const E =
|
|
179
|
-
E && ((
|
|
181
|
+
const E = o.value.getInteractions().getArray().find((F) => F.ol_uid === T.ol_uid);
|
|
182
|
+
E && ((L = o.value) == null || L.removeInteraction(E));
|
|
180
183
|
}
|
|
181
|
-
(
|
|
184
|
+
(I = o.value) == null || I.removeLayer(h), u != null && u.parentNode && u.parentNode.removeChild(u), p != null && p.parentNode && p.parentNode.removeChild(p);
|
|
182
185
|
}
|
|
183
186
|
}
|
|
184
187
|
function x() {
|
|
185
|
-
var
|
|
186
|
-
C(), (
|
|
188
|
+
var I, E;
|
|
189
|
+
C(), (I = o.value) == null || I.addLayer(h), T = new Draw({
|
|
187
190
|
source: d,
|
|
188
191
|
type: "LineString",
|
|
189
192
|
style: function() {
|
|
190
193
|
return b;
|
|
191
194
|
}
|
|
192
|
-
}), (E =
|
|
193
|
-
let
|
|
195
|
+
}), (E = o.value) == null || E.addInteraction(T), w(), v();
|
|
196
|
+
let L;
|
|
194
197
|
T.on("drawstart", function(F) {
|
|
195
|
-
var
|
|
198
|
+
var $;
|
|
196
199
|
m = F.feature;
|
|
197
|
-
let
|
|
198
|
-
|
|
199
|
-
const
|
|
200
|
-
let
|
|
201
|
-
|
|
200
|
+
let N;
|
|
201
|
+
L = ($ = m.getGeometry()) == null ? void 0 : $.on("change", function(D) {
|
|
202
|
+
const P = D.target;
|
|
203
|
+
let B = formatUtils.formatLength(P, Number(i.value));
|
|
204
|
+
N = P.getLastCoordinate(), p && B && (p.innerHTML = B), y.setPosition(N);
|
|
202
205
|
});
|
|
203
206
|
}), T.on("drawend", function() {
|
|
204
|
-
p && (p.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), p != null && p.innerHTML && s.value.push(p == null ? void 0 : p.innerHTML), y.setOffset([0, -7]), m = null, p = null,
|
|
207
|
+
p && (p.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), p != null && p.innerHTML && s.value.push(p == null ? void 0 : p.innerHTML), y.setOffset([0, -7]), m = null, p = null, w(), L && unByKey(L);
|
|
205
208
|
});
|
|
206
209
|
}
|
|
207
210
|
function v() {
|
|
208
|
-
var
|
|
211
|
+
var L;
|
|
209
212
|
u != null && u.parentNode && u.parentNode.removeChild(u), u = document.createElement("div"), u.className = "ol-tooltip hidden", f = new Overlay({
|
|
210
213
|
element: u,
|
|
211
214
|
offset: [15, 0],
|
|
212
215
|
positioning: "center-left"
|
|
213
|
-
}), (
|
|
216
|
+
}), (L = o.value) == null || L.addOverlay(f);
|
|
214
217
|
}
|
|
215
|
-
function
|
|
216
|
-
var
|
|
218
|
+
function w() {
|
|
219
|
+
var L;
|
|
217
220
|
p != null && p.parentNode && p.parentNode.removeChild(p), p = document.createElement("div"), p.className = "ol-tooltip ol-tooltip-measure", y = new Overlay({
|
|
218
221
|
element: p,
|
|
219
222
|
offset: [0, -15],
|
|
220
223
|
positioning: "bottom-center",
|
|
221
224
|
stopEvent: !1,
|
|
222
225
|
insertFirst: !1
|
|
223
|
-
}), (
|
|
226
|
+
}), (L = o.value) == null || L.addOverlay(y);
|
|
224
227
|
}
|
|
225
|
-
const
|
|
226
|
-
var F,
|
|
227
|
-
s.value[
|
|
228
|
-
const
|
|
229
|
-
|
|
228
|
+
const k = (L) => {
|
|
229
|
+
var F, N;
|
|
230
|
+
s.value[L] && s.value.splice(L, 1);
|
|
231
|
+
const I = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
232
|
+
I[L] && ((N = (F = I[L]) == null ? void 0 : F.parentNode) == null || N.removeChild(I[L]));
|
|
230
233
|
const E = d.getFeatures();
|
|
231
|
-
E[
|
|
234
|
+
E[L] && d.removeFeature(E[L]);
|
|
232
235
|
}, V = () => {
|
|
233
236
|
r("close");
|
|
234
237
|
};
|
|
235
238
|
return watch(() => l, () => {
|
|
236
|
-
l && !c.value && (
|
|
239
|
+
l && !c.value && (M(), x());
|
|
237
240
|
}, { deep: !0, immediate: !0 }), t({
|
|
238
241
|
addInteraction: x,
|
|
239
242
|
removeInteraction: C
|
|
240
|
-
}), (
|
|
243
|
+
}), (L, I) => l.value && L.viewMode !== "WxMiniprogram" ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
241
244
|
createElementVNode("div", { class: "header" }, [
|
|
242
|
-
|
|
245
|
+
I[1] || (I[1] = createElementVNode("div", { class: "title" }, "测量", -1)),
|
|
243
246
|
createElementVNode("i", {
|
|
244
247
|
onClick: V,
|
|
245
248
|
class: "map-iconfont icon-close"
|
|
246
249
|
})
|
|
247
250
|
]),
|
|
248
251
|
createElementVNode("div", _hoisted_2$2, [
|
|
249
|
-
|
|
252
|
+
I[2] || (I[2] = createElementVNode("div", { class: "tips" }, "在地图上点击多个点测量距离,距离单位", -1)),
|
|
250
253
|
createVNode(unref(ElSelect), {
|
|
251
254
|
class: "select-length-unit",
|
|
252
255
|
modelValue: i.value,
|
|
253
|
-
"onUpdate:modelValue":
|
|
256
|
+
"onUpdate:modelValue": I[0] || (I[0] = (E) => i.value = E)
|
|
254
257
|
}, {
|
|
255
258
|
default: withCtx(() => [
|
|
256
259
|
createVNode(unref(ElOption), {
|
|
@@ -275,14 +278,14 @@ const formatLength = function(e, t) {
|
|
|
275
278
|
key: F
|
|
276
279
|
}, [
|
|
277
280
|
createElementVNode("div", _hoisted_4, [
|
|
278
|
-
|
|
281
|
+
I[3] || (I[3] = createElementVNode("i", { class: "map-iconfont icon-line" }, null, -1)),
|
|
279
282
|
createElementVNode("span", _hoisted_5, "线段" + toDisplayString(F + 1), 1),
|
|
280
283
|
createElementVNode("span", _hoisted_6, toDisplayString(E), 1)
|
|
281
284
|
]),
|
|
282
285
|
createElementVNode("div", {
|
|
283
286
|
class: "delete-button",
|
|
284
|
-
onClick: (
|
|
285
|
-
},
|
|
287
|
+
onClick: (N) => k(F)
|
|
288
|
+
}, I[4] || (I[4] = [
|
|
286
289
|
createElementVNode("i", { class: "map-iconfont icon-delete" }, null, -1)
|
|
287
290
|
]), 8, _hoisted_7)
|
|
288
291
|
]))), 128))
|
|
@@ -322,12 +325,12 @@ const formatLength = function(e, t) {
|
|
|
322
325
|
shipModelMin: 13,
|
|
323
326
|
// 船形图标最大渲染层级
|
|
324
327
|
shipModelMax: 18
|
|
325
|
-
}, mapDefaultCenter = [114.84, 30.52], projection = {
|
|
328
|
+
}, renderShipsLimit = 200, mapDefaultCenter = [114.84, 30.52], projection = {
|
|
326
329
|
// 经纬度 源数据 地理坐标 WGS84
|
|
327
330
|
data: "EPSG:4326",
|
|
328
331
|
// 墨卡托投影坐标 渲染坐标
|
|
329
332
|
mercator: "EPSG:3857"
|
|
330
|
-
};
|
|
333
|
+
}, LOG_DATE_FORMAT = "YYYY-MM-DD HH:mm:ss", DEFAULT_VALUE = "--";
|
|
331
334
|
ref();
|
|
332
335
|
const shipsLayer = ref(), largeAmountShipsLayer = ref(), selectShipsLayer = ref(), allShips = ref([]), selectSingleShipData = ref();
|
|
333
336
|
ref();
|
|
@@ -340,7 +343,7 @@ function getIconFont(unicode = "") {
|
|
|
340
343
|
}
|
|
341
344
|
const multiplyPixelRatio = (e) => {
|
|
342
345
|
const t = window.devicePixelRatio || 1;
|
|
343
|
-
return e.map((
|
|
346
|
+
return e.map((n) => n.map((o) => o * t));
|
|
344
347
|
}, 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({
|
|
345
348
|
text: new Text({
|
|
346
349
|
font: "Normal 14px map-iconfont",
|
|
@@ -349,8 +352,8 @@ const multiplyPixelRatio = (e) => {
|
|
|
349
352
|
offsetY: -14
|
|
350
353
|
}),
|
|
351
354
|
zIndex: 100
|
|
352
|
-
}), getRotation = (e, t,
|
|
353
|
-
function
|
|
355
|
+
}), getRotation = (e, t, n) => {
|
|
356
|
+
function o(u) {
|
|
354
357
|
return 180 * (u % (2 * Math.PI)) / Math.PI;
|
|
355
358
|
}
|
|
356
359
|
function r(u) {
|
|
@@ -371,11 +374,11 @@ const multiplyPixelRatio = (e) => {
|
|
|
371
374
|
}
|
|
372
375
|
function i(u, f, p = {}) {
|
|
373
376
|
if (p.final)
|
|
374
|
-
return function(v,
|
|
375
|
-
return (i(
|
|
377
|
+
return function(v, w) {
|
|
378
|
+
return (i(w, v) + 180) % 360;
|
|
376
379
|
}(u, f);
|
|
377
|
-
const y = l(u), h = l(f), g = r(y[0]),
|
|
378
|
-
return
|
|
380
|
+
const y = l(u), h = l(f), g = r(y[0]), M = r(h[0]), T = r(y[1]), b = r(h[1]), C = Math.sin(M - g) * Math.cos(b), x = Math.cos(T) * Math.sin(b) - Math.sin(T) * Math.cos(b) * Math.cos(M - g);
|
|
381
|
+
return o(Math.atan2(C, x));
|
|
379
382
|
}
|
|
380
383
|
function s(u) {
|
|
381
384
|
return !isNaN(u) && u !== null && !Array.isArray(u);
|
|
@@ -387,100 +390,100 @@ const multiplyPixelRatio = (e) => {
|
|
|
387
390
|
const y = { type: "Feature" };
|
|
388
391
|
return p.id !== void 0 && (y.id = p.id), p.bbox && (y.bbox = p.bbox), y.properties = f || {}, y.geometry = u, y;
|
|
389
392
|
}
|
|
390
|
-
const m = i(c(e), c(t),
|
|
393
|
+
const m = i(c(e), c(t), n);
|
|
391
394
|
return m < 0 ? 360 + m : m;
|
|
392
|
-
}, labelAlpha = 0.8, labelFont = "500 12px Arial", labelOutSize = 2, labelHeight = 10, fillRectRadius = (e, t,
|
|
393
|
-
e.beginPath(), e.moveTo(t + i,
|
|
395
|
+
}, labelAlpha = 0.8, labelFont = "500 12px Arial", labelOutSize = 2, labelHeight = 10, fillRectRadius = (e, t, n, o, r, l, i = 4) => {
|
|
396
|
+
e.beginPath(), e.moveTo(t + i, n), e.arcTo(t + o, n, t + o, n + i, i), e.arcTo(t + o, n + r, t + o - i, n + r, i), e.arcTo(t, n + r, t, n + r - i, i), e.arcTo(t, n, t + i, n, i), e.closePath(), e.fillStyle = l, e.fill();
|
|
394
397
|
}, getPixelFromCoordinate = (e) => {
|
|
395
398
|
if (!e || e.length === 0)
|
|
396
399
|
throw new Error("Points array is empty or invalid.");
|
|
397
|
-
let t = 1 / 0,
|
|
400
|
+
let t = 1 / 0, n = 1 / 0, o = -1 / 0, r = -1 / 0;
|
|
398
401
|
for (const [l, i] of e)
|
|
399
|
-
l < t && (t = l), i <
|
|
400
|
-
return [t,
|
|
402
|
+
l < t && (t = l), i < n && (n = i), l > o && (o = l), i > r && (r = i);
|
|
403
|
+
return [t, n, o, r];
|
|
401
404
|
}, calculatePolygonCentroid = (e) => {
|
|
402
405
|
if (!Array.isArray(e) || e.length < 3)
|
|
403
406
|
throw new Error("A polygon must have at least 3 coordinates.");
|
|
404
|
-
let t = 0,
|
|
407
|
+
let t = 0, n = 0, o = 0;
|
|
405
408
|
const r = e.length;
|
|
406
409
|
for (let s = 0; s < r - 1; s++) {
|
|
407
410
|
const [c, d] = e[s], [m, u] = e[s + 1], f = c * u - m * d;
|
|
408
|
-
|
|
411
|
+
o += f, t += (c + m) * f, n += (d + u) * f;
|
|
409
412
|
}
|
|
410
|
-
if (
|
|
413
|
+
if (o *= 0.5, o === 0)
|
|
411
414
|
throw new Error("多边形面积为零");
|
|
412
|
-
const l = t / (6 *
|
|
415
|
+
const l = t / (6 * o), i = n / (6 * o);
|
|
413
416
|
return [l, i];
|
|
414
417
|
}, rotateShapeModel = (e, t) => {
|
|
415
|
-
const [
|
|
418
|
+
const [n, o] = calculatePolygonCentroid(e), r = t * Math.PI / 180, l = Math.cos(r), i = Math.sin(r);
|
|
416
419
|
return e.map(([s, c]) => {
|
|
417
|
-
const d = s -
|
|
420
|
+
const d = s - n, m = c - o, u = d * l - m * i + n, f = d * i + m * l + o;
|
|
418
421
|
return [u, f];
|
|
419
422
|
});
|
|
420
423
|
}, getTopLeftPoint = (e) => [e[0], e[3]], getBottomLeftPoint = (e) => [e[2], e[3]], getBottomRightPoint = (e) => [e[2], e[1]], getTopRighttPoint = (e) => [e[0], e[1]];
|
|
421
|
-
function calculateBounds(e, t,
|
|
424
|
+
function calculateBounds(e, t, n, o, r) {
|
|
422
425
|
let l, i, s, c, d = e[0], m = e[1];
|
|
423
426
|
switch (t) {
|
|
424
427
|
case 0:
|
|
425
|
-
l = d + r, i = l +
|
|
428
|
+
l = d + r, i = l + n, c = m - r, s = c - o;
|
|
426
429
|
break;
|
|
427
430
|
case 1:
|
|
428
|
-
l = d + r, i = l +
|
|
431
|
+
l = d + r, i = l + n, c = m + o / 2, s = c - o;
|
|
429
432
|
break;
|
|
430
433
|
case 2:
|
|
431
|
-
l = d + r, i = l +
|
|
434
|
+
l = d + r, i = l + n, c = m + r + o, s = c - o;
|
|
432
435
|
break;
|
|
433
436
|
case 3:
|
|
434
|
-
l = d -
|
|
437
|
+
l = d - n / 2, i = l + n, c = m + r + o, s = c - o;
|
|
435
438
|
break;
|
|
436
439
|
case 4:
|
|
437
|
-
i = d, l = i -
|
|
440
|
+
i = d, l = i - n, c = m + r + o, s = c - o;
|
|
438
441
|
break;
|
|
439
442
|
case 5:
|
|
440
|
-
i = d - r, l = i -
|
|
443
|
+
i = d - r, l = i - n, c = m + o / 2, s = c - o;
|
|
441
444
|
break;
|
|
442
445
|
case 6:
|
|
443
|
-
i = d, l = i -
|
|
446
|
+
i = d, l = i - n, c = m - r, s = c - o;
|
|
444
447
|
break;
|
|
445
448
|
case 7:
|
|
446
|
-
l = d -
|
|
449
|
+
l = d - n / 2, i = l + n, c = m - r, s = c - o;
|
|
447
450
|
}
|
|
448
451
|
if (!(!l || !s || !i || !c))
|
|
449
452
|
return [Math.min(l, i), Math.min(s, c), Math.max(l, i), Math.max(s, c) + 1];
|
|
450
453
|
}
|
|
451
|
-
function calculateAnchorPoint(e, t,
|
|
454
|
+
function calculateAnchorPoint(e, t, n = 70, o = 20, r = 20) {
|
|
452
455
|
let l = [0, 0];
|
|
453
456
|
switch (t) {
|
|
454
457
|
case 0:
|
|
455
|
-
l[0] = e[0] + r, l[1] = e[1] - r -
|
|
458
|
+
l[0] = e[0] + r, l[1] = e[1] - r - o / 2;
|
|
456
459
|
break;
|
|
457
460
|
case 1:
|
|
458
461
|
l[0] = e[0] + r, l[1] = e[1];
|
|
459
462
|
break;
|
|
460
463
|
case 2:
|
|
461
|
-
l[0] = e[0] + r, l[1] = e[1] + r +
|
|
464
|
+
l[0] = e[0] + r, l[1] = e[1] + r + o / 2;
|
|
462
465
|
break;
|
|
463
466
|
case 3:
|
|
464
|
-
l[0] = e[0], l[1] = e[1] + r +
|
|
467
|
+
l[0] = e[0], l[1] = e[1] + r + o / 4;
|
|
465
468
|
break;
|
|
466
469
|
case 4:
|
|
467
|
-
l[0] = Math.max(e[0] - r, e[0] -
|
|
470
|
+
l[0] = Math.max(e[0] - r, e[0] - n / 2), l[1] = e[1] + r + o / 4;
|
|
468
471
|
break;
|
|
469
472
|
case 5:
|
|
470
473
|
l[0] = e[0] - r, l[1] = e[1];
|
|
471
474
|
break;
|
|
472
475
|
case 6:
|
|
473
|
-
l[0] = Math.max(e[0] - r, e[0] -
|
|
476
|
+
l[0] = Math.max(e[0] - r, e[0] - n / 2), l[1] = e[1] - r - o / 4;
|
|
474
477
|
break;
|
|
475
478
|
case 7:
|
|
476
|
-
l[0] = e[0], l[1] = e[1] - r -
|
|
479
|
+
l[0] = e[0], l[1] = e[1] - r - o / 4;
|
|
477
480
|
}
|
|
478
481
|
return l;
|
|
479
482
|
}
|
|
480
|
-
function drawLabelBody(e, t,
|
|
483
|
+
function drawLabelBody(e, t, n) {
|
|
481
484
|
if (!e) return;
|
|
482
485
|
const {
|
|
483
|
-
font:
|
|
486
|
+
font: o,
|
|
484
487
|
labelOutSize: r = 2,
|
|
485
488
|
labelHeight: l,
|
|
486
489
|
center: i,
|
|
@@ -489,14 +492,14 @@ function drawLabelBody(e, t, o) {
|
|
|
489
492
|
shipColor: d,
|
|
490
493
|
lineLength: m = 20,
|
|
491
494
|
selected: u
|
|
492
|
-
} =
|
|
493
|
-
e.save(),
|
|
495
|
+
} = n;
|
|
496
|
+
e.save(), o && (e.font = o);
|
|
494
497
|
let f = e.measureText(s).width + 2 * r;
|
|
495
498
|
(c || d) && (f += l + 4 * r), e.restore();
|
|
496
499
|
let p, y = 20, h = -1, g = l + 3 * r;
|
|
497
500
|
if (m)
|
|
498
|
-
for (let
|
|
499
|
-
p = calculateBounds(i,
|
|
501
|
+
for (let M = 0; M < 8; M++) {
|
|
502
|
+
p = calculateBounds(i, M, f, g, m);
|
|
500
503
|
let T = !1;
|
|
501
504
|
for (let b = 0; b < t.length; ++b) {
|
|
502
505
|
let C = t[b].bounds, x = [
|
|
@@ -511,19 +514,19 @@ function drawLabelBody(e, t, o) {
|
|
|
511
514
|
}
|
|
512
515
|
}
|
|
513
516
|
if (!T) {
|
|
514
|
-
h =
|
|
517
|
+
h = M;
|
|
515
518
|
break;
|
|
516
519
|
}
|
|
517
520
|
}
|
|
518
521
|
else
|
|
519
522
|
h = 0, p = calculateBounds(i, h, f, g, m);
|
|
520
523
|
if (u && h === -1 && (h = 0), p && h > -1) {
|
|
521
|
-
let
|
|
524
|
+
let M = getBottomLeftPoint(p), T = getTopRighttPoint(p);
|
|
522
525
|
return {
|
|
523
526
|
center: i,
|
|
524
527
|
x: calculateAnchorPoint(i, h, f, g, m),
|
|
525
528
|
l: T,
|
|
526
|
-
r:
|
|
529
|
+
r: M,
|
|
527
530
|
bounds: p,
|
|
528
531
|
position: h,
|
|
529
532
|
name: s
|
|
@@ -531,29 +534,46 @@ function drawLabelBody(e, t, o) {
|
|
|
531
534
|
} else
|
|
532
535
|
return null;
|
|
533
536
|
}
|
|
537
|
+
let intervalId;
|
|
534
538
|
const drawText = (e, t) => {
|
|
535
539
|
if (!e) return;
|
|
536
|
-
const { center:
|
|
540
|
+
const { center: n, text: o, textColor: r, leftIcon: l, rightIcons: i, font: s } = t;
|
|
537
541
|
e.save(), e.setTransform(1, 0, 0, 1, 0, 0);
|
|
538
|
-
let [c, d] =
|
|
542
|
+
let [c, d] = n;
|
|
539
543
|
if (l) {
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
544
|
+
if (t.blinkColors && t.blinkColors.length > 0) {
|
|
545
|
+
let m = Date.now(), u = 0;
|
|
546
|
+
const f = [];
|
|
547
|
+
t.blinkColors.forEach((p) => {
|
|
548
|
+
f.push(p), f.push("white");
|
|
549
|
+
}), intervalId && clearInterval(intervalId), intervalId = setInterval(() => {
|
|
550
|
+
const p = Date.now();
|
|
551
|
+
if (p - m >= 500) {
|
|
552
|
+
u = (u + 1) % f.length, m = p, e.font = "22px map-iconfont";
|
|
553
|
+
let y = getIconFont(l.icon);
|
|
554
|
+
e.fillStyle = f[u], e.fillText(y, c - 22 + labelOutSize - 4, d + 4);
|
|
555
|
+
}
|
|
556
|
+
}, 10);
|
|
557
|
+
} else {
|
|
558
|
+
e.font = "22px map-iconfont";
|
|
559
|
+
let m = getIconFont(l.icon);
|
|
560
|
+
e.fillStyle = l.color, e.fillText(m, c + labelOutSize - 4, d + 4);
|
|
561
|
+
}
|
|
562
|
+
c += 22;
|
|
543
563
|
}
|
|
544
564
|
if (i != null && i.length) {
|
|
545
565
|
e.font = "12px map-iconfont", e.fillStyle = "#3370ff";
|
|
546
|
-
let m = e.measureText(
|
|
566
|
+
let m = e.measureText(o).width + 6;
|
|
547
567
|
i.forEach((u, f) => {
|
|
548
568
|
let p = getIconFont(u), y = 20 * f;
|
|
549
569
|
e.fillText(p, c + m + y, d);
|
|
550
570
|
});
|
|
551
571
|
}
|
|
552
|
-
e.font = s || labelFont, e.fillStyle = r, e.fillText(
|
|
572
|
+
e.font = s || labelFont, e.fillStyle = r, e.fillText(o, c, d), e.restore();
|
|
553
573
|
}, drawPolygon = (e, t) => {
|
|
554
574
|
let {
|
|
555
|
-
points:
|
|
556
|
-
strokeColor:
|
|
575
|
+
points: n,
|
|
576
|
+
strokeColor: o,
|
|
557
577
|
fillColor: r,
|
|
558
578
|
shouldClosePath: l,
|
|
559
579
|
translation: i,
|
|
@@ -562,29 +582,29 @@ const drawText = (e, t) => {
|
|
|
562
582
|
scale: d,
|
|
563
583
|
globalAlpha: m
|
|
564
584
|
} = t;
|
|
565
|
-
if (m || (m = 1),
|
|
566
|
-
e.save(), e.beginPath(), s && s !== 0 && c == null && e.rotate(s), i && e.translate(i[0], i[1]), s && (c != null && c.length) && e.rotate(s), d && e.scale(d, d), e.moveTo(
|
|
567
|
-
for (let u = 1; u <
|
|
568
|
-
e.lineTo(
|
|
569
|
-
l && e.closePath(),
|
|
585
|
+
if (m || (m = 1), n && e) {
|
|
586
|
+
e.save(), e.beginPath(), s && s !== 0 && c == null && e.rotate(s), i && e.translate(i[0], i[1]), s && (c != null && c.length) && e.rotate(s), d && e.scale(d, d), e.moveTo(n[0][0], n[0][1]);
|
|
587
|
+
for (let u = 1; u < n.length; u++)
|
|
588
|
+
e.lineTo(n[u][0], n[u][1]);
|
|
589
|
+
l && e.closePath(), o && (e.strokeStyle = o, e.stroke()), r && l && (m && (e.globalAlpha = m), e.fillStyle = r, e.fill()), e.restore();
|
|
570
590
|
}
|
|
571
|
-
}, drawLabel = (e, t,
|
|
572
|
-
const { center:
|
|
573
|
-
if (
|
|
591
|
+
}, drawLabel = (e, t, n) => {
|
|
592
|
+
const { center: o, text: r, color: l, textColor: i, bgColor: s, leftIcon: c, rightIcons: d, type: m } = t;
|
|
593
|
+
if (o && r) {
|
|
574
594
|
let u = {
|
|
575
595
|
font: labelFont,
|
|
576
596
|
labelOutSize,
|
|
577
597
|
labelHeight,
|
|
578
|
-
center:
|
|
598
|
+
center: o,
|
|
579
599
|
text: r,
|
|
580
600
|
leftIcon: c,
|
|
581
601
|
selected: t.selected
|
|
582
|
-
}, f = drawLabelBody(e,
|
|
602
|
+
}, f = drawLabelBody(e, n, u);
|
|
583
603
|
if (f) {
|
|
584
604
|
const { x: p, bounds: y, l: h } = f;
|
|
585
605
|
let g = [getTopLeftPoint(y), getBottomLeftPoint(y), getBottomRightPoint(y), getTopRighttPoint(y)];
|
|
586
|
-
|
|
587
|
-
points: [
|
|
606
|
+
n.find((v) => v.name === r) || n.push(f), drawPolygon(e, {
|
|
607
|
+
points: [o, p],
|
|
588
608
|
strokeColor: l,
|
|
589
609
|
fillColor: "#000",
|
|
590
610
|
shouldClosePath: !0,
|
|
@@ -606,7 +626,8 @@ const drawText = (e, t) => {
|
|
|
606
626
|
text: r,
|
|
607
627
|
textColor: i,
|
|
608
628
|
leftIcon: c,
|
|
609
|
-
rightIcons: d
|
|
629
|
+
rightIcons: d,
|
|
630
|
+
blinkColors: t.blinkColors
|
|
610
631
|
};
|
|
611
632
|
drawText(e, x);
|
|
612
633
|
}
|
|
@@ -614,35 +635,35 @@ const drawText = (e, t) => {
|
|
|
614
635
|
return null;
|
|
615
636
|
}, PI = Math.PI, a = 6378245, ee = 0.006693421622965943;
|
|
616
637
|
function transformLat(e, t) {
|
|
617
|
-
let
|
|
618
|
-
return
|
|
638
|
+
let n = -100 + 2 * e + 3 * t + 0.2 * t * t + 0.1 * e * t + 0.2 * Math.sqrt(Math.abs(e));
|
|
639
|
+
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;
|
|
619
640
|
}
|
|
620
641
|
function transformLng(e, t) {
|
|
621
|
-
let
|
|
622
|
-
return
|
|
642
|
+
let n = 300 + e + 2 * t + 0.1 * e * e + 0.1 * e * t + 0.1 * Math.sqrt(Math.abs(e));
|
|
643
|
+
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;
|
|
623
644
|
}
|
|
624
645
|
function outOfChina(e, t) {
|
|
625
646
|
return !(e > 73.66 && e < 135.05 && t > 3.86 && t < 53.55);
|
|
626
647
|
}
|
|
627
648
|
function gcj02ToWgs84(e) {
|
|
628
|
-
const [t,
|
|
629
|
-
if (outOfChina(t,
|
|
630
|
-
return `${t.toFixed(6)}, ${
|
|
649
|
+
const [t, n] = e.split(",").map(Number);
|
|
650
|
+
if (outOfChina(t, n))
|
|
651
|
+
return `${t.toFixed(6)}, ${n.toFixed(6)}`;
|
|
631
652
|
{
|
|
632
|
-
let
|
|
653
|
+
let o = transformLat(t - 105, n - 35), r = transformLng(t - 105, n - 35), l = n / 180 * PI, i = Math.sin(l);
|
|
633
654
|
i = 1 - ee * i * i;
|
|
634
655
|
let s = Math.sqrt(i);
|
|
635
|
-
|
|
636
|
-
let c =
|
|
637
|
-
return `${(t * 2 - d).toFixed(6)}, ${(
|
|
656
|
+
o = o * 180 / (a * (1 - ee) / (i * s) * PI), r = r * 180 / (a / s * Math.cos(l) * PI);
|
|
657
|
+
let c = n + o, d = t + r;
|
|
658
|
+
return `${(t * 2 - d).toFixed(6)}, ${(n * 2 - c).toFixed(6)}`;
|
|
638
659
|
}
|
|
639
660
|
}
|
|
640
661
|
function calculateCirclePoints(e, t) {
|
|
641
|
-
const
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
662
|
+
const n = fromLonLat(e), o = t * 1e3, r = [
|
|
663
|
+
n[0] - o,
|
|
664
|
+
n[1] - o,
|
|
665
|
+
n[0] + o,
|
|
666
|
+
n[1] + o
|
|
646
667
|
], l = transformExtent(r, projection.mercator, projection.data);
|
|
647
668
|
return {
|
|
648
669
|
leftTopPoint: { lng: l[0], lat: l[3] },
|
|
@@ -654,20 +675,20 @@ function calculateCirclePoints(e, t) {
|
|
|
654
675
|
const equatorialCircumference = 2003750834e-2;
|
|
655
676
|
function lonLatToMercator(e) {
|
|
656
677
|
const t = e[0] * equatorialCircumference / 180;
|
|
657
|
-
let
|
|
658
|
-
return
|
|
678
|
+
let n = Math.log(Math.tan((90 + e[1]) * Math.PI / 360)) / (Math.PI / 180);
|
|
679
|
+
return n = n * equatorialCircumference / 180, [t, n];
|
|
659
680
|
}
|
|
660
681
|
function mercatorToLonLat(e, t = "lonlat") {
|
|
661
|
-
let
|
|
662
|
-
return r = 180 / Math.PI * (2 * Math.atan(Math.exp(r * Math.PI / 180)) - Math.PI / 2),
|
|
682
|
+
let n = { lon: 0, lat: 0 }, o = e[0] / equatorialCircumference * 180, r = e[1] / equatorialCircumference * 180;
|
|
683
|
+
return r = 180 / Math.PI * (2 * Math.atan(Math.exp(r * Math.PI / 180)) - Math.PI / 2), n.lon = o, n.lat = r, t === "lonlat" ? n : [o, r];
|
|
663
684
|
}
|
|
664
685
|
function calculateBoundingBox(e) {
|
|
665
|
-
let t = 1 / 0,
|
|
686
|
+
let t = 1 / 0, n = -1 / 0, o = 1 / 0, r = -1 / 0;
|
|
666
687
|
e.forEach((h) => {
|
|
667
|
-
const [g,
|
|
668
|
-
t = Math.min(t,
|
|
688
|
+
const [g, M] = h;
|
|
689
|
+
t = Math.min(t, M), n = Math.max(n, M), o = Math.min(o, g), r = Math.max(r, g);
|
|
669
690
|
});
|
|
670
|
-
const l = r -
|
|
691
|
+
const l = r - o, i = n - t, s = Math.max(l, i), c = (o + r) / 2, d = (t + n) / 2, m = s / 2, u = c - m, f = c + m, p = d - m, y = d + m;
|
|
671
692
|
return [f, p, u, y];
|
|
672
693
|
}
|
|
673
694
|
const transformUtils = {
|
|
@@ -676,11 +697,11 @@ const transformUtils = {
|
|
|
676
697
|
lonLatToMercator,
|
|
677
698
|
mercatorToLonLat,
|
|
678
699
|
calculateBoundingBox
|
|
679
|
-
}, mapInstance$8 = ref(), renderTrackStyleSetInstance = (e) => mapInstance$8.value = e, stopIcon = "", stopColor = "#E31818", slowIcon = "", slowColor = "#1890FF", dropletsIcon = "", trackList$1 = ref([]), renderTrackLine = (e, t,
|
|
700
|
+
}, mapInstance$8 = ref(), renderTrackStyleSetInstance = (e) => mapInstance$8.value = e, stopIcon = "", stopColor = "#E31818", slowIcon = "", slowColor = "#1890FF", dropletsIcon = "", trackList$1 = ref([]), renderTrackLine = (e, t, n) => {
|
|
680
701
|
var l, i, s;
|
|
681
|
-
const
|
|
682
|
-
if (!
|
|
683
|
-
allTracks.value[t] =
|
|
702
|
+
const o = e[t];
|
|
703
|
+
if (!o) return;
|
|
704
|
+
allTracks.value[t] = o, trackList$1.value = [], trackList$1.value = o.map((c, d) => (c.center = [c.lon, c.lat], c.centerPoint = transformUtils.lonLatToMercator(c.center), c.id = t, c.index = d, c.time = hooks(c.createdAt).format("YYYY-MM-DD HH:mm:ss"), c));
|
|
684
705
|
let r = trackList$1.value.map((c) => c.centerPoint);
|
|
685
706
|
if (r.length >= 2) {
|
|
686
707
|
let c = new LineString(r);
|
|
@@ -688,37 +709,37 @@ const transformUtils = {
|
|
|
688
709
|
d.setStyle(
|
|
689
710
|
new Style({
|
|
690
711
|
stroke: new Stroke({
|
|
691
|
-
color:
|
|
712
|
+
color: n,
|
|
692
713
|
width: 2
|
|
693
714
|
})
|
|
694
715
|
})
|
|
695
716
|
), d.setId(t), d.set("type", "line"), (i = (l = shipTrackVectorLayer.value) == null ? void 0 : l.getSource()) == null || i.clear(), shipTrackLineFeatures.value = [];
|
|
696
717
|
const m = shipTrackLineFeatures.value.findIndex((u) => u.getId() === t);
|
|
697
|
-
m >= 0 ? shipTrackLineFeatures.value[m] = d : shipTrackLineFeatures.value.push(d), createAnimatedIconFeature(
|
|
718
|
+
m >= 0 ? shipTrackLineFeatures.value[m] = d : shipTrackLineFeatures.value.push(d), createAnimatedIconFeature(n, r), trackLineVectorSource.value = new VectorSource({
|
|
698
719
|
features: [...shipTrackLineFeatures.value]
|
|
699
720
|
}), shipTrackVectorLayer.value = new VectorLayer({
|
|
700
721
|
source: trackLineVectorSource.value
|
|
701
|
-
}), renderPoint(
|
|
722
|
+
}), renderPoint(n), (s = mapInstance$8.value) == null || s.addLayer(shipTrackVectorLayer.value);
|
|
702
723
|
}
|
|
703
724
|
}, handlePlay = (e, t) => {
|
|
704
|
-
const
|
|
705
|
-
playAnimation(
|
|
725
|
+
const n = allTracks.value[e];
|
|
726
|
+
playAnimation(n.map((o) => [o.lon, o.lat]), t);
|
|
706
727
|
}, removeShipTrackLineFeatureByIndex = (e) => {
|
|
707
728
|
e >= 0 && e < shipTrackLineFeatures.value.length && (shipTrackLineFeatures.value.splice(e, 1), allTracks.value.splice(e, 1)), trackLineVectorSource.value = new VectorSource({
|
|
708
729
|
features: [...shipTrackLineFeatures.value]
|
|
709
730
|
}), shipTrackVectorLayer.value && shipTrackVectorLayer.value.setSource(trackLineVectorSource.value);
|
|
710
731
|
}, createAnimatedIconFeature = (e, t) => {
|
|
711
|
-
const
|
|
732
|
+
const n = new Feature({
|
|
712
733
|
geometry: new Point(fromLonLat([t[0][0], t[0][1]]))
|
|
713
734
|
// 初始位置
|
|
714
|
-
}),
|
|
735
|
+
}), o = new Style({
|
|
715
736
|
text: new Text({
|
|
716
737
|
font: "700 14px map-iconfont",
|
|
717
738
|
text: getIconFont(""),
|
|
718
739
|
fill: new Fill({ color: e })
|
|
719
740
|
})
|
|
720
741
|
});
|
|
721
|
-
return
|
|
742
|
+
return n.setStyle(o), n;
|
|
722
743
|
}, geoMarkerStyle = new Style({
|
|
723
744
|
text: new Text({
|
|
724
745
|
font: "700 20px map-iconfont",
|
|
@@ -733,8 +754,8 @@ const trackAnimating = ref(!1);
|
|
|
733
754
|
let distance = 0, lastTime = Date.now(), moveFeatureHandler = null;
|
|
734
755
|
const moveFeature = (e, t) => {
|
|
735
756
|
var u;
|
|
736
|
-
const
|
|
737
|
-
if (distance = (distance +
|
|
757
|
+
const n = Number(50 * t), o = e.frameState.time, r = o - lastTime;
|
|
758
|
+
if (distance = (distance + n * r / 1e6) % 2, lastTime = o, distance >= 1) {
|
|
738
759
|
stopAnimation();
|
|
739
760
|
return;
|
|
740
761
|
}
|
|
@@ -754,7 +775,7 @@ const moveFeature = (e, t) => {
|
|
|
754
775
|
var e;
|
|
755
776
|
trackAnimating.value && (trackAnimating.value = !1, geoMarker.setGeometry(null), vectorLayer.un("postrender", moveFeatureHandler), (e = mapInstance$8.value) == null || e.removeLayer(vectorLayer), vectorLayer = null, geoMarker = null);
|
|
756
777
|
}, playAnimation = (e, t) => {
|
|
757
|
-
var
|
|
778
|
+
var n;
|
|
758
779
|
trackAnimating.value && stopAnimation(), polyline = new Polyline({
|
|
759
780
|
factor: 1e6
|
|
760
781
|
}).writeGeometry(new LineString(e)), linePath = new Polyline({
|
|
@@ -773,12 +794,12 @@ const moveFeature = (e, t) => {
|
|
|
773
794
|
source: new VectorSource({
|
|
774
795
|
features: [geoMarker]
|
|
775
796
|
})
|
|
776
|
-
}), (
|
|
797
|
+
}), (n = mapInstance$8.value) == null || n.addLayer(vectorLayer), moveFeatureHandler = (o) => moveFeature(o, t), startAnimation();
|
|
777
798
|
}, renderPoint = (e) => {
|
|
778
799
|
if (!mapInstance$8.value) return;
|
|
779
800
|
let t = trackList$1.value || [];
|
|
780
801
|
if (!(t && t.length > 1)) return [];
|
|
781
|
-
let
|
|
802
|
+
let n = { 16: 24, 17: 15, default: 4 }, o = [], r = t.length;
|
|
782
803
|
for (let s = 0; s < r; s++) {
|
|
783
804
|
t[s].index = s;
|
|
784
805
|
let c = mapInstance$8.value.getPixelFromCoordinate(t[s].centerPoint);
|
|
@@ -788,22 +809,22 @@ const moveFeature = (e, t) => {
|
|
|
788
809
|
let m = mapInstance$8.value.getView().getZoom();
|
|
789
810
|
if (!m) return;
|
|
790
811
|
if (m > 15) {
|
|
791
|
-
let f =
|
|
812
|
+
let f = n[m] || n.default;
|
|
792
813
|
d = adjustBounds(d, [f, f]);
|
|
793
814
|
}
|
|
794
815
|
let u = !0;
|
|
795
816
|
if (t[s].state !== "0") {
|
|
796
|
-
for (let f = 0; f <
|
|
797
|
-
if (isOverlapping(d,
|
|
817
|
+
for (let f = 0; f < o.length; f++)
|
|
818
|
+
if (isOverlapping(d, o[f].bounds)) {
|
|
798
819
|
u = !1;
|
|
799
820
|
break;
|
|
800
821
|
}
|
|
801
822
|
}
|
|
802
|
-
u && (t[s].bounds = d,
|
|
823
|
+
u && (t[s].bounds = d, o.push(t[s]));
|
|
803
824
|
}
|
|
804
825
|
}
|
|
805
826
|
const l = getIconStyle(stopIcon), i = getIconStyle(slowIcon);
|
|
806
|
-
|
|
827
|
+
o.forEach((s, c) => {
|
|
807
828
|
var u, f;
|
|
808
829
|
let d = new Feature({
|
|
809
830
|
geometry: new Point(s.centerPoint)
|
|
@@ -813,7 +834,8 @@ const moveFeature = (e, t) => {
|
|
|
813
834
|
image: new CircleStyle({
|
|
814
835
|
fill: new Fill({ color: e }),
|
|
815
836
|
stroke: new Stroke({ color: "#fff", width: 2 }),
|
|
816
|
-
radius: 3
|
|
837
|
+
radius: 3,
|
|
838
|
+
hitDetectionRadius: 10
|
|
817
839
|
})
|
|
818
840
|
})
|
|
819
841
|
), trackLineVectorSource.value.addFeature(d);
|
|
@@ -835,14 +857,14 @@ const moveFeature = (e, t) => {
|
|
|
835
857
|
}),
|
|
836
858
|
zIndex: 99
|
|
837
859
|
}), h = [];
|
|
838
|
-
s.state ===
|
|
860
|
+
Number(s.state) === 0 ? ((u = y.getText()) == null || u.setFill(new Fill({ color: stopColor })), h.push(l)) : Number(s.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);
|
|
839
861
|
}
|
|
840
|
-
}), renderArrow(
|
|
862
|
+
}), renderArrow(o, e), renderIconPoint();
|
|
841
863
|
}, renderArrow = (e, t) => {
|
|
842
|
-
const
|
|
843
|
-
|
|
844
|
-
for (let
|
|
845
|
-
let r, l = e[
|
|
864
|
+
const n = e.length;
|
|
865
|
+
n || (e.push(trackList$1.value[0]), e.push(trackList$1.value[trackList$1.value.length - 1]));
|
|
866
|
+
for (let o = 0; o < n - 1; o++) {
|
|
867
|
+
let r, l = e[o], i = (e[o + 1].index + l.index) / 2;
|
|
846
868
|
if (i % 2 === 0)
|
|
847
869
|
r = trackList$1.value[i].centerPoint;
|
|
848
870
|
else {
|
|
@@ -864,8 +886,8 @@ const moveFeature = (e, t) => {
|
|
|
864
886
|
fill: new Fill({ color: t }),
|
|
865
887
|
// 设置箭头旋转 角度转为弧度
|
|
866
888
|
rotation: getRotation(
|
|
867
|
-
e[
|
|
868
|
-
e[
|
|
889
|
+
e[o].center,
|
|
890
|
+
e[o + 1].center
|
|
869
891
|
) * (Math.PI / 180)
|
|
870
892
|
})
|
|
871
893
|
})
|
|
@@ -873,13 +895,13 @@ const moveFeature = (e, t) => {
|
|
|
873
895
|
}
|
|
874
896
|
}
|
|
875
897
|
}, renderIconPoint = () => {
|
|
876
|
-
const e = "", t = "#fcdc3f",
|
|
898
|
+
const e = "", t = "#fcdc3f", n = "#ff0000";
|
|
877
899
|
(trackList$1.value.length < 2 ? [trackList$1.value[0]] : [trackList$1.value[0], trackList$1.value[trackList$1.value.length - 1]]).forEach((r) => {
|
|
878
900
|
let l = new Feature({
|
|
879
901
|
geometry: new Point(r.centerPoint)
|
|
880
902
|
});
|
|
881
903
|
l.set("type", "track_begin"), l.set("data", r);
|
|
882
|
-
const i = r.index === 0 && trackList$1.value.length >= 2 ? t :
|
|
904
|
+
const i = r.index === 0 && trackList$1.value.length >= 2 ? t : n;
|
|
883
905
|
l.setStyle(
|
|
884
906
|
new Style({
|
|
885
907
|
text: new Text({
|
|
@@ -892,9 +914,9 @@ const moveFeature = (e, t) => {
|
|
|
892
914
|
), trackLineVectorSource.value.addFeature(l);
|
|
893
915
|
});
|
|
894
916
|
}, setTrackLabelStyle = (e, t) => new Style({
|
|
895
|
-
renderer: (
|
|
896
|
-
const r =
|
|
897
|
-
center:
|
|
917
|
+
renderer: (n, o) => {
|
|
918
|
+
const r = o.context, s = {
|
|
919
|
+
center: n,
|
|
898
920
|
text: e.time,
|
|
899
921
|
color: t,
|
|
900
922
|
textColor: "#000",
|
|
@@ -973,30 +995,30 @@ const moveFeature = (e, t) => {
|
|
|
973
995
|
radius: 0
|
|
974
996
|
})
|
|
975
997
|
}), 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) => new Style({
|
|
976
|
-
renderer: (t,
|
|
977
|
-
const
|
|
978
|
-
|
|
998
|
+
renderer: (t, n) => {
|
|
999
|
+
const o = n.context, r = n.feature.get("data");
|
|
1000
|
+
n.feature.get("index") === 0 && (shipLabels.value = []);
|
|
979
1001
|
try {
|
|
980
|
-
const i = drawShipBody(
|
|
981
|
-
i && (drawHeading(
|
|
1002
|
+
const i = drawShipBody(o, r, t);
|
|
1003
|
+
i && (drawHeading(o, r, i), e && (drawSelectBounds(o, i), r.selected = !0)), drawShipLabel(o, r, t);
|
|
982
1004
|
} catch {
|
|
983
1005
|
return !1;
|
|
984
1006
|
}
|
|
985
1007
|
}
|
|
986
|
-
}), drawShipBody = (e, t,
|
|
1008
|
+
}), drawShipBody = (e, t, n) => {
|
|
987
1009
|
if (!mapInstance$7.value) return;
|
|
988
|
-
const
|
|
989
|
-
if (!
|
|
1010
|
+
const o = Math.round(Number(mapInstance$7.value.getView().getZoom()));
|
|
1011
|
+
if (!o) return;
|
|
990
1012
|
let r = [];
|
|
991
|
-
const [l, i] = drawShipModelByZoom[
|
|
992
|
-
if (
|
|
993
|
-
r = rotateShapeModel(drawCurrentShipShapeModel(t,
|
|
1013
|
+
const [l, i] = drawShipModelByZoom[o] || [0, 0], [s, c] = n;
|
|
1014
|
+
if (o <= mapZoom.shipModelMax && o > mapZoom.shipModelMin && t.length >= l && t.breadth >= i)
|
|
1015
|
+
r = rotateShapeModel(drawCurrentShipShapeModel(t, o), t.angle).map((m) => {
|
|
994
1016
|
const [u, f] = m;
|
|
995
1017
|
return [s + u, c + f];
|
|
996
1018
|
});
|
|
997
1019
|
else {
|
|
998
1020
|
const d = rotateShapeModel(triangleModel, t.angle);
|
|
999
|
-
|
|
1021
|
+
n.length === 2 && (r = d.map((m) => {
|
|
1000
1022
|
const [u, f] = m;
|
|
1001
1023
|
return [s + u, c + f];
|
|
1002
1024
|
}));
|
|
@@ -1006,19 +1028,19 @@ const moveFeature = (e, t) => {
|
|
|
1006
1028
|
for (let d = 1; d < r.length; d++)
|
|
1007
1029
|
e.lineTo(r[d][0], r[d][1]);
|
|
1008
1030
|
return e.closePath(), e.strokeStyle = "#000", e.lineWidth = 1, e.stroke(), e.fillStyle = t.fill, e.fill(), e.restore(), r;
|
|
1009
|
-
}, drawHeading = (e, t,
|
|
1010
|
-
const [
|
|
1031
|
+
}, drawHeading = (e, t, n) => {
|
|
1032
|
+
const [o, r] = n[0], l = getShipDirectPath(t);
|
|
1011
1033
|
if (l) {
|
|
1012
1034
|
let i = l.map(function(s) {
|
|
1013
1035
|
let [c, d] = s;
|
|
1014
|
-
return [c +
|
|
1036
|
+
return [c + o, d + r];
|
|
1015
1037
|
});
|
|
1016
1038
|
if (e.save(), e.beginPath(), t.angle > 0) {
|
|
1017
|
-
e.translate(
|
|
1039
|
+
e.translate(o, r);
|
|
1018
1040
|
const s = t.angle * Math.PI / 180;
|
|
1019
|
-
e.rotate(s), e.translate(-
|
|
1041
|
+
e.rotate(s), e.translate(-o, -r);
|
|
1020
1042
|
}
|
|
1021
|
-
e.moveTo(
|
|
1043
|
+
e.moveTo(o, r);
|
|
1022
1044
|
for (let s = 1; s < i.length; s++) {
|
|
1023
1045
|
let [c, d] = i[s];
|
|
1024
1046
|
e.lineTo(c, d);
|
|
@@ -1026,13 +1048,13 @@ const moveFeature = (e, t) => {
|
|
|
1026
1048
|
e.strokeStyle = "#000", e.lineWidth = 1, e.stroke(), e.restore();
|
|
1027
1049
|
}
|
|
1028
1050
|
}, drawSelectBounds = (e, t) => {
|
|
1029
|
-
let [
|
|
1051
|
+
let [n, o, r, l] = getPixelFromCoordinate(t);
|
|
1030
1052
|
const i = 4;
|
|
1031
|
-
|
|
1053
|
+
n -= i, o -= i, r += i, l += i, e.save(), e.strokeStyle = "#ff0000", e.lineWidth = 4;
|
|
1032
1054
|
const s = 8;
|
|
1033
|
-
e.beginPath(), e.moveTo(
|
|
1034
|
-
}, drawShipLabel = (e, t,
|
|
1035
|
-
const [
|
|
1055
|
+
e.beginPath(), e.moveTo(n + s, l), e.lineTo(n, l), e.lineTo(n, l - s), e.moveTo(n, o + s), e.lineTo(n, o), e.lineTo(n + s, o), e.moveTo(r - s, o), e.lineTo(r, o), e.lineTo(r, o + s), e.moveTo(r, l - s), e.lineTo(r, l), e.lineTo(r - s, l), e.stroke(), e.restore();
|
|
1056
|
+
}, drawShipLabel = (e, t, n) => {
|
|
1057
|
+
const [o, r] = n, l = o - 0, i = r - 0, s = t.name;
|
|
1036
1058
|
let c;
|
|
1037
1059
|
t.leftIconColor && (c = { color: t.leftIconColor, icon: "" });
|
|
1038
1060
|
let d = getShipCustomIcon(t);
|
|
@@ -1045,18 +1067,19 @@ const moveFeature = (e, t) => {
|
|
|
1045
1067
|
leftIcon: c,
|
|
1046
1068
|
rightIcons: d,
|
|
1047
1069
|
selected: t.selected,
|
|
1070
|
+
blinkColors: t.blinkColors,
|
|
1048
1071
|
type: "ShipName"
|
|
1049
1072
|
};
|
|
1050
1073
|
drawLabel(e, m, shipLabels.value);
|
|
1051
1074
|
}, drawCurrentShipShapeModel = (e, t) => {
|
|
1052
|
-
let
|
|
1053
|
-
t <= 14 ?
|
|
1054
|
-
const
|
|
1075
|
+
let n = 0;
|
|
1076
|
+
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);
|
|
1077
|
+
const o = e.length / 4 * n, r = e.breadth * n;
|
|
1055
1078
|
let l = cloneDeep(shipShapeModel);
|
|
1056
|
-
return l = l.map(([i, s]) => [i * r, s *
|
|
1079
|
+
return l = l.map(([i, s]) => [i * r, s * o]), l;
|
|
1057
1080
|
}, getShipDirectPath = (e) => {
|
|
1058
|
-
let { speed: t, hdg:
|
|
1059
|
-
if (t && t > 1 && (
|
|
1081
|
+
let { speed: t, hdg: n, cog: o } = e, r = "", l = null;
|
|
1082
|
+
if (t && t > 1 && (n !== null && n != 511 && o !== null ? o - n >= 3 ? r = "left" : o - n <= -3 ? r = "right" : r = "front" : r = "front", r && t))
|
|
1060
1083
|
for (let i in speedCondition) {
|
|
1061
1084
|
let s = speedCondition[i];
|
|
1062
1085
|
if (t >= s[0] && t < s[1]) {
|
|
@@ -1073,23 +1096,23 @@ let shipsMarkerList = [], shipsVectorSource, largeAmountShipsSource;
|
|
|
1073
1096
|
const selectedShipData = ref(null);
|
|
1074
1097
|
let selectShipsVectorSource;
|
|
1075
1098
|
const renderShips = (e) => {
|
|
1076
|
-
var
|
|
1099
|
+
var n, o, r, l;
|
|
1077
1100
|
if (!mapInstance$6.value || showTrackLayer.value) return;
|
|
1078
1101
|
const t = Math.round(Number(mapInstance$6.value.getView().getZoom()));
|
|
1079
1102
|
if (selectedShipData.value && nextTick(() => {
|
|
1080
1103
|
selectSingleShipMarker(selectedShipData.value);
|
|
1081
1104
|
}).then((i) => {
|
|
1082
1105
|
}), !(!t || t < mapZoom.shipGreenDotMax) && (allShips.value = e, !hiddenOrther.value))
|
|
1083
|
-
return t >= mapZoom.shipGreenDotMax && t < mapZoom.shipModelMin ? ((
|
|
1106
|
+
return t >= mapZoom.shipGreenDotMax && t < mapZoom.shipModelMin ? ((n = shipsLayer.value) == null || n.setVisible(!1), (o = largeAmountShipsLayer.value) == null || o.setVisible(!0), renderLargeAmountShips(e)) : ((r = largeAmountShipsLayer.value) == null || r.setVisible(!1), (l = shipsLayer.value) == null || l.setVisible(!0), renderShipsMarker(e));
|
|
1084
1107
|
}, renderLargeAmountShips = (e) => {
|
|
1085
1108
|
if (!mapInstance$6.value) return;
|
|
1086
|
-
const t = e.map((
|
|
1109
|
+
const t = e.map((n) => ({
|
|
1087
1110
|
type: "Feature",
|
|
1088
1111
|
geometry: {
|
|
1089
1112
|
type: "Point",
|
|
1090
|
-
coordinates: [
|
|
1113
|
+
coordinates: [n.lon, n.lat]
|
|
1091
1114
|
},
|
|
1092
|
-
properties:
|
|
1115
|
+
properties: n
|
|
1093
1116
|
}));
|
|
1094
1117
|
return largeAmountShipsSource == null || largeAmountShipsSource.clear(), largeAmountShipsSource = new VectorSource({
|
|
1095
1118
|
features: new GeoJSON().readFeatures({
|
|
@@ -1130,33 +1153,33 @@ const renderShips = (e) => {
|
|
|
1130
1153
|
}
|
|
1131
1154
|
}), mapInstance$6.value.addLayer(largeAmountShipsLayer.value), largeAmountShipsLayer.value;
|
|
1132
1155
|
}, renderShipsMarker = (e) => {
|
|
1133
|
-
var
|
|
1156
|
+
var n;
|
|
1134
1157
|
if (!mapInstance$6.value) return;
|
|
1135
1158
|
deleteAllShipMarkers();
|
|
1136
1159
|
let t = convertShipMapData(e);
|
|
1137
1160
|
if (t = customFilterShips(t), !!(t != null && t.length))
|
|
1138
|
-
return t.forEach((
|
|
1139
|
-
const l = [
|
|
1161
|
+
return t.forEach((o, r) => {
|
|
1162
|
+
const l = [o.lon, o.lat], i = new Feature({
|
|
1140
1163
|
geometry: new Point(fromLonLat(l))
|
|
1141
1164
|
}), s = 1;
|
|
1142
|
-
i.set("clickGeometry", new Circle(fromLonLat(l), s)), i.set("data",
|
|
1165
|
+
i.set("clickGeometry", new Circle(fromLonLat(l), s)), i.set("data", o), i.set("index", r), i.setStyle(
|
|
1143
1166
|
setShipStyle(!1)
|
|
1144
1167
|
), shipsMarkerList.push({
|
|
1145
|
-
ship:
|
|
1168
|
+
ship: o,
|
|
1146
1169
|
lonlat: l,
|
|
1147
1170
|
feature: i
|
|
1148
1171
|
});
|
|
1149
1172
|
}), shipsVectorSource = new VectorSource({
|
|
1150
|
-
features: shipsMarkerList.map((
|
|
1173
|
+
features: shipsMarkerList.map((o) => o.feature)
|
|
1151
1174
|
}), shipsLayer.value = new VectorLayer({
|
|
1152
1175
|
source: shipsVectorSource
|
|
1153
|
-
}), (
|
|
1176
|
+
}), (n = mapInstance$6.value) == null || n.addLayer(shipsLayer.value), shipsLayer.value;
|
|
1154
1177
|
}, customFilterShips = (e) => {
|
|
1155
1178
|
let t = cloneDeep(e);
|
|
1156
|
-
return t = t.filter((
|
|
1179
|
+
return t = t.filter((n) => {
|
|
1157
1180
|
var r;
|
|
1158
|
-
let
|
|
1159
|
-
return (switchBtnShow.value.camera || switchBtnShow.value.mobile || switchBtnShow.value.waterGauge) && ((r = selectedShipData.value) == null ? void 0 : r.id) ===
|
|
1181
|
+
let o = getFilterItem(n).every(({ btnShow: l, value: i }) => l ? !!i : !0);
|
|
1182
|
+
return (switchBtnShow.value.camera || switchBtnShow.value.mobile || switchBtnShow.value.waterGauge) && ((r = selectedShipData.value) == null ? void 0 : r.id) === n.id && clearSelectFeature(), o;
|
|
1160
1183
|
}), t;
|
|
1161
1184
|
}, getFilterItem = (e) => [
|
|
1162
1185
|
{ btnShow: switchBtnShow.value.camera, value: e == null ? void 0 : e.existDevice },
|
|
@@ -1171,45 +1194,45 @@ const renderShips = (e) => {
|
|
|
1171
1194
|
if (!mapInstance$6.value) return;
|
|
1172
1195
|
const t = cloneDeep(selectSingleShipData.value);
|
|
1173
1196
|
selectSingleShipData.value = convertShipMapData(e);
|
|
1174
|
-
const
|
|
1175
|
-
geometry: new Point(fromLonLat(
|
|
1197
|
+
const n = [selectSingleShipData.value.lon, selectSingleShipData.value.lat], o = new Feature({
|
|
1198
|
+
geometry: new Point(fromLonLat(n))
|
|
1176
1199
|
});
|
|
1177
|
-
|
|
1200
|
+
o.set("data", selectSingleShipData.value), o.setStyle(
|
|
1178
1201
|
setShipStyle(!0)
|
|
1179
1202
|
), shipsMarkerList.push({
|
|
1180
1203
|
ship: selectSingleShipData.value,
|
|
1181
|
-
lonlat:
|
|
1182
|
-
feature:
|
|
1204
|
+
lonlat: n,
|
|
1205
|
+
feature: o
|
|
1183
1206
|
}), selectShipsVectorSource == null || selectShipsVectorSource.clear(), selectShipsVectorSource = new VectorSource({
|
|
1184
|
-
features: [
|
|
1207
|
+
features: [o]
|
|
1185
1208
|
}), selectShipsLayer.value = new VectorLayer({
|
|
1186
1209
|
source: selectShipsVectorSource
|
|
1187
1210
|
}), setVisibleFeatureById(shipsVectorSource, selectSingleShipData.value.id, !0);
|
|
1188
1211
|
const r = (l = shipsLayer.value) == null ? void 0 : l.getSource();
|
|
1189
1212
|
return r && (t && setVisibleFeatureById(r, t.id, !0), setVisibleFeatureById(r, selectSingleShipData.value.id, !1)), mapInstance$6.value.addLayer(selectShipsLayer.value), selectShipsLayer.value.setVisible(!0), selectShipsLayer.value;
|
|
1190
|
-
}, setVisibleFeatureById = (e, t,
|
|
1191
|
-
e && e.forEachFeature((
|
|
1192
|
-
const r =
|
|
1193
|
-
r && r.id === t &&
|
|
1213
|
+
}, setVisibleFeatureById = (e, t, n) => {
|
|
1214
|
+
e && e.forEachFeature((o) => {
|
|
1215
|
+
const r = o.get("data");
|
|
1216
|
+
r && r.id === t && o.setStyle(n ? setShipStyle(!1, r.id) : setBlankStyle());
|
|
1194
1217
|
});
|
|
1195
|
-
}, findShip = (e, t,
|
|
1218
|
+
}, findShip = (e, t, n = !0) => {
|
|
1196
1219
|
var r, l, i, s, c;
|
|
1197
1220
|
if (console.log(mapInstance$6.value.ol_uid), !e || !mapInstance$6.value) return;
|
|
1198
|
-
const
|
|
1221
|
+
const o = (i = (l = (r = shipsLayer.value) == null ? void 0 : r.getSource()) == null ? void 0 : l.getFeatures()) == null ? void 0 : i.find((d) => {
|
|
1199
1222
|
var m;
|
|
1200
1223
|
return ((m = d.get("data")) == null ? void 0 : m.id) === e;
|
|
1201
1224
|
});
|
|
1202
|
-
if (
|
|
1225
|
+
if (o ? selectedShipData.value = o.get("data") : t && (selectedShipData.value = t), !t) {
|
|
1203
1226
|
console.error("找不到船舶");
|
|
1204
1227
|
return;
|
|
1205
1228
|
}
|
|
1206
|
-
if (
|
|
1229
|
+
if (n && ((s = selectedShipData.value) != null && s.lon) && ((c = selectedShipData.value) != null && c.lat)) {
|
|
1207
1230
|
const d = mapInstance$6.value.getView(), m = new Point([selectedShipData.value.lon, selectedShipData.value.lat]);
|
|
1208
1231
|
d.setCenter(transform(m.getCoordinates(), projection.data, projection.mercator));
|
|
1209
1232
|
const u = d.getZoom(), f = u < mapZoom.findShipMin ? mapZoom.findShip : u;
|
|
1210
1233
|
d.setZoom(f);
|
|
1211
1234
|
}
|
|
1212
|
-
return selectSingleShipMarker(t),
|
|
1235
|
+
return selectSingleShipMarker(t), o;
|
|
1213
1236
|
}, clearSelectFeature = () => {
|
|
1214
1237
|
var e;
|
|
1215
1238
|
if (selectedShipData.value) {
|
|
@@ -1234,9 +1257,50 @@ const renderShips = (e) => {
|
|
|
1234
1257
|
switchBtnShow.value[e] = t, renderShips(allShips.value);
|
|
1235
1258
|
}, rerenderShip = () => {
|
|
1236
1259
|
renderShips(allShips.value);
|
|
1237
|
-
}, mapInstance$5 = ref(),
|
|
1260
|
+
}, mapInstance$5 = ref(), renderCustomOverlaySetInstance = (e) => mapInstance$5.value = e, drawCustomContent = (e, t, n, o = "top-left", r = !1) => {
|
|
1261
|
+
var m, u;
|
|
1262
|
+
if (!t || !mapInstance$5.value) return;
|
|
1263
|
+
document.querySelectorAll(".truck-custom-content").forEach((f) => f.parentNode.removeChild(f));
|
|
1264
|
+
const l = document.createElement("div");
|
|
1265
|
+
l.innerHTML = n;
|
|
1266
|
+
const i = new Overlay({
|
|
1267
|
+
element: l,
|
|
1268
|
+
position: t,
|
|
1269
|
+
// 初始位置
|
|
1270
|
+
positioning: o,
|
|
1271
|
+
stopEvent: r
|
|
1272
|
+
// 设置不阻拦事件
|
|
1273
|
+
});
|
|
1274
|
+
if (r) {
|
|
1275
|
+
let f = !1, p = [0, 0], y = [0, 0];
|
|
1276
|
+
l.addEventListener("mousedown", function(h) {
|
|
1277
|
+
var g;
|
|
1278
|
+
f = !0, h.clientX, h.clientY, p = (g = mapInstance$5.value) == null ? void 0 : g.getCoordinateFromPixel([h.clientX - 200, h.clientY - 200]), y = [
|
|
1279
|
+
h.clientX - l.getBoundingClientRect().left + 160,
|
|
1280
|
+
h.clientY - l.getBoundingClientRect().top + 84
|
|
1281
|
+
], h.preventDefault();
|
|
1282
|
+
}), document.addEventListener("mousemove", function(h) {
|
|
1283
|
+
var g;
|
|
1284
|
+
if (f) {
|
|
1285
|
+
let M = (g = mapInstance$5.value) == null ? void 0 : g.getCoordinateFromPixel([h.clientX - y[0], h.clientY - y[1]]), T = M[0] - p[0], b = M[1] - p[1];
|
|
1286
|
+
i.setPosition([p[0] + T, p[1] + b]);
|
|
1287
|
+
}
|
|
1288
|
+
}), document.addEventListener("mouseup", function() {
|
|
1289
|
+
f = !1;
|
|
1290
|
+
});
|
|
1291
|
+
}
|
|
1292
|
+
(m = mapInstance$5.value) == null || m.addOverlay(i);
|
|
1293
|
+
const s = l.querySelector(".close-button");
|
|
1294
|
+
s && s.addEventListener("click", () => {
|
|
1295
|
+
var f, p;
|
|
1296
|
+
(f = mapInstance$5.value) == null || f.removeOverlay(i), (p = l.parentNode) == null || p.removeChild(l);
|
|
1297
|
+
});
|
|
1298
|
+
let c = JSON.parse(JSON.stringify(t));
|
|
1299
|
+
const d = (u = mapInstance$5.value) == null ? void 0 : u.getCoordinateFromPixel(c);
|
|
1300
|
+
return i.setPosition(d), i;
|
|
1301
|
+
}, mapInstance$4 = ref(), renderTrackSetInstance = (e) => mapInstance$4.value = e, showTracks = ref([]), trackList = ref([]);
|
|
1238
1302
|
ref(null);
|
|
1239
|
-
const trackId = ref(""), cursor = ref(0), renderTrack = (e, t,
|
|
1303
|
+
const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, r = "ship") => {
|
|
1240
1304
|
var m;
|
|
1241
1305
|
if (nextTick(() => {
|
|
1242
1306
|
hiddenAllShips();
|
|
@@ -1251,18 +1315,71 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, r = "ship")
|
|
|
1251
1315
|
}), trackId.value = e, l[e] = t, trackList.value = t;
|
|
1252
1316
|
const i = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], s = l[e].map(
|
|
1253
1317
|
(u) => transform([u.lon, u.lat], projection.data, projection.mercator)
|
|
1254
|
-
), c = new LineString(s), d = formatUtils.formatLength(c,
|
|
1318
|
+
), c = new LineString(s), d = formatUtils.formatLength(c, o) || "--";
|
|
1255
1319
|
nextTick(() => {
|
|
1256
1320
|
var f, p;
|
|
1257
1321
|
const u = (f = showTracks.value) == null ? void 0 : f.findIndex((y) => y.id === e);
|
|
1258
|
-
u < 0 ? showTracks.value.push({ id: e, length: d }) : showTracks.value[u].length = d, ++cursor.value, cursor.value > i.length && (cursor.value = 0), renderTrackLine(l, e,
|
|
1322
|
+
u < 0 ? showTracks.value.push({ id: e, length: d }) : showTracks.value[u].length = d, ++cursor.value, cursor.value > i.length && (cursor.value = 0), renderTrackLine(l, e, n), nextTick(() => {
|
|
1259
1323
|
resetTrackView(e);
|
|
1260
1324
|
}).then(() => {
|
|
1261
|
-
}), (p = mapInstance$
|
|
1262
|
-
showTrackLayer.value && (trackLabels.value = [], renderTrackLine(l, e,
|
|
1263
|
-
});
|
|
1325
|
+
}), (p = mapInstance$4.value) == null || p.on("moveend", () => {
|
|
1326
|
+
showTrackLayer.value && (trackLabels.value = [], renderTrackLine(l, e, n));
|
|
1327
|
+
}), renderTrackPointPopup();
|
|
1264
1328
|
}).then(() => {
|
|
1265
1329
|
});
|
|
1330
|
+
}, renderTrackPointPopup = () => {
|
|
1331
|
+
var t;
|
|
1332
|
+
const e = ref(null);
|
|
1333
|
+
(t = mapInstance$4.value) == null || t.on("pointermove", (n) => {
|
|
1334
|
+
var r, l, i, s;
|
|
1335
|
+
e.value && ((r = mapInstance$4.value) == null || r.removeOverlay(e.value));
|
|
1336
|
+
const o = (l = mapInstance$4.value) == null ? void 0 : l.forEachFeatureAtPixel(n.pixel, (c) => c);
|
|
1337
|
+
if (o) {
|
|
1338
|
+
const c = o.get("data");
|
|
1339
|
+
if (!(c != null && c.time)) return;
|
|
1340
|
+
let d = "";
|
|
1341
|
+
c != null && c.stayTime && (d = `
|
|
1342
|
+
<div class="item w-100">
|
|
1343
|
+
<div class="item-label">停泊时间约</div>
|
|
1344
|
+
<div class="item-item">${c.stayTime}</div>
|
|
1345
|
+
</div>
|
|
1346
|
+
`);
|
|
1347
|
+
const m = `
|
|
1348
|
+
<div class="track-point-popup">
|
|
1349
|
+
<div class="item">
|
|
1350
|
+
<div class="item-label">状态</div>
|
|
1351
|
+
<div class="item-item">${c != null && c.sailStatus ? SHIP_SAIL_STATUS[String(c.sailStatus)] : DEFAULT_VALUE}</div>
|
|
1352
|
+
</div>
|
|
1353
|
+
<div class="item">
|
|
1354
|
+
<div class="item-label">航速</div>
|
|
1355
|
+
<div class="item-item">${c.speed || DEFAULT_VALUE}</div>
|
|
1356
|
+
</div>
|
|
1357
|
+
<div class="item">
|
|
1358
|
+
<div class="item-label">艏向</div>
|
|
1359
|
+
<div class="item-item">${c.hdg || DEFAULT_VALUE}</div>
|
|
1360
|
+
</div>
|
|
1361
|
+
<div class="item">
|
|
1362
|
+
<div class="item-label">航向</div>
|
|
1363
|
+
<div class="item-item">${c.cog || DEFAULT_VALUE}</div>
|
|
1364
|
+
</div>
|
|
1365
|
+
<div class="item">
|
|
1366
|
+
<div class="item-label">经度</div>
|
|
1367
|
+
<div class="item-item">${c.lon || DEFAULT_VALUE}</div>
|
|
1368
|
+
</div>
|
|
1369
|
+
<div class="item">
|
|
1370
|
+
<div class="item-label">纬度</div>
|
|
1371
|
+
<div class="item-item">${c.lat || DEFAULT_VALUE}</div>
|
|
1372
|
+
</div>
|
|
1373
|
+
<div class="item w-100">
|
|
1374
|
+
<div class="item-label">时间</div>
|
|
1375
|
+
<div class="item-item">${c.time}</div>
|
|
1376
|
+
</div>
|
|
1377
|
+
${d ?? d}
|
|
1378
|
+
</div>`, u = (i = mapInstance$4.value) == null ? void 0 : i.getPixelFromCoordinate(n.coordinate);
|
|
1379
|
+
e.value = drawCustomContent(c.time, u, m, "center-center");
|
|
1380
|
+
} else
|
|
1381
|
+
(s = mapInstance$4.value) == null || s.removeOverlay(e.value);
|
|
1382
|
+
});
|
|
1266
1383
|
}, removeAllTrackLayer = () => {
|
|
1267
1384
|
var e;
|
|
1268
1385
|
showTracks.value = [], (e = trackLineVectorSource.value) == null || e.clear();
|
|
@@ -1270,12 +1387,12 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, r = "ship")
|
|
|
1270
1387
|
handlePlay(String(e), t);
|
|
1271
1388
|
}, resetTrackView = (e) => {
|
|
1272
1389
|
var r;
|
|
1273
|
-
const t = mapInstance$
|
|
1274
|
-
if (!
|
|
1275
|
-
const
|
|
1276
|
-
if (
|
|
1390
|
+
const t = mapInstance$4.value.getView(), n = e ? shipTrackLineFeatures.value.find((l) => l.getId() === e) : shipTrackLineFeatures.value[0];
|
|
1391
|
+
if (!n) return;
|
|
1392
|
+
const o = (r = n == null ? void 0 : n.getGeometry()) == null ? void 0 : r.getExtent();
|
|
1393
|
+
if (o != null && o.length)
|
|
1277
1394
|
try {
|
|
1278
|
-
const l = buffer(
|
|
1395
|
+
const l = buffer(o, Math.max(o[2] - o[0], o[3] - o[1]) * 0.02);
|
|
1279
1396
|
t.fit(l);
|
|
1280
1397
|
} catch (l) {
|
|
1281
1398
|
console.log(l);
|
|
@@ -1295,10 +1412,10 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, r = "ship")
|
|
|
1295
1412
|
emits: ["switchGreenDot", "switchMapTile"],
|
|
1296
1413
|
setup(e, { emit: t }) {
|
|
1297
1414
|
var p, y;
|
|
1298
|
-
const
|
|
1299
|
-
|
|
1415
|
+
const n = inject("mapInstance"), o = e, r = t, l = ref(((y = (p = n.value) == null ? void 0 : p.getView()) == null ? void 0 : y.getZoom()) || mapZoom.default), i = ref(!1), s = ref(null), c = ref(!0), d = () => {
|
|
1416
|
+
o.disableGreenDot || l.value >= mapZoom.shipGreenDotMax || (c.value = !c.value, r("switchGreenDot", c.value));
|
|
1300
1417
|
}, m = () => {
|
|
1301
|
-
r("switchMapTile",
|
|
1418
|
+
r("switchMapTile", o.mapTileMode === BaseMapType.vector ? BaseMapType.satellite : BaseMapType.vector);
|
|
1302
1419
|
}, u = () => {
|
|
1303
1420
|
var h, g;
|
|
1304
1421
|
i.value ? (h = s.value) == null || h.removeInteraction() : (g = s.value) == null || g.addInteraction(), i.value = !i.value;
|
|
@@ -1309,9 +1426,9 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, r = "ship")
|
|
|
1309
1426
|
return onMounted(() => {
|
|
1310
1427
|
nextTick(() => {
|
|
1311
1428
|
var h;
|
|
1312
|
-
(h =
|
|
1313
|
-
var
|
|
1314
|
-
const g = (T = (
|
|
1429
|
+
(h = n.value) == null || h.on("moveend", () => {
|
|
1430
|
+
var M, T;
|
|
1431
|
+
const g = (T = (M = n.value) == null ? void 0 : M.getView()) == null ? void 0 : T.getZoom();
|
|
1315
1432
|
g && (l.value = g);
|
|
1316
1433
|
});
|
|
1317
1434
|
});
|
|
@@ -1340,7 +1457,7 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, r = "ship")
|
|
|
1340
1457
|
h.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
|
|
1341
1458
|
key: 2,
|
|
1342
1459
|
class: normalizeClass(`switch-btn ${h.mapTileMode === unref(BaseMapType).satellite && "active"}`),
|
|
1343
|
-
onClick: g[0] || (g[0] = (
|
|
1460
|
+
onClick: g[0] || (g[0] = (M) => m())
|
|
1344
1461
|
}, g[7] || (g[7] = [
|
|
1345
1462
|
createElementVNode("i", { class: "map-iconfont icon-space" }, null, -1),
|
|
1346
1463
|
createElementVNode("div", { class: "button-text" }, "图层", -1)
|
|
@@ -1348,7 +1465,7 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, r = "ship")
|
|
|
1348
1465
|
h.vehicleMode === "truck" ? (openBlock(), createElementBlock("div", {
|
|
1349
1466
|
key: 3,
|
|
1350
1467
|
class: normalizeClass(`switch-btn ${h.mapTileMode === unref(BaseMapType).satellite && "active"}`),
|
|
1351
|
-
onClick: g[1] || (g[1] = (
|
|
1468
|
+
onClick: g[1] || (g[1] = (M) => m())
|
|
1352
1469
|
}, g[8] || (g[8] = [
|
|
1353
1470
|
createElementVNode("i", { class: "map-iconfont icon-space" }, null, -1),
|
|
1354
1471
|
createElementVNode("div", { class: "button-text" }, "卫星", -1)
|
|
@@ -1356,14 +1473,14 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, r = "ship")
|
|
|
1356
1473
|
h.showTrackLayer ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
|
|
1357
1474
|
createElementVNode("div", {
|
|
1358
1475
|
class: "switch-btn multiple",
|
|
1359
|
-
onClick: g[2] || (g[2] = (
|
|
1476
|
+
onClick: g[2] || (g[2] = (M) => unref(playTrack)(unref(currentTrackId), 1))
|
|
1360
1477
|
}, g[9] || (g[9] = [
|
|
1361
1478
|
createElementVNode("i", { class: "map-iconfont icon-play" }, null, -1),
|
|
1362
1479
|
createElementVNode("div", { class: "button-text" }, "播放轨迹", -1)
|
|
1363
1480
|
])),
|
|
1364
1481
|
createElementVNode("div", {
|
|
1365
1482
|
class: "switch-btn multiple",
|
|
1366
|
-
onClick: g[3] || (g[3] = (
|
|
1483
|
+
onClick: g[3] || (g[3] = (M) => unref(resetTrackView)())
|
|
1367
1484
|
}, g[10] || (g[10] = [
|
|
1368
1485
|
createElementVNode("i", { class: "map-iconfont icon-center" }, null, -1),
|
|
1369
1486
|
createElementVNode("div", { class: "button-text" }, "轨迹居中", -1)
|
|
@@ -1404,7 +1521,7 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, r = "ship")
|
|
|
1404
1521
|
ref_key: "measureRef",
|
|
1405
1522
|
ref: s,
|
|
1406
1523
|
visible: i.value,
|
|
1407
|
-
"onUpdate:visible": g[4] || (g[4] = (
|
|
1524
|
+
"onUpdate:visible": g[4] || (g[4] = (M) => i.value = M),
|
|
1408
1525
|
onClose: f,
|
|
1409
1526
|
"view-mode": h.viewMode
|
|
1410
1527
|
}, null, 8, ["visible", "view-mode"])) : createCommentVNode("", !0)
|
|
@@ -1414,14 +1531,14 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, r = "ship")
|
|
|
1414
1531
|
}), ToolPanel = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-ef931f65"]]), _hoisted_1$2 = { id: "scale-line-container" }, _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
1415
1532
|
__name: "scaleLine",
|
|
1416
1533
|
setup(e, { expose: t }) {
|
|
1417
|
-
const
|
|
1534
|
+
const n = inject("mapInstance");
|
|
1418
1535
|
return t({
|
|
1419
1536
|
setScaleLine: (r) => {
|
|
1420
1537
|
var s;
|
|
1421
1538
|
const l = new ScaleLine$1({
|
|
1422
1539
|
units: r || "metric"
|
|
1423
1540
|
}), i = document.getElementById("scale-line-container");
|
|
1424
|
-
i && (l.setTarget(i), (s =
|
|
1541
|
+
i && (l.setTarget(i), (s = n.value) == null || s.addControl(l));
|
|
1425
1542
|
}
|
|
1426
1543
|
}), (r, l) => (openBlock(), createElementBlock("div", _hoisted_1$2));
|
|
1427
1544
|
}
|
|
@@ -1433,22 +1550,22 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, r = "ship")
|
|
|
1433
1550
|
}
|
|
1434
1551
|
},
|
|
1435
1552
|
setup(e) {
|
|
1436
|
-
const t = inject("mapInstance"),
|
|
1553
|
+
const t = inject("mapInstance"), n = () => {
|
|
1437
1554
|
if (!t.value) return;
|
|
1438
1555
|
const r = t.value.getView(), l = r.getZoom();
|
|
1439
1556
|
l && r.setZoom(l + 1);
|
|
1440
|
-
},
|
|
1557
|
+
}, o = () => {
|
|
1441
1558
|
if (!t.value) return;
|
|
1442
1559
|
const r = t.value.getView(), l = r.getZoom();
|
|
1443
1560
|
l && r.setZoom(l - 1);
|
|
1444
1561
|
};
|
|
1445
1562
|
return (r, l) => (openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
1446
1563
|
createElementVNode("div", {
|
|
1447
|
-
onClick:
|
|
1564
|
+
onClick: n,
|
|
1448
1565
|
class: "button big-button"
|
|
1449
1566
|
}, "+"),
|
|
1450
1567
|
createElementVNode("div", {
|
|
1451
|
-
onClick:
|
|
1568
|
+
onClick: o,
|
|
1452
1569
|
class: "button small-button"
|
|
1453
1570
|
}, "-")
|
|
1454
1571
|
]));
|
|
@@ -1456,7 +1573,7 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, r = "ship")
|
|
|
1456
1573
|
}), ZoomControl = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-602b1c0f"]]), _hoisted_1 = { class: "copyright" }, _hoisted_2 = { class: "tdt-control-copyright tdt-control" }, _hoisted_3 = ["src"], _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
1457
1574
|
__name: "copyright",
|
|
1458
1575
|
setup(e) {
|
|
1459
|
-
return (t,
|
|
1576
|
+
return (t, n) => (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
1460
1577
|
createElementVNode("div", _hoisted_2, [
|
|
1461
1578
|
createElementVNode("img", {
|
|
1462
1579
|
src: unref(CDN_URL) + "map/tdt-logo.png",
|
|
@@ -1465,27 +1582,27 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, r = "ship")
|
|
|
1465
1582
|
class: "logo",
|
|
1466
1583
|
alt: ""
|
|
1467
1584
|
}, null, 8, _hoisted_3),
|
|
1468
|
-
|
|
1585
|
+
n[0] || (n[0] = createElementVNode("div", { class: "copyright-text" }, "GS(2024)0568号 - 甲测资字1100471", -1))
|
|
1469
1586
|
]),
|
|
1470
|
-
|
|
1587
|
+
n[1] || (n[1] = createElementVNode("div", {
|
|
1471
1588
|
id: "dataSource",
|
|
1472
1589
|
class: "tdt-control data-source"
|
|
1473
1590
|
}, "数据来源:自然资源部 & NavInfo", -1))
|
|
1474
1591
|
]));
|
|
1475
1592
|
}
|
|
1476
|
-
}), Copyright = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-9c5c2f7b"]]), dotImage = new Image();
|
|
1477
|
-
dotImage.src = `${CDN_URL}/map/truck-dot.svg`;
|
|
1478
|
-
dotImage.crossOrigin = "anonymous";
|
|
1479
|
-
const dotActiveImage = new Image();
|
|
1480
|
-
dotActiveImage.src = `${CDN_URL}/map/truck-dot-active.svg`;
|
|
1481
|
-
dotActiveImage.crossOrigin = "anonymous";
|
|
1593
|
+
}), Copyright = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-9c5c2f7b"]]), dotImage$1 = new Image();
|
|
1594
|
+
dotImage$1.src = `${CDN_URL}/map/truck-dot.svg`;
|
|
1595
|
+
dotImage$1.crossOrigin = "anonymous";
|
|
1596
|
+
const dotActiveImage$1 = new Image();
|
|
1597
|
+
dotActiveImage$1.src = `${CDN_URL}/map/truck-dot-active.svg`;
|
|
1598
|
+
dotActiveImage$1.crossOrigin = "anonymous";
|
|
1482
1599
|
const cameraImage = new Image();
|
|
1483
1600
|
cameraImage.src = `${CDN_URL}/map/map-camera.svg`;
|
|
1484
1601
|
cameraImage.crossOrigin = "anonymous";
|
|
1485
1602
|
const loadImage = new Image();
|
|
1486
1603
|
loadImage.src = `${CDN_URL}/map/map-load.svg`;
|
|
1487
1604
|
loadImage.crossOrigin = "anonymous";
|
|
1488
|
-
const setTruckStyle = (e, t,
|
|
1605
|
+
const setTruckStyle = (e, t, n, o) => new Style({
|
|
1489
1606
|
renderer: (r, l) => {
|
|
1490
1607
|
const i = l.context;
|
|
1491
1608
|
i.save();
|
|
@@ -1498,99 +1615,58 @@ const setTruckStyle = (e, t, o, n) => new Style({
|
|
|
1498
1615
|
const p = 56, y = "#FFFFFF";
|
|
1499
1616
|
let h = 176;
|
|
1500
1617
|
const g = 52;
|
|
1501
|
-
let
|
|
1502
|
-
|
|
1618
|
+
let M = "#164AFF", T = "#FFFFFF";
|
|
1619
|
+
n === CAR_COLOR.YELLOW ? (h = 176, M = "#FFC81E", T = "rgba(0,0,0,0.88)") : n === CAR_COLOR.Y_GREEN && (f = 200, h = 196, M = "#8FED7C", T = "rgba(0,0,0,0.88)"), o != null && o.length && (f += o.length * 56), fillRectRadius(i, m, u, f, p, y), fillRectRadius(i, m + 2, u + 2, h, g, M), n === CAR_COLOR.Y_GREEN && fillRectRadius(i, m + 2, u + 2, 68, g, "#FFC81E"), i.save(), i.restore(), i.fillStyle = T, i.font = "bold 28px Arial", i.textAlign = "left", i.textBaseline = "middle";
|
|
1503
1620
|
const b = `${t.slice(0, 2) + " · " + t.slice(2)}`;
|
|
1504
|
-
if (i.fillText(b, m + 12, u + 32), i.save(), i.restore(),
|
|
1621
|
+
if (i.fillText(b, m + 12, u + 32), i.save(), i.restore(), o != null && o.length) {
|
|
1505
1622
|
const x = i.measureText(b).width + 12;
|
|
1506
1623
|
let v = 0;
|
|
1507
|
-
|
|
1508
|
-
|
|
1624
|
+
o.forEach((w) => {
|
|
1625
|
+
w === DEVICE_TYPE.CAMERA && (i.drawImage(cameraImage, c - 54 + x + v * 56, d - 64, 50, 50), ++v), w === DEVICE_TYPE.LOAD && (i.drawImage(loadImage, c - 54 + x + v * 56, d - 64, 50, 50), ++v);
|
|
1509
1626
|
});
|
|
1510
1627
|
}
|
|
1511
|
-
const C = dotImage;
|
|
1628
|
+
const C = dotImage$1;
|
|
1512
1629
|
i.drawImage(C, c + f / 2 - 90, d, 50 / s, 50 / s), i.restore();
|
|
1513
1630
|
}
|
|
1514
|
-
}), mapInstance$
|
|
1631
|
+
}), mapInstance$3 = ref(), renderDashboardSetInstance = (e) => mapInstance$3.value = e;
|
|
1515
1632
|
ref([]);
|
|
1516
1633
|
let truckMarkerList = [], trucksVectorSource;
|
|
1517
1634
|
const renderTrucksMarker = (e) => {
|
|
1518
|
-
if (deleteAllTruckMarkers(), !!mapInstance$
|
|
1635
|
+
if (deleteAllTruckMarkers(), !!mapInstance$3.value)
|
|
1519
1636
|
return e.forEach((t) => {
|
|
1520
|
-
const
|
|
1521
|
-
geometry: new Point(fromLonLat(
|
|
1637
|
+
const n = formatUtils.convertSixHundredThousandToLatLng(t.lon, t.lat), o = new Feature({
|
|
1638
|
+
geometry: new Point(fromLonLat(n))
|
|
1522
1639
|
});
|
|
1523
|
-
|
|
1640
|
+
o.set("data", t), o.setStyle(
|
|
1524
1641
|
setTruckStyle(!1, t.vno, t == null ? void 0 : t.vclColor, t == null ? void 0 : t.icons)
|
|
1525
1642
|
), truckMarkerList.push({
|
|
1526
1643
|
name: t.vno,
|
|
1527
|
-
lonlat:
|
|
1528
|
-
feature:
|
|
1644
|
+
lonlat: n,
|
|
1645
|
+
feature: o
|
|
1529
1646
|
});
|
|
1530
1647
|
}), trucksVectorSource = new VectorSource({
|
|
1531
1648
|
features: truckMarkerList.map((t) => t.feature)
|
|
1532
1649
|
}), trucksLayer.value = new VectorLayer({
|
|
1533
1650
|
source: trucksVectorSource
|
|
1534
|
-
}), mapInstance$
|
|
1651
|
+
}), mapInstance$3.value.addLayer(trucksLayer.value), trucksLayer.value;
|
|
1535
1652
|
}, deleteAllTruckMarkers = () => {
|
|
1536
1653
|
truckMarkerList.forEach((e) => {
|
|
1537
1654
|
e.feature && (trucksVectorSource == null || trucksVectorSource.removeFeature(e.feature));
|
|
1538
1655
|
}), truckMarkerList = [];
|
|
1539
|
-
}, mapInstance$3 = ref(), renderCustomOverlaySetInstance = (e) => mapInstance$3.value = e, drawCustomContent = (e, t, o, n = "top-left", r = !1) => {
|
|
1540
|
-
var m, u;
|
|
1541
|
-
if (!t || !mapInstance$3.value) return;
|
|
1542
|
-
document.querySelectorAll(".truck-custom-content").forEach((f) => f.parentNode.removeChild(f));
|
|
1543
|
-
const l = document.createElement("div");
|
|
1544
|
-
l.innerHTML = o;
|
|
1545
|
-
const i = new Overlay({
|
|
1546
|
-
element: l,
|
|
1547
|
-
position: t,
|
|
1548
|
-
// 初始位置
|
|
1549
|
-
positioning: n,
|
|
1550
|
-
stopEvent: r
|
|
1551
|
-
// 设置不阻拦事件
|
|
1552
|
-
});
|
|
1553
|
-
if (r) {
|
|
1554
|
-
let f = !1, p = [0, 0], y = [0, 0];
|
|
1555
|
-
l.addEventListener("mousedown", function(h) {
|
|
1556
|
-
var g;
|
|
1557
|
-
f = !0, h.clientX, h.clientY, p = (g = mapInstance$3.value) == null ? void 0 : g.getCoordinateFromPixel([h.clientX - 200, h.clientY - 200]), y = [
|
|
1558
|
-
h.clientX - l.getBoundingClientRect().left + 160,
|
|
1559
|
-
h.clientY - l.getBoundingClientRect().top + 84
|
|
1560
|
-
], h.preventDefault();
|
|
1561
|
-
}), document.addEventListener("mousemove", function(h) {
|
|
1562
|
-
var g;
|
|
1563
|
-
if (f) {
|
|
1564
|
-
let L = (g = mapInstance$3.value) == null ? void 0 : g.getCoordinateFromPixel([h.clientX - y[0], h.clientY - y[1]]), T = L[0] - p[0], b = L[1] - p[1];
|
|
1565
|
-
i.setPosition([p[0] + T, p[1] + b]);
|
|
1566
|
-
}
|
|
1567
|
-
}), document.addEventListener("mouseup", function() {
|
|
1568
|
-
f = !1;
|
|
1569
|
-
});
|
|
1570
|
-
}
|
|
1571
|
-
(m = mapInstance$3.value) == null || m.addOverlay(i);
|
|
1572
|
-
const s = l.querySelector(".close-button");
|
|
1573
|
-
s && s.addEventListener("click", () => {
|
|
1574
|
-
var f, p;
|
|
1575
|
-
(f = mapInstance$3.value) == null || f.removeOverlay(i), (p = l.parentNode) == null || p.removeChild(l);
|
|
1576
|
-
});
|
|
1577
|
-
let c = JSON.parse(JSON.stringify(t));
|
|
1578
|
-
const d = (u = mapInstance$3.value) == null ? void 0 : u.getCoordinateFromPixel(c);
|
|
1579
|
-
return i.setPosition(d), i;
|
|
1580
1656
|
}, mapInstance$2 = ref(), renderTruckSetInstance = (e) => mapInstance$2.value = e, vehicle = ref(null), focusShipData = ref(), currentTruckOverlay = ref(null), findTruck = async (e) => {
|
|
1581
1657
|
if (!mapInstance$2.value) return;
|
|
1582
1658
|
focusShipData.value = e;
|
|
1583
|
-
const t = formatUtils.convertSixHundredThousandToLatLng(e.lon, e.lat),
|
|
1584
|
-
currentTruckOverlay.value = drawTruckIcon(e.vno,
|
|
1585
|
-
const
|
|
1586
|
-
|
|
1659
|
+
const t = formatUtils.convertSixHundredThousandToLatLng(e.lon, e.lat), n = mapInstance$2.value.getPixelFromCoordinate(transform(t, projection.data, projection.mercator));
|
|
1660
|
+
currentTruckOverlay.value = drawTruckIcon(e.vno, n, e == null ? void 0 : e.drc);
|
|
1661
|
+
const o = mapInstance$2.value.getView(), r = new Point(t);
|
|
1662
|
+
o.setCenter(transform(r.getCoordinates(), projection.data, projection.mercator));
|
|
1587
1663
|
}, clearAllTruck = () => {
|
|
1588
1664
|
vehicle.value.clearAllShip();
|
|
1589
|
-
}, drawTruckIcon = (e, t,
|
|
1590
|
-
const
|
|
1665
|
+
}, drawTruckIcon = (e, t, n) => {
|
|
1666
|
+
const o = `<div id="${e}" class="ol-custom-content truck-custom-content" style="width: 80px; height: 80px; transform: rotate(${n}deg);">
|
|
1591
1667
|
<img src="${CDN_URL}map/car-icon.gif" width="100%" height="100%" />
|
|
1592
1668
|
</div>`;
|
|
1593
|
-
return drawCustomContent(e, t,
|
|
1669
|
+
return drawCustomContent(e, t, o, "center-center");
|
|
1594
1670
|
}, removeTruckIcon = () => {
|
|
1595
1671
|
var t;
|
|
1596
1672
|
const e = (t = currentTruckOverlay.value) == null ? void 0 : t.getElement();
|
|
@@ -1598,11 +1674,11 @@ const renderTrucksMarker = (e) => {
|
|
|
1598
1674
|
}, zoomTruckIcon = () => {
|
|
1599
1675
|
var l;
|
|
1600
1676
|
if (!mapInstance$2.value) return;
|
|
1601
|
-
const e = mapInstance$2.value.getView().getZoom(), t = 120,
|
|
1602
|
-
function
|
|
1603
|
-
return i < 14 ?
|
|
1677
|
+
const e = mapInstance$2.value.getView().getZoom(), t = 120, n = 60;
|
|
1678
|
+
function o(i) {
|
|
1679
|
+
return i < 14 ? n : i >= 14 && i <= 18 ? Math.round((i - 14) * (t - n) / 4 + n) : t;
|
|
1604
1680
|
}
|
|
1605
|
-
const r =
|
|
1681
|
+
const r = o(e);
|
|
1606
1682
|
(l = document.querySelectorAll(".truck-custom-content")) == null || l.forEach((i) => {
|
|
1607
1683
|
i.style.width = `${r}px`, i.style.height = `${r}px`;
|
|
1608
1684
|
});
|
|
@@ -1635,14 +1711,14 @@ const renderTrucksMarker = (e) => {
|
|
|
1635
1711
|
padding: [2, 2, 2, 2]
|
|
1636
1712
|
// 设置文本背景的内边距
|
|
1637
1713
|
})
|
|
1638
|
-
}), renderMarker = (e, t = !0,
|
|
1714
|
+
}), renderMarker = (e, t = !0, n = !0) => {
|
|
1639
1715
|
var m;
|
|
1640
1716
|
if (!mapInstance$1.value || !e || e.split(",").length !== 2) return;
|
|
1641
|
-
const [
|
|
1717
|
+
const [o, r] = e.split(",").map(Number);
|
|
1642
1718
|
marker.value = new Feature({
|
|
1643
|
-
geometry: new Point(fromLonLat([
|
|
1719
|
+
geometry: new Point(fromLonLat([o, r]))
|
|
1644
1720
|
});
|
|
1645
|
-
const l =
|
|
1721
|
+
const l = n ? `${o}, ${r}` : "";
|
|
1646
1722
|
(m = marker.value) == null || m.setStyle(createIconStyle(l));
|
|
1647
1723
|
const i = new VectorSource({
|
|
1648
1724
|
features: [marker.value]
|
|
@@ -1659,15 +1735,15 @@ const renderTrucksMarker = (e) => {
|
|
|
1659
1735
|
markerPosition.value = `${y[0].toFixed(6)}, ${y[1].toFixed(6)}`, (h = marker.value) == null || h.setStyle(createIconStyle(markerPosition.value));
|
|
1660
1736
|
}), mapInstance$1.value.addInteraction(u);
|
|
1661
1737
|
}
|
|
1662
|
-
const d = new Point([
|
|
1738
|
+
const d = new Point([o, r]);
|
|
1663
1739
|
c.setCenter(transform(d.getCoordinates(), projection.data, projection.mercator)), c.setZoom(mapZoom.findShip);
|
|
1664
1740
|
}, setMarkerPosition = (e) => {
|
|
1665
1741
|
var r, l;
|
|
1666
1742
|
if (!mapInstance$1.value) return;
|
|
1667
|
-
const t = mapInstance$1.value.getView(),
|
|
1668
|
-
(l = (r = marker.value) == null ? void 0 : r.getGeometry()) == null || l.setCoordinates(fromLonLat([
|
|
1669
|
-
const
|
|
1670
|
-
t.setCenter(transform(
|
|
1743
|
+
const t = mapInstance$1.value.getView(), n = e.split(",").map(Number);
|
|
1744
|
+
(l = (r = marker.value) == null ? void 0 : r.getGeometry()) == null || l.setCoordinates(fromLonLat([n[0], n[1]]));
|
|
1745
|
+
const o = new Point([n[0], n[1]]);
|
|
1746
|
+
t.setCenter(transform(o.getCoordinates(), projection.data, projection.mercator));
|
|
1671
1747
|
}, mapInstance = ref(), drawPolygonSetInstance = (e) => mapInstance.value = e;
|
|
1672
1748
|
let layerState = "drawn", drawnState = "undrawn";
|
|
1673
1749
|
const source = new VectorSource();
|
|
@@ -1692,18 +1768,18 @@ function createHelpTooltip() {
|
|
|
1692
1768
|
}
|
|
1693
1769
|
let squareLimitError = !1, lineLimitError = !1;
|
|
1694
1770
|
const validateSquareLimit = (e) => {
|
|
1695
|
-
let
|
|
1771
|
+
let n = 1 / 0, o = -1 / 0, r = 1 / 0, l = -1 / 0;
|
|
1696
1772
|
e == null || e.forEach((c) => {
|
|
1697
1773
|
const d = transform(c, projection.mercator, projection.data), m = d[0], u = d[1];
|
|
1698
|
-
|
|
1774
|
+
n = Math.min(n, u), o = Math.max(o, u), r = Math.min(r, m), l = Math.max(l, m);
|
|
1699
1775
|
});
|
|
1700
|
-
const i = (
|
|
1776
|
+
const i = (o - n) * 111, s = (l - r) * 111;
|
|
1701
1777
|
squareLimitError = i > 150 || s > 150;
|
|
1702
1778
|
};
|
|
1703
1779
|
let storeFeature;
|
|
1704
1780
|
const addInteraction = (e) => {
|
|
1705
|
-
var
|
|
1706
|
-
drawVector || init(), drawnState = "undrawn", layerState = "drawn", (
|
|
1781
|
+
var o, r;
|
|
1782
|
+
drawVector || init(), drawnState = "undrawn", layerState = "drawn", (o = mapInstance.value) == null || o.addLayer(drawVector);
|
|
1707
1783
|
const t = new Style({
|
|
1708
1784
|
stroke: new Stroke({
|
|
1709
1785
|
color: "rgba(255, 255, 255, 1)",
|
|
@@ -1720,10 +1796,10 @@ const addInteraction = (e) => {
|
|
|
1720
1796
|
trace: !0,
|
|
1721
1797
|
style: [t, circleStyle]
|
|
1722
1798
|
}), (r = mapInstance.value) == null || r.addInteraction(draw), createMeasureTooltip(), createHelpTooltip();
|
|
1723
|
-
let
|
|
1799
|
+
let n;
|
|
1724
1800
|
draw.on("drawstart", function(l) {
|
|
1725
1801
|
var i;
|
|
1726
|
-
layerState = "drawn", sketch = l.feature,
|
|
1802
|
+
layerState = "drawn", sketch = l.feature, n = (i = sketch.getGeometry()) == null ? void 0 : i.on("change", function(s) {
|
|
1727
1803
|
const c = s.target;
|
|
1728
1804
|
let d = formatUtils.formatArea(c, LENGTH_UNIT.NM);
|
|
1729
1805
|
const u = c.getCoordinates()[0], f = new LineString([u[u.length - 2], u[u.length - 1]]);
|
|
@@ -1746,57 +1822,57 @@ const addInteraction = (e) => {
|
|
|
1746
1822
|
const s = endFn(l.feature);
|
|
1747
1823
|
s != null && s.length && e && e(s);
|
|
1748
1824
|
}
|
|
1749
|
-
if (sketch = null, measureTooltipElement = null, createMeasureTooltip(),
|
|
1825
|
+
if (sketch = null, measureTooltipElement = null, createMeasureTooltip(), n && unByKey(n), drawnState = "drawend", draw) {
|
|
1750
1826
|
const s = mapInstance.value.getInteractions().getArray().find((c) => c.ol_uid === draw.ol_uid);
|
|
1751
1827
|
s && ((i = mapInstance.value) == null || i.removeInteraction(s)), helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement);
|
|
1752
1828
|
}
|
|
1753
1829
|
});
|
|
1754
1830
|
}, removeInteraction = () => {
|
|
1755
|
-
var e, t,
|
|
1831
|
+
var e, t, n;
|
|
1756
1832
|
if (mapInstance.value) {
|
|
1757
|
-
if (document.querySelectorAll(".ol-tooltip.ol-tooltip-draw-polygon").forEach((
|
|
1833
|
+
if (document.querySelectorAll(".ol-tooltip.ol-tooltip-draw-polygon").forEach((o) => {
|
|
1758
1834
|
var r;
|
|
1759
|
-
(r =
|
|
1835
|
+
(r = o == null ? void 0 : o.parentNode) == null || r.removeChild(o);
|
|
1760
1836
|
}), 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) {
|
|
1761
|
-
const
|
|
1762
|
-
|
|
1837
|
+
const o = mapInstance.value.getInteractions().getArray().find((r) => r.ol_uid === draw.ol_uid);
|
|
1838
|
+
o && ((n = mapInstance.value) == null || n.removeInteraction(o));
|
|
1763
1839
|
}
|
|
1764
1840
|
drawnState = "undrawn", layerState = "destroyed";
|
|
1765
1841
|
}
|
|
1766
1842
|
}, endFn = (e) => {
|
|
1767
|
-
var t,
|
|
1843
|
+
var t, n, o;
|
|
1768
1844
|
if (e.getGeometry()) {
|
|
1769
1845
|
const r = [], i = e.getGeometry().getCoordinates();
|
|
1770
1846
|
(t = i[0]) == null || t.forEach((c) => {
|
|
1771
1847
|
r.push(transform(c, projection.mercator, projection.data));
|
|
1772
1848
|
});
|
|
1773
1849
|
const s = i[0][i[0].length - 2];
|
|
1774
|
-
if (s && measureTooltip.setPosition(s), measureTooltip.setOffset([10, 0]), measureTooltipElement && (measureTooltipElement.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), (
|
|
1850
|
+
if (s && measureTooltip.setPosition(s), 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", () => {
|
|
1775
1851
|
reset();
|
|
1776
1852
|
}), !lineLimitError && !squareLimitError)
|
|
1777
1853
|
return r;
|
|
1778
|
-
draw && ((
|
|
1854
|
+
draw && ((o = mapInstance.value) == null || o.removeInteraction(draw)), helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement);
|
|
1779
1855
|
}
|
|
1780
1856
|
}, initFeature = (e) => {
|
|
1781
|
-
var t,
|
|
1857
|
+
var t, n;
|
|
1782
1858
|
if (layerState = "drawn", storeFeature) {
|
|
1783
|
-
const
|
|
1784
|
-
if (!
|
|
1785
|
-
const r = formatUtils.formatArea(
|
|
1859
|
+
const o = storeFeature.getGeometry();
|
|
1860
|
+
if (!o) return;
|
|
1861
|
+
const r = formatUtils.formatArea(o, LENGTH_UNIT.NM);
|
|
1786
1862
|
measureTooltipElement && (measureTooltipElement.innerHTML = `
|
|
1787
1863
|
<span class="text">面积:${r}${lineLimitError || squareLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1788
1864
|
`), (t = drawVector.getSource()) == null || t.addFeature(storeFeature);
|
|
1789
1865
|
const l = endFn(storeFeature);
|
|
1790
1866
|
l != null && l.length && e && e(l);
|
|
1791
1867
|
const i = getCenter(storeFeature.getGeometry().getExtent());
|
|
1792
|
-
(
|
|
1868
|
+
(n = mapInstance.value) == null || n.getView().setCenter(i);
|
|
1793
1869
|
}
|
|
1794
1870
|
}, pointerMoveHandler = function(e) {
|
|
1795
|
-
var
|
|
1871
|
+
var n;
|
|
1796
1872
|
if (e.dragging)
|
|
1797
1873
|
return;
|
|
1798
1874
|
let t = "点击选择起点";
|
|
1799
|
-
sketch && (t = "单击继续,双击结束"), helpTooltipElement && (helpTooltipElement.innerHTML = t, helpTooltip.setPosition(e.coordinate), helpTooltipElement.classList.remove("hidden")), layerState === "drawn" && (((
|
|
1875
|
+
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");
|
|
1800
1876
|
}, init = () => {
|
|
1801
1877
|
mapInstance.value && (circleStyle = new Style({
|
|
1802
1878
|
image: new CircleStyle({
|
|
@@ -1844,16 +1920,16 @@ const addInteraction = (e) => {
|
|
|
1844
1920
|
shipData: {}
|
|
1845
1921
|
},
|
|
1846
1922
|
emits: ["zoomChanged", "extentChanged"],
|
|
1847
|
-
setup(e, { expose: t, emit:
|
|
1848
|
-
const
|
|
1849
|
-
provide("mapInstance",
|
|
1850
|
-
const r = ref(null), l = ref(null), i = ref(null), s =
|
|
1923
|
+
setup(e, { expose: t, emit: n }) {
|
|
1924
|
+
const o = ref();
|
|
1925
|
+
provide("mapInstance", o);
|
|
1926
|
+
const r = ref(null), l = ref(null), i = ref(null), s = n, c = e, d = ref(c.zoom || mapZoom.default), m = ref(!1), u = ref(!0), f = ref(!0);
|
|
1851
1927
|
let p;
|
|
1852
1928
|
((v) => {
|
|
1853
1929
|
v[v.tiandituTile = new TileLayer({ source: new XYZ({ url: baseMap.tiandituTile }) })] = "tiandituTile", v[v.tiandituTileMark = new TileLayer({ source: new XYZ({ url: baseMap.tiandituTileMark }) })] = "tiandituTileMark", v[v.tiandituImgTile = new TileLayer({ source: new XYZ({ url: baseMap.tiandituImgTile }), visible: !1 })] = "tiandituImgTile", v[v.tiandituImgTileMark = new TileLayer({ source: new XYZ({ url: baseMap.tiandituImgTileMark }), visible: !1 })] = "tiandituImgTileMark", v[v.greenMark = new TileLayer({ source: new XYZ({ url: baseMap.greenTile }) })] = "greenMark";
|
|
1854
1930
|
})(p || (p = {}));
|
|
1855
1931
|
const y = () => {
|
|
1856
|
-
var
|
|
1932
|
+
var w, k;
|
|
1857
1933
|
const v = {
|
|
1858
1934
|
projection: projection.mercator,
|
|
1859
1935
|
// 地图投影坐标系
|
|
@@ -1871,7 +1947,7 @@ const addInteraction = (e) => {
|
|
|
1871
1947
|
// 禁用旋转
|
|
1872
1948
|
multiWorld: !0
|
|
1873
1949
|
};
|
|
1874
|
-
|
|
1950
|
+
o.value = new Map$1({
|
|
1875
1951
|
target: "map",
|
|
1876
1952
|
// 对应页面里 id 为 map 的元素
|
|
1877
1953
|
layers: [
|
|
@@ -1883,7 +1959,7 @@ const addInteraction = (e) => {
|
|
|
1883
1959
|
p.greenMark
|
|
1884
1960
|
],
|
|
1885
1961
|
view: new View(v)
|
|
1886
|
-
}), h(), (
|
|
1962
|
+
}), h(), (w = l.value) == null || w.setScaleLine(c.vehicleMode === "ship" && "nautical"), (k = o.value) == null || k.on("moveend", b), g(v.zoom < mapZoom.shipGreenDotMax), T(c.vehicleMode === "ship" || c.viewMode === "findShip" ? BaseMapType.satellite : BaseMapType.vector), c.viewMode === "findShip" && c.mmsi && c.shipData && nextTick(() => {
|
|
1887
1963
|
findShip(String(c.mmsi), c.shipData);
|
|
1888
1964
|
});
|
|
1889
1965
|
};
|
|
@@ -1891,58 +1967,58 @@ const addInteraction = (e) => {
|
|
|
1891
1967
|
y();
|
|
1892
1968
|
});
|
|
1893
1969
|
const h = () => {
|
|
1894
|
-
|
|
1970
|
+
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));
|
|
1895
1971
|
}, g = (v) => {
|
|
1896
|
-
var
|
|
1897
|
-
c.vehicleMode !== "ship" && (v = !1), (
|
|
1898
|
-
|
|
1972
|
+
var w;
|
|
1973
|
+
c.vehicleMode !== "ship" && (v = !1), (w = o.value) == null || w.getLayers().forEach((k) => {
|
|
1974
|
+
k.ol_uid === p.greenMark.ol_uid && (k.setVisible(v), u.value = v);
|
|
1899
1975
|
});
|
|
1900
|
-
},
|
|
1901
|
-
var
|
|
1902
|
-
|
|
1903
|
-
(
|
|
1976
|
+
}, M = ref(BaseMapType.satellite), T = (v) => {
|
|
1977
|
+
var w;
|
|
1978
|
+
M.value = v, (w = o.value) == null || w.getLayers().forEach((k) => {
|
|
1979
|
+
(k.ol_uid === p.tiandituTile.ol_uid || k.ol_uid === p.tiandituTileMark.ol_uid || k.ol_uid === p.tiandituImgTile.ol_uid || k.ol_uid === p.tiandituImgTileMark.ol_uid) && k.setVisible(!1), (v === BaseMapType.vector && (k.ol_uid === p.tiandituTile.ol_uid || k.ol_uid === p.tiandituTileMark.ol_uid) || v === BaseMapType.satellite && (k.ol_uid === p.tiandituImgTile.ol_uid || k.ol_uid === p.tiandituImgTileMark.ol_uid)) && k.setVisible(!0);
|
|
1904
1980
|
});
|
|
1905
1981
|
}, b = () => {
|
|
1906
|
-
const v =
|
|
1907
|
-
|
|
1908
|
-
const
|
|
1909
|
-
|
|
1982
|
+
const v = o.value.getView(), w = v.getZoom();
|
|
1983
|
+
w && C(w);
|
|
1984
|
+
const k = v.calculateExtent(o.value.getSize());
|
|
1985
|
+
k && w && x(k, w);
|
|
1910
1986
|
}, C = (v) => {
|
|
1911
|
-
var V,
|
|
1987
|
+
var V, L, I, E, F;
|
|
1912
1988
|
d.value = v, g(v < mapZoom.shipGreenDotMax);
|
|
1913
|
-
const
|
|
1914
|
-
showTrackLayer.value ? (f.value = !1,
|
|
1915
|
-
}, x = (v,
|
|
1916
|
-
const
|
|
1917
|
-
s("extentChanged", { extent: [
|
|
1989
|
+
const w = (V = o.value) == null ? void 0 : V.getLayers(), k = c.vehicleMode === "ship" ? w == null ? void 0 : w.getArray().find((N) => N.ol_uid === p.greenMark.ol_uid) : void 0;
|
|
1990
|
+
showTrackLayer.value ? (f.value = !1, k == null || k.setVisible(!1), (L = shipsLayer.value) == null || L.setVisible(!1), (I = largeAmountShipsLayer.value) == null || I.setVisible(!1)) : !m.value && u.value && v <= mapZoom.shipGreenDotMax ? (f.value = !0, k == null || k.setVisible(!0), (E = shipsLayer.value) == null || E.setVisible(!1), (F = largeAmountShipsLayer.value) == null || F.setVisible(!1)) : (f.value = !1, k == null || k.setVisible(!1)), s("zoomChanged", v);
|
|
1991
|
+
}, x = (v, w) => {
|
|
1992
|
+
const k = transform([v[0], v[1]], projection.mercator, projection.data), V = transform([v[2], v[3]], projection.mercator, projection.data);
|
|
1993
|
+
s("extentChanged", { extent: [k, V], zoom: w });
|
|
1918
1994
|
};
|
|
1919
1995
|
return t({
|
|
1920
|
-
mapInstance:
|
|
1996
|
+
mapInstance: o,
|
|
1921
1997
|
initMap: y,
|
|
1922
1998
|
renderTrucksMarker,
|
|
1923
1999
|
renderShip: renderShips,
|
|
1924
|
-
renderTrack: (v,
|
|
1925
|
-
var V,
|
|
1926
|
-
currentTrackId.value = v, showTrackLayer.value = !0, m.value = !0, hiddenAllShips(), (
|
|
2000
|
+
renderTrack: (v, w, k) => {
|
|
2001
|
+
var V, L;
|
|
2002
|
+
currentTrackId.value = v, showTrackLayer.value = !0, m.value = !0, hiddenAllShips(), (L = (V = largeAmountShipsLayer.value) == null ? void 0 : V.getSource()) == null || L.clear(), renderTrack(v, w, k, LENGTH_UNIT.NM);
|
|
1927
2003
|
},
|
|
1928
2004
|
findTruck,
|
|
1929
2005
|
removeTruckIcon,
|
|
1930
2006
|
clearAllTruck,
|
|
1931
2007
|
closeTrack: () => {
|
|
1932
|
-
var v,
|
|
1933
|
-
showTrackLayer.value = !1, (v = shipTrackVectorLayer.value) == null || v.setVisible(!1), (
|
|
2008
|
+
var v, w;
|
|
2009
|
+
showTrackLayer.value = !1, (v = shipTrackVectorLayer.value) == null || v.setVisible(!1), (w = selectShipsLayer.value) == null || w.setVisible(!0), m.value = !1, g(d.value < mapZoom.shipGreenDotMax), allTracks.value = [], stopAnimation();
|
|
1934
2010
|
},
|
|
1935
2011
|
closeTruckTrack: () => {
|
|
1936
|
-
var v,
|
|
1937
|
-
showTrackLayer.value = !1, (v = shipTrackVectorLayer.value) == null || v.setVisible(!1), (
|
|
2012
|
+
var v, w;
|
|
2013
|
+
showTrackLayer.value = !1, (v = shipTrackVectorLayer.value) == null || v.setVisible(!1), (w = selectShipsLayer.value) == null || w.setVisible(!0), stopAnimation();
|
|
1938
2014
|
},
|
|
1939
2015
|
resetTrackView,
|
|
1940
2016
|
playTrack,
|
|
1941
2017
|
clearSelectFeature,
|
|
1942
2018
|
findShip,
|
|
1943
|
-
focusShip: (v,
|
|
1944
|
-
var V,
|
|
1945
|
-
hiddenOrther.value =
|
|
2019
|
+
focusShip: (v, w, k = !0) => {
|
|
2020
|
+
var V, L;
|
|
2021
|
+
hiddenOrther.value = k, (V = shipsLayer.value) == null || V.setVisible(!k), (L = largeAmountShipsLayer.value) == null || L.setVisible(!1), findShip(v, w);
|
|
1946
2022
|
},
|
|
1947
2023
|
showTracks,
|
|
1948
2024
|
removeAllTrackLayer,
|
|
@@ -1950,25 +2026,25 @@ const addInteraction = (e) => {
|
|
|
1950
2026
|
rerenderShip,
|
|
1951
2027
|
switchGreenDot: () => g(!1),
|
|
1952
2028
|
zoomTruckIcon,
|
|
1953
|
-
renderTruckTrack: (v,
|
|
1954
|
-
showTrackLayer.value = !0, renderTrack(v,
|
|
2029
|
+
renderTruckTrack: (v, w, k) => {
|
|
2030
|
+
showTrackLayer.value = !0, renderTrack(v, w, k, LENGTH_UNIT.KM, "truck");
|
|
1955
2031
|
},
|
|
1956
2032
|
removerLayer: removeShipTrackLineFeatureByIndex,
|
|
1957
2033
|
renderMarker,
|
|
1958
2034
|
setMarkerPosition,
|
|
1959
2035
|
getZoomAndCenter: () => {
|
|
1960
|
-
var
|
|
1961
|
-
const v = (
|
|
2036
|
+
var L;
|
|
2037
|
+
const v = (L = o.value) == null ? void 0 : L.getView();
|
|
1962
2038
|
if (!v) return null;
|
|
1963
|
-
const
|
|
1964
|
-
return { zoom:
|
|
2039
|
+
const w = Math.round(Number(v.getZoom())), { lon: k, lat: V } = transformUtils.mercatorToLonLat(v.getCenter());
|
|
2040
|
+
return { zoom: w, center: [k, V] };
|
|
1965
2041
|
},
|
|
1966
2042
|
setCenter: (v) => {
|
|
1967
2043
|
var V;
|
|
1968
|
-
const
|
|
1969
|
-
if (!
|
|
1970
|
-
const
|
|
1971
|
-
|
|
2044
|
+
const w = (V = o.value) == null ? void 0 : V.getView();
|
|
2045
|
+
if (!w) return null;
|
|
2046
|
+
const k = new Point(v);
|
|
2047
|
+
w.setCenter(transform(k.getCoordinates(), projection.data, projection.mercator));
|
|
1972
2048
|
},
|
|
1973
2049
|
drawPolygonTool,
|
|
1974
2050
|
setMapInstance: h,
|
|
@@ -1980,12 +2056,12 @@ const addInteraction = (e) => {
|
|
|
1980
2056
|
transform: transformUtils,
|
|
1981
2057
|
format: formatUtils
|
|
1982
2058
|
}
|
|
1983
|
-
}), (v,
|
|
2059
|
+
}), (v, w) => (openBlock(), createElementBlock("div", {
|
|
1984
2060
|
class: "map-page map-container",
|
|
1985
2061
|
ref_key: "pageRef",
|
|
1986
2062
|
ref: r
|
|
1987
2063
|
}, [
|
|
1988
|
-
|
|
2064
|
+
w[0] || (w[0] = createElementVNode("div", {
|
|
1989
2065
|
id: "map",
|
|
1990
2066
|
class: "map"
|
|
1991
2067
|
}, null, -1)),
|
|
@@ -1994,7 +2070,7 @@ const addInteraction = (e) => {
|
|
|
1994
2070
|
"view-mode": v.viewMode,
|
|
1995
2071
|
"disable-green-dot": m.value,
|
|
1996
2072
|
"show-track-layer": unref(showTrackLayer),
|
|
1997
|
-
"map-tile-mode":
|
|
2073
|
+
"map-tile-mode": M.value,
|
|
1998
2074
|
onSwitchGreenDot: g,
|
|
1999
2075
|
onSwitchMapTile: T
|
|
2000
2076
|
}, {
|
|
@@ -2016,7 +2092,180 @@ const addInteraction = (e) => {
|
|
|
2016
2092
|
createVNode(Copyright)
|
|
2017
2093
|
], 512));
|
|
2018
2094
|
}
|
|
2019
|
-
}), Map = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-d4bd9364"]]),
|
|
2095
|
+
}), Map = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-d4bd9364"]]), dotImage = new Image();
|
|
2096
|
+
dotImage.crossOrigin = "anonymous";
|
|
2097
|
+
const dotActiveImage = new Image();
|
|
2098
|
+
dotActiveImage.crossOrigin = "anonymous";
|
|
2099
|
+
const setPointStyle = (e, t, n) => {
|
|
2100
|
+
const { color: o, url: r, activeUrl: l, activeColor: i } = n;
|
|
2101
|
+
return (l || r) && (e ? dotActiveImage.src = CDN_URL + (l || r) : dotImage.src = CDN_URL + (r || l)), new Style({
|
|
2102
|
+
renderer: (s, c) => {
|
|
2103
|
+
const d = c.context;
|
|
2104
|
+
d.save();
|
|
2105
|
+
let m = 1;
|
|
2106
|
+
d.scale(m, m);
|
|
2107
|
+
let [u, f] = s;
|
|
2108
|
+
u = u / m, f = f / m, d.font = "12px Arial";
|
|
2109
|
+
const p = d.measureText(t).width, y = u - p / 2, h = f - 10, g = p + 4, M = 20, T = e && i || o;
|
|
2110
|
+
if (fillRectRadius(d, y, h + 30, g, M, T), d.save(), d.restore(), d.fillStyle = e ? "#FFFFFF" : "#000000", d.textAlign = "center", d.textBaseline = "middle", d.fillText(t, y + (p + 4) / 2, h + 41), d.save(), d.restore(), r || l) {
|
|
2111
|
+
const b = e ? dotActiveImage : dotImage;
|
|
2112
|
+
d.drawImage(b, u - b.width / 2, f - b.height / 2, 40 / m, 40 / m);
|
|
2113
|
+
}
|
|
2114
|
+
d.restore();
|
|
2115
|
+
}
|
|
2116
|
+
});
|
|
2117
|
+
};
|
|
2118
|
+
class PointMarkerClass {
|
|
2119
|
+
/**
|
|
2120
|
+
* 地图实例
|
|
2121
|
+
* @param mapInstance
|
|
2122
|
+
* 配置渲染点的样式
|
|
2123
|
+
* @param options
|
|
2124
|
+
*/
|
|
2125
|
+
constructor(t, n) {
|
|
2126
|
+
S(this, "mapInstance");
|
|
2127
|
+
// 渲染的数据
|
|
2128
|
+
S(this, "pointMarkerList", []);
|
|
2129
|
+
// 绘制点渲染层数据
|
|
2130
|
+
S(this, "pointsVectorSource");
|
|
2131
|
+
// 当前高亮的数据
|
|
2132
|
+
S(this, "highlightPoint");
|
|
2133
|
+
S(this, "pointLayer");
|
|
2134
|
+
// 颜色等其他设置
|
|
2135
|
+
S(this, "options");
|
|
2136
|
+
this.mapInstance = t, this.options = n;
|
|
2137
|
+
}
|
|
2138
|
+
/**
|
|
2139
|
+
* 渲染
|
|
2140
|
+
* @param list
|
|
2141
|
+
* 格式:
|
|
2142
|
+
* 获取数据的id
|
|
2143
|
+
* id
|
|
2144
|
+
* 地图显示
|
|
2145
|
+
* name
|
|
2146
|
+
* fullName,
|
|
2147
|
+
* 经纬度
|
|
2148
|
+
* lon,
|
|
2149
|
+
* lat,
|
|
2150
|
+
* 渲染点的数据类型,好通过这个判断点击地图获取到的类型, 任意字符串
|
|
2151
|
+
* pointType
|
|
2152
|
+
*/
|
|
2153
|
+
renderPointMarker(t) {
|
|
2154
|
+
if (this.deleteAllPointMarkers(), !this.mapInstance) return;
|
|
2155
|
+
let n = {};
|
|
2156
|
+
t.forEach((o) => {
|
|
2157
|
+
var l;
|
|
2158
|
+
const r = [o.lon, o.lat];
|
|
2159
|
+
if (((l = this.highlightPoint) == null ? void 0 : l.id) === o.id)
|
|
2160
|
+
n = {
|
|
2161
|
+
id: o.id,
|
|
2162
|
+
name: o.name,
|
|
2163
|
+
lonlat: [Number(o.lon), Number(o.lat)],
|
|
2164
|
+
pointType: o.pointType
|
|
2165
|
+
};
|
|
2166
|
+
else {
|
|
2167
|
+
const i = this.getFeature(o, r);
|
|
2168
|
+
this.pointMarkerList.push({
|
|
2169
|
+
id: o.id,
|
|
2170
|
+
name: o.name,
|
|
2171
|
+
lonlat: [Number(o.lon), Number(o.lat)],
|
|
2172
|
+
feature: i,
|
|
2173
|
+
pointType: o.pointType
|
|
2174
|
+
});
|
|
2175
|
+
}
|
|
2176
|
+
}), n && n.lonlat && (n.feature = this.getFeature(n, n.lonlat), this.pointMarkerList.push(n)), this.pointsVectorSource = new VectorSource({
|
|
2177
|
+
features: [...this.pointMarkerList.map((o) => o.feature)]
|
|
2178
|
+
}), this.pointLayer = new VectorLayer({
|
|
2179
|
+
source: this.pointsVectorSource
|
|
2180
|
+
}), this.mapInstance.addLayer(this.pointLayer), console.log(this.pointLayer);
|
|
2181
|
+
}
|
|
2182
|
+
// 删除所有已渲染的点
|
|
2183
|
+
deleteAllPointMarkers() {
|
|
2184
|
+
this.pointMarkerList.forEach((t) => {
|
|
2185
|
+
var n;
|
|
2186
|
+
t.feature && ((n = this.pointsVectorSource) == null || n.removeFeature(t.feature));
|
|
2187
|
+
}), this.pointMarkerList = [];
|
|
2188
|
+
}
|
|
2189
|
+
// 取消高亮
|
|
2190
|
+
cancelHighlightTruckMarker() {
|
|
2191
|
+
var r;
|
|
2192
|
+
if (!this.highlightPoint)
|
|
2193
|
+
return;
|
|
2194
|
+
const { id: t, name: n } = this.highlightPoint, o = this.pointMarkerList.find((l) => l.id === t);
|
|
2195
|
+
t && o && o.feature && ((r = this.pointsVectorSource) == null || r.removeFeature(o.feature), o.feature.setStyle(
|
|
2196
|
+
setPointStyle(!1, n, this.options)
|
|
2197
|
+
));
|
|
2198
|
+
}
|
|
2199
|
+
/**
|
|
2200
|
+
* 设置选中
|
|
2201
|
+
* 渲染
|
|
2202
|
+
* @param item
|
|
2203
|
+
* 格式:
|
|
2204
|
+
* 获取数据的id
|
|
2205
|
+
* id
|
|
2206
|
+
* 地图显示
|
|
2207
|
+
* name
|
|
2208
|
+
* fullName,
|
|
2209
|
+
* 经纬度
|
|
2210
|
+
* lon,
|
|
2211
|
+
* lat,
|
|
2212
|
+
* 渲染点的数据类型,好通过这个判断点击地图获取到的类型, 任意字符串
|
|
2213
|
+
* pointType
|
|
2214
|
+
*/
|
|
2215
|
+
highlightPointMarker(t) {
|
|
2216
|
+
if (!this.mapInstance) return;
|
|
2217
|
+
const { id: n, name: o, fullName: r, lon: l, lat: i, pointType: s } = t, c = [Number(l), Number(i)];
|
|
2218
|
+
this.highlightPoint = {
|
|
2219
|
+
id: n,
|
|
2220
|
+
name: o,
|
|
2221
|
+
fullName: r,
|
|
2222
|
+
lonlat: c,
|
|
2223
|
+
pointType: s
|
|
2224
|
+
}, this.setPointCenter(c);
|
|
2225
|
+
}
|
|
2226
|
+
//隐藏其他点
|
|
2227
|
+
hiddenPointMarker(t) {
|
|
2228
|
+
this.pointMarkerList.forEach((n) => {
|
|
2229
|
+
n.id !== t && n.feature && n.feature.setStyle(void 0);
|
|
2230
|
+
});
|
|
2231
|
+
}
|
|
2232
|
+
// 获取feature
|
|
2233
|
+
getFeature(t, n) {
|
|
2234
|
+
var r;
|
|
2235
|
+
const o = new Feature({
|
|
2236
|
+
geometry: new Point(fromLonLat(n))
|
|
2237
|
+
});
|
|
2238
|
+
return o.set("data", t), o.setStyle(
|
|
2239
|
+
setPointStyle(((r = this.highlightPoint) == null ? void 0 : r.id) === t.id, t.name, this.options)
|
|
2240
|
+
), o;
|
|
2241
|
+
}
|
|
2242
|
+
/**
|
|
2243
|
+
*
|
|
2244
|
+
* @param lonlat 经纬度
|
|
2245
|
+
* @param options {
|
|
2246
|
+
* customZoom 自定义层级
|
|
2247
|
+
* type 0: 不改变地图大小 1: 等于customZoom 2: 地图当前zoom > 传入的customZoom(缩小地图) 3: 地图当前zoom < 传入的customZoom(放大地图)
|
|
2248
|
+
* }
|
|
2249
|
+
*/
|
|
2250
|
+
setPointCenter(t, n = { customZoom: mapZoom.findShip, type: 1 }) {
|
|
2251
|
+
if (!this.mapInstance) return;
|
|
2252
|
+
const { customZoom: o = mapZoom.findShip, type: r = 1 } = n, l = this.mapInstance.getView(), i = l.getZoom();
|
|
2253
|
+
(r === 1 || i > o && r === 2 || i < o && r === 3) && l.setZoom(o);
|
|
2254
|
+
const s = new Point(t);
|
|
2255
|
+
l.setCenter(transform(s.getCoordinates(), projection.data, projection.mercator));
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
const ZhMap = withInstall(Map);
|
|
2020
2259
|
export {
|
|
2021
|
-
|
|
2260
|
+
CDN_URL as C,
|
|
2261
|
+
DEFAULT_VALUE as D,
|
|
2262
|
+
LOG_DATE_FORMAT as L,
|
|
2263
|
+
PointMarkerClass as P,
|
|
2264
|
+
ZhMap as Z,
|
|
2265
|
+
mapDefaultCenter as a,
|
|
2266
|
+
baseMap as b,
|
|
2267
|
+
mapZoom as m,
|
|
2268
|
+
projection as p,
|
|
2269
|
+
renderShipsLimit as r,
|
|
2270
|
+
tiandituKey as t
|
|
2022
2271
|
};
|