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