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