zhihao-ui 1.2.45 → 1.2.46
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-VzgiaCKn.js → BaseInfo-D-0T7Xj6.js} +1 -1
- package/dist/es/{BaseItem-D1xoWSGo.js → BaseItem-CY9hXXR0.js} +3 -3
- package/dist/es/{Button-CNEQmoqP.js → Button-USqLJ-9S.js} +2 -2
- package/dist/es/{DatePicker-Dh8sksac.js → DatePicker-C6kyMZ8-.js} +3 -3
- package/dist/es/{DetailHeader-CSC9DAQc.js → DetailHeader-BpKX32Ip.js} +3 -3
- package/dist/es/{DetailSubTitle-1ZjJAmet.js → DetailSubTitle-Bu8Ke5B0.js} +2 -2
- package/dist/es/{Dialog-BuGbBs3k.js → Dialog-Dez6LM1c.js} +3 -3
- package/dist/es/{DiyDataTable-BerDffOX.js → DiyDataTable--G4p9NXy.js} +4 -4
- package/dist/es/{EditInfoPair-Dx0KRj7O.js → EditInfoPair-BWFgGS2F.js} +3 -3
- package/dist/es/{FileWrapper-CS2RTMEV.js → FileWrapper-BN7d5fIh.js} +4 -4
- package/dist/es/{Grid-BQYUct2W.js → Grid-Cs3EsKJP.js} +2 -2
- package/dist/es/{InfoPair-C3sCcJVT.js → InfoPair-CNgNOqBr.js} +3 -3
- package/dist/es/{Input-CcYpobcm.js → Input-BQdnfIM2.js} +3 -3
- package/dist/es/{Loading-DCEW1FE_.js → Loading-D44Z_50e.js} +2 -2
- package/dist/es/{Map-B_2SojSM.js → Map-BIIy56u4.js} +980 -979
- package/dist/es/{MessageBox-ByLWEDby.js → MessageBox-6Q871-mu.js} +2 -2
- package/dist/es/{MoneyInput-DevlnT8p.js → MoneyInput-DdXhvQpn.js} +5 -5
- package/dist/es/{PageHeadPanel-C5A4n2ie.js → PageHeadPanel-a3trdcKM.js} +2 -2
- package/dist/es/{Table-BoMGydAp.js → Table-B7qziI2U.js} +5 -5
- package/dist/es/{ToolTips-6ETyGI4m.js → ToolTips-DhLuEMZP.js} +3 -3
- package/dist/es/index.js +23 -23
- package/dist/es/{utils-BSQSj8Ii.js → utils-DvDZ3DAF.js} +1 -1
- package/dist/es/{vendor-DaYdW1_n.js → vendor-BmuLaCuO.js} +5 -5
- package/dist/types/components/Map/render/canvasRender/canvasRender.d.ts +2 -1
- package/dist/umd/index.umd.cjs +11 -11
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var b = (e, t, n) =>
|
|
1
|
+
var j = Object.defineProperty;
|
|
2
|
+
var H = (e, t, n) => t in e ? j(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var b = (e, t, n) => H(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import { defineComponent, inject, useModel, ref, watch, openBlock, createElementBlock, createElementVNode, createVNode, unref, withCtx, Fragment, renderList, toDisplayString, createCommentVNode, mergeModels, nextTick, onMounted, normalizeClass, renderSlot, createBlock, useCssVars, computed, provide } from "vue";
|
|
5
|
-
import { p as getArea, q as getLength, V as VectorSource, r as VectorLayer, S as Style, C as CircleStyle, F as Fill, s as Stroke, D as Draw, O as Overlay, u as unByKey, t as ElSelect, v as ElOption, w as getUid, x as fromLonLat, P as Point, y as transform, z as Feature, T as Text, I as Icon, A as Translate, B as toLonLat,
|
|
6
|
-
import { _ as _export_sfc } from "./Button-
|
|
7
|
-
import { g as getForegroundColor } from "./DatePicker-
|
|
8
|
-
import { w as withInstall } from "./utils-
|
|
5
|
+
import { p as getArea, q as getLength, V as VectorSource, r as VectorLayer, S as Style, C as CircleStyle, F as Fill, s as Stroke, D as Draw, O as Overlay, u as unByKey, t as ElSelect, v as ElOption, w as getUid, x as fromLonLat, P as Point, y as transform, z as Feature, T as Text, I as Icon, A as Translate, B as toLonLat, G as transformExtent, h as hooks, L as LineString, H as Polyline, J as getVectorContext, i as cloneDeep, K as GeoJSON, W as WebGLPointsLayer, M as Circle, N as buffer, Q as ScaleLine$1, R as MultiPoint, U as getCenter, X as TileLayer, Y as XYZ, Z as Map$1, _ as View } from "./vendor-BmuLaCuO.js";
|
|
6
|
+
import { _ as _export_sfc } from "./Button-USqLJ-9S.js";
|
|
7
|
+
import { g as getForegroundColor } from "./DatePicker-C6kyMZ8-.js";
|
|
8
|
+
import { w as withInstall } from "./utils-DvDZ3DAF.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, n, o,
|
|
11
|
+
constructor(t, n, o, l, r, i, c, s, m, u, d, f, p, w, h, v, L, T, I, V, x, P, g, y) {
|
|
12
12
|
b(this, "id");
|
|
13
13
|
// mmsi
|
|
14
14
|
b(this, "mmsi");
|
|
@@ -50,40 +50,40 @@ class ShipMapData {
|
|
|
50
50
|
b(this, "existWaterGauge");
|
|
51
51
|
b(this, "selected");
|
|
52
52
|
b(this, "blinkColors");
|
|
53
|
-
this.id = t, this.mmsi = n, this.fill = o, this.shipType =
|
|
53
|
+
this.id = t, this.mmsi = n, this.fill = o, this.shipType = l, this.name = r, this.length = i, this.breadth = c, this.lon = s, this.lat = m, this.createdAt = u, this.speed = d, this.from = f, this.sailStatus = p, this.hdg = w, this.cog = h, this.posType = v, this.type = L, this.angle = T, this.leftIconColor = I, this.existDevice = V, this.existMobile = x, this.existWaterGauge = P, this.selected = g, this.blinkColors = y;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
const formatLength = function(e, t) {
|
|
57
57
|
const o = getLength(e);
|
|
58
|
-
let
|
|
58
|
+
let l = "";
|
|
59
59
|
switch (t) {
|
|
60
60
|
case LENGTH_UNIT.M:
|
|
61
|
-
|
|
61
|
+
l = Math.round(o * 100) / 100 + " m";
|
|
62
62
|
break;
|
|
63
63
|
case LENGTH_UNIT.KM:
|
|
64
|
-
|
|
64
|
+
l = Math.round(o / 1e3 * 100) / 100 + " km";
|
|
65
65
|
break;
|
|
66
66
|
case LENGTH_UNIT.NM:
|
|
67
|
-
|
|
67
|
+
l = (Math.round(o / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
|
|
68
68
|
break;
|
|
69
69
|
}
|
|
70
|
-
return
|
|
70
|
+
return l;
|
|
71
71
|
}, convertSixHundredThousandToLatLng = function(e, t) {
|
|
72
72
|
const n = Number(t) / 6e5;
|
|
73
73
|
return [Number(e) / 6e5, n];
|
|
74
74
|
}, formatArea = (e, t) => {
|
|
75
75
|
const o = getArea(e);
|
|
76
|
-
let
|
|
76
|
+
let l;
|
|
77
77
|
switch (t) {
|
|
78
78
|
case LENGTH_UNIT.KM:
|
|
79
|
-
o > 1e4 ?
|
|
79
|
+
o > 1e4 ? l = Math.round(o / 1e6 * 100) / 100 + " km<sup>2</sup>" : l = Math.round(o * 100) / 100 + " m<sup>2</sup>";
|
|
80
80
|
break;
|
|
81
81
|
case LENGTH_UNIT.NM:
|
|
82
82
|
const r = Math.pow(1.852, 2);
|
|
83
|
-
o > 1e4 ?
|
|
83
|
+
o > 1e4 ? l = Math.round(o / 1e6 / r * 100) / 100 + " nm<sup>2</sup>" : l = Math.round(o * 100) / 100 + " m<sup>2</sup>";
|
|
84
84
|
break;
|
|
85
85
|
}
|
|
86
|
-
return
|
|
86
|
+
return l;
|
|
87
87
|
}, convertShipMapData = (e) => {
|
|
88
88
|
const t = (n) => new ShipMapData(
|
|
89
89
|
n.id,
|
|
@@ -130,8 +130,8 @@ const formatLength = function(e, t) {
|
|
|
130
130
|
}),
|
|
131
131
|
emits: /* @__PURE__ */ mergeModels(["close"], ["update:visible"]),
|
|
132
132
|
setup(e, { expose: t, emit: n }) {
|
|
133
|
-
const o = inject("mapInstance"),
|
|
134
|
-
let
|
|
133
|
+
const o = inject("mapInstance"), l = n, r = useModel(e, "visible"), i = ref("3"), c = ref([]), s = ref(!1), m = new VectorSource();
|
|
134
|
+
let u, d, f, p, w;
|
|
135
135
|
const h = new VectorLayer({
|
|
136
136
|
source: m,
|
|
137
137
|
style: {
|
|
@@ -141,16 +141,16 @@ const formatLength = function(e, t) {
|
|
|
141
141
|
"circle-radius": 7,
|
|
142
142
|
"circle-fill-color": "#ffcc33"
|
|
143
143
|
}
|
|
144
|
-
}),
|
|
145
|
-
if (
|
|
144
|
+
}), v = function(k) {
|
|
145
|
+
if (k.dragging)
|
|
146
146
|
return;
|
|
147
147
|
let M = "点击选择起点";
|
|
148
|
-
|
|
149
|
-
},
|
|
150
|
-
var
|
|
151
|
-
o != null && o.value && ((
|
|
152
|
-
var
|
|
153
|
-
(
|
|
148
|
+
u && (M = "单击继续,双击结束"), d && (d.innerHTML = M, f.setPosition(k.coordinate), d.classList.remove("hidden"));
|
|
149
|
+
}, L = () => {
|
|
150
|
+
var k, M;
|
|
151
|
+
o != null && o.value && ((k = o == null ? void 0 : o.value) == null || k.on("pointermove", v), (M = o == null ? void 0 : o.value) == null || M.getViewport().addEventListener("mouseout", function() {
|
|
152
|
+
var E;
|
|
153
|
+
(E = d == null ? void 0 : d.classList) == null || E.add("hidden");
|
|
154
154
|
}), s.value = !0);
|
|
155
155
|
};
|
|
156
156
|
let T;
|
|
@@ -173,90 +173,90 @@ const formatLength = function(e, t) {
|
|
|
173
173
|
})
|
|
174
174
|
})
|
|
175
175
|
});
|
|
176
|
-
function
|
|
177
|
-
var
|
|
176
|
+
function V() {
|
|
177
|
+
var k, M;
|
|
178
178
|
if (o != null && o.value) {
|
|
179
|
-
if (c.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((
|
|
180
|
-
var
|
|
181
|
-
(
|
|
179
|
+
if (c.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((E) => {
|
|
180
|
+
var C;
|
|
181
|
+
(C = E == null ? void 0 : E.parentNode) == null || C.removeChild(E);
|
|
182
182
|
}), m.clear(), T) {
|
|
183
|
-
const
|
|
184
|
-
|
|
183
|
+
const E = o.value.getInteractions().getArray().find((C) => getUid(C) === getUid(T));
|
|
184
|
+
E && ((k = o.value) == null || k.removeInteraction(E));
|
|
185
185
|
}
|
|
186
|
-
(M = o.value) == null || M.removeLayer(h),
|
|
186
|
+
(M = o.value) == null || M.removeLayer(h), d != null && d.parentNode && d.parentNode.removeChild(d), p != null && p.parentNode && p.parentNode.removeChild(p);
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
function
|
|
190
|
-
var M,
|
|
191
|
-
|
|
189
|
+
function x() {
|
|
190
|
+
var M, E;
|
|
191
|
+
V(), (M = o == null ? void 0 : o.value) == null || M.addLayer(h), T = new Draw({
|
|
192
192
|
source: m,
|
|
193
193
|
type: "LineString",
|
|
194
194
|
style: function() {
|
|
195
195
|
return I;
|
|
196
196
|
},
|
|
197
197
|
// 添加条件函数,判断是否应该触发绘制
|
|
198
|
-
condition: function(
|
|
199
|
-
return
|
|
198
|
+
condition: function(C) {
|
|
199
|
+
return C.originalEvent.target.tagName !== "DIV";
|
|
200
200
|
}
|
|
201
|
-
}), (
|
|
202
|
-
let
|
|
203
|
-
T.on("drawstart", function(
|
|
204
|
-
var
|
|
205
|
-
|
|
206
|
-
let
|
|
207
|
-
|
|
208
|
-
const
|
|
209
|
-
let
|
|
210
|
-
|
|
201
|
+
}), (E = o == null ? void 0 : o.value) == null || E.addInteraction(T), g(), P();
|
|
202
|
+
let k;
|
|
203
|
+
T.on("drawstart", function(C) {
|
|
204
|
+
var $;
|
|
205
|
+
u = C.feature;
|
|
206
|
+
let F;
|
|
207
|
+
k = ($ = u.getGeometry()) == null ? void 0 : $.on("change", function(R) {
|
|
208
|
+
const B = R.target;
|
|
209
|
+
let N = formatUtils.formatLength(B, Number(i.value));
|
|
210
|
+
F = B.getLastCoordinate(), p && N && (p.innerHTML = N), w.setPosition(F);
|
|
211
211
|
});
|
|
212
212
|
}), T.on("drawend", function() {
|
|
213
|
-
var
|
|
214
|
-
p && (p.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), p != null && p.innerHTML && (c.value.push(p == null ? void 0 : p.innerHTML), p.innerHTML = `${p.innerHTML}<div class="ol-tooltip-delete-button" data-index="${((
|
|
215
|
-
var
|
|
216
|
-
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
}),
|
|
213
|
+
var C, F;
|
|
214
|
+
p && (p.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), p != null && p.innerHTML && (c.value.push(p == null ? void 0 : p.innerHTML), p.innerHTML = `${p.innerHTML}<div class="ol-tooltip-delete-button" data-index="${((C = c.value) == null ? void 0 : C.length) - 1}"><i class="map-iconfont icon-delete"></i></div>`), (F = document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button")) == null || F.addEventListener("click", ($) => {
|
|
215
|
+
var B;
|
|
216
|
+
$.preventDefault(), $.stopPropagation();
|
|
217
|
+
const R = (B = $.target) == null ? void 0 : B.getAttribute("data-index");
|
|
218
|
+
R && y(Number(R));
|
|
219
|
+
}), w.setOffset([0, -7]), u = null, p = null, g(), k && unByKey(k);
|
|
220
220
|
});
|
|
221
221
|
}
|
|
222
222
|
function P() {
|
|
223
|
-
var
|
|
224
|
-
|
|
225
|
-
element:
|
|
223
|
+
var k;
|
|
224
|
+
d != null && d.parentNode && d.parentNode.removeChild(d), d = document.createElement("div"), d.className = "ol-tooltip hidden", f = new Overlay({
|
|
225
|
+
element: d,
|
|
226
226
|
offset: [15, 0],
|
|
227
227
|
positioning: "center-left"
|
|
228
|
-
}), (
|
|
228
|
+
}), (k = o == null ? void 0 : o.value) == null || k.addOverlay(f);
|
|
229
229
|
}
|
|
230
|
-
function
|
|
231
|
-
var
|
|
232
|
-
p != null && p.parentNode && p.parentNode.removeChild(p), p = document.createElement("div"), p.className = "ol-tooltip ol-tooltip-measure",
|
|
230
|
+
function g() {
|
|
231
|
+
var k;
|
|
232
|
+
p != null && p.parentNode && p.parentNode.removeChild(p), p = document.createElement("div"), p.className = "ol-tooltip ol-tooltip-measure", w = new Overlay({
|
|
233
233
|
element: p,
|
|
234
234
|
offset: [0, -15],
|
|
235
235
|
positioning: "bottom-center",
|
|
236
236
|
stopEvent: !1,
|
|
237
237
|
insertFirst: !1
|
|
238
|
-
}), (
|
|
238
|
+
}), (k = o == null ? void 0 : o.value) == null || k.addOverlay(w);
|
|
239
239
|
}
|
|
240
|
-
const
|
|
241
|
-
var
|
|
242
|
-
c.value[
|
|
240
|
+
const y = (k) => {
|
|
241
|
+
var C, F;
|
|
242
|
+
c.value[k] && c.value.splice(k, 1);
|
|
243
243
|
const M = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
244
|
-
M[
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
},
|
|
248
|
-
|
|
244
|
+
M[k] && ((F = (C = M[k]) == null ? void 0 : C.parentNode) == null || F.removeChild(M[k]));
|
|
245
|
+
const E = m.getFeatures();
|
|
246
|
+
E[k] && m.removeFeature(E[k]);
|
|
247
|
+
}, S = () => {
|
|
248
|
+
l("close");
|
|
249
249
|
};
|
|
250
250
|
return watch(() => r, () => {
|
|
251
|
-
r.value && !s.value && (
|
|
251
|
+
r.value && !s.value && (L(), x());
|
|
252
252
|
}, { deep: !0, immediate: !0 }), t({
|
|
253
|
-
addInteraction:
|
|
254
|
-
removeInteraction:
|
|
255
|
-
}), (
|
|
253
|
+
addInteraction: x,
|
|
254
|
+
removeInteraction: V
|
|
255
|
+
}), (k, M) => r.value && k.viewMode !== "WxMiniprogram" ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
256
256
|
createElementVNode("div", { class: "header" }, [
|
|
257
257
|
M[1] || (M[1] = createElementVNode("div", { class: "title" }, "测量", -1)),
|
|
258
258
|
createElementVNode("i", {
|
|
259
|
-
onClick:
|
|
259
|
+
onClick: S,
|
|
260
260
|
class: "map-iconfont icon-close"
|
|
261
261
|
})
|
|
262
262
|
]),
|
|
@@ -264,8 +264,8 @@ const formatLength = function(e, t) {
|
|
|
264
264
|
M[2] || (M[2] = createElementVNode("div", { class: "tips" }, "在地图上点击多个点测量距离,距离单位", -1)),
|
|
265
265
|
createVNode(unref(ElSelect), {
|
|
266
266
|
class: "select-length-unit",
|
|
267
|
-
modelValue:
|
|
268
|
-
"onUpdate:modelValue": M[0] || (M[0] = (
|
|
267
|
+
modelValue: i.value,
|
|
268
|
+
"onUpdate:modelValue": M[0] || (M[0] = (E) => i.value = E)
|
|
269
269
|
}, {
|
|
270
270
|
default: withCtx(() => [
|
|
271
271
|
createVNode(unref(ElOption), {
|
|
@@ -285,18 +285,18 @@ const formatLength = function(e, t) {
|
|
|
285
285
|
}, 8, ["modelValue"])
|
|
286
286
|
]),
|
|
287
287
|
createElementVNode("div", _hoisted_3$1, [
|
|
288
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(c.value, (
|
|
288
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(c.value, (E, C) => (openBlock(), createElementBlock("div", {
|
|
289
289
|
class: "measure-history-item",
|
|
290
|
-
key:
|
|
290
|
+
key: C
|
|
291
291
|
}, [
|
|
292
292
|
createElementVNode("div", _hoisted_4, [
|
|
293
293
|
M[3] || (M[3] = createElementVNode("i", { class: "map-iconfont icon-line" }, null, -1)),
|
|
294
|
-
createElementVNode("span", _hoisted_5, "线段" + toDisplayString(
|
|
295
|
-
createElementVNode("span", _hoisted_6, toDisplayString(
|
|
294
|
+
createElementVNode("span", _hoisted_5, "线段" + toDisplayString(C + 1), 1),
|
|
295
|
+
createElementVNode("span", _hoisted_6, toDisplayString(E), 1)
|
|
296
296
|
]),
|
|
297
297
|
createElementVNode("div", {
|
|
298
298
|
class: "delete-button",
|
|
299
|
-
onClick: (
|
|
299
|
+
onClick: (F) => y(C)
|
|
300
300
|
}, M[4] || (M[4] = [
|
|
301
301
|
createElementVNode("i", { class: "map-iconfont icon-delete" }, null, -1)
|
|
302
302
|
]), 8, _hoisted_7)
|
|
@@ -334,36 +334,36 @@ const formatLength = function(e, t) {
|
|
|
334
334
|
// 设置文本背景的内边距
|
|
335
335
|
})
|
|
336
336
|
}), renderMarker = (e, t = !0, n = !0) => {
|
|
337
|
-
var
|
|
337
|
+
var u;
|
|
338
338
|
if (!mapInstance$8.value || !e || e.split(",").length !== 2) return;
|
|
339
|
-
const [o,
|
|
339
|
+
const [o, l] = e.split(",").map(Number);
|
|
340
340
|
marker.value = new Feature({
|
|
341
|
-
geometry: new Point(fromLonLat([o,
|
|
341
|
+
geometry: new Point(fromLonLat([o, l]))
|
|
342
342
|
});
|
|
343
|
-
const r = n ? `${o}, ${
|
|
344
|
-
(
|
|
345
|
-
const
|
|
343
|
+
const r = n ? `${o}, ${l}` : "";
|
|
344
|
+
(u = marker.value) == null || u.setStyle(createIconStyle(r));
|
|
345
|
+
const i = new VectorSource({
|
|
346
346
|
features: [marker.value]
|
|
347
347
|
}), c = new VectorLayer({
|
|
348
|
-
source:
|
|
348
|
+
source: i
|
|
349
349
|
}), s = mapInstance$8.value.getView();
|
|
350
350
|
if (mapInstance$8.value.addLayer(c), t) {
|
|
351
|
-
const
|
|
351
|
+
const d = new Translate({
|
|
352
352
|
layers: [c]
|
|
353
353
|
});
|
|
354
|
-
|
|
354
|
+
d.on("translating", function(f) {
|
|
355
355
|
var h;
|
|
356
|
-
const p = f.features.item(0).getGeometry().getCoordinates(),
|
|
357
|
-
markerPosition.value = `${
|
|
358
|
-
}), mapInstance$8.value.addInteraction(
|
|
356
|
+
const p = f.features.item(0).getGeometry().getCoordinates(), w = toLonLat(p);
|
|
357
|
+
markerPosition.value = `${w[0].toFixed(6)}, ${w[1].toFixed(6)}`, (h = marker.value) == null || h.setStyle(createIconStyle(markerPosition.value));
|
|
358
|
+
}), mapInstance$8.value.addInteraction(d);
|
|
359
359
|
}
|
|
360
|
-
const m = new Point([o,
|
|
360
|
+
const m = new Point([o, l]);
|
|
361
361
|
s.setCenter(transform(m.getCoordinates(), projection.data, projection.mercator)), s.setZoom(mapZoom.findShip);
|
|
362
362
|
}, setMarkerPosition = (e) => {
|
|
363
|
-
var
|
|
363
|
+
var l, r;
|
|
364
364
|
if (!mapInstance$8.value) return;
|
|
365
365
|
const t = mapInstance$8.value.getView(), n = e.split(",").map(Number);
|
|
366
|
-
(r = (
|
|
366
|
+
(r = (l = marker.value) == null ? void 0 : l.getGeometry()) == null || r.setCoordinates(fromLonLat([n[0], n[1]]));
|
|
367
367
|
const o = new Point([n[0], n[1]]);
|
|
368
368
|
t.setCenter(transform(o.getCoordinates(), projection.data, projection.mercator)), t.setZoom(mapZoom.markerPosition);
|
|
369
369
|
}, CDN_URL = "https://static.zhihaoscm.cn/", tiandituKey = "a6e8f78974f2581f2ca00485b40c948f", zhongkeKey = "15c81cc0a191a232e0a0ca1a51c3ca81", baseMap = {
|
|
@@ -430,518 +430,131 @@ const multiplyPixelRatio = (e) => {
|
|
|
430
430
|
}),
|
|
431
431
|
zIndex: 100
|
|
432
432
|
}), getRotation = (e, t, n) => {
|
|
433
|
-
function o(
|
|
434
|
-
return 180 * (
|
|
433
|
+
function o(d) {
|
|
434
|
+
return 180 * (d % (2 * Math.PI)) / Math.PI;
|
|
435
435
|
}
|
|
436
|
-
function
|
|
437
|
-
return
|
|
436
|
+
function l(d) {
|
|
437
|
+
return d % 360 * Math.PI / 180;
|
|
438
438
|
}
|
|
439
|
-
function r(
|
|
440
|
-
if (!
|
|
441
|
-
if (!Array.isArray(
|
|
442
|
-
if (
|
|
443
|
-
return
|
|
444
|
-
if (
|
|
439
|
+
function r(d) {
|
|
440
|
+
if (!d) throw new Error("Coordinate is required");
|
|
441
|
+
if (!Array.isArray(d)) {
|
|
442
|
+
if (d.type === "Feature" && d.geometry !== null && d.geometry.type === "Point")
|
|
443
|
+
return d.geometry.coordinates;
|
|
444
|
+
if (d.type === "Point") return d.coordinates;
|
|
445
445
|
}
|
|
446
|
-
if (Array.isArray(
|
|
447
|
-
return
|
|
446
|
+
if (Array.isArray(d) && d.length >= 2 && !Array.isArray(d[0]) && !Array.isArray(d[1]))
|
|
447
|
+
return d;
|
|
448
448
|
throw new Error(
|
|
449
449
|
"Coordinate must be GeoJSON Point or an Array of numbers"
|
|
450
450
|
);
|
|
451
451
|
}
|
|
452
|
-
function
|
|
452
|
+
function i(d, f, p = {}) {
|
|
453
453
|
if (p.final)
|
|
454
|
-
return function(P,
|
|
455
|
-
return (
|
|
456
|
-
}(
|
|
457
|
-
const
|
|
458
|
-
return o(Math.atan2(
|
|
459
|
-
}
|
|
460
|
-
function c(u) {
|
|
461
|
-
return !isNaN(u) && u !== null && !Array.isArray(u);
|
|
454
|
+
return function(P, g) {
|
|
455
|
+
return (i(g, P) + 180) % 360;
|
|
456
|
+
}(d, f);
|
|
457
|
+
const w = r(d), h = r(f), v = l(w[0]), L = l(h[0]), T = l(w[1]), I = l(h[1]), V = Math.sin(L - v) * Math.cos(I), x = Math.cos(T) * Math.sin(I) - Math.sin(T) * Math.cos(I) * Math.cos(L - v);
|
|
458
|
+
return o(Math.atan2(V, x));
|
|
462
459
|
}
|
|
463
|
-
function
|
|
464
|
-
return
|
|
465
|
-
}
|
|
466
|
-
function m(u, f = {}, p = {}) {
|
|
467
|
-
const y = { type: "Feature" };
|
|
468
|
-
return p.id !== void 0 && (y.id = p.id), p.bbox && (y.bbox = p.bbox), y.properties = f || {}, y.geometry = u, y;
|
|
469
|
-
}
|
|
470
|
-
const d = l(s(e), s(t), n);
|
|
471
|
-
return d < 0 ? 360 + d : d;
|
|
472
|
-
}, triangleModel = multiplyPixelRatio([
|
|
473
|
-
[0, -8],
|
|
474
|
-
[5, 8],
|
|
475
|
-
[-5, 8]
|
|
476
|
-
]), shipShapeModel = multiplyPixelRatio([
|
|
477
|
-
[0, -4.545],
|
|
478
|
-
[-0.56, -3.909],
|
|
479
|
-
[-1, -2.727],
|
|
480
|
-
[-1, 3.636],
|
|
481
|
-
[-0.8, 4.545],
|
|
482
|
-
[0.8, 4.545],
|
|
483
|
-
[1, 3.636],
|
|
484
|
-
[1, -2.727],
|
|
485
|
-
[0.56, -3.909],
|
|
486
|
-
[0, -4.545]
|
|
487
|
-
]), shipDirectPath = {
|
|
488
|
-
left: {
|
|
489
|
-
0: [
|
|
490
|
-
[0, 0],
|
|
491
|
-
[0, -8],
|
|
492
|
-
[-4, -8]
|
|
493
|
-
],
|
|
494
|
-
1: [
|
|
495
|
-
[0, 0],
|
|
496
|
-
[0, -16],
|
|
497
|
-
[-6, -16]
|
|
498
|
-
],
|
|
499
|
-
2: [
|
|
500
|
-
[0, 0],
|
|
501
|
-
[0, -24],
|
|
502
|
-
[-8, -24]
|
|
503
|
-
]
|
|
504
|
-
},
|
|
505
|
-
right: {
|
|
506
|
-
0: [
|
|
507
|
-
[0, 0],
|
|
508
|
-
[0, -8],
|
|
509
|
-
[-4, -8]
|
|
510
|
-
],
|
|
511
|
-
1: [
|
|
512
|
-
[0, 0],
|
|
513
|
-
[0, -16],
|
|
514
|
-
[-6, -16]
|
|
515
|
-
],
|
|
516
|
-
2: [
|
|
517
|
-
[0, 0],
|
|
518
|
-
[0, -24],
|
|
519
|
-
[-8, -24]
|
|
520
|
-
]
|
|
521
|
-
},
|
|
522
|
-
front: {
|
|
523
|
-
0: [
|
|
524
|
-
[0, 0],
|
|
525
|
-
[0, -8]
|
|
526
|
-
],
|
|
527
|
-
1: [
|
|
528
|
-
[0, 0],
|
|
529
|
-
[0, -16]
|
|
530
|
-
],
|
|
531
|
-
2: [
|
|
532
|
-
[0, 0],
|
|
533
|
-
[0, -24]
|
|
534
|
-
]
|
|
535
|
-
}
|
|
536
|
-
}, setBlankStyle = () => new Style({
|
|
537
|
-
image: new CircleStyle({
|
|
538
|
-
radius: 0
|
|
539
|
-
})
|
|
540
|
-
}), mapInstance$7 = ref(), renderShipStyleSetInstance = (e) => mapInstance$7.value = e, speedCondition = [[1, 10], [10, 20], [20, 1 / 0]], drawShipModelByZoom = { 14: [200, 30], 15: [115, 15], 16: [55, 8], 17: [25, 5], 18: [1, 1] }, setShipStyle = (e, t = !1) => new Style({
|
|
541
|
-
renderer: (n, o) => {
|
|
542
|
-
n = n;
|
|
543
|
-
const i = o.context, r = o.feature.get("data");
|
|
544
|
-
if (!r) return;
|
|
545
|
-
o.feature.get("index") === 0 && (shipLabels.value = []);
|
|
546
|
-
try {
|
|
547
|
-
const c = drawShipBody(i, r, n, t);
|
|
548
|
-
c && (drawHeading(i, r, c, t), r.selected = e, e && setTimeout(() => {
|
|
549
|
-
drawSelectBounds(i, c);
|
|
550
|
-
}, 1)), drawShipLabel(i, r, n);
|
|
551
|
-
} catch {
|
|
552
|
-
return !1;
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
}), drawShipBody = (e, t, n, o) => {
|
|
556
|
-
if (!mapInstance$7.value) return;
|
|
557
|
-
const i = Math.round(Number(mapInstance$7.value.getView().getZoom()));
|
|
558
|
-
if (!i) return;
|
|
559
|
-
let r = [];
|
|
560
|
-
const [l, c] = drawShipModelByZoom[i] || [0, 0], [s, m] = n;
|
|
561
|
-
if (i <= mapZoom.shipModelMax && i > mapZoom.shipModelMin && t.length >= l && t.breadth >= c)
|
|
562
|
-
r = rotateShapeModel(drawCurrentShipShapeModel(t, i), t.angle).map((u) => {
|
|
563
|
-
const [f, p] = u;
|
|
564
|
-
return [s + f, m + p];
|
|
565
|
-
});
|
|
566
|
-
else {
|
|
567
|
-
const d = rotateShapeModel(triangleModel, t.angle);
|
|
568
|
-
n.length === 2 && (r = d.map((u) => {
|
|
569
|
-
const [f, p] = u;
|
|
570
|
-
return [s + f, m + p];
|
|
571
|
-
}));
|
|
572
|
-
}
|
|
573
|
-
if (!(r.length > 2)) return !1;
|
|
574
|
-
if (t != null && t.length) {
|
|
575
|
-
const d = r.length === 3 ? 30 : t.length * 0.4;
|
|
576
|
-
e.beginPath(), e.arc(
|
|
577
|
-
n[0],
|
|
578
|
-
n[1],
|
|
579
|
-
d,
|
|
580
|
-
0,
|
|
581
|
-
2 * Math.PI
|
|
582
|
-
), e.fillStyle = "rgba(255, 255, 255, 0.001)", e.fill();
|
|
583
|
-
}
|
|
584
|
-
e.save(), e.beginPath(), e.moveTo(r[0][0], r[0][1]);
|
|
585
|
-
for (let d = 1; d < r.length; d++)
|
|
586
|
-
e.lineTo(r[d][0], r[d][1]);
|
|
587
|
-
return e.closePath(), e.strokeStyle = o ? "#ff0000" : "#000", e.lineWidth = o ? 2 : 1, e.stroke(), e.fillStyle = t.fill, e.fill(), e.restore(), r;
|
|
588
|
-
}, drawHeading = (e, t, n, o) => {
|
|
589
|
-
const [i, r] = n[0], l = getShipDirectPath(t);
|
|
590
|
-
if (l) {
|
|
591
|
-
const c = l.map(function(s) {
|
|
592
|
-
const [m, d] = s;
|
|
593
|
-
return [m + i, d + r];
|
|
594
|
-
});
|
|
595
|
-
if (e.save(), e.beginPath(), t.angle > 0) {
|
|
596
|
-
e.translate(i, r);
|
|
597
|
-
const s = t.angle * Math.PI / 180;
|
|
598
|
-
e.rotate(s), e.translate(-i, -r);
|
|
599
|
-
}
|
|
600
|
-
e.moveTo(i, r);
|
|
601
|
-
for (let s = 1; s < c.length; s++) {
|
|
602
|
-
const [m, d] = c[s];
|
|
603
|
-
e.lineTo(m, d);
|
|
604
|
-
}
|
|
605
|
-
e.strokeStyle = o ? "#ff0000" : "#000", e.lineWidth = o ? 2 : 1, e.stroke(), e.restore();
|
|
606
|
-
}
|
|
607
|
-
}, drawSelectBounds = (e, t) => {
|
|
608
|
-
let [n, o, i, r] = getPixelFromCoordinate(t);
|
|
609
|
-
const l = window.devicePixelRatio || 1, c = 4;
|
|
610
|
-
n -= c, o -= c, i += c, r += c, e.save(), e.strokeStyle = "#ff0000", e.lineWidth = 4 * l;
|
|
611
|
-
const s = 8 * l;
|
|
612
|
-
e.beginPath(), e.moveTo(n + s, r), e.lineTo(n, r), e.lineTo(n, r - s), e.moveTo(n, o + s), e.lineTo(n, o), e.lineTo(n + s, o), e.moveTo(i - s, o), e.lineTo(i, o), e.lineTo(i, o + s), e.moveTo(i, r - s), e.lineTo(i, r), e.lineTo(i - s, r), e.stroke(), e.restore();
|
|
613
|
-
}, drawShipLabel = (e, t, n) => {
|
|
614
|
-
if (!t.selected && shipLabels.value.find((u) => u.name === t.name)) return;
|
|
615
|
-
const [o, i] = n, r = o, l = i, c = t.name;
|
|
616
|
-
let s;
|
|
617
|
-
t.leftIconColor && (s = { color: t.leftIconColor, icon: "" });
|
|
618
|
-
const m = getShipCustomIcon(t), d = {
|
|
619
|
-
id: t.id,
|
|
620
|
-
center: [r, l],
|
|
621
|
-
text: c,
|
|
622
|
-
fill: t.fill,
|
|
623
|
-
color: "#fff",
|
|
624
|
-
textColor: "#000",
|
|
625
|
-
bgColor: "#fff",
|
|
626
|
-
leftIcon: s,
|
|
627
|
-
rightIcons: m,
|
|
628
|
-
selected: t.selected,
|
|
629
|
-
blinkColors: t.blinkColors,
|
|
630
|
-
type: "ShipName"
|
|
631
|
-
};
|
|
632
|
-
drawLabel(e, d, shipLabels.value);
|
|
633
|
-
}, drawCurrentShipShapeModel = (e, t) => {
|
|
634
|
-
let n = 0;
|
|
635
|
-
t <= 14 ? n = 0.058 : t === 15 ? n = 0.12 : t === 16 ? n = 0.22 : t === 17 ? n = 0.435 : t === 18 && (n = 0.857);
|
|
636
|
-
const o = e.length / 4 * n, i = e.breadth * n;
|
|
637
|
-
let r = cloneDeep(shipShapeModel);
|
|
638
|
-
return r = r.map(([l, c]) => [l * i, c * o]), r;
|
|
639
|
-
}, getShipDirectPath = (e) => {
|
|
640
|
-
const { speed: t, hdg: n, cog: o } = e;
|
|
641
|
-
let i = "", r = null;
|
|
642
|
-
if (t && t > 1 && (n !== null && n != 511 && o !== null ? o - n >= 3 ? i = "left" : o - n <= -3 ? i = "right" : i = "front" : i = "front", i && t))
|
|
643
|
-
for (let l = 0; l < speedCondition.length; l++) {
|
|
644
|
-
const c = speedCondition[l];
|
|
645
|
-
if (t >= c[0] && t < c[1]) {
|
|
646
|
-
r = shipDirectPath[i][l];
|
|
647
|
-
break;
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
return r;
|
|
651
|
-
}, getShipCustomIcon = (e) => {
|
|
652
|
-
const t = [];
|
|
653
|
-
return e.existDevice && t.push(""), e.existMobile && t.push(""), e.existWaterGauge && t.push(""), t || [];
|
|
654
|
-
}, mapInstance$6 = ref(), renderShipSetInstance = (e) => mapInstance$6.value = e;
|
|
655
|
-
let shipsMarkerList = [], shipsVectorSource, largeAmountShipsSource;
|
|
656
|
-
const selectedShipData = ref(null), selectedShips = ref([]);
|
|
657
|
-
let selectShipsVectorSource;
|
|
658
|
-
const renderShips = (e) => {
|
|
659
|
-
var n, o, i, r;
|
|
660
|
-
if (!mapInstance$6.value || showTrackLayer.value) return;
|
|
661
|
-
const t = Math.round(Number(mapInstance$6.value.getView().getZoom()));
|
|
662
|
-
if (selectedShipData.value && nextTick(() => {
|
|
663
|
-
selectSingleShipMarker(selectedShipData.value);
|
|
664
|
-
}).then((l) => {
|
|
665
|
-
}), !(!t || t < mapZoom.shipGreenDotMax) && (allShips.value = [...e, ...selectedShips.value], !hiddenOrther.value))
|
|
666
|
-
return t >= mapZoom.shipGreenDotMax && t < mapZoom.shipModelMin ? ((n = shipsLayer.value) == null || n.setVisible(!1), (o = largeAmountShipsLayer.value) == null || o.setVisible(!0), renderLargeAmountShips(allShips.value)) : ((i = largeAmountShipsLayer.value) == null || i.setVisible(!1), (r = shipsLayer.value) == null || r.setVisible(!0), renderShipsMarker(allShips.value));
|
|
667
|
-
}, renderLargeAmountShips = (e) => {
|
|
668
|
-
if (!mapInstance$6.value) return;
|
|
669
|
-
const t = e.map((n) => ({
|
|
670
|
-
type: "Feature",
|
|
671
|
-
geometry: {
|
|
672
|
-
type: "Point",
|
|
673
|
-
coordinates: [n.lon, n.lat]
|
|
674
|
-
},
|
|
675
|
-
properties: n
|
|
676
|
-
}));
|
|
677
|
-
return largeAmountShipsSource == null || largeAmountShipsSource.clear(), largeAmountShipsSource = new VectorSource({
|
|
678
|
-
features: new GeoJSON().readFeatures({
|
|
679
|
-
type: "FeatureCollection",
|
|
680
|
-
features: t
|
|
681
|
-
}, {
|
|
682
|
-
featureProjection: projection.mercator
|
|
683
|
-
})
|
|
684
|
-
}), largeAmountShipsLayer.value = new WebGLPointsLayer({
|
|
685
|
-
source: largeAmountShipsSource,
|
|
686
|
-
style: {
|
|
687
|
-
"shape-points": 3,
|
|
688
|
-
"shape-radius": 9,
|
|
689
|
-
"shape-fill-color": [
|
|
690
|
-
"case",
|
|
691
|
-
["==", ["get", "fill"], "#D9001C"],
|
|
692
|
-
"#D9001C",
|
|
693
|
-
// 如果 fill 是 #D9001C,返回红色
|
|
694
|
-
["==", ["get", "fill"], "#04C900"],
|
|
695
|
-
"#04C900",
|
|
696
|
-
// 如果 fill 是 #04C900,返回绿色
|
|
697
|
-
"#04C900"
|
|
698
|
-
// 默认颜色(绿色)
|
|
699
|
-
],
|
|
700
|
-
"shape-rotate-with-view": !1,
|
|
701
|
-
"shape-rotation": [
|
|
702
|
-
"+",
|
|
703
|
-
["get", "cog"],
|
|
704
|
-
// 获取 'cog' 属性值
|
|
705
|
-
180
|
|
706
|
-
// 将值旋转 180 度
|
|
707
|
-
],
|
|
708
|
-
"shape-scale": [0.8, 1.2],
|
|
709
|
-
"shape-stroke-color": "#000000",
|
|
710
|
-
// 边框颜色为黑色
|
|
711
|
-
"shape-stroke-width": 0.5
|
|
712
|
-
// 边框宽度为0.5px
|
|
713
|
-
}
|
|
714
|
-
}), mapInstance$6.value.addLayer(largeAmountShipsLayer.value), largeAmountShipsLayer.value;
|
|
715
|
-
}, renderShipsMarker = (e) => {
|
|
716
|
-
var n;
|
|
717
|
-
if (!mapInstance$6.value) return;
|
|
718
|
-
deleteAllShipMarkers();
|
|
719
|
-
let t = convertShipMapData(e);
|
|
720
|
-
if (t = customFilterShips(t), !!(t != null && t.length))
|
|
721
|
-
return t.forEach((o, i) => {
|
|
722
|
-
const r = [o.lon, o.lat], l = new Feature({
|
|
723
|
-
geometry: new Point(fromLonLat(r))
|
|
724
|
-
}), c = 1;
|
|
725
|
-
l.set("clickGeometry", new Circle(fromLonLat(r), c)), l.set("data", o), l.set("index", i), l.setStyle(
|
|
726
|
-
setShipStyle(!1)
|
|
727
|
-
), shipsMarkerList.push({
|
|
728
|
-
ship: o,
|
|
729
|
-
lonlat: r,
|
|
730
|
-
feature: l
|
|
731
|
-
});
|
|
732
|
-
}), shipsVectorSource = new VectorSource({
|
|
733
|
-
features: shipsMarkerList.map((o) => o.feature)
|
|
734
|
-
}), shipsLayer.value = new VectorLayer({
|
|
735
|
-
source: shipsVectorSource,
|
|
736
|
-
zIndex: 100
|
|
737
|
-
}), (n = mapInstance$6.value) == null || n.addLayer(shipsLayer.value), shipsLayer.value;
|
|
738
|
-
}, onShipsMarkerHover = () => {
|
|
739
|
-
var o;
|
|
740
|
-
let e = null, t = 0;
|
|
741
|
-
const n = 100;
|
|
742
|
-
(o = mapInstance$6.value) == null || o.on("pointermove", function(i) {
|
|
743
|
-
var s, m, d, u;
|
|
744
|
-
const r = Date.now();
|
|
745
|
-
if (r - t < n)
|
|
746
|
-
return;
|
|
747
|
-
t = r;
|
|
748
|
-
const l = (s = mapInstance$6.value) == null ? void 0 : s.forEachFeatureAtPixel(i.pixel, (f) => f), c = (m = mapInstance$6.value) == null ? void 0 : m.getTargetElement();
|
|
749
|
-
if (c && (c.style.cursor = l ? "pointer" : ""), e !== l) {
|
|
750
|
-
if (e) {
|
|
751
|
-
const f = e.get("data");
|
|
752
|
-
if (!(f != null && f.mmsi)) return;
|
|
753
|
-
e.setStyle(
|
|
754
|
-
setShipStyle(((d = selectedShipData.value) == null ? void 0 : d.id) === f.id, !1)
|
|
755
|
-
);
|
|
756
|
-
}
|
|
757
|
-
if (l) {
|
|
758
|
-
const f = l.get("data");
|
|
759
|
-
if (!(f != null && f.mmsi)) return;
|
|
760
|
-
e = l, l.setStyle(
|
|
761
|
-
setShipStyle(((u = selectedShipData.value) == null ? void 0 : u.id) === f.id, !0)
|
|
762
|
-
);
|
|
763
|
-
} else
|
|
764
|
-
e = null;
|
|
765
|
-
}
|
|
766
|
-
});
|
|
767
|
-
}, customFilterShips = (e) => {
|
|
768
|
-
let t = cloneDeep(e);
|
|
769
|
-
return t = t.filter((n) => {
|
|
770
|
-
var i;
|
|
771
|
-
const o = getFilterItem(n).every(({ btnShow: r, value: l }) => r ? !!l : !0);
|
|
772
|
-
return (switchBtnShow.value.camera || switchBtnShow.value.mobile || switchBtnShow.value.waterGauge) && ((i = selectedShipData.value) == null ? void 0 : i.id) === n.id && clearSelectFeature(), o;
|
|
773
|
-
}), t;
|
|
774
|
-
}, getFilterItem = (e) => [
|
|
775
|
-
{ btnShow: switchBtnShow.value.camera, value: e == null ? void 0 : e.existDevice },
|
|
776
|
-
{ btnShow: switchBtnShow.value.mobile, value: e == null ? void 0 : e.existMobile },
|
|
777
|
-
{ btnShow: switchBtnShow.value.waterGauge, value: e == null ? void 0 : e.existWaterGauge }
|
|
778
|
-
], deleteAllShipMarkers = () => {
|
|
779
|
-
shipsMarkerList.forEach((e) => {
|
|
780
|
-
e.feature && (shipsVectorSource == null || shipsVectorSource.removeFeature(e.feature));
|
|
781
|
-
}), clearAllInterval(), shipsMarkerList = [];
|
|
782
|
-
}, selectSingleShipMarker = (e) => {
|
|
783
|
-
var r;
|
|
784
|
-
if (!mapInstance$6.value) return;
|
|
785
|
-
const t = cloneDeep(selectSingleShipData.value);
|
|
786
|
-
selectSingleShipData.value = convertShipMapData(e);
|
|
787
|
-
const n = [selectSingleShipData.value.lon, selectSingleShipData.value.lat], o = new Feature({
|
|
788
|
-
geometry: new Point(fromLonLat(n))
|
|
789
|
-
});
|
|
790
|
-
o.set("data", selectSingleShipData.value), o.setStyle(
|
|
791
|
-
setShipStyle(!0)
|
|
792
|
-
), shipsMarkerList.push({
|
|
793
|
-
ship: selectSingleShipData.value,
|
|
794
|
-
lonlat: n,
|
|
795
|
-
feature: o
|
|
796
|
-
}), selectShipsVectorSource == null || selectShipsVectorSource.clear(), selectShipsVectorSource = new VectorSource({
|
|
797
|
-
features: [o]
|
|
798
|
-
}), selectShipsLayer.value = new VectorLayer({
|
|
799
|
-
source: selectShipsVectorSource
|
|
800
|
-
}), shipsVectorSource && setVisibleFeatureById(shipsVectorSource, selectSingleShipData.value.id, !0);
|
|
801
|
-
const i = (r = shipsLayer.value) == null ? void 0 : r.getSource();
|
|
802
|
-
return i && (t && setVisibleFeatureById(i, t.id, !0), setVisibleFeatureById(i, selectSingleShipData.value.id, !1)), mapInstance$6.value.addLayer(selectShipsLayer.value), selectShipsLayer.value.setVisible(!0), selectShipsLayer.value;
|
|
803
|
-
}, setVisibleFeatureById = (e, t, n) => {
|
|
804
|
-
e && e.forEachFeature((o) => {
|
|
805
|
-
const i = o.get("data");
|
|
806
|
-
i && i.id === t && o.setStyle(n ? setShipStyle(!1, i.id) : setBlankStyle());
|
|
807
|
-
});
|
|
808
|
-
}, findShip = (e, t, n = !0) => {
|
|
809
|
-
var i, r, l, c, s;
|
|
810
|
-
if (!e || !mapInstance$6.value) return;
|
|
811
|
-
const o = (l = (r = (i = shipsLayer.value) == null ? void 0 : i.getSource()) == null ? void 0 : r.getFeatures()) == null ? void 0 : l.find((m) => {
|
|
812
|
-
var d;
|
|
813
|
-
return ((d = m.get("data")) == null ? void 0 : d.id) === e;
|
|
814
|
-
});
|
|
815
|
-
if (o)
|
|
816
|
-
selectedShipData.value = o.get("data");
|
|
817
|
-
else if (t && t.lon && t.lat)
|
|
818
|
-
selectedShipData.value = t;
|
|
819
|
-
else {
|
|
820
|
-
console.error("找不到船舶");
|
|
821
|
-
return;
|
|
460
|
+
function c(d) {
|
|
461
|
+
return !isNaN(d) && d !== null && !Array.isArray(d);
|
|
822
462
|
}
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
return m.id === ((d = selectedShipData.value) == null ? void 0 : d.id);
|
|
826
|
-
}) || selectedShips.value.push(selectedShipData.value), n && ((c = selectedShipData.value) != null && c.lon) && ((s = selectedShipData.value) != null && s.lat)) {
|
|
827
|
-
const m = mapInstance$6.value.getView(), d = new Point([selectedShipData.value.lon, selectedShipData.value.lat]);
|
|
828
|
-
m.setCenter(transform(d.getCoordinates(), projection.data, projection.mercator));
|
|
829
|
-
const u = m.getZoom(), f = u < mapZoom.findShipMin ? mapZoom.findShip : u;
|
|
830
|
-
m.setZoom(f);
|
|
463
|
+
function s(d, f = {}, p = {}) {
|
|
464
|
+
return d || console.log("Coordinates are required"), Array.isArray(d) || console.log("Coordinates must be an Array"), d.length < 2 && console.log("Coordinates must be at least 2 numbers long"), (!c(d[0]) || !c(d[1])) && console.log("Coordinates must contain numbers"), m({ type: "Point", coordinates: d }, f, p);
|
|
831
465
|
}
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
}, clearSelectFeature = () => {
|
|
836
|
-
var e;
|
|
837
|
-
if (selectedShipData.value && shipsVectorSource && selectSingleShipData.value) {
|
|
838
|
-
setVisibleFeatureById(shipsVectorSource, selectSingleShipData.value.id, !1);
|
|
839
|
-
const t = (e = shipsLayer.value) == null ? void 0 : e.getSource();
|
|
840
|
-
t && setVisibleFeatureById(t, selectSingleShipData.value.id, !0);
|
|
466
|
+
function m(d, f = {}, p = {}) {
|
|
467
|
+
const w = { type: "Feature" };
|
|
468
|
+
return p.id !== void 0 && (w.id = p.id), p.bbox && (w.bbox = p.bbox), w.properties = f || {}, w.geometry = d, w;
|
|
841
469
|
}
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
var e, t;
|
|
847
|
-
(e = shipsLayer.value) == null || e.setVisible(!1), (t = largeAmountShipsLayer.value) == null || t.setVisible(!1);
|
|
848
|
-
}, switchBtnShow = ref({
|
|
849
|
-
// 船舶摄像头过滤开关
|
|
850
|
-
[SWITCH_BTN.Camera]: !1,
|
|
851
|
-
// 船舶联系方式过滤开关
|
|
852
|
-
[SWITCH_BTN.Mobile]: !1,
|
|
853
|
-
// 船舶水尺过滤开关
|
|
854
|
-
[SWITCH_BTN.WaterGauge]: !1
|
|
855
|
-
}), switchFilterItem = (e, t) => {
|
|
856
|
-
switchBtnShow.value[e] = t, renderShips(allShips.value);
|
|
857
|
-
}, rerenderShip = () => {
|
|
858
|
-
renderShips(allShips.value);
|
|
859
|
-
}, labelAlpha = 0.8, pixelRatio = window.devicePixelRatio || 1, labelFont = `500 ${12 * pixelRatio}px Arial`, labelOutSize = 2 * pixelRatio, labelHeight = 10 * pixelRatio, fillRectRadius = (e, t, n, o, i, r, l = 4) => {
|
|
860
|
-
e.beginPath(), e.moveTo(t + l, n), e.arcTo(t + o, n, t + o, n + l, l), e.arcTo(t + o, n + i, t + o - l, n + i, l), e.arcTo(t, n + i, t, n + i - l, l), e.arcTo(t, n, t + l, n, l), e.closePath(), e.fillStyle = r, e.fill();
|
|
470
|
+
const u = i(s(e), s(t), n);
|
|
471
|
+
return u < 0 ? 360 + u : u;
|
|
472
|
+
}, labelAlpha = 0.8, pixelRatio = window.devicePixelRatio || 1, labelFont = `500 ${12 * pixelRatio}px Arial`, labelOutSize = 2 * pixelRatio, labelHeight = 10 * pixelRatio, fillRectRadius = (e, t, n, o, l, r, i = 4) => {
|
|
473
|
+
e.beginPath(), e.moveTo(t + i, n), e.arcTo(t + o, n, t + o, n + i, i), e.arcTo(t + o, n + l, t + o - i, n + l, i), e.arcTo(t, n + l, t, n + l - i, i), e.arcTo(t, n, t + i, n, i), e.closePath(), e.fillStyle = r, e.fill();
|
|
861
474
|
}, getPixelFromCoordinate = (e) => {
|
|
862
475
|
if (!e || e.length === 0)
|
|
863
476
|
throw new Error("Points array is empty or invalid.");
|
|
864
|
-
let t = 1 / 0, n = 1 / 0, o = -1 / 0,
|
|
865
|
-
for (const [r,
|
|
866
|
-
r < t && (t = r),
|
|
867
|
-
return [t, n, o,
|
|
477
|
+
let t = 1 / 0, n = 1 / 0, o = -1 / 0, l = -1 / 0;
|
|
478
|
+
for (const [r, i] of e)
|
|
479
|
+
r < t && (t = r), i < n && (n = i), r > o && (o = r), i > l && (l = i);
|
|
480
|
+
return [t, n, o, l];
|
|
868
481
|
}, calculatePolygonCentroid = (e) => {
|
|
869
482
|
if (!Array.isArray(e) || e.length < 3)
|
|
870
483
|
throw new Error("A polygon must have at least 3 coordinates.");
|
|
871
484
|
let t = 0, n = 0, o = 0;
|
|
872
|
-
const
|
|
873
|
-
for (let c = 0; c <
|
|
874
|
-
const [s, m] = e[c], [
|
|
875
|
-
o += f, t += (s +
|
|
485
|
+
const l = e.length;
|
|
486
|
+
for (let c = 0; c < l - 1; c++) {
|
|
487
|
+
const [s, m] = e[c], [u, d] = e[c + 1], f = s * d - u * m;
|
|
488
|
+
o += f, t += (s + u) * f, n += (m + d) * f;
|
|
876
489
|
}
|
|
877
490
|
if (o *= 0.5, o === 0)
|
|
878
491
|
throw new Error("多边形面积为零");
|
|
879
|
-
const r = t / (6 * o),
|
|
880
|
-
return [r,
|
|
492
|
+
const r = t / (6 * o), i = n / (6 * o);
|
|
493
|
+
return [r, i];
|
|
881
494
|
}, rotateShapeModel = (e, t) => {
|
|
882
|
-
const [n, o] = calculatePolygonCentroid(e),
|
|
495
|
+
const [n, o] = calculatePolygonCentroid(e), l = t * Math.PI / 180, r = Math.cos(l), i = Math.sin(l);
|
|
883
496
|
return e.map(([c, s]) => {
|
|
884
|
-
const m = c - n,
|
|
885
|
-
return [
|
|
497
|
+
const m = c - n, u = s - o, d = m * r - u * i + n, f = m * i + u * r + o;
|
|
498
|
+
return [d, f];
|
|
886
499
|
});
|
|
887
500
|
}, getTopLeftPoint = (e) => [e[0], e[3]], getBottomLeftPoint = (e) => [e[2], e[3]], getBottomRightPoint = (e) => [e[2], e[1]], getTopRighttPoint = (e) => [e[0], e[1]];
|
|
888
|
-
function calculateBounds(e, t, n, o,
|
|
889
|
-
let r,
|
|
890
|
-
const m = e[0],
|
|
501
|
+
function calculateBounds(e, t, n, o, l) {
|
|
502
|
+
let r, i, c, s;
|
|
503
|
+
const m = e[0], u = e[1];
|
|
891
504
|
switch (t) {
|
|
892
505
|
case 0:
|
|
893
|
-
r = m +
|
|
506
|
+
r = m + l, i = r + n, s = u - l, c = s - o;
|
|
894
507
|
break;
|
|
895
508
|
case 1:
|
|
896
|
-
r = m +
|
|
509
|
+
r = m + l, i = r + n, s = u + o / 2, c = s - o;
|
|
897
510
|
break;
|
|
898
511
|
case 2:
|
|
899
|
-
r = m +
|
|
512
|
+
r = m + l, i = r + n, s = u + l + o, c = s - o;
|
|
900
513
|
break;
|
|
901
514
|
case 3:
|
|
902
|
-
r = m - n / 2,
|
|
515
|
+
r = m - n / 2, i = r + n, s = u + l + o, c = s - o;
|
|
903
516
|
break;
|
|
904
517
|
case 4:
|
|
905
|
-
|
|
518
|
+
i = m, r = i - n, s = u + l + o, c = s - o;
|
|
906
519
|
break;
|
|
907
520
|
case 5:
|
|
908
|
-
|
|
521
|
+
i = m - l, r = i - n, s = u + o / 2, c = s - o;
|
|
909
522
|
break;
|
|
910
523
|
case 6:
|
|
911
|
-
|
|
524
|
+
i = m, r = i - n, s = u - l, c = s - o;
|
|
912
525
|
break;
|
|
913
526
|
case 7:
|
|
914
|
-
r = m - n / 2,
|
|
527
|
+
r = m - n / 2, i = r + n, s = u - l, c = s - o;
|
|
915
528
|
}
|
|
916
|
-
if (!(!r || !c || !
|
|
917
|
-
return [Math.min(r,
|
|
529
|
+
if (!(!r || !c || !i || !s))
|
|
530
|
+
return [Math.min(r, i), Math.min(c, s), Math.max(r, i), Math.max(c, s) + 1];
|
|
918
531
|
}
|
|
919
|
-
function calculateAnchorPoint(e, t, n = 70, o = 20,
|
|
532
|
+
function calculateAnchorPoint(e, t, n = 70, o = 20, l = 20) {
|
|
920
533
|
const r = [0, 0];
|
|
921
534
|
switch (t) {
|
|
922
535
|
case 0:
|
|
923
|
-
r[0] = e[0] +
|
|
536
|
+
r[0] = e[0] + l, r[1] = e[1] - l - o / 2;
|
|
924
537
|
break;
|
|
925
538
|
case 1:
|
|
926
|
-
r[0] = e[0] +
|
|
539
|
+
r[0] = e[0] + l, r[1] = e[1];
|
|
927
540
|
break;
|
|
928
541
|
case 2:
|
|
929
|
-
r[0] = e[0] +
|
|
542
|
+
r[0] = e[0] + l, r[1] = e[1] + l + o / 2;
|
|
930
543
|
break;
|
|
931
544
|
case 3:
|
|
932
|
-
r[0] = e[0], r[1] = e[1] +
|
|
545
|
+
r[0] = e[0], r[1] = e[1] + l + o / 4;
|
|
933
546
|
break;
|
|
934
547
|
case 4:
|
|
935
|
-
r[0] = Math.max(e[0] -
|
|
548
|
+
r[0] = Math.max(e[0] - l, e[0] - n / 2), r[1] = e[1] + l + o / 4;
|
|
936
549
|
break;
|
|
937
550
|
case 5:
|
|
938
|
-
r[0] = e[0] -
|
|
551
|
+
r[0] = e[0] - l, r[1] = e[1];
|
|
939
552
|
break;
|
|
940
553
|
case 6:
|
|
941
|
-
r[0] = Math.max(e[0] -
|
|
554
|
+
r[0] = Math.max(e[0] - l, e[0] - n / 2), r[1] = e[1] - l - o / 4;
|
|
942
555
|
break;
|
|
943
556
|
case 7:
|
|
944
|
-
r[0] = e[0], r[1] = e[1] -
|
|
557
|
+
r[0] = e[0], r[1] = e[1] - l - o / 4;
|
|
945
558
|
}
|
|
946
559
|
return r;
|
|
947
560
|
}
|
|
@@ -949,49 +562,49 @@ function drawLabelBody(e, t, n) {
|
|
|
949
562
|
if (!e) return;
|
|
950
563
|
const {
|
|
951
564
|
font: o,
|
|
952
|
-
labelOutSize:
|
|
565
|
+
labelOutSize: l = 2,
|
|
953
566
|
labelHeight: r,
|
|
954
|
-
center:
|
|
567
|
+
center: i,
|
|
955
568
|
text: c,
|
|
956
569
|
leftIcon: s,
|
|
957
570
|
shipColor: m,
|
|
958
|
-
lineLength:
|
|
959
|
-
selected:
|
|
571
|
+
lineLength: u = 20,
|
|
572
|
+
selected: d
|
|
960
573
|
} = n;
|
|
961
574
|
e.save(), o && (e.font = o);
|
|
962
|
-
let f = e.measureText(c).width + 4 *
|
|
963
|
-
(s || m) && (f += r + 6 *
|
|
964
|
-
let p,
|
|
965
|
-
if (
|
|
966
|
-
for (let
|
|
967
|
-
p = calculateBounds(
|
|
575
|
+
let f = e.measureText(c).width + 4 * l;
|
|
576
|
+
(s || m) && (f += r + 6 * l), e.restore();
|
|
577
|
+
let p, w = 20, h = -1, v = r + 3 * l;
|
|
578
|
+
if (u)
|
|
579
|
+
for (let L = 0; L < 8; L++) {
|
|
580
|
+
p = calculateBounds(i, L, f, v, u);
|
|
968
581
|
let T = !1;
|
|
969
582
|
for (let I = 0; I < t.length; ++I) {
|
|
970
|
-
let
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
583
|
+
let V = t[I].bounds, x = [
|
|
584
|
+
V[0] - w,
|
|
585
|
+
V[1] - w,
|
|
586
|
+
V[2] + w,
|
|
587
|
+
V[3] + w
|
|
975
588
|
];
|
|
976
|
-
if (p && isOverlapping(p,
|
|
589
|
+
if (p && isOverlapping(p, x)) {
|
|
977
590
|
T = !0;
|
|
978
591
|
break;
|
|
979
592
|
}
|
|
980
593
|
}
|
|
981
594
|
if (!T) {
|
|
982
|
-
h =
|
|
595
|
+
h = L;
|
|
983
596
|
break;
|
|
984
597
|
}
|
|
985
598
|
}
|
|
986
599
|
else
|
|
987
|
-
h = 0, p = calculateBounds(
|
|
988
|
-
if (
|
|
989
|
-
let
|
|
600
|
+
h = 0, p = calculateBounds(i, h, f, v, u);
|
|
601
|
+
if (d && h === -1 && (h = 0), h === 5 && (h = 0), p && h > -1) {
|
|
602
|
+
let L = getBottomLeftPoint(p), T = getTopRighttPoint(p);
|
|
990
603
|
return {
|
|
991
|
-
center:
|
|
992
|
-
x: calculateAnchorPoint(
|
|
604
|
+
center: i,
|
|
605
|
+
x: calculateAnchorPoint(i, h, f, v, u),
|
|
993
606
|
l: T,
|
|
994
|
-
r:
|
|
607
|
+
r: L,
|
|
995
608
|
bounds: p,
|
|
996
609
|
position: h,
|
|
997
610
|
name: c
|
|
@@ -1001,61 +614,61 @@ function drawLabelBody(e, t, n) {
|
|
|
1001
614
|
}
|
|
1002
615
|
const drawText = (e, t) => {
|
|
1003
616
|
if (!e) return;
|
|
1004
|
-
const { center: n, text: o, textColor:
|
|
617
|
+
const { center: n, text: o, textColor: l, leftIcon: r, rightIcons: i, font: c } = t;
|
|
1005
618
|
e.save(), e.setTransform(1, 0, 0, 1, 0, 0);
|
|
1006
619
|
let [s, m] = n;
|
|
1007
620
|
if (r) {
|
|
1008
621
|
e.font = `${18 * pixelRatio}px map-iconfont`;
|
|
1009
|
-
let
|
|
1010
|
-
e.fillStyle = r.color, e.fillText(
|
|
622
|
+
let u = getIconFont(r.icon);
|
|
623
|
+
e.fillStyle = r.color, e.fillText(u, s + labelOutSize - 3 * pixelRatio, m + 2.6 * pixelRatio), s += 23 * pixelRatio;
|
|
1011
624
|
}
|
|
1012
|
-
if (
|
|
625
|
+
if (i != null && i.length) {
|
|
1013
626
|
e.font = `${12 * pixelRatio}px map-iconfont`, e.fillStyle = "#3370ff";
|
|
1014
|
-
const
|
|
1015
|
-
|
|
1016
|
-
const p = getIconFont(
|
|
1017
|
-
e.fillText(p, s +
|
|
627
|
+
const u = e.measureText(o).width + 6 * pixelRatio;
|
|
628
|
+
i.forEach((d, f) => {
|
|
629
|
+
const p = getIconFont(d), w = 20 * pixelRatio * f;
|
|
630
|
+
e.fillText(p, s + u + w, m);
|
|
1018
631
|
});
|
|
1019
632
|
}
|
|
1020
|
-
e.font = c || labelFont, e.fillStyle =
|
|
633
|
+
e.font = c || labelFont, e.fillStyle = l, e.fillText(o, s + 2, m), e.restore();
|
|
1021
634
|
}, drawPolygon = (e, t) => {
|
|
1022
635
|
let {
|
|
1023
636
|
points: n,
|
|
1024
637
|
strokeColor: o,
|
|
1025
|
-
fillColor:
|
|
638
|
+
fillColor: l,
|
|
1026
639
|
shouldClosePath: r,
|
|
1027
|
-
translation:
|
|
640
|
+
translation: i,
|
|
1028
641
|
rotation: c,
|
|
1029
642
|
rotationCenter: s,
|
|
1030
643
|
scale: m,
|
|
1031
|
-
globalAlpha:
|
|
644
|
+
globalAlpha: u
|
|
1032
645
|
} = t;
|
|
1033
|
-
if (
|
|
1034
|
-
e.save(), e.beginPath(), c && c !== 0 && s == null && e.rotate(c),
|
|
1035
|
-
for (let
|
|
1036
|
-
e.lineTo(n[
|
|
1037
|
-
r && e.closePath(), o && (e.strokeStyle = o, e.stroke()),
|
|
646
|
+
if (u || (u = 1), n && e) {
|
|
647
|
+
e.save(), e.beginPath(), c && c !== 0 && s == null && e.rotate(c), i && e.translate(i[0], i[1]), c && (s != null && s.length) && e.rotate(c), m && e.scale(m, m), e.moveTo(n[0][0], n[0][1]);
|
|
648
|
+
for (let d = 1; d < n.length; d++)
|
|
649
|
+
e.lineTo(n[d][0], n[d][1]);
|
|
650
|
+
r && e.closePath(), o && (e.strokeStyle = o, e.stroke()), l && r && (u && (e.globalAlpha = u), e.fillStyle = l, e.fill()), e.restore();
|
|
1038
651
|
}
|
|
1039
|
-
}, intervalIds = {}, drawLabel = (e, t, n) => {
|
|
1040
|
-
var
|
|
1041
|
-
let { center:
|
|
1042
|
-
if (
|
|
1043
|
-
const
|
|
652
|
+
}, intervalIds = {}, drawLabel = (e, t, n, o) => {
|
|
653
|
+
var f, p, w, h, v, L, T;
|
|
654
|
+
let { center: l, text: r, color: i, textColor: c, bgColor: s, leftIcon: m, rightIcons: u, type: d } = t;
|
|
655
|
+
if (l && r) {
|
|
656
|
+
const I = {
|
|
1044
657
|
font: labelFont,
|
|
1045
658
|
labelOutSize,
|
|
1046
659
|
labelHeight,
|
|
1047
|
-
center:
|
|
1048
|
-
text:
|
|
1049
|
-
leftIcon:
|
|
660
|
+
center: l,
|
|
661
|
+
text: r,
|
|
662
|
+
leftIcon: m,
|
|
1050
663
|
selected: t.selected
|
|
1051
664
|
};
|
|
1052
|
-
(
|
|
1053
|
-
const
|
|
1054
|
-
if (
|
|
1055
|
-
const { x
|
|
1056
|
-
n.find((
|
|
1057
|
-
points: [
|
|
1058
|
-
strokeColor:
|
|
665
|
+
(f = t.blinkColors) != null && f.length && t.fill && (s = t.fill, c = getForegroundColor(t.fill));
|
|
666
|
+
const V = drawLabelBody(e, n, I);
|
|
667
|
+
if (V) {
|
|
668
|
+
const { x, bounds: P, l: g } = V, y = [getTopLeftPoint(P), getBottomLeftPoint(P), getBottomRightPoint(P), getTopRighttPoint(P)];
|
|
669
|
+
n.find((F) => F.name === r) || n.push(V), drawPolygon(e, {
|
|
670
|
+
points: [l, x],
|
|
671
|
+
strokeColor: i,
|
|
1059
672
|
fillColor: "#000",
|
|
1060
673
|
shouldClosePath: !0,
|
|
1061
674
|
translation: void 0,
|
|
@@ -1063,46 +676,47 @@ const drawText = (e, t) => {
|
|
|
1063
676
|
rotationCenter: void 0,
|
|
1064
677
|
scale: void 0,
|
|
1065
678
|
globalAlpha: labelAlpha
|
|
1066
|
-
}),
|
|
1067
|
-
|
|
679
|
+
}), u != null && u.length && u.forEach(() => {
|
|
680
|
+
y[1][0] += pixelRatio * 18, y[2][0] += pixelRatio * 18;
|
|
1068
681
|
});
|
|
1069
|
-
const
|
|
1070
|
-
points:
|
|
1071
|
-
strokeColor:
|
|
1072
|
-
fillColor:
|
|
682
|
+
const k = {
|
|
683
|
+
points: y,
|
|
684
|
+
strokeColor: i,
|
|
685
|
+
fillColor: s,
|
|
1073
686
|
shouldClosePath: !0
|
|
1074
|
-
}, [
|
|
1075
|
-
center: [
|
|
1076
|
-
text:
|
|
1077
|
-
textColor:
|
|
1078
|
-
leftIcon:
|
|
1079
|
-
rightIcons:
|
|
687
|
+
}, [M, E] = g, C = {
|
|
688
|
+
center: [M, E + labelOutSize + labelHeight + 1],
|
|
689
|
+
text: r,
|
|
690
|
+
textColor: c,
|
|
691
|
+
leftIcon: m,
|
|
692
|
+
rightIcons: u,
|
|
1080
693
|
blinkColors: t.blinkColors
|
|
1081
694
|
};
|
|
1082
|
-
if (drawPolygon(e,
|
|
1083
|
-
let
|
|
1084
|
-
const
|
|
1085
|
-
!!!((
|
|
1086
|
-
var
|
|
1087
|
-
return ((
|
|
1088
|
-
}) || (
|
|
1089
|
-
var
|
|
1090
|
-
return ((
|
|
1091
|
-
})) || hiddenOrther.value ? (clearInterval(intervalIds[t.id]), deleteLabelFromArray(n,
|
|
1092
|
-
var
|
|
1093
|
-
const
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
695
|
+
if (drawPolygon(e, k), drawText(e, C), t != null && t.blinkColors && t.blinkColors.length > 0) {
|
|
696
|
+
let F = Date.now(), $ = 0;
|
|
697
|
+
const R = t.blinkColors;
|
|
698
|
+
!!!((h = (w = (p = selectShipsLayer.value) == null ? void 0 : p.getSource()) == null ? void 0 : w.getFeatures()) != null && h.find((N) => {
|
|
699
|
+
var A;
|
|
700
|
+
return ((A = N.get("data")) == null ? void 0 : A.id) === t.id;
|
|
701
|
+
}) || (T = (L = (v = shipsLayer.value) == null ? void 0 : v.getSource()) == null ? void 0 : L.getFeatures()) != null && T.find((N) => {
|
|
702
|
+
var A;
|
|
703
|
+
return ((A = N.get("data")) == null ? void 0 : A.id) === t.id;
|
|
704
|
+
})) || hiddenOrther.value ? (clearInterval(intervalIds[t.id]), deleteLabelFromArray(n, r)) : (intervalIds[t.id] && clearInterval(intervalIds[t.id]), intervalIds[t.id] = window.setInterval(() => {
|
|
705
|
+
var _, Z, U;
|
|
706
|
+
const N = Date.now();
|
|
707
|
+
N - F >= 500 && ($ = ($ + 1) % R.length, F = N, k.fillColor = R[$], drawPolygon(e, k), C.textColor = getForegroundColor(k.fillColor), drawText(e, C)), ((U = (Z = (_ = shipsLayer.value) == null ? void 0 : _.getSource()) == null ? void 0 : Z.getFeatures()) == null ? void 0 : U.some((z) => {
|
|
708
|
+
const O = z.get("data");
|
|
709
|
+
if ((O == null ? void 0 : O.id) === t.id) {
|
|
710
|
+
const D = o == null ? void 0 : o.getView().calculateExtent();
|
|
711
|
+
if (!D) return !1;
|
|
712
|
+
const G = fromLonLat([O.lon, O.lat]);
|
|
713
|
+
return G[0] >= D[0] && G[0] <= D[2] && G[1] >= D[1] && G[1] <= D[3];
|
|
714
|
+
}
|
|
715
|
+
return !1;
|
|
716
|
+
})) || (clearInterval(intervalIds[t.id]), deleteLabelFromArray(n, r));
|
|
1103
717
|
}, 10));
|
|
1104
718
|
} else
|
|
1105
|
-
shipLabels.value.find((
|
|
719
|
+
shipLabels.value.find(($) => $.name === r) && (clearInterval(intervalIds[t.id]), drawPolygon(e, k), drawText(e, C));
|
|
1106
720
|
}
|
|
1107
721
|
}
|
|
1108
722
|
return null;
|
|
@@ -1130,23 +744,23 @@ function gcj02ToWgs84(e) {
|
|
|
1130
744
|
if (outOfChina(t, n))
|
|
1131
745
|
return `${t.toFixed(6)}, ${n.toFixed(6)}`;
|
|
1132
746
|
{
|
|
1133
|
-
let o = transformLat(t - 105, n - 35),
|
|
747
|
+
let o = transformLat(t - 105, n - 35), l = transformLng(t - 105, n - 35);
|
|
1134
748
|
const r = n / 180 * PI;
|
|
1135
|
-
let
|
|
1136
|
-
|
|
1137
|
-
const c = Math.sqrt(
|
|
1138
|
-
o = o * 180 / (a * (1 - ee) / (
|
|
1139
|
-
const s = n + o, m = t +
|
|
749
|
+
let i = Math.sin(r);
|
|
750
|
+
i = 1 - ee * i * i;
|
|
751
|
+
const c = Math.sqrt(i);
|
|
752
|
+
o = o * 180 / (a * (1 - ee) / (i * c) * PI), l = l * 180 / (a / c * Math.cos(r) * PI);
|
|
753
|
+
const s = n + o, m = t + l;
|
|
1140
754
|
return `${(t * 2 - m).toFixed(6)}, ${(n * 2 - s).toFixed(6)}`;
|
|
1141
755
|
}
|
|
1142
756
|
}
|
|
1143
757
|
function calculateCirclePoints(e, t) {
|
|
1144
|
-
const n = fromLonLat(e), o = t * 1e3,
|
|
758
|
+
const n = fromLonLat(e), o = t * 1e3, l = [
|
|
1145
759
|
n[0] - o,
|
|
1146
760
|
n[1] - o,
|
|
1147
761
|
n[0] + o,
|
|
1148
762
|
n[1] + o
|
|
1149
|
-
], r = transformExtent(
|
|
763
|
+
], r = transformExtent(l, projection.mercator, projection.data);
|
|
1150
764
|
return {
|
|
1151
765
|
leftTopPoint: { lng: r[0], lat: r[3] },
|
|
1152
766
|
rightTopPoint: { lng: r[2], lat: r[3] },
|
|
@@ -1162,17 +776,17 @@ function lonLatToMercator(e) {
|
|
|
1162
776
|
}
|
|
1163
777
|
function mercatorToLonLat(e, t = "lonlat") {
|
|
1164
778
|
const n = { lon: 0, lat: 0 }, o = e[0] / equatorialCircumference * 180;
|
|
1165
|
-
let
|
|
1166
|
-
return
|
|
779
|
+
let l = e[1] / equatorialCircumference * 180;
|
|
780
|
+
return l = 180 / Math.PI * (2 * Math.atan(Math.exp(l * Math.PI / 180)) - Math.PI / 2), n.lon = o, n.lat = l, t === "lonlat" ? n : [o, l];
|
|
1167
781
|
}
|
|
1168
782
|
function calculateBoundingBox(e) {
|
|
1169
|
-
let t = 1 / 0, n = -1 / 0, o = 1 / 0,
|
|
783
|
+
let t = 1 / 0, n = -1 / 0, o = 1 / 0, l = -1 / 0;
|
|
1170
784
|
e.forEach((h) => {
|
|
1171
|
-
const [
|
|
1172
|
-
t = Math.min(t,
|
|
785
|
+
const [v, L] = h;
|
|
786
|
+
t = Math.min(t, L), n = Math.max(n, L), o = Math.min(o, v), l = Math.max(l, v);
|
|
1173
787
|
});
|
|
1174
|
-
const r =
|
|
1175
|
-
return [f, p,
|
|
788
|
+
const r = l - o, i = n - t, c = Math.max(r, i), s = (o + l) / 2, m = (t + n) / 2, u = c / 2, d = s - u, f = s + u, p = m - u, w = m + u;
|
|
789
|
+
return [f, p, d, w];
|
|
1176
790
|
}
|
|
1177
791
|
const transformUtils = {
|
|
1178
792
|
gcj02ToWgs84,
|
|
@@ -1180,16 +794,16 @@ const transformUtils = {
|
|
|
1180
794
|
lonLatToMercator,
|
|
1181
795
|
mercatorToLonLat,
|
|
1182
796
|
calculateBoundingBox
|
|
1183
|
-
}, mapInstance$
|
|
797
|
+
}, mapInstance$7 = ref(), renderTrackStyleSetInstance = (e) => mapInstance$7.value = e, stopIcon = "", stopColor = "#E31818", slowIcon = "", slowColor = "#1890FF", dropletsIcon = "", trackList$1 = ref([]);
|
|
1184
798
|
let animationFeature;
|
|
1185
799
|
const renderTrackLine = (e, t, n) => {
|
|
1186
|
-
var r,
|
|
800
|
+
var r, i, c;
|
|
1187
801
|
const o = e[t];
|
|
1188
802
|
if (!o) return;
|
|
1189
803
|
allTracks.value[t] = o, trackList$1.value = [], trackList$1.value = o.map((s, m) => (s.center = [s.lon, s.lat], s.centerPoint = transformUtils.lonLatToMercator(s.center), s.id = t, s.index = m, s.time = hooks(s.createdAt).format("YYYY-MM-DD HH:mm:ss"), s));
|
|
1190
|
-
const
|
|
1191
|
-
if (
|
|
1192
|
-
const s = new LineString(
|
|
804
|
+
const l = trackList$1.value.map((s) => s.centerPoint);
|
|
805
|
+
if (l.length >= 2) {
|
|
806
|
+
const s = new LineString(l), m = new Feature({ geometry: s });
|
|
1193
807
|
m.setStyle(
|
|
1194
808
|
new Style({
|
|
1195
809
|
stroke: new Stroke({
|
|
@@ -1197,16 +811,16 @@ const renderTrackLine = (e, t, n) => {
|
|
|
1197
811
|
width: 2
|
|
1198
812
|
})
|
|
1199
813
|
})
|
|
1200
|
-
), m.setId(t), m.set("type", "line"), (
|
|
1201
|
-
const
|
|
1202
|
-
|
|
1203
|
-
const
|
|
814
|
+
), m.setId(t), m.set("type", "line"), (i = (r = shipTrackVectorLayer.value) == null ? void 0 : r.getSource()) == null || i.clear(), shipTrackLineFeatures.value = [];
|
|
815
|
+
const u = shipTrackLineFeatures.value.findIndex((f) => f.getId() === t);
|
|
816
|
+
u >= 0 ? shipTrackLineFeatures.value[u] = m : shipTrackLineFeatures.value.push(m);
|
|
817
|
+
const d = createAnimatedIconFeature(n, l);
|
|
1204
818
|
trackLineVectorSource.value = new VectorSource({
|
|
1205
819
|
features: [...shipTrackLineFeatures.value]
|
|
1206
|
-
}), animationFeature =
|
|
820
|
+
}), animationFeature = d, console.log(animationFeature), shipTrackVectorLayer.value = new VectorLayer({
|
|
1207
821
|
source: trackLineVectorSource.value,
|
|
1208
822
|
zIndex: 102
|
|
1209
|
-
}), renderPoint(n), (c = mapInstance$
|
|
823
|
+
}), renderPoint(n), (c = mapInstance$7.value) == null || c.addLayer(shipTrackVectorLayer.value);
|
|
1210
824
|
}
|
|
1211
825
|
}, handlePlay = (e, t) => {
|
|
1212
826
|
const n = allTracks.value[String(e)];
|
|
@@ -1240,31 +854,31 @@ let polyline, linePath, startMarker, position, geoMarker, vectorLayer;
|
|
|
1240
854
|
const trackAnimating = ref(!1);
|
|
1241
855
|
let distance = 0, lastTime = Date.now(), moveFeatureHandler = null;
|
|
1242
856
|
const moveFeature = (e, t) => {
|
|
1243
|
-
var
|
|
1244
|
-
const n = Number(50 * t), o = ((
|
|
1245
|
-
if (distance = (distance + n *
|
|
857
|
+
var d, f, p;
|
|
858
|
+
const n = Number(50 * t), o = ((d = e.frameState) == null ? void 0 : d.time) ?? Date.now(), l = o - lastTime;
|
|
859
|
+
if (distance = (distance + n * l / 1e6) % 2, lastTime = o, distance >= 1) {
|
|
1246
860
|
stopAnimation();
|
|
1247
861
|
return;
|
|
1248
862
|
}
|
|
1249
863
|
const r = linePath.getCoordinateAt(
|
|
1250
864
|
distance > 1 ? 2 - distance : distance
|
|
1251
|
-
),
|
|
865
|
+
), i = linePath.getCoordinateAt(
|
|
1252
866
|
distance > 1 ? distance - 0.01 : distance
|
|
1253
867
|
), c = linePath.getCoordinateAt(
|
|
1254
868
|
distance > 1 ? 2 - distance : distance + 0.01
|
|
1255
869
|
), m = getRotation(
|
|
1256
|
-
transformUtils.mercatorToLonLat(
|
|
870
|
+
transformUtils.mercatorToLonLat(i, "array"),
|
|
1257
871
|
transformUtils.mercatorToLonLat(c, "array")
|
|
1258
872
|
) * Math.PI / 180;
|
|
1259
873
|
(f = geoMarkerStyle.getText()) == null || f.setRotation(m), position.setCoordinates(r);
|
|
1260
|
-
const
|
|
1261
|
-
|
|
874
|
+
const u = getVectorContext(e);
|
|
875
|
+
u.context_.save(), u.setStyle(geoMarkerStyle), u.drawGeometry(position), u.context_.restore(), (p = mapInstance$7.value) == null || p.render();
|
|
1262
876
|
}, startAnimation = () => {
|
|
1263
877
|
var e;
|
|
1264
878
|
trackAnimating.value = !0, showTrackAnimatMarker.value = !0, lastTime = Date.now(), distance = 0, position = ((e = startMarker.getGeometry()) == null ? void 0 : e.clone()) || new Point([0, 0]), moveFeatureHandler && (vectorLayer == null || vectorLayer.on("postrender", moveFeatureHandler)), geoMarker == null || geoMarker.setGeometry(void 0);
|
|
1265
879
|
}, stopAnimation = () => {
|
|
1266
880
|
var e;
|
|
1267
|
-
trackAnimating.value && (trackAnimating.value = !1, geoMarker == null || geoMarker.setGeometry(void 0), moveFeatureHandler && vectorLayer && vectorLayer.un("postrender", moveFeatureHandler), vectorLayer && ((e = mapInstance$
|
|
881
|
+
trackAnimating.value && (trackAnimating.value = !1, geoMarker == null || geoMarker.setGeometry(void 0), moveFeatureHandler && vectorLayer && vectorLayer.un("postrender", moveFeatureHandler), vectorLayer && ((e = mapInstance$7.value) == null || e.removeLayer(vectorLayer)), vectorLayer = null, geoMarker = null);
|
|
1268
882
|
}, playAnimation = (e, t) => {
|
|
1269
883
|
var o;
|
|
1270
884
|
trackAnimating.value && stopAnimation(), polyline = new Polyline({
|
|
@@ -1287,38 +901,38 @@ const moveFeature = (e, t) => {
|
|
|
1287
901
|
source: new VectorSource({
|
|
1288
902
|
features: [geoMarker]
|
|
1289
903
|
})
|
|
1290
|
-
}), (o = mapInstance$
|
|
904
|
+
}), (o = mapInstance$7.value) == null || o.addLayer(vectorLayer), moveFeatureHandler = (l) => moveFeature(l, t), startAnimation();
|
|
1291
905
|
}, renderPoint = (e) => {
|
|
1292
|
-
if (!mapInstance$
|
|
906
|
+
if (!mapInstance$7.value) return;
|
|
1293
907
|
const t = trackList$1.value || [];
|
|
1294
908
|
if (!(t && t.length > 1)) return [];
|
|
1295
|
-
const n = { 16: 24, 17: 15, default: 4 }, o = [],
|
|
1296
|
-
for (let c = 0; c <
|
|
909
|
+
const n = { 16: 24, 17: 15, default: 4 }, o = [], l = t.length;
|
|
910
|
+
for (let c = 0; c < l; c++) {
|
|
1297
911
|
t[c].index = c;
|
|
1298
|
-
const s = mapInstance$
|
|
912
|
+
const s = mapInstance$7.value.getPixelFromCoordinate(t[c].centerPoint);
|
|
1299
913
|
if (s) {
|
|
1300
914
|
let m = s.concat(s);
|
|
1301
915
|
m = adjustBounds(m, [20, 20]);
|
|
1302
|
-
const
|
|
1303
|
-
if (!
|
|
1304
|
-
if (
|
|
1305
|
-
const f = n[
|
|
916
|
+
const u = mapInstance$7.value.getView().getZoom();
|
|
917
|
+
if (!u) return;
|
|
918
|
+
if (u > 15) {
|
|
919
|
+
const f = n[u] || n.default;
|
|
1306
920
|
m = adjustBounds(m, [f, f]);
|
|
1307
921
|
}
|
|
1308
|
-
let
|
|
922
|
+
let d = !0;
|
|
1309
923
|
if (t[c].state !== "0") {
|
|
1310
924
|
for (let f = 0; f < o.length; f++)
|
|
1311
925
|
if (isOverlapping(m, o[f].bounds)) {
|
|
1312
|
-
|
|
926
|
+
d = !1;
|
|
1313
927
|
break;
|
|
1314
928
|
}
|
|
1315
929
|
}
|
|
1316
|
-
|
|
930
|
+
d && (t[c].bounds = m, o.push(t[c]));
|
|
1317
931
|
}
|
|
1318
932
|
}
|
|
1319
|
-
const r = getIconStyle(stopIcon),
|
|
933
|
+
const r = getIconStyle(stopIcon), i = getIconStyle(slowIcon);
|
|
1320
934
|
o.forEach((c, s) => {
|
|
1321
|
-
var
|
|
935
|
+
var d, f;
|
|
1322
936
|
const m = new Feature({
|
|
1323
937
|
geometry: new Point(c.centerPoint)
|
|
1324
938
|
});
|
|
@@ -1339,17 +953,17 @@ const moveFeature = (e, t) => {
|
|
|
1339
953
|
})
|
|
1340
954
|
})
|
|
1341
955
|
]), trackLineVectorSource.value.addFeature(m);
|
|
1342
|
-
const
|
|
956
|
+
const u = new Feature({
|
|
1343
957
|
geometry: new Point(fromLonLat(c.center))
|
|
1344
958
|
});
|
|
1345
|
-
if (
|
|
959
|
+
if (u.set("type", "track_label"), u.set("track_label_index", s), u.setStyle(
|
|
1346
960
|
setTrackLabelStyle(c, e)
|
|
1347
|
-
), trackLineVectorSource.value.addFeature(
|
|
961
|
+
), trackLineVectorSource.value.addFeature(u), typeof c == "object" && c.hasOwnProperty("state")) {
|
|
1348
962
|
const p = new Feature({
|
|
1349
963
|
geometry: new Point(c.centerPoint)
|
|
1350
964
|
});
|
|
1351
965
|
p.set("type", "track_icon");
|
|
1352
|
-
const
|
|
966
|
+
const w = new Style({
|
|
1353
967
|
text: new Text({
|
|
1354
968
|
font: "Normal 22px map-iconfont",
|
|
1355
969
|
text: getIconFont(dropletsIcon),
|
|
@@ -1357,79 +971,466 @@ const moveFeature = (e, t) => {
|
|
|
1357
971
|
}),
|
|
1358
972
|
zIndex: 99
|
|
1359
973
|
}), h = [];
|
|
1360
|
-
Number(c.state) === 0 ? ((
|
|
974
|
+
Number(c.state) === 0 ? ((d = w.getText()) == null || d.setFill(new Fill({ color: stopColor })), h.push(r)) : Number(c.state) === 1 && ((f = w.getText()) == null || f.setFill(new Fill({ color: slowColor })), h.push(i)), h.push(w), p.setStyle(h), trackLineVectorSource.value.addFeature(p);
|
|
975
|
+
}
|
|
976
|
+
}), renderArrow(o, e), renderIconPoint();
|
|
977
|
+
}, renderArrow = (e, t) => {
|
|
978
|
+
const n = e.length;
|
|
979
|
+
n || (e.push(trackList$1.value[0]), e.push(trackList$1.value[trackList$1.value.length - 1]));
|
|
980
|
+
for (let o = 0; o < n - 1; o++) {
|
|
981
|
+
let l;
|
|
982
|
+
const r = e[o], i = (e[o + 1].index + r.index) / 2;
|
|
983
|
+
if (i % 2 === 0)
|
|
984
|
+
l = trackList$1.value[i].centerPoint;
|
|
985
|
+
else {
|
|
986
|
+
const c = trackList$1.value[Math.floor(i)], s = trackList$1.value[Math.ceil(i)];
|
|
987
|
+
if (c && s) {
|
|
988
|
+
const [m, u] = c.centerPoint, [d, f] = s.centerPoint;
|
|
989
|
+
l = [(m + d) / 2, (u + f) / 2];
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
if (l) {
|
|
993
|
+
const c = new Feature({
|
|
994
|
+
geometry: new Point(l)
|
|
995
|
+
});
|
|
996
|
+
c.set("type", "track_arrow"), c.setStyle(
|
|
997
|
+
new Style({
|
|
998
|
+
text: new Text({
|
|
999
|
+
font: "700 14px map-iconfont",
|
|
1000
|
+
text: getIconFont(""),
|
|
1001
|
+
fill: new Fill({ color: t }),
|
|
1002
|
+
// 设置箭头旋转 角度转为弧度
|
|
1003
|
+
rotation: getRotation(
|
|
1004
|
+
e[o].center,
|
|
1005
|
+
e[o + 1].center
|
|
1006
|
+
) * (Math.PI / 180)
|
|
1007
|
+
})
|
|
1008
|
+
})
|
|
1009
|
+
), trackLineVectorSource.value.addFeature(c);
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
}, renderIconPoint = () => {
|
|
1013
|
+
const e = "", t = "#fcdc3f", n = "#ff0000";
|
|
1014
|
+
(trackList$1.value.length < 2 ? [trackList$1.value[0]] : [trackList$1.value[0], trackList$1.value[trackList$1.value.length - 1]]).forEach((l) => {
|
|
1015
|
+
const r = new Feature({
|
|
1016
|
+
geometry: new Point(l.centerPoint)
|
|
1017
|
+
});
|
|
1018
|
+
r.set("type", "track_begin"), r.set("data", l);
|
|
1019
|
+
const i = l.index === 0 && trackList$1.value.length >= 2 ? t : n;
|
|
1020
|
+
r.setStyle(
|
|
1021
|
+
new Style({
|
|
1022
|
+
text: new Text({
|
|
1023
|
+
font: "Normal 14px map-iconfont",
|
|
1024
|
+
text: getIconFont(e),
|
|
1025
|
+
fill: new Fill({ color: i })
|
|
1026
|
+
}),
|
|
1027
|
+
zIndex: 101
|
|
1028
|
+
})
|
|
1029
|
+
), trackLineVectorSource.value.addFeature(r);
|
|
1030
|
+
});
|
|
1031
|
+
}, setTrackLabelStyle = (e, t) => new Style({
|
|
1032
|
+
renderer: (n, o) => {
|
|
1033
|
+
const l = o.context, c = {
|
|
1034
|
+
id: e.id || "",
|
|
1035
|
+
center: n,
|
|
1036
|
+
text: e.time,
|
|
1037
|
+
color: t,
|
|
1038
|
+
textColor: "#000",
|
|
1039
|
+
bgColor: "rgba(255,255,255,.8)",
|
|
1040
|
+
selected: !0,
|
|
1041
|
+
type: "TrackTime"
|
|
1042
|
+
};
|
|
1043
|
+
drawLabel(l, c, trackLabels.value);
|
|
1044
|
+
}
|
|
1045
|
+
}), triangleModel = multiplyPixelRatio([
|
|
1046
|
+
[0, -8],
|
|
1047
|
+
[5, 8],
|
|
1048
|
+
[-5, 8]
|
|
1049
|
+
]), shipShapeModel = multiplyPixelRatio([
|
|
1050
|
+
[0, -4.545],
|
|
1051
|
+
[-0.56, -3.909],
|
|
1052
|
+
[-1, -2.727],
|
|
1053
|
+
[-1, 3.636],
|
|
1054
|
+
[-0.8, 4.545],
|
|
1055
|
+
[0.8, 4.545],
|
|
1056
|
+
[1, 3.636],
|
|
1057
|
+
[1, -2.727],
|
|
1058
|
+
[0.56, -3.909],
|
|
1059
|
+
[0, -4.545]
|
|
1060
|
+
]), shipDirectPath = {
|
|
1061
|
+
left: {
|
|
1062
|
+
0: [
|
|
1063
|
+
[0, 0],
|
|
1064
|
+
[0, -8],
|
|
1065
|
+
[-4, -8]
|
|
1066
|
+
],
|
|
1067
|
+
1: [
|
|
1068
|
+
[0, 0],
|
|
1069
|
+
[0, -16],
|
|
1070
|
+
[-6, -16]
|
|
1071
|
+
],
|
|
1072
|
+
2: [
|
|
1073
|
+
[0, 0],
|
|
1074
|
+
[0, -24],
|
|
1075
|
+
[-8, -24]
|
|
1076
|
+
]
|
|
1077
|
+
},
|
|
1078
|
+
right: {
|
|
1079
|
+
0: [
|
|
1080
|
+
[0, 0],
|
|
1081
|
+
[0, -8],
|
|
1082
|
+
[-4, -8]
|
|
1083
|
+
],
|
|
1084
|
+
1: [
|
|
1085
|
+
[0, 0],
|
|
1086
|
+
[0, -16],
|
|
1087
|
+
[-6, -16]
|
|
1088
|
+
],
|
|
1089
|
+
2: [
|
|
1090
|
+
[0, 0],
|
|
1091
|
+
[0, -24],
|
|
1092
|
+
[-8, -24]
|
|
1093
|
+
]
|
|
1094
|
+
},
|
|
1095
|
+
front: {
|
|
1096
|
+
0: [
|
|
1097
|
+
[0, 0],
|
|
1098
|
+
[0, -8]
|
|
1099
|
+
],
|
|
1100
|
+
1: [
|
|
1101
|
+
[0, 0],
|
|
1102
|
+
[0, -16]
|
|
1103
|
+
],
|
|
1104
|
+
2: [
|
|
1105
|
+
[0, 0],
|
|
1106
|
+
[0, -24]
|
|
1107
|
+
]
|
|
1108
|
+
}
|
|
1109
|
+
}, setBlankStyle = () => new Style({
|
|
1110
|
+
image: new CircleStyle({
|
|
1111
|
+
radius: 0
|
|
1112
|
+
})
|
|
1113
|
+
}), 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, t = !1) => new Style({
|
|
1114
|
+
renderer: (n, o) => {
|
|
1115
|
+
n = n;
|
|
1116
|
+
const l = o.context, r = o.feature.get("data");
|
|
1117
|
+
if (!r) return;
|
|
1118
|
+
o.feature.get("index") === 0 && (shipLabels.value = []);
|
|
1119
|
+
try {
|
|
1120
|
+
const c = drawShipBody(l, r, n, t);
|
|
1121
|
+
c && (drawHeading(l, r, c, t), r.selected = e, e && setTimeout(() => {
|
|
1122
|
+
drawSelectBounds(l, c);
|
|
1123
|
+
}, 1)), drawShipLabel(l, r, n);
|
|
1124
|
+
} catch {
|
|
1125
|
+
return !1;
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
}), drawShipBody = (e, t, n, o) => {
|
|
1129
|
+
if (!mapInstance$6.value) return;
|
|
1130
|
+
const l = Math.round(Number(mapInstance$6.value.getView().getZoom()));
|
|
1131
|
+
if (!l) return;
|
|
1132
|
+
let r = [];
|
|
1133
|
+
const [i, c] = drawShipModelByZoom[l] || [0, 0], [s, m] = n;
|
|
1134
|
+
if (l <= mapZoom.shipModelMax && l > mapZoom.shipModelMin && t.length >= i && t.breadth >= c)
|
|
1135
|
+
r = rotateShapeModel(drawCurrentShipShapeModel(t, l), t.angle).map((d) => {
|
|
1136
|
+
const [f, p] = d;
|
|
1137
|
+
return [s + f, m + p];
|
|
1138
|
+
});
|
|
1139
|
+
else {
|
|
1140
|
+
const u = rotateShapeModel(triangleModel, t.angle);
|
|
1141
|
+
n.length === 2 && (r = u.map((d) => {
|
|
1142
|
+
const [f, p] = d;
|
|
1143
|
+
return [s + f, m + p];
|
|
1144
|
+
}));
|
|
1145
|
+
}
|
|
1146
|
+
if (!(r.length > 2)) return !1;
|
|
1147
|
+
if (t != null && t.length) {
|
|
1148
|
+
const u = r.length === 3 ? 30 : t.length * 0.4;
|
|
1149
|
+
e.beginPath(), e.arc(
|
|
1150
|
+
n[0],
|
|
1151
|
+
n[1],
|
|
1152
|
+
u,
|
|
1153
|
+
0,
|
|
1154
|
+
2 * Math.PI
|
|
1155
|
+
), e.fillStyle = "rgba(255, 255, 255, 0.001)", e.fill();
|
|
1156
|
+
}
|
|
1157
|
+
e.save(), e.beginPath(), e.moveTo(r[0][0], r[0][1]);
|
|
1158
|
+
for (let u = 1; u < r.length; u++)
|
|
1159
|
+
e.lineTo(r[u][0], r[u][1]);
|
|
1160
|
+
return e.closePath(), e.strokeStyle = o ? "#ff0000" : "#000", e.lineWidth = o ? 2 : 1, e.stroke(), e.fillStyle = t.fill, e.fill(), e.restore(), r;
|
|
1161
|
+
}, drawHeading = (e, t, n, o) => {
|
|
1162
|
+
const [l, r] = n[0], i = getShipDirectPath(t);
|
|
1163
|
+
if (i) {
|
|
1164
|
+
const c = i.map(function(s) {
|
|
1165
|
+
const [m, u] = s;
|
|
1166
|
+
return [m + l, u + r];
|
|
1167
|
+
});
|
|
1168
|
+
if (e.save(), e.beginPath(), t.angle > 0) {
|
|
1169
|
+
e.translate(l, r);
|
|
1170
|
+
const s = t.angle * Math.PI / 180;
|
|
1171
|
+
e.rotate(s), e.translate(-l, -r);
|
|
1361
1172
|
}
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1173
|
+
e.moveTo(l, r);
|
|
1174
|
+
for (let s = 1; s < c.length; s++) {
|
|
1175
|
+
const [m, u] = c[s];
|
|
1176
|
+
e.lineTo(m, u);
|
|
1177
|
+
}
|
|
1178
|
+
e.strokeStyle = o ? "#ff0000" : "#000", e.lineWidth = o ? 2 : 1, e.stroke(), e.restore();
|
|
1179
|
+
}
|
|
1180
|
+
}, drawSelectBounds = (e, t) => {
|
|
1181
|
+
let [n, o, l, r] = getPixelFromCoordinate(t);
|
|
1182
|
+
const i = window.devicePixelRatio || 1, c = 4;
|
|
1183
|
+
n -= c, o -= c, l += c, r += c, e.save(), e.strokeStyle = "#ff0000", e.lineWidth = 4 * i;
|
|
1184
|
+
const s = 8 * i;
|
|
1185
|
+
e.beginPath(), e.moveTo(n + s, r), e.lineTo(n, r), e.lineTo(n, r - s), e.moveTo(n, o + s), e.lineTo(n, o), e.lineTo(n + s, o), e.moveTo(l - s, o), e.lineTo(l, o), e.lineTo(l, o + s), e.moveTo(l, r - s), e.lineTo(l, r), e.lineTo(l - s, r), e.stroke(), e.restore();
|
|
1186
|
+
}, drawShipLabel = (e, t, n) => {
|
|
1187
|
+
if (!t.selected && shipLabels.value.find((d) => d.name === t.name)) return;
|
|
1188
|
+
const [o, l] = n, r = o, i = l, c = t.name;
|
|
1189
|
+
let s;
|
|
1190
|
+
t.leftIconColor && (s = { color: t.leftIconColor, icon: "" });
|
|
1191
|
+
const m = getShipCustomIcon(t), u = {
|
|
1192
|
+
id: t.id,
|
|
1193
|
+
center: [r, i],
|
|
1194
|
+
text: c,
|
|
1195
|
+
fill: t.fill,
|
|
1196
|
+
color: "#fff",
|
|
1197
|
+
textColor: "#000",
|
|
1198
|
+
bgColor: "#fff",
|
|
1199
|
+
leftIcon: s,
|
|
1200
|
+
rightIcons: m,
|
|
1201
|
+
selected: t.selected,
|
|
1202
|
+
blinkColors: t.blinkColors,
|
|
1203
|
+
type: "ShipName"
|
|
1204
|
+
};
|
|
1205
|
+
drawLabel(e, u, shipLabels.value, mapInstance$6.value);
|
|
1206
|
+
}, drawCurrentShipShapeModel = (e, t) => {
|
|
1207
|
+
let n = 0;
|
|
1208
|
+
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);
|
|
1209
|
+
const o = e.length / 4 * n, l = e.breadth * n;
|
|
1210
|
+
let r = cloneDeep(shipShapeModel);
|
|
1211
|
+
return r = r.map(([i, c]) => [i * l, c * o]), r;
|
|
1212
|
+
}, getShipDirectPath = (e) => {
|
|
1213
|
+
const { speed: t, hdg: n, cog: o } = e;
|
|
1214
|
+
let l = "", r = null;
|
|
1215
|
+
if (t && t > 1 && (n !== null && n != 511 && o !== null ? o - n >= 3 ? l = "left" : o - n <= -3 ? l = "right" : l = "front" : l = "front", l && t))
|
|
1216
|
+
for (let i = 0; i < speedCondition.length; i++) {
|
|
1217
|
+
const c = speedCondition[i];
|
|
1218
|
+
if (t >= c[0] && t < c[1]) {
|
|
1219
|
+
r = shipDirectPath[l][i];
|
|
1220
|
+
break;
|
|
1376
1221
|
}
|
|
1377
1222
|
}
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1223
|
+
return r;
|
|
1224
|
+
}, getShipCustomIcon = (e) => {
|
|
1225
|
+
const t = [];
|
|
1226
|
+
return e.existDevice && t.push(""), e.existMobile && t.push(""), e.existWaterGauge && t.push(""), t || [];
|
|
1227
|
+
}, mapInstance$5 = ref(), renderShipSetInstance = (e) => mapInstance$5.value = e;
|
|
1228
|
+
let shipsMarkerList = [], shipsVectorSource, largeAmountShipsSource;
|
|
1229
|
+
const selectedShipData = ref(null), selectedShips = ref([]);
|
|
1230
|
+
let selectShipsVectorSource;
|
|
1231
|
+
const renderShips = (e) => {
|
|
1232
|
+
var n, o, l, r;
|
|
1233
|
+
if (!mapInstance$5.value || showTrackLayer.value) return;
|
|
1234
|
+
const t = Math.round(Number(mapInstance$5.value.getView().getZoom()));
|
|
1235
|
+
if (selectedShipData.value && nextTick(() => {
|
|
1236
|
+
selectSingleShipMarker(selectedShipData.value);
|
|
1237
|
+
}).then((i) => {
|
|
1238
|
+
}), !(!t || t < mapZoom.shipGreenDotMax) && (allShips.value = [...e, ...selectedShips.value], !hiddenOrther.value))
|
|
1239
|
+
return t >= mapZoom.shipGreenDotMax && t < mapZoom.shipModelMin ? ((n = shipsLayer.value) == null || n.setVisible(!1), (o = largeAmountShipsLayer.value) == null || o.setVisible(!0), renderLargeAmountShips(allShips.value)) : ((l = largeAmountShipsLayer.value) == null || l.setVisible(!1), (r = shipsLayer.value) == null || r.setVisible(!0), renderShipsMarker(allShips.value));
|
|
1240
|
+
}, renderLargeAmountShips = (e) => {
|
|
1241
|
+
if (!mapInstance$5.value) return;
|
|
1242
|
+
const t = e.map((n) => ({
|
|
1243
|
+
type: "Feature",
|
|
1244
|
+
geometry: {
|
|
1245
|
+
type: "Point",
|
|
1246
|
+
coordinates: [n.lon, n.lat]
|
|
1247
|
+
},
|
|
1248
|
+
properties: n
|
|
1249
|
+
}));
|
|
1250
|
+
return largeAmountShipsSource == null || largeAmountShipsSource.clear(), largeAmountShipsSource = new VectorSource({
|
|
1251
|
+
features: new GeoJSON().readFeatures({
|
|
1252
|
+
type: "FeatureCollection",
|
|
1253
|
+
features: t
|
|
1254
|
+
}, {
|
|
1255
|
+
featureProjection: projection.mercator
|
|
1256
|
+
})
|
|
1257
|
+
}), largeAmountShipsLayer.value = new WebGLPointsLayer({
|
|
1258
|
+
source: largeAmountShipsSource,
|
|
1259
|
+
style: {
|
|
1260
|
+
"shape-points": 3,
|
|
1261
|
+
"shape-radius": 9,
|
|
1262
|
+
"shape-fill-color": [
|
|
1263
|
+
"case",
|
|
1264
|
+
["==", ["get", "fill"], "#D9001C"],
|
|
1265
|
+
"#D9001C",
|
|
1266
|
+
// 如果 fill 是 #D9001C,返回红色
|
|
1267
|
+
["==", ["get", "fill"], "#04C900"],
|
|
1268
|
+
"#04C900",
|
|
1269
|
+
// 如果 fill 是 #04C900,返回绿色
|
|
1270
|
+
"#04C900"
|
|
1271
|
+
// 默认颜色(绿色)
|
|
1272
|
+
],
|
|
1273
|
+
"shape-rotate-with-view": !1,
|
|
1274
|
+
"shape-rotation": [
|
|
1275
|
+
"+",
|
|
1276
|
+
["get", "cog"],
|
|
1277
|
+
// 获取 'cog' 属性值
|
|
1278
|
+
180
|
|
1279
|
+
// 将值旋转 180 度
|
|
1280
|
+
],
|
|
1281
|
+
"shape-scale": [0.8, 1.2],
|
|
1282
|
+
"shape-stroke-color": "#000000",
|
|
1283
|
+
// 边框颜色为黑色
|
|
1284
|
+
"shape-stroke-width": 0.5
|
|
1285
|
+
// 边框宽度为0.5px
|
|
1286
|
+
}
|
|
1287
|
+
}), mapInstance$5.value.addLayer(largeAmountShipsLayer.value), largeAmountShipsLayer.value;
|
|
1288
|
+
}, renderShipsMarker = (e) => {
|
|
1289
|
+
var n;
|
|
1290
|
+
if (!mapInstance$5.value) return;
|
|
1291
|
+
deleteAllShipMarkers();
|
|
1292
|
+
let t = convertShipMapData(e);
|
|
1293
|
+
if (t = customFilterShips(t), !!(t != null && t.length))
|
|
1294
|
+
return t.forEach((o, l) => {
|
|
1295
|
+
const r = [o.lon, o.lat], i = new Feature({
|
|
1296
|
+
geometry: new Point(fromLonLat(r))
|
|
1297
|
+
}), c = 1;
|
|
1298
|
+
i.set("clickGeometry", new Circle(fromLonLat(r), c)), i.set("data", o), i.set("index", l), i.setStyle(
|
|
1299
|
+
setShipStyle(!1)
|
|
1300
|
+
), shipsMarkerList.push({
|
|
1301
|
+
ship: o,
|
|
1302
|
+
lonlat: r,
|
|
1303
|
+
feature: i
|
|
1381
1304
|
});
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1305
|
+
}), shipsVectorSource = new VectorSource({
|
|
1306
|
+
features: shipsMarkerList.map((o) => o.feature)
|
|
1307
|
+
}), shipsLayer.value = new VectorLayer({
|
|
1308
|
+
source: shipsVectorSource,
|
|
1309
|
+
zIndex: 100
|
|
1310
|
+
}), (n = mapInstance$5.value) == null || n.addLayer(shipsLayer.value), shipsLayer.value;
|
|
1311
|
+
}, onShipsMarkerHover = () => {
|
|
1312
|
+
var o;
|
|
1313
|
+
let e = null, t = 0;
|
|
1314
|
+
const n = 100;
|
|
1315
|
+
(o = mapInstance$5.value) == null || o.on("pointermove", function(l) {
|
|
1316
|
+
var s, m, u, d;
|
|
1317
|
+
const r = Date.now();
|
|
1318
|
+
if (r - t < n)
|
|
1319
|
+
return;
|
|
1320
|
+
t = r;
|
|
1321
|
+
const i = (s = mapInstance$5.value) == null ? void 0 : s.forEachFeatureAtPixel(l.pixel, (f) => f), c = (m = mapInstance$5.value) == null ? void 0 : m.getTargetElement();
|
|
1322
|
+
if (c && (c.style.cursor = i ? "pointer" : ""), e !== i) {
|
|
1323
|
+
if (e) {
|
|
1324
|
+
const f = e.get("data");
|
|
1325
|
+
if (!(f != null && f.mmsi)) return;
|
|
1326
|
+
e.setStyle(
|
|
1327
|
+
setShipStyle(((u = selectedShipData.value) == null ? void 0 : u.id) === f.id, !1)
|
|
1328
|
+
);
|
|
1329
|
+
}
|
|
1330
|
+
if (i) {
|
|
1331
|
+
const f = i.get("data");
|
|
1332
|
+
if (!(f != null && f.mmsi)) return;
|
|
1333
|
+
e = i, i.setStyle(
|
|
1334
|
+
setShipStyle(((d = selectedShipData.value) == null ? void 0 : d.id) === f.id, !0)
|
|
1335
|
+
);
|
|
1336
|
+
} else
|
|
1337
|
+
e = null;
|
|
1396
1338
|
}
|
|
1397
|
-
}
|
|
1398
|
-
}, renderIconPoint = () => {
|
|
1399
|
-
const e = "", t = "#fcdc3f", n = "#ff0000";
|
|
1400
|
-
(trackList$1.value.length < 2 ? [trackList$1.value[0]] : [trackList$1.value[0], trackList$1.value[trackList$1.value.length - 1]]).forEach((i) => {
|
|
1401
|
-
const r = new Feature({
|
|
1402
|
-
geometry: new Point(i.centerPoint)
|
|
1403
|
-
});
|
|
1404
|
-
r.set("type", "track_begin"), r.set("data", i);
|
|
1405
|
-
const l = i.index === 0 && trackList$1.value.length >= 2 ? t : n;
|
|
1406
|
-
r.setStyle(
|
|
1407
|
-
new Style({
|
|
1408
|
-
text: new Text({
|
|
1409
|
-
font: "Normal 14px map-iconfont",
|
|
1410
|
-
text: getIconFont(e),
|
|
1411
|
-
fill: new Fill({ color: l })
|
|
1412
|
-
}),
|
|
1413
|
-
zIndex: 101
|
|
1414
|
-
})
|
|
1415
|
-
), trackLineVectorSource.value.addFeature(r);
|
|
1416
1339
|
});
|
|
1417
|
-
},
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1340
|
+
}, customFilterShips = (e) => {
|
|
1341
|
+
let t = cloneDeep(e);
|
|
1342
|
+
return t = t.filter((n) => {
|
|
1343
|
+
var l;
|
|
1344
|
+
const o = getFilterItem(n).every(({ btnShow: r, value: i }) => r ? !!i : !0);
|
|
1345
|
+
return (switchBtnShow.value.camera || switchBtnShow.value.mobile || switchBtnShow.value.waterGauge) && ((l = selectedShipData.value) == null ? void 0 : l.id) === n.id && clearSelectFeature(), o;
|
|
1346
|
+
}), t;
|
|
1347
|
+
}, getFilterItem = (e) => [
|
|
1348
|
+
{ btnShow: switchBtnShow.value.camera, value: e == null ? void 0 : e.existDevice },
|
|
1349
|
+
{ btnShow: switchBtnShow.value.mobile, value: e == null ? void 0 : e.existMobile },
|
|
1350
|
+
{ btnShow: switchBtnShow.value.waterGauge, value: e == null ? void 0 : e.existWaterGauge }
|
|
1351
|
+
], deleteAllShipMarkers = () => {
|
|
1352
|
+
shipsMarkerList.forEach((e) => {
|
|
1353
|
+
e.feature && (shipsVectorSource == null || shipsVectorSource.removeFeature(e.feature));
|
|
1354
|
+
}), clearAllInterval(), shipsMarkerList = [];
|
|
1355
|
+
}, selectSingleShipMarker = (e) => {
|
|
1356
|
+
var r;
|
|
1357
|
+
if (!mapInstance$5.value) return;
|
|
1358
|
+
const t = cloneDeep(selectSingleShipData.value);
|
|
1359
|
+
selectSingleShipData.value = convertShipMapData(e);
|
|
1360
|
+
const n = [selectSingleShipData.value.lon, selectSingleShipData.value.lat], o = new Feature({
|
|
1361
|
+
geometry: new Point(fromLonLat(n))
|
|
1362
|
+
});
|
|
1363
|
+
o.set("data", selectSingleShipData.value), o.setStyle(
|
|
1364
|
+
setShipStyle(!0)
|
|
1365
|
+
), shipsMarkerList.push({
|
|
1366
|
+
ship: selectSingleShipData.value,
|
|
1367
|
+
lonlat: n,
|
|
1368
|
+
feature: o
|
|
1369
|
+
}), selectShipsVectorSource == null || selectShipsVectorSource.clear(), selectShipsVectorSource = new VectorSource({
|
|
1370
|
+
features: [o]
|
|
1371
|
+
}), selectShipsLayer.value = new VectorLayer({
|
|
1372
|
+
source: selectShipsVectorSource
|
|
1373
|
+
}), shipsVectorSource && setVisibleFeatureById(shipsVectorSource, selectSingleShipData.value.id, !0);
|
|
1374
|
+
const l = (r = shipsLayer.value) == null ? void 0 : r.getSource();
|
|
1375
|
+
return l && (t && setVisibleFeatureById(l, t.id, !0), setVisibleFeatureById(l, selectSingleShipData.value.id, !1)), mapInstance$5.value.addLayer(selectShipsLayer.value), selectShipsLayer.value.setVisible(!0), selectShipsLayer.value;
|
|
1376
|
+
}, setVisibleFeatureById = (e, t, n) => {
|
|
1377
|
+
e && e.forEachFeature((o) => {
|
|
1378
|
+
const l = o.get("data");
|
|
1379
|
+
l && l.id === t && o.setStyle(n ? setShipStyle(!1, l.id) : setBlankStyle());
|
|
1380
|
+
});
|
|
1381
|
+
}, findShip = (e, t, n = !0) => {
|
|
1382
|
+
var l, r, i, c, s;
|
|
1383
|
+
if (!e || !mapInstance$5.value) return;
|
|
1384
|
+
const o = (i = (r = (l = shipsLayer.value) == null ? void 0 : l.getSource()) == null ? void 0 : r.getFeatures()) == null ? void 0 : i.find((m) => {
|
|
1385
|
+
var u;
|
|
1386
|
+
return ((u = m.get("data")) == null ? void 0 : u.id) === e;
|
|
1387
|
+
});
|
|
1388
|
+
if (o)
|
|
1389
|
+
selectedShipData.value = o.get("data");
|
|
1390
|
+
else if (t && t.lon && t.lat)
|
|
1391
|
+
selectedShipData.value = t;
|
|
1392
|
+
else {
|
|
1393
|
+
console.error("找不到船舶");
|
|
1394
|
+
return;
|
|
1395
|
+
}
|
|
1396
|
+
if (selectedShips.value.some((m) => {
|
|
1397
|
+
var u;
|
|
1398
|
+
return m.id === ((u = selectedShipData.value) == null ? void 0 : u.id);
|
|
1399
|
+
}) || selectedShips.value.push(selectedShipData.value), n && ((c = selectedShipData.value) != null && c.lon) && ((s = selectedShipData.value) != null && s.lat)) {
|
|
1400
|
+
const m = mapInstance$5.value.getView(), u = new Point([selectedShipData.value.lon, selectedShipData.value.lat]);
|
|
1401
|
+
m.setCenter(transform(u.getCoordinates(), projection.data, projection.mercator));
|
|
1402
|
+
const d = m.getZoom(), f = d < mapZoom.findShipMin ? mapZoom.findShip : d;
|
|
1403
|
+
m.setZoom(f);
|
|
1404
|
+
}
|
|
1405
|
+
return setTimeout(() => {
|
|
1406
|
+
t && selectSingleShipMarker(t);
|
|
1407
|
+
}, 50), o;
|
|
1408
|
+
}, clearSelectFeature = () => {
|
|
1409
|
+
var e;
|
|
1410
|
+
if (selectedShipData.value && shipsVectorSource && selectSingleShipData.value) {
|
|
1411
|
+
setVisibleFeatureById(shipsVectorSource, selectSingleShipData.value.id, !1);
|
|
1412
|
+
const t = (e = shipsLayer.value) == null ? void 0 : e.getSource();
|
|
1413
|
+
t && setVisibleFeatureById(t, selectSingleShipData.value.id, !0);
|
|
1430
1414
|
}
|
|
1431
|
-
|
|
1432
|
-
|
|
1415
|
+
selectedShipData.value = null, mapInstance$5.value && (selectShipsVectorSource == null || selectShipsVectorSource.clear(), selectShipsLayer.value = new VectorLayer({
|
|
1416
|
+
source: selectShipsVectorSource
|
|
1417
|
+
}), mapInstance$5.value.addLayer(selectShipsLayer.value), selectShipsLayer.value.setVisible(!1));
|
|
1418
|
+
}, hiddenAllShips = () => {
|
|
1419
|
+
var e, t;
|
|
1420
|
+
(e = shipsLayer.value) == null || e.setVisible(!1), (t = largeAmountShipsLayer.value) == null || t.setVisible(!1);
|
|
1421
|
+
}, switchBtnShow = ref({
|
|
1422
|
+
// 船舶摄像头过滤开关
|
|
1423
|
+
[SWITCH_BTN.Camera]: !1,
|
|
1424
|
+
// 船舶联系方式过滤开关
|
|
1425
|
+
[SWITCH_BTN.Mobile]: !1,
|
|
1426
|
+
// 船舶水尺过滤开关
|
|
1427
|
+
[SWITCH_BTN.WaterGauge]: !1
|
|
1428
|
+
}), switchFilterItem = (e, t) => {
|
|
1429
|
+
switchBtnShow.value[e] = t, renderShips(allShips.value);
|
|
1430
|
+
}, rerenderShip = () => {
|
|
1431
|
+
renderShips(allShips.value);
|
|
1432
|
+
}, mapInstance$4 = ref(), renderCustomOverlaySetInstance = (e) => mapInstance$4.value = e, drawCustomContent = (e, t, n, o = "top-left", l = !1) => {
|
|
1433
|
+
var u, d;
|
|
1433
1434
|
if (!t || !mapInstance$4.value) return;
|
|
1434
1435
|
document.querySelectorAll(".truck-custom-content").forEach((f) => {
|
|
1435
1436
|
var p;
|
|
@@ -1437,64 +1438,64 @@ const moveFeature = (e, t) => {
|
|
|
1437
1438
|
});
|
|
1438
1439
|
const r = document.createElement("div");
|
|
1439
1440
|
r.innerHTML = n;
|
|
1440
|
-
const
|
|
1441
|
+
const i = new Overlay({
|
|
1441
1442
|
element: r,
|
|
1442
1443
|
position: t,
|
|
1443
1444
|
// 初始位置
|
|
1444
1445
|
positioning: o,
|
|
1445
|
-
stopEvent:
|
|
1446
|
+
stopEvent: l
|
|
1446
1447
|
// 设置不阻拦事件
|
|
1447
1448
|
});
|
|
1448
|
-
if (
|
|
1449
|
-
let f = !1, p = [0, 0],
|
|
1450
|
-
r.addEventListener("mousedown", function(
|
|
1449
|
+
if (l) {
|
|
1450
|
+
let f = !1, p = [0, 0], w = [0, 0], h = 0, v = 0;
|
|
1451
|
+
r.addEventListener("mousedown", function(L) {
|
|
1451
1452
|
var I;
|
|
1452
|
-
f = !0, h =
|
|
1453
|
-
const T = (I = mapInstance$4.value) == null ? void 0 : I.getCoordinateFromPixel([
|
|
1454
|
-
T && (p = T),
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
],
|
|
1458
|
-
}), document.addEventListener("mousemove", function(
|
|
1453
|
+
f = !0, h = L.clientX, v = L.clientY;
|
|
1454
|
+
const T = (I = mapInstance$4.value) == null ? void 0 : I.getCoordinateFromPixel([L.clientX - 200, L.clientY - 200]);
|
|
1455
|
+
T && (p = T), w = [
|
|
1456
|
+
L.clientX - r.getBoundingClientRect().left + 160,
|
|
1457
|
+
L.clientY - r.getBoundingClientRect().top + 84
|
|
1458
|
+
], L.preventDefault(), console.log(e, h, v);
|
|
1459
|
+
}), document.addEventListener("mousemove", function(L) {
|
|
1459
1460
|
var T;
|
|
1460
1461
|
if (f) {
|
|
1461
|
-
const I = (T = mapInstance$4.value) == null ? void 0 : T.getCoordinateFromPixel([
|
|
1462
|
-
|
|
1462
|
+
const I = (T = mapInstance$4.value) == null ? void 0 : T.getCoordinateFromPixel([L.clientX - w[0], L.clientY - w[1]]), V = I[0] - p[0], x = I[1] - p[1];
|
|
1463
|
+
i.setPosition([p[0] + V, p[1] + x]);
|
|
1463
1464
|
}
|
|
1464
1465
|
}), document.addEventListener("mouseup", function() {
|
|
1465
1466
|
f = !1;
|
|
1466
1467
|
});
|
|
1467
1468
|
}
|
|
1468
|
-
(
|
|
1469
|
+
(u = mapInstance$4.value) == null || u.addOverlay(i);
|
|
1469
1470
|
const c = r.querySelector(".close-button");
|
|
1470
1471
|
c && c.addEventListener("click", () => {
|
|
1471
1472
|
var f, p;
|
|
1472
|
-
(f = mapInstance$4.value) == null || f.removeOverlay(
|
|
1473
|
+
(f = mapInstance$4.value) == null || f.removeOverlay(i), (p = r.parentNode) == null || p.removeChild(r);
|
|
1473
1474
|
});
|
|
1474
|
-
const s = JSON.parse(JSON.stringify(t)), m = (
|
|
1475
|
-
return
|
|
1475
|
+
const s = JSON.parse(JSON.stringify(t)), m = (d = mapInstance$4.value) == null ? void 0 : d.getCoordinateFromPixel(s);
|
|
1476
|
+
return i.setPosition(m), i;
|
|
1476
1477
|
}, mapInstance$3 = ref(), renderTrackSetInstance = (e) => mapInstance$3.value = e, showTracks = ref([]), trackList = ref([]);
|
|
1477
1478
|
ref(null);
|
|
1478
|
-
const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o,
|
|
1479
|
-
var
|
|
1480
|
-
if (console.log(
|
|
1479
|
+
const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, l = "ship") => {
|
|
1480
|
+
var u;
|
|
1481
|
+
if (console.log(l), nextTick(() => {
|
|
1481
1482
|
hiddenAllShips();
|
|
1482
|
-
}).then((
|
|
1483
|
+
}).then((d) => {
|
|
1483
1484
|
}), (t == null ? void 0 : t.length) < 2) {
|
|
1484
|
-
((
|
|
1485
|
+
((u = showTracks.value) == null ? void 0 : u.findIndex((d) => d.id === e)) < 0 && showTracks.value.push({ id: e, length: "" });
|
|
1485
1486
|
return;
|
|
1486
1487
|
}
|
|
1487
1488
|
const r = {};
|
|
1488
|
-
t.forEach((
|
|
1489
|
-
|
|
1489
|
+
t.forEach((d) => {
|
|
1490
|
+
d.state ? d.state = Number(d.state) : delete d.state;
|
|
1490
1491
|
}), trackId.value = e, r[e] = t, trackList.value = t;
|
|
1491
|
-
const
|
|
1492
|
-
(
|
|
1492
|
+
const i = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], c = r[e].map(
|
|
1493
|
+
(d) => transform([d.lon, d.lat], projection.data, projection.mercator)
|
|
1493
1494
|
), s = new LineString(c), m = formatUtils.formatLength(s, o) || "--";
|
|
1494
1495
|
nextTick(() => {
|
|
1495
1496
|
var f, p;
|
|
1496
|
-
const
|
|
1497
|
-
|
|
1497
|
+
const d = (f = showTracks.value) == null ? void 0 : f.findIndex((w) => w.id === e);
|
|
1498
|
+
d < 0 ? showTracks.value.push({ id: e, length: m }) : showTracks.value[d].length = m, ++cursor.value, cursor.value > i.length && (cursor.value = 0), renderTrackLine(r, e, n), nextTick(() => {
|
|
1498
1499
|
resetTrackView(e);
|
|
1499
1500
|
}).then(() => {
|
|
1500
1501
|
}), (p = mapInstance$3.value) == null || p.on("moveend", () => {
|
|
@@ -1506,8 +1507,8 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
|
|
|
1506
1507
|
var t;
|
|
1507
1508
|
const e = ref(null);
|
|
1508
1509
|
(t = mapInstance$3.value) == null || t.on("pointermove", (n) => {
|
|
1509
|
-
var
|
|
1510
|
-
e.value && ((
|
|
1510
|
+
var l, r, i, c;
|
|
1511
|
+
e.value && ((l = mapInstance$3.value) == null || l.removeOverlay(e.value));
|
|
1511
1512
|
const o = (r = mapInstance$3.value) == null ? void 0 : r.forEachFeatureAtPixel(n.pixel, (s) => s);
|
|
1512
1513
|
if (o) {
|
|
1513
1514
|
const s = o.get("data");
|
|
@@ -1519,7 +1520,7 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
|
|
|
1519
1520
|
<div class="item-item">${formatMinutesToDDHHMM(Number(s.stayTime))}</div>
|
|
1520
1521
|
</div>
|
|
1521
1522
|
`);
|
|
1522
|
-
const
|
|
1523
|
+
const u = `
|
|
1523
1524
|
<div class="track-point-popup">
|
|
1524
1525
|
<div class="item">
|
|
1525
1526
|
<div class="item-label">状态</div>
|
|
@@ -1550,9 +1551,9 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
|
|
|
1550
1551
|
<div class="item-item">${s.time}</div>
|
|
1551
1552
|
</div>
|
|
1552
1553
|
${m ?? m}
|
|
1553
|
-
</div>`,
|
|
1554
|
-
if (
|
|
1555
|
-
const f = drawCustomContent(s.time,
|
|
1554
|
+
</div>`, d = (i = mapInstance$3.value) == null ? void 0 : i.getPixelFromCoordinate(n.coordinate);
|
|
1555
|
+
if (d) {
|
|
1556
|
+
const f = drawCustomContent(s.time, d, u, "top-left");
|
|
1556
1557
|
f && (e.value = f);
|
|
1557
1558
|
}
|
|
1558
1559
|
} else
|
|
@@ -1564,10 +1565,10 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
|
|
|
1564
1565
|
}, playTrack = (e, t) => {
|
|
1565
1566
|
handlePlay(String(e), t);
|
|
1566
1567
|
}, resetTrackView = (e) => {
|
|
1567
|
-
var
|
|
1568
|
+
var l;
|
|
1568
1569
|
const t = mapInstance$3.value.getView(), n = e ? shipTrackLineFeatures.value.find((r) => r.getId() === e) : shipTrackLineFeatures.value[0];
|
|
1569
1570
|
if (!n) return;
|
|
1570
|
-
const o = (
|
|
1571
|
+
const o = (l = n == null ? void 0 : n.getGeometry()) == null ? void 0 : l.getExtent();
|
|
1571
1572
|
if (o != null && o.length)
|
|
1572
1573
|
try {
|
|
1573
1574
|
const r = buffer(o, Math.max(o[2] - o[0], o[3] - o[1]) * 0.02);
|
|
@@ -1576,8 +1577,8 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
|
|
|
1576
1577
|
console.log(r);
|
|
1577
1578
|
}
|
|
1578
1579
|
}, formatMinutesToDDHHMM = (e) => {
|
|
1579
|
-
const t = hooks.duration(e, "minutes"), n = Math.floor(t.asDays()), o = t.hours(),
|
|
1580
|
-
let r = `${String(
|
|
1580
|
+
const t = hooks.duration(e, "minutes"), n = Math.floor(t.asDays()), o = t.hours(), l = t.minutes();
|
|
1581
|
+
let r = `${String(l).padStart(2, "0")}分`;
|
|
1581
1582
|
return o !== 0 && (r = `${String(o).padStart(2, "0")}时${r}`), n !== 0 && (r = `${String(n).padStart(2, "0")}天${r}`), r;
|
|
1582
1583
|
}, _hoisted_1$3 = {
|
|
1583
1584
|
key: 0,
|
|
@@ -1593,28 +1594,28 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
|
|
|
1593
1594
|
},
|
|
1594
1595
|
emits: ["switchGreenDot", "switchMapTile"],
|
|
1595
1596
|
setup(e, { emit: t }) {
|
|
1596
|
-
var p,
|
|
1597
|
-
const n = inject("mapInstance"), o = e,
|
|
1598
|
-
o.disableGreenDot || r.value >= mapZoom.shipGreenDotMax || (s.value = !s.value,
|
|
1599
|
-
}, d = () => {
|
|
1600
|
-
i("switchMapTile", o.mapTileMode === BaseMapType.vector ? BaseMapType.satellite : BaseMapType.vector);
|
|
1597
|
+
var p, w;
|
|
1598
|
+
const n = inject("mapInstance"), o = e, l = t, r = ref(((w = (p = n == null ? void 0 : n.value) == null ? void 0 : p.getView()) == null ? void 0 : w.getZoom()) || mapZoom.default), i = ref(!1), c = ref(null), s = ref(!0), m = () => {
|
|
1599
|
+
o.disableGreenDot || r.value >= mapZoom.shipGreenDotMax || (s.value = !s.value, l("switchGreenDot", s.value));
|
|
1601
1600
|
}, u = () => {
|
|
1602
|
-
|
|
1603
|
-
|
|
1601
|
+
l("switchMapTile", o.mapTileMode === BaseMapType.vector ? BaseMapType.satellite : BaseMapType.vector);
|
|
1602
|
+
}, d = () => {
|
|
1603
|
+
var h, v;
|
|
1604
|
+
i.value ? (showMeasure.value = !1, (h = c.value) == null || h.removeInteraction()) : (showMeasure.value = !0, (v = c.value) == null || v.addInteraction()), i.value = !i.value;
|
|
1604
1605
|
}, f = () => {
|
|
1605
1606
|
var h;
|
|
1606
|
-
(h = c.value) == null || h.removeInteraction(),
|
|
1607
|
+
(h = c.value) == null || h.removeInteraction(), i.value = !1;
|
|
1607
1608
|
};
|
|
1608
1609
|
return onMounted(() => {
|
|
1609
1610
|
nextTick(() => {
|
|
1610
1611
|
var h;
|
|
1611
1612
|
(h = n == null ? void 0 : n.value) == null || h.on("moveend", () => {
|
|
1612
|
-
var
|
|
1613
|
-
const
|
|
1614
|
-
|
|
1613
|
+
var L, T;
|
|
1614
|
+
const v = (T = (L = n == null ? void 0 : n.value) == null ? void 0 : L.getView()) == null ? void 0 : T.getZoom();
|
|
1615
|
+
v && (r.value = v);
|
|
1615
1616
|
});
|
|
1616
1617
|
});
|
|
1617
|
-
}), (h,
|
|
1618
|
+
}), (h, v) => (openBlock(), createElementBlock(Fragment, null, [
|
|
1618
1619
|
createElementVNode("div", {
|
|
1619
1620
|
class: normalizeClass(`tool-panel ${h.viewMode}`)
|
|
1620
1621
|
}, [
|
|
@@ -1622,9 +1623,9 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
|
|
|
1622
1623
|
createElementVNode("div", _hoisted_2$1, [
|
|
1623
1624
|
h.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
|
|
1624
1625
|
key: 0,
|
|
1625
|
-
class: normalizeClass(["switch-btn", `${
|
|
1626
|
-
onClick:
|
|
1627
|
-
},
|
|
1626
|
+
class: normalizeClass(["switch-btn", `${i.value && "active"}`]),
|
|
1627
|
+
onClick: d
|
|
1628
|
+
}, v[5] || (v[5] = [
|
|
1628
1629
|
createElementVNode("i", { class: "map-iconfont icon-measure" }, null, -1),
|
|
1629
1630
|
createElementVNode("div", { class: "button-text" }, "测距", -1)
|
|
1630
1631
|
]), 2)) : createCommentVNode("", !0),
|
|
@@ -1632,38 +1633,38 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
|
|
|
1632
1633
|
key: 1,
|
|
1633
1634
|
class: normalizeClass(`switch-btn ${s.value && "active"} ${(h.disableGreenDot || r.value >= unref(mapZoom).shipGreenDotMax) && "disabled"}`),
|
|
1634
1635
|
onClick: m
|
|
1635
|
-
},
|
|
1636
|
+
}, v[6] || (v[6] = [
|
|
1636
1637
|
createElementVNode("i", { class: "map-iconfont icon-ship" }, null, -1),
|
|
1637
1638
|
createElementVNode("div", { class: "button-text" }, "绿点", -1)
|
|
1638
1639
|
]), 2)) : createCommentVNode("", !0),
|
|
1639
1640
|
h.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
|
|
1640
1641
|
key: 2,
|
|
1641
1642
|
class: normalizeClass(`switch-btn ${h.mapTileMode === unref(BaseMapType).satellite && "active"}`),
|
|
1642
|
-
onClick:
|
|
1643
|
-
},
|
|
1643
|
+
onClick: v[0] || (v[0] = (L) => u())
|
|
1644
|
+
}, v[7] || (v[7] = [
|
|
1644
1645
|
createElementVNode("i", { class: "map-iconfont icon-space" }, null, -1),
|
|
1645
1646
|
createElementVNode("div", { class: "button-text" }, "图层", -1)
|
|
1646
1647
|
]), 2)) : createCommentVNode("", !0),
|
|
1647
1648
|
h.vehicleMode === "truck" ? (openBlock(), createElementBlock("div", {
|
|
1648
1649
|
key: 3,
|
|
1649
1650
|
class: normalizeClass(`switch-btn ${h.mapTileMode === unref(BaseMapType).satellite && "active"}`),
|
|
1650
|
-
onClick:
|
|
1651
|
-
},
|
|
1651
|
+
onClick: v[1] || (v[1] = (L) => u())
|
|
1652
|
+
}, v[8] || (v[8] = [
|
|
1652
1653
|
createElementVNode("i", { class: "map-iconfont icon-space" }, null, -1),
|
|
1653
1654
|
createElementVNode("div", { class: "button-text" }, "卫星", -1)
|
|
1654
1655
|
]), 2)) : createCommentVNode("", !0),
|
|
1655
1656
|
h.showTrackLayer ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
|
|
1656
1657
|
createElementVNode("div", {
|
|
1657
1658
|
class: "switch-btn multiple",
|
|
1658
|
-
onClick:
|
|
1659
|
-
},
|
|
1659
|
+
onClick: v[2] || (v[2] = (L) => unref(playTrack)(unref(currentTrackId), 1))
|
|
1660
|
+
}, v[9] || (v[9] = [
|
|
1660
1661
|
createElementVNode("i", { class: "map-iconfont icon-play" }, null, -1),
|
|
1661
1662
|
createElementVNode("div", { class: "button-text" }, "播放轨迹", -1)
|
|
1662
1663
|
])),
|
|
1663
1664
|
createElementVNode("div", {
|
|
1664
1665
|
class: "switch-btn multiple",
|
|
1665
|
-
onClick:
|
|
1666
|
-
},
|
|
1666
|
+
onClick: v[3] || (v[3] = (L) => unref(resetTrackView)())
|
|
1667
|
+
}, v[10] || (v[10] = [
|
|
1667
1668
|
createElementVNode("i", { class: "map-iconfont icon-center" }, null, -1),
|
|
1668
1669
|
createElementVNode("div", { class: "button-text" }, "轨迹居中", -1)
|
|
1669
1670
|
]))
|
|
@@ -1673,9 +1674,9 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
|
|
|
1673
1674
|
])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
1674
1675
|
h.vehicleMode === "ship" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
1675
1676
|
createElementVNode("div", {
|
|
1676
|
-
class: normalizeClass(["switch-btn", `${
|
|
1677
|
-
onClick:
|
|
1678
|
-
},
|
|
1677
|
+
class: normalizeClass(["switch-btn", `${i.value && "active"}`]),
|
|
1678
|
+
onClick: d
|
|
1679
|
+
}, v[11] || (v[11] = [
|
|
1679
1680
|
createElementVNode("i", { class: "map-iconfont icon-measure" }, null, -1),
|
|
1680
1681
|
createElementVNode("div", { class: "button-text" }, "测距", -1)
|
|
1681
1682
|
]), 2),
|
|
@@ -1683,27 +1684,27 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
|
|
|
1683
1684
|
key: 0,
|
|
1684
1685
|
class: normalizeClass(`switch-btn ${s.value && "active"} ${(h.disableGreenDot || r.value >= unref(mapZoom).shipGreenDotMax) && "disabled"}`),
|
|
1685
1686
|
onClick: m
|
|
1686
|
-
},
|
|
1687
|
+
}, v[12] || (v[12] = [
|
|
1687
1688
|
createElementVNode("i", { class: "map-iconfont icon-ship" }, null, -1),
|
|
1688
1689
|
createElementVNode("div", { class: "button-text" }, "绿点", -1)
|
|
1689
1690
|
]), 2)) : createCommentVNode("", !0)
|
|
1690
1691
|
], 64)) : createCommentVNode("", !0),
|
|
1691
1692
|
createElementVNode("div", {
|
|
1692
1693
|
class: normalizeClass(["switch-btn", { active: h.mapTileMode === unref(BaseMapType).satellite }]),
|
|
1693
|
-
onClick:
|
|
1694
|
-
},
|
|
1694
|
+
onClick: u
|
|
1695
|
+
}, v[13] || (v[13] = [
|
|
1695
1696
|
createElementVNode("i", { class: "map-iconfont icon-space" }, null, -1),
|
|
1696
1697
|
createElementVNode("div", { class: "button-text" }, "卫星", -1)
|
|
1697
1698
|
]), 2)
|
|
1698
1699
|
], 64))
|
|
1699
1700
|
], 2),
|
|
1700
1701
|
createElementVNode("div", _hoisted_3, [
|
|
1701
|
-
|
|
1702
|
+
i.value ? (openBlock(), createBlock(Measure, {
|
|
1702
1703
|
key: 0,
|
|
1703
1704
|
ref_key: "measureRef",
|
|
1704
1705
|
ref: c,
|
|
1705
|
-
visible:
|
|
1706
|
-
"onUpdate:visible":
|
|
1706
|
+
visible: i.value,
|
|
1707
|
+
"onUpdate:visible": v[4] || (v[4] = (L) => i.value = L),
|
|
1707
1708
|
onClose: f,
|
|
1708
1709
|
"view-mode": h.viewMode
|
|
1709
1710
|
}, null, 8, ["visible", "view-mode"])) : createCommentVNode("", !0)
|
|
@@ -1715,15 +1716,15 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
|
|
|
1715
1716
|
setup(e, { expose: t }) {
|
|
1716
1717
|
const n = inject("mapInstance");
|
|
1717
1718
|
return t({
|
|
1718
|
-
setScaleLine: (
|
|
1719
|
+
setScaleLine: (l) => {
|
|
1719
1720
|
var c;
|
|
1720
|
-
|
|
1721
|
+
l || (l = "metric");
|
|
1721
1722
|
const r = new ScaleLine$1({
|
|
1722
|
-
units:
|
|
1723
|
-
}),
|
|
1724
|
-
|
|
1723
|
+
units: l
|
|
1724
|
+
}), i = document.getElementById("scale-line-container");
|
|
1725
|
+
i && (r.setTarget(i), (c = n == null ? void 0 : n.value) == null || c.addControl(r));
|
|
1725
1726
|
}
|
|
1726
|
-
}), (
|
|
1727
|
+
}), (l, r) => (openBlock(), createElementBlock("div", _hoisted_1$2));
|
|
1727
1728
|
}
|
|
1728
1729
|
}), ScaleLine = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-d666f80d"]]), _hoisted_1$1 = { class: "zoom" }, _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
1729
1730
|
__name: "zoomControl",
|
|
@@ -1735,14 +1736,14 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
|
|
|
1735
1736
|
setup(e) {
|
|
1736
1737
|
const t = inject("mapInstance"), n = () => {
|
|
1737
1738
|
if (!t.value) return;
|
|
1738
|
-
const
|
|
1739
|
-
r &&
|
|
1739
|
+
const l = t.value.getView(), r = l.getZoom();
|
|
1740
|
+
r && l.setZoom(r + 1);
|
|
1740
1741
|
}, o = () => {
|
|
1741
1742
|
if (!t.value) return;
|
|
1742
|
-
const
|
|
1743
|
-
r &&
|
|
1743
|
+
const l = t.value.getView(), r = l.getZoom();
|
|
1744
|
+
r && l.setZoom(r - 1);
|
|
1744
1745
|
};
|
|
1745
|
-
return (
|
|
1746
|
+
return (l, r) => (openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
1746
1747
|
createElementVNode("div", {
|
|
1747
1748
|
onClick: n,
|
|
1748
1749
|
class: "button big-button"
|
|
@@ -1761,10 +1762,10 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, i = "ship")
|
|
|
1761
1762
|
},
|
|
1762
1763
|
setup(e) {
|
|
1763
1764
|
useCssVars((r) => ({
|
|
1764
|
-
ae2bbc28:
|
|
1765
|
+
ae2bbc28: l.value
|
|
1765
1766
|
}));
|
|
1766
|
-
const t = e, n = computed(() => t.type === COPY_RIGHT_TYPE.HORIZONTAL ? "map/tdt-copyright-h.svg" : `map/tdt-copyright-v${t.mapTile === BaseMapType.satellite ? "-w" : ""}.svg`), o = computed(() => t.type === COPY_RIGHT_TYPE.HORIZONTAL ? "400px" : "168px"),
|
|
1767
|
-
return (r,
|
|
1767
|
+
const t = e, n = computed(() => t.type === COPY_RIGHT_TYPE.HORIZONTAL ? "map/tdt-copyright-h.svg" : `map/tdt-copyright-v${t.mapTile === BaseMapType.satellite ? "-w" : ""}.svg`), o = computed(() => t.type === COPY_RIGHT_TYPE.HORIZONTAL ? "400px" : "168px"), l = computed(() => t.type === COPY_RIGHT_TYPE.HORIZONTAL ? "auto auto 0 5px" : "0 auto auto 5px");
|
|
1768
|
+
return (r, i) => (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
1768
1769
|
createElementVNode("img", {
|
|
1769
1770
|
src: unref(CDN_URL) + n.value,
|
|
1770
1771
|
width: o.value,
|
|
@@ -1786,30 +1787,30 @@ const loadImage = new Image();
|
|
|
1786
1787
|
loadImage.src = `${CDN_URL}/map/map-load.svg`;
|
|
1787
1788
|
loadImage.crossOrigin = "anonymous";
|
|
1788
1789
|
const setTruckStyle = (e, t, n, o) => new Style({
|
|
1789
|
-
renderer: (
|
|
1790
|
-
const
|
|
1791
|
-
|
|
1790
|
+
renderer: (l, r) => {
|
|
1791
|
+
const i = r.context;
|
|
1792
|
+
i.save();
|
|
1792
1793
|
let c = 1;
|
|
1793
|
-
|
|
1794
|
-
let [s, m] =
|
|
1794
|
+
i.scale(c, c);
|
|
1795
|
+
let [s, m] = l;
|
|
1795
1796
|
s = Number(s) / c - 20, m = Number(m) / c;
|
|
1796
|
-
const
|
|
1797
|
+
const u = s - 70, d = m - 68;
|
|
1797
1798
|
let f = 180;
|
|
1798
|
-
const p = 56,
|
|
1799
|
+
const p = 56, w = "#FFFFFF";
|
|
1799
1800
|
let h = 176;
|
|
1800
|
-
const
|
|
1801
|
-
let
|
|
1802
|
-
n === CAR_COLOR.YELLOW ? (h = 176,
|
|
1801
|
+
const v = 52;
|
|
1802
|
+
let L = "#164AFF", T = "#FFFFFF";
|
|
1803
|
+
n === CAR_COLOR.YELLOW ? (h = 176, L = "#FFC81E", T = "rgba(0,0,0,0.88)") : n === CAR_COLOR.Y_GREEN && (f = 200, h = 196, L = "#8FED7C", T = "rgba(0,0,0,0.88)"), o != null && o.length && (f += o.length * 56), fillRectRadius(i, u, d, f, p, w), fillRectRadius(i, u + 2, d + 2, h, v, L), n === CAR_COLOR.Y_GREEN && fillRectRadius(i, u + 2, d + 2, 68, v, "#FFC81E"), i.save(), i.restore(), i.fillStyle = T, i.font = "bold 28px Arial", i.textAlign = "left", i.textBaseline = "middle";
|
|
1803
1804
|
const I = `${t.slice(0, 2) + " · " + t.slice(2)}`;
|
|
1804
|
-
if (
|
|
1805
|
-
const
|
|
1805
|
+
if (i.fillText(I, u + 12, d + 32), i.save(), i.restore(), o != null && o.length) {
|
|
1806
|
+
const x = i.measureText(I).width + 12;
|
|
1806
1807
|
let P = 0;
|
|
1807
|
-
o.forEach((
|
|
1808
|
-
|
|
1808
|
+
o.forEach((g) => {
|
|
1809
|
+
g === DEVICE_TYPE.CAMERA && (i.drawImage(cameraImage, s - 54 + x + P * 56, m - 64, 50, 50), ++P), g === DEVICE_TYPE.LOAD && (i.drawImage(loadImage, s - 54 + x + P * 56, m - 64, 50, 50), ++P);
|
|
1809
1810
|
});
|
|
1810
1811
|
}
|
|
1811
|
-
const
|
|
1812
|
-
|
|
1812
|
+
const V = dotImage$1;
|
|
1813
|
+
i.drawImage(V, s + f / 2 - 90, m, 50 / c, 50 / c), i.restore();
|
|
1813
1814
|
}
|
|
1814
1815
|
}), mapInstance$2 = ref(), renderDashboardSetInstance = (e) => mapInstance$2.value = e;
|
|
1815
1816
|
ref([]);
|
|
@@ -1840,8 +1841,8 @@ const renderTrucksMarker = (e) => {
|
|
|
1840
1841
|
if (!mapInstance$1.value || (focusShipData.value = e, !(e != null && e.lon && (e != null && e.lat)))) return;
|
|
1841
1842
|
const t = formatUtils.convertSixHundredThousandToLatLng(e.lon, e.lat), n = mapInstance$1.value.getPixelFromCoordinate(transform(t, projection.data, projection.mercator));
|
|
1842
1843
|
currentTruckOverlay.value = e ? drawTruckIcon(e.vno, n, (e == null ? void 0 : e.drc) ?? "") ?? null : null;
|
|
1843
|
-
const o = mapInstance$1.value.getView(),
|
|
1844
|
-
o.setCenter(transform(
|
|
1844
|
+
const o = mapInstance$1.value.getView(), l = new Point(t);
|
|
1845
|
+
o.setCenter(transform(l.getCoordinates(), projection.data, projection.mercator));
|
|
1845
1846
|
}, clearAllTruck = () => {
|
|
1846
1847
|
vehicle.value.clearAllShip();
|
|
1847
1848
|
}, drawTruckIcon = (e, t, n) => {
|
|
@@ -1857,12 +1858,12 @@ const renderTrucksMarker = (e) => {
|
|
|
1857
1858
|
var r;
|
|
1858
1859
|
if (!mapInstance$1.value) return;
|
|
1859
1860
|
const e = mapInstance$1.value.getView().getZoom(), t = 120, n = 60;
|
|
1860
|
-
function o(
|
|
1861
|
-
return
|
|
1861
|
+
function o(i) {
|
|
1862
|
+
return i < 14 ? n : i >= 14 && i <= 18 ? Math.round((i - 14) * (t - n) / 4 + n) : t;
|
|
1862
1863
|
}
|
|
1863
|
-
const
|
|
1864
|
-
(r = document.querySelectorAll(".truck-custom-content")) == null || r.forEach((
|
|
1865
|
-
|
|
1864
|
+
const l = o(e);
|
|
1865
|
+
(r = document.querySelectorAll(".truck-custom-content")) == null || r.forEach((i) => {
|
|
1866
|
+
i.style.width = `${l}px`, i.style.height = `${l}px`;
|
|
1866
1867
|
});
|
|
1867
1868
|
}, mapInstance = ref(), drawPolygonSetInstance = (e) => mapInstance.value = e;
|
|
1868
1869
|
let layerState = "drawn", drawnState = "undrawn";
|
|
@@ -1908,13 +1909,13 @@ function createHelpTooltip() {
|
|
|
1908
1909
|
}
|
|
1909
1910
|
let squareLimitError = !1, lineLimitError = !1;
|
|
1910
1911
|
const validateSquareLimit = (e) => {
|
|
1911
|
-
let n = 1 / 0, o = -1 / 0,
|
|
1912
|
+
let n = 1 / 0, o = -1 / 0, l = 1 / 0, r = -1 / 0;
|
|
1912
1913
|
e == null || e.forEach((s) => {
|
|
1913
|
-
const m = transform(s, projection.mercator, projection.data),
|
|
1914
|
-
n = Math.min(n,
|
|
1914
|
+
const m = transform(s, projection.mercator, projection.data), u = m[0], d = m[1];
|
|
1915
|
+
n = Math.min(n, d), o = Math.max(o, d), l = Math.min(l, u), r = Math.max(r, u);
|
|
1915
1916
|
});
|
|
1916
|
-
const
|
|
1917
|
-
squareLimitError =
|
|
1917
|
+
const i = (o - n) * 111, c = (r - l) * 111;
|
|
1918
|
+
squareLimitError = i > 150 || c > 150;
|
|
1918
1919
|
};
|
|
1919
1920
|
let storeFeature, callbackFunction = null;
|
|
1920
1921
|
const addInteraction = (e) => {
|
|
@@ -1926,29 +1927,29 @@ const addInteraction = (e) => {
|
|
|
1926
1927
|
style: [drawPolygonStyle.drawing, circleStyle]
|
|
1927
1928
|
}), (o = mapInstance.value) == null || o.addInteraction(draw), createMeasureTooltip(), createHelpTooltip();
|
|
1928
1929
|
let t;
|
|
1929
|
-
draw.on("drawstart", function(
|
|
1930
|
+
draw.on("drawstart", function(l) {
|
|
1930
1931
|
var r;
|
|
1931
|
-
layerState = "drawn", sketch =
|
|
1932
|
-
const c =
|
|
1933
|
-
if (lineLimitError = Number(getLength(
|
|
1932
|
+
layerState = "drawn", sketch = l.feature, t = (r = sketch.getGeometry()) == null ? void 0 : r.on("change", function(i) {
|
|
1933
|
+
const c = i.target, s = formatUtils.formatArea(c, LENGTH_UNIT.NM), u = c.getCoordinates()[0], d = new LineString([u[u.length - 2], u[u.length - 1]]), f = formatUtils.formatLength(d, LENGTH_UNIT.NM);
|
|
1934
|
+
if (lineLimitError = Number(getLength(d) / 1e3) > 150, validateSquareLimit(u), measureTooltipElement && s && (measureTooltipElement.innerHTML = `
|
|
1934
1935
|
<span class="text">面积:${s}${lineLimitError || squareLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1935
1936
|
`), helpTooltipElement && s) {
|
|
1936
1937
|
let p = "";
|
|
1937
1938
|
parseFloat(s) > 0 && (p = `
|
|
1938
1939
|
<div class="text ${squareLimitError ? "error" : ""}">面积:${s}${squareLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</div>`), helpTooltipElement.innerHTML = `${p}
|
|
1939
|
-
<span class="text ${lineLimitError ? "error" : ""}">线段${
|
|
1940
|
+
<span class="text ${lineLimitError ? "error" : ""}">线段${u.length - 2}:${f}${lineLimitError ? '<span class="error pl-4">超出可以绘画的距离</span>' : ""}</span>
|
|
1940
1941
|
<div><span class="text">单击继续,双击结束</span></div>
|
|
1941
1942
|
`;
|
|
1942
1943
|
}
|
|
1943
1944
|
}), drawnState = "drawing";
|
|
1944
|
-
}), draw.on("drawend", function(
|
|
1945
|
-
if (
|
|
1946
|
-
storeFeature =
|
|
1947
|
-
const r = endFn(
|
|
1945
|
+
}), draw.on("drawend", function(l) {
|
|
1946
|
+
if (l.feature.getGeometry()) {
|
|
1947
|
+
storeFeature = l.feature;
|
|
1948
|
+
const r = endFn(l.feature);
|
|
1948
1949
|
r != null && r.length && callbackFunction && callbackFunction(r);
|
|
1949
1950
|
}
|
|
1950
1951
|
if (sketch = null, measureTooltipElement = null, createMeasureTooltip(), t && unByKey(t), drawnState = "drawend", draw && mapInstance.value) {
|
|
1951
|
-
const r = mapInstance.value.getInteractions().getArray().find((
|
|
1952
|
+
const r = mapInstance.value.getInteractions().getArray().find((i) => getUid(i) === getUid(draw));
|
|
1952
1953
|
r && mapInstance.value.removeInteraction(r), helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement);
|
|
1953
1954
|
}
|
|
1954
1955
|
});
|
|
@@ -1956,10 +1957,10 @@ const addInteraction = (e) => {
|
|
|
1956
1957
|
var e, t, n;
|
|
1957
1958
|
if (mapInstance.value) {
|
|
1958
1959
|
if (document.querySelectorAll(".ol-tooltip.ol-tooltip-draw-polygon").forEach((o) => {
|
|
1959
|
-
var
|
|
1960
|
-
(
|
|
1960
|
+
var l;
|
|
1961
|
+
(l = o == null ? void 0 : o.parentNode) == null || l.removeChild(o);
|
|
1961
1962
|
}), 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) {
|
|
1962
|
-
const o = mapInstance.value.getInteractions().getArray().find((
|
|
1963
|
+
const o = mapInstance.value.getInteractions().getArray().find((l) => getUid(l) === getUid(draw));
|
|
1963
1964
|
o && ((n = mapInstance.value) == null || n.removeInteraction(o));
|
|
1964
1965
|
}
|
|
1965
1966
|
drawnState = "undrawn", layerState = "destroyed";
|
|
@@ -1967,15 +1968,15 @@ const addInteraction = (e) => {
|
|
|
1967
1968
|
}, endFn = (e) => {
|
|
1968
1969
|
var t, n, o;
|
|
1969
1970
|
if (e.getGeometry()) {
|
|
1970
|
-
const
|
|
1971
|
-
(t =
|
|
1972
|
-
|
|
1971
|
+
const l = [], i = e.getGeometry().getCoordinates();
|
|
1972
|
+
(t = i[0]) == null || t.forEach((s) => {
|
|
1973
|
+
l.push(transform(s, projection.mercator, projection.data));
|
|
1973
1974
|
});
|
|
1974
|
-
const c =
|
|
1975
|
+
const c = i[0][i[0].length - 2];
|
|
1975
1976
|
if (c && measureTooltip.setPosition(c), measureTooltip.setOffset([10, 0]), measureTooltipElement && (measureTooltipElement.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), (n = document.querySelector(".delete-icon")) == null || n.addEventListener("click", () => {
|
|
1976
1977
|
reset();
|
|
1977
1978
|
}), !lineLimitError && !squareLimitError)
|
|
1978
|
-
return
|
|
1979
|
+
return l;
|
|
1979
1980
|
draw && ((o = mapInstance.value) == null || o.removeInteraction(draw)), helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement);
|
|
1980
1981
|
}
|
|
1981
1982
|
}, initFeature = (e) => {
|
|
@@ -1983,14 +1984,14 @@ const addInteraction = (e) => {
|
|
|
1983
1984
|
if (e && (callbackFunction = e), layerState = "drawn", storeFeature) {
|
|
1984
1985
|
const o = storeFeature.getGeometry();
|
|
1985
1986
|
if (!o) return;
|
|
1986
|
-
const
|
|
1987
|
+
const l = formatUtils.formatArea(o, LENGTH_UNIT.NM);
|
|
1987
1988
|
measureTooltipElement && (measureTooltipElement.innerHTML = `
|
|
1988
|
-
<span class="text">面积:${
|
|
1989
|
+
<span class="text">面积:${l}${lineLimitError || squareLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1989
1990
|
`), (t = drawVector.getSource()) == null || t.addFeature(storeFeature);
|
|
1990
1991
|
const r = endFn(storeFeature);
|
|
1991
1992
|
r != null && r.length && callbackFunction && callbackFunction(r);
|
|
1992
|
-
const
|
|
1993
|
-
(n = mapInstance.value) == null || n.getView().setCenter(
|
|
1993
|
+
const i = getCenter(storeFeature.getGeometry().getExtent());
|
|
1994
|
+
(n = mapInstance.value) == null || n.getView().setCenter(i);
|
|
1994
1995
|
}
|
|
1995
1996
|
}, pointerMoveHandler = function(e) {
|
|
1996
1997
|
var n;
|
|
@@ -2031,18 +2032,18 @@ dotImage.crossOrigin = "anonymous";
|
|
|
2031
2032
|
const dotActiveImage = new Image();
|
|
2032
2033
|
dotActiveImage.crossOrigin = "anonymous";
|
|
2033
2034
|
const setPointStyle = (e, t, n) => {
|
|
2034
|
-
const { color: o, url:
|
|
2035
|
-
return (r ||
|
|
2035
|
+
const { color: o, url: l, activeUrl: r, activeColor: i } = n;
|
|
2036
|
+
return (r || l) && (e ? dotActiveImage.src = CDN_URL + (r || l) : dotImage.src = CDN_URL + (l || r)), new Style({
|
|
2036
2037
|
renderer: (c, s) => {
|
|
2037
2038
|
const m = s.context;
|
|
2038
2039
|
m.save();
|
|
2039
|
-
const
|
|
2040
|
-
let [
|
|
2041
|
-
|
|
2042
|
-
const p = m.measureText(t).width,
|
|
2043
|
-
if (fillRectRadius(m,
|
|
2040
|
+
const u = window.devicePixelRatio || 1;
|
|
2041
|
+
let [d, f] = c;
|
|
2042
|
+
d = Number(d), f = Number(f), m.font = `${12 * u}px Arial`;
|
|
2043
|
+
const p = m.measureText(t).width, w = d - p / 2 - (u <= 1 ? 8 : u), h = f + 6 * u, v = p + 4, L = 16 * u, T = e && i || o;
|
|
2044
|
+
if (fillRectRadius(m, w, h + 13 * u, v, L, T), m.save(), m.restore(), m.fillStyle = e ? "#FFFFFF" : "#000000", m.textAlign = "center", m.textBaseline = "middle", m.fillText(t, w + (p + 4) / 2, h + 22 * u), m.save(), m.restore(), l || r) {
|
|
2044
2045
|
const I = e ? dotActiveImage : dotImage;
|
|
2045
|
-
m.drawImage(I,
|
|
2046
|
+
m.drawImage(I, d - I.width / 2, f - I.height / 2, 30 * u, 30 * u);
|
|
2046
2047
|
}
|
|
2047
2048
|
m.restore();
|
|
2048
2049
|
}
|
|
@@ -2088,7 +2089,7 @@ class PointMarkerClass {
|
|
|
2088
2089
|
let n = {};
|
|
2089
2090
|
t.forEach((o) => {
|
|
2090
2091
|
var r;
|
|
2091
|
-
const
|
|
2092
|
+
const l = [o.lon, o.lat];
|
|
2092
2093
|
if (((r = this.highlightPoint) == null ? void 0 : r.id) === o.id)
|
|
2093
2094
|
n = {
|
|
2094
2095
|
id: o.id,
|
|
@@ -2097,12 +2098,12 @@ class PointMarkerClass {
|
|
|
2097
2098
|
pointType: o.pointType
|
|
2098
2099
|
};
|
|
2099
2100
|
else {
|
|
2100
|
-
const
|
|
2101
|
+
const i = this.getFeature(o, l);
|
|
2101
2102
|
this.pointMarkerList.push({
|
|
2102
2103
|
id: o.id,
|
|
2103
2104
|
name: o.name,
|
|
2104
2105
|
lonlat: [Number(o.lon), Number(o.lat)],
|
|
2105
|
-
feature:
|
|
2106
|
+
feature: i,
|
|
2106
2107
|
pointType: o.pointType
|
|
2107
2108
|
});
|
|
2108
2109
|
}
|
|
@@ -2148,23 +2149,23 @@ class PointMarkerClass {
|
|
|
2148
2149
|
*/
|
|
2149
2150
|
highlightPointMarker(t) {
|
|
2150
2151
|
if (!this.mapInstance) return;
|
|
2151
|
-
const { id: n, name: o, fullName:
|
|
2152
|
+
const { id: n, name: o, fullName: l, lon: r, lat: i, pointType: c } = t, s = [Number(r), Number(i)];
|
|
2152
2153
|
this.highlightPoint = {
|
|
2153
2154
|
id: n,
|
|
2154
2155
|
name: o,
|
|
2155
|
-
fullName:
|
|
2156
|
+
fullName: l,
|
|
2156
2157
|
lonlat: s,
|
|
2157
2158
|
pointType: c
|
|
2158
2159
|
}, this.setPointCenter(s);
|
|
2159
2160
|
}
|
|
2160
2161
|
// 获取feature
|
|
2161
2162
|
getFeature(t, n) {
|
|
2162
|
-
var
|
|
2163
|
+
var l;
|
|
2163
2164
|
const o = new Feature({
|
|
2164
2165
|
geometry: new Point(fromLonLat(n))
|
|
2165
2166
|
});
|
|
2166
2167
|
return o.set("data", t), o.setStyle(
|
|
2167
|
-
setPointStyle(((
|
|
2168
|
+
setPointStyle(((l = this.highlightPoint) == null ? void 0 : l.id) === t.id, t.name, this.options)
|
|
2168
2169
|
), o;
|
|
2169
2170
|
}
|
|
2170
2171
|
/**
|
|
@@ -2177,8 +2178,8 @@ class PointMarkerClass {
|
|
|
2177
2178
|
*/
|
|
2178
2179
|
setPointCenter(t, n = { customZoom: mapZoom.findShip, type: 1 }) {
|
|
2179
2180
|
if (!this.mapInstance) return;
|
|
2180
|
-
const { customZoom: o = mapZoom.findShip, type:
|
|
2181
|
-
(
|
|
2181
|
+
const { customZoom: o = mapZoom.findShip, type: l = 1 } = n, r = this.mapInstance.getView(), i = r.getZoom();
|
|
2182
|
+
(l === 1 || i > o && l === 2 || i < o && l === 3) && r.setZoom(o);
|
|
2182
2183
|
const c = new Point(t);
|
|
2183
2184
|
r.setCenter(transform(c.getCoordinates(), projection.data, projection.mercator));
|
|
2184
2185
|
}
|
|
@@ -2198,15 +2199,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2198
2199
|
setup(e, { expose: t, emit: n }) {
|
|
2199
2200
|
const o = ref();
|
|
2200
2201
|
provide("mapInstance", o);
|
|
2201
|
-
const
|
|
2202
|
+
const l = ref(null), r = ref(null), i = ref(null), c = n, s = e, m = ref(s.zoom || mapZoom.default), u = ref(!1), d = ref(!0), f = ref(!0), p = {
|
|
2202
2203
|
tiandituTile: new TileLayer({ source: new XYZ({ url: baseMap.tiandituTile }) }),
|
|
2203
2204
|
tiandituTileMark: new TileLayer({ source: new XYZ({ url: baseMap.tiandituTileMark }) }),
|
|
2204
2205
|
tiandituImgTile: new TileLayer({ source: new XYZ({ url: baseMap.tiandituImgTile }), visible: !1 }),
|
|
2205
2206
|
tiandituImgTileMark: new TileLayer({ source: new XYZ({ url: baseMap.tiandituImgTileMark }), visible: !1 }),
|
|
2206
2207
|
greenMark: new TileLayer({ source: new XYZ({ url: baseMap.greenTile }) })
|
|
2207
|
-
},
|
|
2208
|
-
var
|
|
2209
|
-
const
|
|
2208
|
+
}, w = () => {
|
|
2209
|
+
var y, S;
|
|
2210
|
+
const g = {
|
|
2210
2211
|
projection: projection.mercator,
|
|
2211
2212
|
// 地图投影坐标系
|
|
2212
2213
|
zoom: s.zoom || (s.vehicleMode === "ship" ? mapZoom.default : mapZoom.truckDefault),
|
|
@@ -2234,96 +2235,96 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2234
2235
|
p.tiandituImgTileMark,
|
|
2235
2236
|
p.greenMark
|
|
2236
2237
|
],
|
|
2237
|
-
view: new View(
|
|
2238
|
-
}), h(), (
|
|
2238
|
+
view: new View(g)
|
|
2239
|
+
}), h(), (y = r.value) == null || y.setScaleLine(s.vehicleMode === "ship" ? "nautical" : "metric"), (S = o.value) == null || S.on("moveend", I), v(g.zoom < mapZoom.shipGreenDotMax), T(s.vehicleMode === "ship" || s.viewMode === "findShip" ? BaseMapType.satellite : BaseMapType.vector), s.viewMode === "findShip" && s.mmsi && s.shipData && nextTick(() => {
|
|
2239
2240
|
findShip(String(s.mmsi), s.shipData);
|
|
2240
2241
|
}), onShipsMarkerHover();
|
|
2241
2242
|
};
|
|
2242
2243
|
onMounted(() => {
|
|
2243
|
-
|
|
2244
|
+
w();
|
|
2244
2245
|
});
|
|
2245
2246
|
const h = () => {
|
|
2246
2247
|
o.value && (renderCustomOverlaySetInstance(o.value), renderTruckSetInstance(o.value), drawPolygonSetInstance(o.value), renderShipStyleSetInstance(o.value), renderTrackStyleSetInstance(o.value), renderDashboardSetInstance(o.value), renderMarkerSetInstance(o.value), renderShipSetInstance(o.value), renderTrackSetInstance(o.value));
|
|
2247
|
-
},
|
|
2248
|
-
var
|
|
2249
|
-
s.vehicleMode !== "ship" && (
|
|
2250
|
-
getUid(
|
|
2248
|
+
}, v = (g) => {
|
|
2249
|
+
var y;
|
|
2250
|
+
s.vehicleMode !== "ship" && (g = !1), (y = o.value) == null || y.getLayers().forEach((S) => {
|
|
2251
|
+
getUid(S) === getUid(p.greenMark) && (S.setVisible(g), d.value = g);
|
|
2251
2252
|
});
|
|
2252
|
-
},
|
|
2253
|
-
var
|
|
2254
|
-
|
|
2255
|
-
(getUid(
|
|
2253
|
+
}, L = ref(BaseMapType.satellite), T = (g) => {
|
|
2254
|
+
var y;
|
|
2255
|
+
L.value = g, (y = o.value) == null || y.getLayers().forEach((S) => {
|
|
2256
|
+
(getUid(S) === getUid(p.tiandituTile) || getUid(S) === getUid(p.tiandituTileMark) || getUid(S) === getUid(p.tiandituImgTile) || getUid(S) === getUid(p.tiandituImgTileMark)) && S.setVisible(!1), (g === BaseMapType.vector && (getUid(S) === getUid(p.tiandituTile) || getUid(S) === getUid(p.tiandituTileMark)) || g === BaseMapType.satellite && (getUid(S) === getUid(p.tiandituImgTile) || getUid(S) === getUid(p.tiandituImgTileMark))) && S.setVisible(!0);
|
|
2256
2257
|
});
|
|
2257
2258
|
}, I = () => {
|
|
2258
|
-
const
|
|
2259
|
-
|
|
2260
|
-
const
|
|
2261
|
-
|
|
2262
|
-
},
|
|
2263
|
-
var
|
|
2264
|
-
m.value =
|
|
2265
|
-
const
|
|
2266
|
-
showTrackLayer.value ? (f.value = !1,
|
|
2267
|
-
},
|
|
2268
|
-
const
|
|
2269
|
-
c("extentChanged", { extent: [
|
|
2259
|
+
const g = o.value.getView(), y = g.getZoom();
|
|
2260
|
+
y && V(y);
|
|
2261
|
+
const S = g.calculateExtent(o.value.getSize());
|
|
2262
|
+
S && y && x(S, y);
|
|
2263
|
+
}, V = (g) => {
|
|
2264
|
+
var k, M, E, C, F;
|
|
2265
|
+
m.value = g, v(g < mapZoom.shipGreenDotMax);
|
|
2266
|
+
const y = (k = o.value) == null ? void 0 : k.getLayers(), S = s.vehicleMode === "ship" ? y == null ? void 0 : y.getArray().find(($) => getUid($) === getUid(p.greenMark)) : void 0;
|
|
2267
|
+
showTrackLayer.value ? (f.value = !1, S == null || S.setVisible(!1), (M = shipsLayer.value) == null || M.setVisible(!1), (E = largeAmountShipsLayer.value) == null || E.setVisible(!1)) : !u.value && d.value && g <= mapZoom.shipGreenDotMax ? (f.value = !0, S == null || S.setVisible(!0), (C = shipsLayer.value) == null || C.setVisible(!1), (F = largeAmountShipsLayer.value) == null || F.setVisible(!1)) : (f.value = !1, S == null || S.setVisible(!1)), c("zoomChanged", g);
|
|
2268
|
+
}, x = (g, y) => {
|
|
2269
|
+
const S = transform([g[0], g[1]], projection.mercator, projection.data), k = transform([g[2], g[3]], projection.mercator, projection.data);
|
|
2270
|
+
c("extentChanged", { extent: [S, k], zoom: y });
|
|
2270
2271
|
};
|
|
2271
2272
|
return t({
|
|
2272
2273
|
mapInstance: o,
|
|
2273
|
-
initMap:
|
|
2274
|
-
pointRender: (
|
|
2274
|
+
initMap: w,
|
|
2275
|
+
pointRender: (g, y) => new PointMarkerClass(g, y),
|
|
2275
2276
|
renderTrucksMarker,
|
|
2276
2277
|
renderShip: renderShips,
|
|
2277
|
-
renderTrack: (
|
|
2278
|
-
var
|
|
2279
|
-
currentTrackId.value =
|
|
2278
|
+
renderTrack: (g, y, S) => {
|
|
2279
|
+
var k, M;
|
|
2280
|
+
currentTrackId.value = g, showTrackLayer.value = !0, u.value = !0, hiddenAllShips(), (M = (k = largeAmountShipsLayer.value) == null ? void 0 : k.getSource()) == null || M.clear(), renderTrack(g, s.vehicleMode === "ship" ? y.reverse() : y, S, LENGTH_UNIT.NM);
|
|
2280
2281
|
},
|
|
2281
2282
|
findTruck,
|
|
2282
2283
|
removeTruckIcon,
|
|
2283
2284
|
clearAllTruck,
|
|
2284
2285
|
closeTrack: () => {
|
|
2285
|
-
var
|
|
2286
|
-
showTrackLayer.value = !1, (
|
|
2286
|
+
var g, y;
|
|
2287
|
+
showTrackLayer.value = !1, (g = shipTrackVectorLayer.value) == null || g.setVisible(!1), (y = selectShipsLayer.value) == null || y.setVisible(!0), u.value = !1, v(m.value < mapZoom.shipGreenDotMax), allTracks.value = [], stopAnimation();
|
|
2287
2288
|
},
|
|
2288
2289
|
closeTruckTrack: () => {
|
|
2289
|
-
var
|
|
2290
|
-
showTrackLayer.value = !1, (
|
|
2290
|
+
var g, y;
|
|
2291
|
+
showTrackLayer.value = !1, (g = shipTrackVectorLayer.value) == null || g.setVisible(!1), (y = selectShipsLayer.value) == null || y.setVisible(!0), stopAnimation();
|
|
2291
2292
|
},
|
|
2292
2293
|
resetTrackView,
|
|
2293
2294
|
playTrack,
|
|
2294
2295
|
clearSelectFeature,
|
|
2295
2296
|
findShip,
|
|
2296
|
-
focusShip: (
|
|
2297
|
-
var
|
|
2298
|
-
hiddenOrther.value =
|
|
2297
|
+
focusShip: (g, y, S = !0) => {
|
|
2298
|
+
var k, M;
|
|
2299
|
+
hiddenOrther.value = S, (k = shipsLayer.value) == null || k.setVisible(!S), (M = largeAmountShipsLayer.value) == null || M.setVisible(!1), findShip(g, y);
|
|
2299
2300
|
},
|
|
2300
2301
|
showTracks,
|
|
2301
2302
|
removeAllTrackLayer,
|
|
2302
2303
|
switchFilterItem,
|
|
2303
2304
|
rerenderShip,
|
|
2304
|
-
switchGreenDot: () =>
|
|
2305
|
+
switchGreenDot: () => v(!1),
|
|
2305
2306
|
zoomTruckIcon,
|
|
2306
|
-
renderTruckTrack: (
|
|
2307
|
-
showTrackLayer.value = !0, renderTrack(
|
|
2307
|
+
renderTruckTrack: (g, y, S) => {
|
|
2308
|
+
showTrackLayer.value = !0, renderTrack(g, y, S, LENGTH_UNIT.KM, "truck");
|
|
2308
2309
|
},
|
|
2309
2310
|
removerLayer: removeShipTrackLineFeatureByIndex,
|
|
2310
2311
|
renderMarker,
|
|
2311
|
-
setMarkerPosition: (
|
|
2312
|
-
|
|
2312
|
+
setMarkerPosition: (g) => {
|
|
2313
|
+
u.value = !0, setMarkerPosition(g);
|
|
2313
2314
|
},
|
|
2314
2315
|
getZoomAndCenter: () => {
|
|
2315
2316
|
var M;
|
|
2316
|
-
const
|
|
2317
|
-
if (!
|
|
2318
|
-
const
|
|
2319
|
-
return { zoom:
|
|
2317
|
+
const g = (M = o.value) == null ? void 0 : M.getView();
|
|
2318
|
+
if (!g) return null;
|
|
2319
|
+
const y = Math.round(Number(g.getZoom())), { lon: S, lat: k } = transformUtils.mercatorToLonLat(g.getCenter());
|
|
2320
|
+
return { zoom: y, center: [S, k] };
|
|
2320
2321
|
},
|
|
2321
|
-
setCenter: (
|
|
2322
|
-
var
|
|
2323
|
-
const
|
|
2324
|
-
if (!
|
|
2325
|
-
const
|
|
2326
|
-
|
|
2322
|
+
setCenter: (g) => {
|
|
2323
|
+
var k;
|
|
2324
|
+
const y = (k = o.value) == null ? void 0 : k.getView();
|
|
2325
|
+
if (!y) return null;
|
|
2326
|
+
const S = new Point(g);
|
|
2327
|
+
y.setCenter(transform(S.getCoordinates(), projection.data, projection.mercator));
|
|
2327
2328
|
},
|
|
2328
2329
|
drawPolygonTool,
|
|
2329
2330
|
setMapInstance: h,
|
|
@@ -2338,42 +2339,42 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2338
2339
|
transform: transformUtils,
|
|
2339
2340
|
format: formatUtils
|
|
2340
2341
|
}
|
|
2341
|
-
}), (
|
|
2342
|
+
}), (g, y) => (openBlock(), createElementBlock("div", {
|
|
2342
2343
|
class: "map-page map-container",
|
|
2343
2344
|
ref_key: "pageRef",
|
|
2344
|
-
ref:
|
|
2345
|
+
ref: l
|
|
2345
2346
|
}, [
|
|
2346
|
-
|
|
2347
|
+
y[0] || (y[0] = createElementVNode("div", {
|
|
2347
2348
|
id: "map",
|
|
2348
2349
|
class: "map"
|
|
2349
2350
|
}, null, -1)),
|
|
2350
2351
|
createVNode(ToolPanel, {
|
|
2351
|
-
"vehicle-mode":
|
|
2352
|
-
"view-mode":
|
|
2353
|
-
"disable-green-dot":
|
|
2352
|
+
"vehicle-mode": g.vehicleMode,
|
|
2353
|
+
"view-mode": g.viewMode,
|
|
2354
|
+
"disable-green-dot": u.value,
|
|
2354
2355
|
"show-track-layer": unref(showTrackLayer),
|
|
2355
|
-
"map-tile-mode":
|
|
2356
|
-
onSwitchGreenDot:
|
|
2356
|
+
"map-tile-mode": L.value,
|
|
2357
|
+
onSwitchGreenDot: v,
|
|
2357
2358
|
onSwitchMapTile: T
|
|
2358
2359
|
}, {
|
|
2359
2360
|
toolPanel: withCtx(() => [
|
|
2360
|
-
renderSlot(
|
|
2361
|
+
renderSlot(g.$slots, "toolPanel", {}, void 0, !0)
|
|
2361
2362
|
]),
|
|
2362
2363
|
_: 3
|
|
2363
2364
|
}, 8, ["vehicle-mode", "view-mode", "disable-green-dot", "show-track-layer", "map-tile-mode"]),
|
|
2364
|
-
|
|
2365
|
+
g.viewMode !== "WxMiniprogram" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2365
2366
|
createVNode(ScaleLine, {
|
|
2366
2367
|
ref_key: "scaleLineControl",
|
|
2367
2368
|
ref: r
|
|
2368
2369
|
}, null, 512),
|
|
2369
2370
|
createVNode(ZoomControl, {
|
|
2370
2371
|
ref_key: "zoomControl",
|
|
2371
|
-
ref:
|
|
2372
|
+
ref: i
|
|
2372
2373
|
}, null, 512)
|
|
2373
2374
|
], 64)) : createCommentVNode("", !0),
|
|
2374
2375
|
createVNode(Copyright, {
|
|
2375
|
-
type:
|
|
2376
|
-
"map-tile":
|
|
2376
|
+
type: g.logoType,
|
|
2377
|
+
"map-tile": L.value
|
|
2377
2378
|
}, null, 8, ["type", "map-tile"])
|
|
2378
2379
|
], 512));
|
|
2379
2380
|
}
|