zhihao-ui 1.2.35 → 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-Cgw7AB3i.js → Map-DngWgfIX.js} +803 -767
- 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 +10 -10
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var _ = (e, t,
|
|
3
|
-
var I = (e, t,
|
|
1
|
+
var B = Object.defineProperty;
|
|
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,9 +129,9 @@ 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,
|
|
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
135
|
const h = new VectorLayer({
|
|
136
136
|
source: d,
|
|
137
137
|
style: {
|
|
@@ -144,15 +144,15 @@ const formatLength = function(e, t) {
|
|
|
144
144
|
}), g = function(k) {
|
|
145
145
|
if (k.dragging)
|
|
146
146
|
return;
|
|
147
|
-
let
|
|
148
|
-
m && (
|
|
147
|
+
let S = "点击选择起点";
|
|
148
|
+
m && (S = "单击继续,双击结束"), u && (u.innerHTML = S, f.setPosition(k.coordinate), u.classList.remove("hidden"));
|
|
149
149
|
}, T = () => {
|
|
150
|
-
|
|
150
|
+
n.value && (n.value.on("pointermove", g), n.value.getViewport().addEventListener("mouseout", function() {
|
|
151
151
|
var k;
|
|
152
152
|
(k = u == null ? void 0 : u.classList) == null || k.add("hidden");
|
|
153
|
-
}),
|
|
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)"
|
|
@@ -173,45 +173,45 @@ const formatLength = function(e, t) {
|
|
|
173
173
|
})
|
|
174
174
|
});
|
|
175
175
|
function V() {
|
|
176
|
-
var k,
|
|
177
|
-
if (
|
|
178
|
-
if (
|
|
176
|
+
var k, S;
|
|
177
|
+
if (n.value) {
|
|
178
|
+
if (c.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((E) => {
|
|
179
179
|
var C;
|
|
180
180
|
(C = E == null ? void 0 : E.parentNode) == null || C.removeChild(E);
|
|
181
|
-
}), d.clear(),
|
|
182
|
-
const E =
|
|
183
|
-
E && ((k =
|
|
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
|
-
V(), (
|
|
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 =
|
|
196
|
+
}), (E = n.value) == null || E.addInteraction(M), v(), x();
|
|
197
197
|
let k;
|
|
198
|
-
|
|
199
|
-
var
|
|
198
|
+
M.on("drawstart", function(C) {
|
|
199
|
+
var $;
|
|
200
200
|
m = C.feature;
|
|
201
201
|
let F;
|
|
202
|
-
k = (
|
|
203
|
-
const
|
|
204
|
-
let N = formatUtils.formatLength(
|
|
205
|
-
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
|
-
}),
|
|
207
|
+
}), M.on("drawend", function() {
|
|
208
208
|
var C, F;
|
|
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
|
-
}),
|
|
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() {
|
|
@@ -220,47 +220,47 @@ const formatLength = function(e, t) {
|
|
|
220
220
|
element: u,
|
|
221
221
|
offset: [15, 0],
|
|
222
222
|
positioning: "center-left"
|
|
223
|
-
}), (k =
|
|
223
|
+
}), (k = n.value) == null || k.addOverlay(f);
|
|
224
224
|
}
|
|
225
225
|
function v() {
|
|
226
226
|
var k;
|
|
227
|
-
p != null && p.parentNode && p.parentNode.removeChild(p), p = document.createElement("div"), p.className = "ol-tooltip ol-tooltip-measure",
|
|
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
|
-
}), (k =
|
|
233
|
+
}), (k = n.value) == null || k.addOverlay(w);
|
|
234
234
|
}
|
|
235
|
-
const
|
|
235
|
+
const y = (k) => {
|
|
236
236
|
var C, F;
|
|
237
|
-
|
|
238
|
-
const
|
|
239
|
-
|
|
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
241
|
E[k] && d.removeFeature(E[k]);
|
|
242
242
|
}, L = () => {
|
|
243
|
-
|
|
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:
|
|
248
|
+
addInteraction: P,
|
|
249
249
|
removeInteraction: V
|
|
250
|
-
}), (k,
|
|
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
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,19 +280,19 @@ const formatLength = function(e, t) {
|
|
|
280
280
|
}, 8, ["modelValue"])
|
|
281
281
|
]),
|
|
282
282
|
createElementVNode("div", _hoisted_3$1, [
|
|
283
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(
|
|
283
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(c.value, (E, C) => (openBlock(), createElementBlock("div", {
|
|
284
284
|
class: "measure-history-item",
|
|
285
285
|
key: C
|
|
286
286
|
}, [
|
|
287
287
|
createElementVNode("div", _hoisted_4, [
|
|
288
|
-
|
|
288
|
+
S[3] || (S[3] = createElementVNode("i", { class: "map-iconfont icon-line" }, null, -1)),
|
|
289
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: (F) =>
|
|
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))
|
|
@@ -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
350
|
var h;
|
|
351
|
-
const p = f.features.item(0).getGeometry().getCoordinates(),
|
|
352
|
-
markerPosition.value = `${
|
|
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")
|
|
@@ -449,144 +449,144 @@ const multiplyPixelRatio = (e) => {
|
|
|
449
449
|
return function(x, v) {
|
|
450
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, pixelRatio = window.devicePixelRatio || 1, labelFont = `500 ${12 * pixelRatio}px Arial`, labelOutSize = 2 * pixelRatio, labelHeight = 10 * pixelRatio, fillRectRadius = (e, t, n,
|
|
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,
|
|
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;
|
|
573
573
|
if (m)
|
|
574
574
|
for (let T = 0; T < 8; T++) {
|
|
575
575
|
p = calculateBounds(i, T, f, g, m);
|
|
576
|
-
let
|
|
576
|
+
let M = !1;
|
|
577
577
|
for (let b = 0; b < t.length; ++b) {
|
|
578
|
-
let V = t[b].bounds,
|
|
579
|
-
V[0] -
|
|
580
|
-
V[1] -
|
|
581
|
-
V[2] +
|
|
582
|
-
V[3] +
|
|
578
|
+
let V = t[b].bounds, P = [
|
|
579
|
+
V[0] - w,
|
|
580
|
+
V[1] - w,
|
|
581
|
+
V[2] + w,
|
|
582
|
+
V[3] + w
|
|
583
583
|
];
|
|
584
|
-
if (p && isOverlapping(p,
|
|
585
|
-
|
|
584
|
+
if (p && isOverlapping(p, P)) {
|
|
585
|
+
M = !0;
|
|
586
586
|
break;
|
|
587
587
|
}
|
|
588
588
|
}
|
|
589
|
-
if (!
|
|
589
|
+
if (!M) {
|
|
590
590
|
h = T;
|
|
591
591
|
break;
|
|
592
592
|
}
|
|
@@ -594,76 +594,76 @@ function drawLabelBody(e, t, n) {
|
|
|
594
594
|
else
|
|
595
595
|
h = 0, p = calculateBounds(i, h, f, g, m);
|
|
596
596
|
if (u && h === -1 && (h = 0), p && h > -1) {
|
|
597
|
-
let T = getBottomLeftPoint(p),
|
|
597
|
+
let T = getBottomLeftPoint(p), M = getTopRighttPoint(p);
|
|
598
598
|
return {
|
|
599
599
|
center: i,
|
|
600
600
|
x: calculateAnchorPoint(i, h, f, g, m),
|
|
601
|
-
l:
|
|
601
|
+
l: M,
|
|
602
602
|
r: T,
|
|
603
603
|
bounds: p,
|
|
604
604
|
position: h,
|
|
605
|
-
name:
|
|
605
|
+
name: c
|
|
606
606
|
};
|
|
607
607
|
} else
|
|
608
608
|
return null;
|
|
609
609
|
}
|
|
610
610
|
const drawText = (e, t) => {
|
|
611
611
|
if (!e) return;
|
|
612
|
-
const { center:
|
|
612
|
+
const { center: o, text: n, textColor: l, leftIcon: r, rightIcons: i, font: c } = t;
|
|
613
613
|
e.save(), e.setTransform(1, 0, 0, 1, 0, 0);
|
|
614
|
-
let [
|
|
615
|
-
if (
|
|
614
|
+
let [s, d] = o;
|
|
615
|
+
if (r) {
|
|
616
616
|
e.font = `${20 * pixelRatio}px map-iconfont`;
|
|
617
|
-
let m = getIconFont(
|
|
618
|
-
e.fillStyle =
|
|
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;
|
|
619
619
|
}
|
|
620
620
|
if (i != null && i.length) {
|
|
621
621
|
e.font = `${12 * pixelRatio}px map-iconfont`, e.fillStyle = "#3370ff";
|
|
622
|
-
const m = e.measureText(
|
|
622
|
+
const m = e.measureText(n).width + 3 * pixelRatio;
|
|
623
623
|
i.forEach((u, f) => {
|
|
624
|
-
const p = getIconFont(u),
|
|
625
|
-
e.fillText(p,
|
|
624
|
+
const p = getIconFont(u), w = 20 * pixelRatio * f;
|
|
625
|
+
e.fillText(p, s + m + w, d);
|
|
626
626
|
});
|
|
627
627
|
}
|
|
628
|
-
e.font =
|
|
628
|
+
e.font = c || labelFont, e.fillStyle = l, e.fillText(n, s + 2, d), e.restore();
|
|
629
629
|
}, drawPolygon = (e, t) => {
|
|
630
630
|
let {
|
|
631
|
-
points:
|
|
632
|
-
strokeColor:
|
|
633
|
-
fillColor:
|
|
634
|
-
shouldClosePath:
|
|
631
|
+
points: o,
|
|
632
|
+
strokeColor: n,
|
|
633
|
+
fillColor: l,
|
|
634
|
+
shouldClosePath: r,
|
|
635
635
|
translation: i,
|
|
636
|
-
rotation:
|
|
637
|
-
rotationCenter:
|
|
636
|
+
rotation: c,
|
|
637
|
+
rotationCenter: s,
|
|
638
638
|
scale: d,
|
|
639
639
|
globalAlpha: m
|
|
640
640
|
} = t;
|
|
641
|
-
if (m || (m = 1),
|
|
642
|
-
e.save(), e.beginPath(),
|
|
643
|
-
for (let u = 1; u <
|
|
644
|
-
e.lineTo(
|
|
645
|
-
|
|
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();
|
|
646
646
|
}
|
|
647
|
-
}, intervalId = [], drawLabel = (e, t,
|
|
648
|
-
var u, f, p,
|
|
649
|
-
let { center:
|
|
650
|
-
if (
|
|
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
651
|
const b = {
|
|
652
652
|
font: labelFont,
|
|
653
653
|
labelOutSize,
|
|
654
654
|
labelHeight,
|
|
655
|
-
center:
|
|
656
|
-
text:
|
|
657
|
-
leftIcon:
|
|
655
|
+
center: n,
|
|
656
|
+
text: l,
|
|
657
|
+
leftIcon: s,
|
|
658
658
|
selected: t.selected
|
|
659
659
|
};
|
|
660
|
-
(u = t.blinkColors) != null && u.length && (
|
|
661
|
-
const V = drawLabelBody(e,
|
|
660
|
+
(u = t.blinkColors) != null && u.length && (c = t.fill, i = getForegroundColor(t.fill));
|
|
661
|
+
const V = drawLabelBody(e, o, b);
|
|
662
662
|
if (V) {
|
|
663
|
-
const { x:
|
|
664
|
-
|
|
665
|
-
points: [
|
|
666
|
-
strokeColor:
|
|
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,
|
|
667
667
|
fillColor: "#000",
|
|
668
668
|
shouldClosePath: !0,
|
|
669
669
|
translation: void 0,
|
|
@@ -672,108 +672,110 @@ const drawText = (e, t) => {
|
|
|
672
672
|
scale: void 0,
|
|
673
673
|
globalAlpha: labelAlpha
|
|
674
674
|
}), d != null && d.length && d.forEach(() => {
|
|
675
|
-
|
|
675
|
+
y[1][0] += 20, y[2][0] += 20;
|
|
676
676
|
});
|
|
677
677
|
const k = {
|
|
678
|
-
points:
|
|
679
|
-
strokeColor:
|
|
680
|
-
fillColor:
|
|
678
|
+
points: y,
|
|
679
|
+
strokeColor: r,
|
|
680
|
+
fillColor: c,
|
|
681
681
|
shouldClosePath: !0
|
|
682
|
-
}, [
|
|
683
|
-
center: [
|
|
684
|
-
text:
|
|
682
|
+
}, [S, E] = v, C = {
|
|
683
|
+
center: [S, E + labelOutSize + labelHeight + 1],
|
|
684
|
+
text: l,
|
|
685
685
|
textColor: i,
|
|
686
|
-
leftIcon:
|
|
686
|
+
leftIcon: s,
|
|
687
687
|
rightIcons: d,
|
|
688
688
|
blinkColors: t.blinkColors
|
|
689
689
|
};
|
|
690
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(),
|
|
691
|
+
let F = Date.now(), $ = 0;
|
|
692
692
|
const R = [];
|
|
693
693
|
t.blinkColors.forEach((N) => {
|
|
694
694
|
R.push(N), R.push("white");
|
|
695
|
-
})
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
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(() => {
|
|
702
704
|
const N = Date.now();
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
const A = !!shipLabels.value.find((O) => O.name === t.name);
|
|
706
|
-
A || (console.log(A), clearInterval(intervalId[t.id]), deleteLabelFromArray(n, r));
|
|
707
|
-
}
|
|
708
|
-
}, 10)) : (clearInterval(intervalId[t.id]), deleteLabelFromArray(n, r));
|
|
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));
|
|
709
707
|
} else
|
|
710
|
-
shipLabels.value.find((
|
|
708
|
+
shipLabels.value.find(($) => $.name === l) && (clearInterval(intervalId[t.id]), drawPolygon(e, k), drawText(e, C));
|
|
711
709
|
}
|
|
712
710
|
}
|
|
713
711
|
return null;
|
|
712
|
+
}, clearAllInterval = () => {
|
|
713
|
+
Object.keys(intervalId).forEach((e) => {
|
|
714
|
+
clearInterval(e);
|
|
715
|
+
});
|
|
714
716
|
}, deleteLabelFromArray = (e, t) => {
|
|
715
|
-
const
|
|
716
|
-
|
|
717
|
+
const o = e.findIndex((n) => n.name === t);
|
|
718
|
+
o !== -1 && e.splice(o, 1);
|
|
717
719
|
}, PI = Math.PI, a = 6378245, ee = 0.006693421622965943;
|
|
718
720
|
function transformLat(e, t) {
|
|
719
|
-
let
|
|
720
|
-
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;
|
|
721
723
|
}
|
|
722
724
|
function transformLng(e, t) {
|
|
723
|
-
let
|
|
724
|
-
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;
|
|
725
727
|
}
|
|
726
728
|
function outOfChina(e, t) {
|
|
727
729
|
return !(e > 73.66 && e < 135.05 && t > 3.86 && t < 53.55);
|
|
728
730
|
}
|
|
729
731
|
function gcj02ToWgs84(e) {
|
|
730
|
-
const [t,
|
|
731
|
-
if (outOfChina(t,
|
|
732
|
-
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)}`;
|
|
733
735
|
{
|
|
734
|
-
let
|
|
735
|
-
const
|
|
736
|
-
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);
|
|
737
739
|
i = 1 - ee * i * i;
|
|
738
|
-
const
|
|
739
|
-
|
|
740
|
-
const
|
|
741
|
-
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)}`;
|
|
742
744
|
}
|
|
743
745
|
}
|
|
744
746
|
function calculateCirclePoints(e, t) {
|
|
745
|
-
const
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
],
|
|
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);
|
|
751
753
|
return {
|
|
752
|
-
leftTopPoint: { lng:
|
|
753
|
-
rightTopPoint: { lng:
|
|
754
|
-
rightBottomPoint: { lng:
|
|
755
|
-
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] }
|
|
756
758
|
};
|
|
757
759
|
}
|
|
758
760
|
const equatorialCircumference = 2003750834e-2;
|
|
759
761
|
function lonLatToMercator(e) {
|
|
760
762
|
const t = e[0] * equatorialCircumference / 180;
|
|
761
|
-
let
|
|
762
|
-
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];
|
|
763
765
|
}
|
|
764
766
|
function mercatorToLonLat(e, t = "lonlat") {
|
|
765
|
-
const
|
|
766
|
-
let
|
|
767
|
-
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];
|
|
768
770
|
}
|
|
769
771
|
function calculateBoundingBox(e) {
|
|
770
|
-
let t = 1 / 0,
|
|
772
|
+
let t = 1 / 0, o = -1 / 0, n = 1 / 0, l = -1 / 0;
|
|
771
773
|
e.forEach((h) => {
|
|
772
774
|
const [g, T] = h;
|
|
773
|
-
t = Math.min(t, T),
|
|
775
|
+
t = Math.min(t, T), o = Math.max(o, T), n = Math.min(n, g), l = Math.max(l, g);
|
|
774
776
|
});
|
|
775
|
-
const
|
|
776
|
-
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];
|
|
777
779
|
}
|
|
778
780
|
const transformUtils = {
|
|
779
781
|
gcj02ToWgs84,
|
|
@@ -781,48 +783,48 @@ const transformUtils = {
|
|
|
781
783
|
lonLatToMercator,
|
|
782
784
|
mercatorToLonLat,
|
|
783
785
|
calculateBoundingBox
|
|
784
|
-
}, mapInstance$7 = ref(), renderTrackStyleSetInstance = (e) => mapInstance$7.value = e, stopIcon = "", stopColor = "#E31818", slowIcon = "", slowColor = "#1890FF", dropletsIcon = "", trackList$1 = ref([]), renderTrackLine = (e, t,
|
|
785
|
-
var
|
|
786
|
-
const
|
|
787
|
-
if (!
|
|
788
|
-
allTracks.value[t] =
|
|
789
|
-
const
|
|
790
|
-
if (
|
|
791
|
-
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 });
|
|
792
794
|
d.setStyle(
|
|
793
795
|
new Style({
|
|
794
796
|
stroke: new Stroke({
|
|
795
|
-
color:
|
|
797
|
+
color: o,
|
|
796
798
|
width: 2
|
|
797
799
|
})
|
|
798
800
|
})
|
|
799
|
-
), 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 = [];
|
|
800
802
|
const m = shipTrackLineFeatures.value.findIndex((u) => u.getId() === t);
|
|
801
|
-
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({
|
|
802
804
|
features: [...shipTrackLineFeatures.value]
|
|
803
805
|
}), shipTrackVectorLayer.value = new VectorLayer({
|
|
804
806
|
source: trackLineVectorSource.value
|
|
805
|
-
}), renderPoint(
|
|
807
|
+
}), renderPoint(o), (c = mapInstance$7.value) == null || c.addLayer(shipTrackVectorLayer.value);
|
|
806
808
|
}
|
|
807
809
|
}, handlePlay = (e, t) => {
|
|
808
|
-
const
|
|
809
|
-
playAnimation(
|
|
810
|
+
const o = allTracks.value[String(e)];
|
|
811
|
+
playAnimation(o.map((n) => [n.lon, n.lat]), t);
|
|
810
812
|
}, removeShipTrackLineFeatureByIndex = (e, t) => {
|
|
811
813
|
e >= 0 && e < shipTrackLineFeatures.value.length && (shipTrackLineFeatures.value.splice(e, 1), delete allTracks.value[t]), trackLineVectorSource.value = new VectorSource({
|
|
812
814
|
features: [...shipTrackLineFeatures.value]
|
|
813
815
|
}), shipTrackVectorLayer.value && shipTrackVectorLayer.value.setSource(trackLineVectorSource.value);
|
|
814
816
|
}, createAnimatedIconFeature = (e, t) => {
|
|
815
|
-
const
|
|
817
|
+
const o = new Feature({
|
|
816
818
|
geometry: new Point(fromLonLat([t[0][0], t[0][1]]))
|
|
817
819
|
// 初始位置
|
|
818
|
-
}),
|
|
820
|
+
}), n = new Style({
|
|
819
821
|
text: new Text({
|
|
820
822
|
font: "700 14px map-iconfont",
|
|
821
823
|
text: getIconFont(""),
|
|
822
824
|
fill: new Fill({ color: e })
|
|
823
825
|
})
|
|
824
826
|
});
|
|
825
|
-
return
|
|
827
|
+
return o.setStyle(n), o;
|
|
826
828
|
}, geoMarkerStyle = new Style({
|
|
827
829
|
text: new Text({
|
|
828
830
|
font: "700 20px map-iconfont",
|
|
@@ -837,19 +839,19 @@ const trackAnimating = ref(!1);
|
|
|
837
839
|
let distance = 0, lastTime = Date.now(), moveFeatureHandler = null;
|
|
838
840
|
const moveFeature = (e, t) => {
|
|
839
841
|
var u, f;
|
|
840
|
-
const
|
|
841
|
-
if (distance = (distance +
|
|
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) {
|
|
842
844
|
stopAnimation();
|
|
843
845
|
return;
|
|
844
846
|
}
|
|
845
|
-
const
|
|
847
|
+
const r = linePath.getCoordinateAt(
|
|
846
848
|
distance > 1 ? 2 - distance : distance
|
|
847
849
|
), i = linePath.getCoordinateAt(
|
|
848
850
|
distance > 1 ? distance - 0.01 : distance
|
|
849
|
-
),
|
|
851
|
+
), c = linePath.getCoordinateAt(
|
|
850
852
|
distance > 1 ? 2 - distance : distance + 0.01
|
|
851
|
-
), d = getRotation(transformUtils.mercatorToLonLat(i, "array"), transformUtils.mercatorToLonLat(
|
|
852
|
-
(u = geoMarkerStyle.getText()) == null || u.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);
|
|
853
855
|
const m = getVectorContext(e);
|
|
854
856
|
m.context_.save(), m.setStyle(geoMarkerStyle), m.drawGeometry(position), m.context_.restore(), (f = mapInstance$7.value) == null || f.render();
|
|
855
857
|
}, startAnimation = () => {
|
|
@@ -858,7 +860,7 @@ const moveFeature = (e, t) => {
|
|
|
858
860
|
var e;
|
|
859
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);
|
|
860
862
|
}, playAnimation = (e, t) => {
|
|
861
|
-
var
|
|
863
|
+
var o;
|
|
862
864
|
trackAnimating.value && stopAnimation(), polyline = new Polyline({
|
|
863
865
|
factor: 1e6
|
|
864
866
|
}).writeGeometry(new LineString(e)), linePath = new Polyline({
|
|
@@ -877,42 +879,42 @@ const moveFeature = (e, t) => {
|
|
|
877
879
|
source: new VectorSource({
|
|
878
880
|
features: [geoMarker]
|
|
879
881
|
})
|
|
880
|
-
}), (
|
|
882
|
+
}), (o = mapInstance$7.value) == null || o.addLayer(vectorLayer), moveFeatureHandler = (n) => moveFeature(n, t), startAnimation();
|
|
881
883
|
}, renderPoint = (e) => {
|
|
882
884
|
if (!mapInstance$7.value) return;
|
|
883
885
|
const t = trackList$1.value || [];
|
|
884
886
|
if (!(t && t.length > 1)) return [];
|
|
885
|
-
const
|
|
886
|
-
for (let
|
|
887
|
-
t[
|
|
888
|
-
const
|
|
889
|
-
if (
|
|
890
|
-
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);
|
|
891
893
|
d = adjustBounds(d, [20, 20]);
|
|
892
894
|
const m = mapInstance$7.value.getView().getZoom();
|
|
893
895
|
if (!m) return;
|
|
894
896
|
if (m > 15) {
|
|
895
|
-
const f =
|
|
897
|
+
const f = o[m] || o.default;
|
|
896
898
|
d = adjustBounds(d, [f, f]);
|
|
897
899
|
}
|
|
898
900
|
let u = !0;
|
|
899
|
-
if (t[
|
|
900
|
-
for (let f = 0; f <
|
|
901
|
-
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)) {
|
|
902
904
|
u = !1;
|
|
903
905
|
break;
|
|
904
906
|
}
|
|
905
907
|
}
|
|
906
|
-
u && (t[
|
|
908
|
+
u && (t[c].bounds = d, n.push(t[c]));
|
|
907
909
|
}
|
|
908
910
|
}
|
|
909
|
-
const
|
|
910
|
-
|
|
911
|
+
const r = getIconStyle(stopIcon), i = getIconStyle(slowIcon);
|
|
912
|
+
n.forEach((c, s) => {
|
|
911
913
|
var u, f;
|
|
912
914
|
const d = new Feature({
|
|
913
|
-
geometry: new Point(
|
|
915
|
+
geometry: new Point(c.centerPoint)
|
|
914
916
|
});
|
|
915
|
-
d.set("type", "track_point"), d.set("data",
|
|
917
|
+
d.set("type", "track_point"), d.set("data", c), d.setStyle([
|
|
916
918
|
new Style({
|
|
917
919
|
// 扩大交互热区
|
|
918
920
|
image: new CircleStyle({
|
|
@@ -930,16 +932,16 @@ const moveFeature = (e, t) => {
|
|
|
930
932
|
})
|
|
931
933
|
]), trackLineVectorSource.value.addFeature(d);
|
|
932
934
|
const m = new Feature({
|
|
933
|
-
geometry: new Point(fromLonLat(
|
|
935
|
+
geometry: new Point(fromLonLat(c.center))
|
|
934
936
|
});
|
|
935
|
-
if (m.set("type", "track_label"), m.set("track_label_index",
|
|
936
|
-
setTrackLabelStyle(
|
|
937
|
-
), 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")) {
|
|
938
940
|
const p = new Feature({
|
|
939
|
-
geometry: new Point(
|
|
941
|
+
geometry: new Point(c.centerPoint)
|
|
940
942
|
});
|
|
941
943
|
p.set("type", "track_icon");
|
|
942
|
-
const
|
|
944
|
+
const w = new Style({
|
|
943
945
|
text: new Text({
|
|
944
946
|
font: "Normal 22px map-iconfont",
|
|
945
947
|
text: getIconFont(dropletsIcon),
|
|
@@ -947,29 +949,29 @@ const moveFeature = (e, t) => {
|
|
|
947
949
|
}),
|
|
948
950
|
zIndex: 99
|
|
949
951
|
}), h = [];
|
|
950
|
-
Number(
|
|
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);
|
|
951
953
|
}
|
|
952
|
-
}), renderArrow(
|
|
954
|
+
}), renderArrow(n, e), renderIconPoint();
|
|
953
955
|
}, renderArrow = (e, t) => {
|
|
954
|
-
const
|
|
955
|
-
|
|
956
|
-
for (let
|
|
957
|
-
let
|
|
958
|
-
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;
|
|
959
961
|
if (i % 2 === 0)
|
|
960
|
-
|
|
962
|
+
l = trackList$1.value[i].centerPoint;
|
|
961
963
|
else {
|
|
962
|
-
const
|
|
963
|
-
if (
|
|
964
|
-
const [d, m] =
|
|
965
|
-
|
|
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];
|
|
966
968
|
}
|
|
967
969
|
}
|
|
968
|
-
if (
|
|
969
|
-
const
|
|
970
|
-
geometry: new Point(
|
|
970
|
+
if (l) {
|
|
971
|
+
const c = new Feature({
|
|
972
|
+
geometry: new Point(l)
|
|
971
973
|
});
|
|
972
|
-
|
|
974
|
+
c.set("type", "track_arrow"), c.setStyle(
|
|
973
975
|
new Style({
|
|
974
976
|
text: new Text({
|
|
975
977
|
font: "700 14px map-iconfont",
|
|
@@ -977,23 +979,23 @@ const moveFeature = (e, t) => {
|
|
|
977
979
|
fill: new Fill({ color: t }),
|
|
978
980
|
// 设置箭头旋转 角度转为弧度
|
|
979
981
|
rotation: getRotation(
|
|
980
|
-
e[
|
|
981
|
-
e[
|
|
982
|
+
e[n].center,
|
|
983
|
+
e[n + 1].center
|
|
982
984
|
) * (Math.PI / 180)
|
|
983
985
|
})
|
|
984
986
|
})
|
|
985
|
-
), trackLineVectorSource.value.addFeature(
|
|
987
|
+
), trackLineVectorSource.value.addFeature(c);
|
|
986
988
|
}
|
|
987
989
|
}
|
|
988
990
|
}, renderIconPoint = () => {
|
|
989
|
-
const e = "", t = "#fcdc3f",
|
|
990
|
-
(trackList$1.value.length < 2 ? [trackList$1.value[0]] : [trackList$1.value[0], trackList$1.value[trackList$1.value.length - 1]]).forEach((
|
|
991
|
-
const
|
|
992
|
-
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)
|
|
993
995
|
});
|
|
994
|
-
|
|
995
|
-
const i =
|
|
996
|
-
|
|
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(
|
|
997
999
|
new Style({
|
|
998
1000
|
text: new Text({
|
|
999
1001
|
font: "Normal 14px map-iconfont",
|
|
@@ -1002,12 +1004,12 @@ const moveFeature = (e, t) => {
|
|
|
1002
1004
|
}),
|
|
1003
1005
|
zIndex: 101
|
|
1004
1006
|
})
|
|
1005
|
-
), trackLineVectorSource.value.addFeature(
|
|
1007
|
+
), trackLineVectorSource.value.addFeature(r);
|
|
1006
1008
|
});
|
|
1007
1009
|
}, setTrackLabelStyle = (e, t) => new Style({
|
|
1008
|
-
renderer: (
|
|
1009
|
-
const
|
|
1010
|
-
center:
|
|
1010
|
+
renderer: (o, n) => {
|
|
1011
|
+
const l = n.context, c = {
|
|
1012
|
+
center: o,
|
|
1011
1013
|
text: e.time,
|
|
1012
1014
|
color: t,
|
|
1013
1015
|
textColor: "#000",
|
|
@@ -1015,7 +1017,7 @@ const moveFeature = (e, t) => {
|
|
|
1015
1017
|
selected: !0,
|
|
1016
1018
|
type: "TrackTime"
|
|
1017
1019
|
};
|
|
1018
|
-
drawLabel(
|
|
1020
|
+
drawLabel(l, c, trackLabels.value);
|
|
1019
1021
|
}
|
|
1020
1022
|
}), triangleModel = multiplyPixelRatio([
|
|
1021
1023
|
[0, -8],
|
|
@@ -1085,85 +1087,92 @@ const moveFeature = (e, t) => {
|
|
|
1085
1087
|
image: new CircleStyle({
|
|
1086
1088
|
radius: 0
|
|
1087
1089
|
})
|
|
1088
|
-
}), mapInstance$6 = ref(), renderShipStyleSetInstance = (e) => mapInstance$6.value = e, speedCondition = [[1, 10], [10, 20], [20, 1 / 0]], drawShipModelByZoom = { 14: [200, 30], 15: [115, 15], 16: [55, 8], 17: [25, 5], 18: [1, 1] }, setShipStyle = (e) => new Style({
|
|
1089
|
-
renderer: (
|
|
1090
|
-
const
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
l,
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
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 = []);
|
|
1098
1105
|
try {
|
|
1099
|
-
const
|
|
1100
|
-
|
|
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);
|
|
1101
1110
|
} catch {
|
|
1102
1111
|
return !1;
|
|
1103
1112
|
}
|
|
1104
1113
|
}
|
|
1105
|
-
}), drawShipBody = (e, t, n) => {
|
|
1114
|
+
}), drawShipBody = (e, t, o, n) => {
|
|
1106
1115
|
if (!mapInstance$6.value) return;
|
|
1107
|
-
const
|
|
1108
|
-
if (!
|
|
1116
|
+
const l = Math.round(Number(mapInstance$6.value.getView().getZoom()));
|
|
1117
|
+
if (!l) return;
|
|
1109
1118
|
let r = [];
|
|
1110
|
-
const [
|
|
1111
|
-
if (
|
|
1112
|
-
r = rotateShapeModel(drawCurrentShipShapeModel(t,
|
|
1113
|
-
const [
|
|
1114
|
-
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];
|
|
1115
1124
|
});
|
|
1116
1125
|
else {
|
|
1117
|
-
const
|
|
1118
|
-
|
|
1119
|
-
const [
|
|
1120
|
-
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];
|
|
1121
1130
|
}));
|
|
1122
1131
|
}
|
|
1123
1132
|
if (!(r.length > 2)) return !1;
|
|
1124
1133
|
e.save(), e.beginPath(), e.moveTo(r[0][0], r[0][1]);
|
|
1125
|
-
for (let
|
|
1126
|
-
e.lineTo(r[
|
|
1127
|
-
return e.closePath(), e.strokeStyle = "#000", e.lineWidth = 1, e.stroke(), e.fillStyle = t.fill, e.fill(), e.restore(), r;
|
|
1128
|
-
}, drawHeading = (e, t, n) => {
|
|
1129
|
-
const [
|
|
1130
|
-
if (
|
|
1131
|
-
const
|
|
1132
|
-
const [
|
|
1133
|
-
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];
|
|
1134
1143
|
});
|
|
1135
1144
|
if (e.save(), e.beginPath(), t.angle > 0) {
|
|
1136
|
-
e.translate(
|
|
1145
|
+
e.translate(l, r);
|
|
1137
1146
|
const s = t.angle * Math.PI / 180;
|
|
1138
|
-
e.rotate(s), e.translate(-
|
|
1147
|
+
e.rotate(s), e.translate(-l, -r);
|
|
1139
1148
|
}
|
|
1140
|
-
e.moveTo(
|
|
1141
|
-
for (let s = 1; s <
|
|
1142
|
-
const [
|
|
1143
|
-
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);
|
|
1144
1153
|
}
|
|
1145
|
-
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();
|
|
1146
1155
|
}
|
|
1147
1156
|
}, drawSelectBounds = (e, t) => {
|
|
1148
|
-
let [n,
|
|
1157
|
+
let [o, n, l, r] = getPixelFromCoordinate(t);
|
|
1149
1158
|
const i = 4;
|
|
1150
|
-
|
|
1151
|
-
const
|
|
1152
|
-
e.beginPath(), e.moveTo(
|
|
1153
|
-
}, 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) => {
|
|
1154
1163
|
if (!t.selected && shipLabels.value.find((u) => u.name === t.name)) return;
|
|
1155
|
-
const [
|
|
1156
|
-
let
|
|
1157
|
-
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: "" });
|
|
1158
1167
|
const d = getShipCustomIcon(t), m = {
|
|
1159
1168
|
id: t.id,
|
|
1160
|
-
center: [
|
|
1161
|
-
text:
|
|
1169
|
+
center: [r, i],
|
|
1170
|
+
text: c,
|
|
1162
1171
|
fill: t.fill,
|
|
1163
1172
|
color: "#fff",
|
|
1164
1173
|
textColor: "#000",
|
|
1165
1174
|
bgColor: "#fff",
|
|
1166
|
-
leftIcon:
|
|
1175
|
+
leftIcon: s,
|
|
1167
1176
|
rightIcons: d,
|
|
1168
1177
|
selected: t.selected,
|
|
1169
1178
|
blinkColors: t.blinkColors,
|
|
@@ -1171,23 +1180,23 @@ const moveFeature = (e, t) => {
|
|
|
1171
1180
|
};
|
|
1172
1181
|
drawLabel(e, m, shipLabels.value);
|
|
1173
1182
|
}, drawCurrentShipShapeModel = (e, t) => {
|
|
1174
|
-
let
|
|
1175
|
-
t <= 14 ?
|
|
1176
|
-
const
|
|
1177
|
-
let
|
|
1178
|
-
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;
|
|
1179
1188
|
}, getShipDirectPath = (e) => {
|
|
1180
|
-
const { speed: t, hdg:
|
|
1181
|
-
let
|
|
1182
|
-
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))
|
|
1183
1192
|
for (const i in speedCondition) {
|
|
1184
|
-
const
|
|
1185
|
-
if (t >=
|
|
1186
|
-
|
|
1193
|
+
const c = speedCondition[i];
|
|
1194
|
+
if (t >= c[0] && t < c[1]) {
|
|
1195
|
+
r = shipDirectPath[l][i];
|
|
1187
1196
|
break;
|
|
1188
1197
|
}
|
|
1189
1198
|
}
|
|
1190
|
-
return
|
|
1199
|
+
return r;
|
|
1191
1200
|
}, getShipCustomIcon = (e) => {
|
|
1192
1201
|
const t = [];
|
|
1193
1202
|
return e.existDevice && t.push(""), e.existMobile && t.push(""), e.existWaterGauge && t.push(""), t || [];
|
|
@@ -1196,23 +1205,23 @@ let shipsMarkerList = [], shipsVectorSource, largeAmountShipsSource;
|
|
|
1196
1205
|
const selectedShipData = ref(null);
|
|
1197
1206
|
let selectShipsVectorSource;
|
|
1198
1207
|
const renderShips = (e) => {
|
|
1199
|
-
var n,
|
|
1208
|
+
var o, n, l, r;
|
|
1200
1209
|
if (!mapInstance$5.value || showTrackLayer.value) return;
|
|
1201
1210
|
const t = Math.round(Number(mapInstance$5.value.getView().getZoom()));
|
|
1202
1211
|
if (selectedShipData.value && nextTick(() => {
|
|
1203
1212
|
selectSingleShipMarker(selectedShipData.value);
|
|
1204
1213
|
}).then((i) => {
|
|
1205
1214
|
}), !(!t || t < mapZoom.shipGreenDotMax) && (allShips.value = e, !hiddenOrther.value))
|
|
1206
|
-
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));
|
|
1207
1216
|
}, renderLargeAmountShips = (e) => {
|
|
1208
1217
|
if (!mapInstance$5.value) return;
|
|
1209
|
-
const t = e.map((
|
|
1218
|
+
const t = e.map((o) => ({
|
|
1210
1219
|
type: "Feature",
|
|
1211
1220
|
geometry: {
|
|
1212
1221
|
type: "Point",
|
|
1213
|
-
coordinates: [
|
|
1222
|
+
coordinates: [o.lon, o.lat]
|
|
1214
1223
|
},
|
|
1215
|
-
properties:
|
|
1224
|
+
properties: o
|
|
1216
1225
|
}));
|
|
1217
1226
|
return largeAmountShipsSource == null || largeAmountShipsSource.clear(), largeAmountShipsSource = new VectorSource({
|
|
1218
1227
|
features: new GeoJSON().readFeatures({
|
|
@@ -1253,34 +1262,55 @@ const renderShips = (e) => {
|
|
|
1253
1262
|
}
|
|
1254
1263
|
}), mapInstance$5.value.addLayer(largeAmountShipsLayer.value), largeAmountShipsLayer.value;
|
|
1255
1264
|
}, renderShipsMarker = (e) => {
|
|
1256
|
-
var
|
|
1265
|
+
var o;
|
|
1257
1266
|
if (!mapInstance$5.value) return;
|
|
1258
1267
|
deleteAllShipMarkers();
|
|
1259
1268
|
let t = convertShipMapData(e);
|
|
1260
1269
|
if (t = customFilterShips(t), !!(t != null && t.length))
|
|
1261
|
-
return t.forEach((
|
|
1262
|
-
const
|
|
1263
|
-
geometry: new Point(fromLonLat(
|
|
1264
|
-
}),
|
|
1265
|
-
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(
|
|
1266
1275
|
setShipStyle(!1)
|
|
1267
1276
|
), shipsMarkerList.push({
|
|
1268
|
-
ship:
|
|
1269
|
-
lonlat:
|
|
1277
|
+
ship: n,
|
|
1278
|
+
lonlat: r,
|
|
1270
1279
|
feature: i
|
|
1271
1280
|
});
|
|
1272
1281
|
}), shipsVectorSource = new VectorSource({
|
|
1273
|
-
features: shipsMarkerList.map((
|
|
1282
|
+
features: shipsMarkerList.map((n) => n.feature)
|
|
1274
1283
|
}), shipsLayer.value = new VectorLayer({
|
|
1275
1284
|
source: shipsVectorSource,
|
|
1276
1285
|
zIndex: 100
|
|
1277
|
-
}), (
|
|
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
|
+
});
|
|
1278
1308
|
}, customFilterShips = (e) => {
|
|
1279
1309
|
let t = cloneDeep(e);
|
|
1280
|
-
return t = t.filter((
|
|
1281
|
-
var
|
|
1282
|
-
const
|
|
1283
|
-
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;
|
|
1284
1314
|
}), t;
|
|
1285
1315
|
}, getFilterItem = (e) => [
|
|
1286
1316
|
{ btnShow: switchBtnShow.value.camera, value: e == null ? void 0 : e.existDevice },
|
|
@@ -1289,51 +1319,53 @@ const renderShips = (e) => {
|
|
|
1289
1319
|
], deleteAllShipMarkers = () => {
|
|
1290
1320
|
shipsMarkerList.forEach((e) => {
|
|
1291
1321
|
e.feature && (shipsVectorSource == null || shipsVectorSource.removeFeature(e.feature));
|
|
1292
|
-
}), shipsMarkerList = [];
|
|
1322
|
+
}), clearAllInterval(), shipsMarkerList = [];
|
|
1293
1323
|
}, selectSingleShipMarker = (e) => {
|
|
1294
|
-
var
|
|
1324
|
+
var r;
|
|
1295
1325
|
if (!mapInstance$5.value) return;
|
|
1296
1326
|
const t = cloneDeep(selectSingleShipData.value);
|
|
1297
1327
|
selectSingleShipData.value = convertShipMapData(e);
|
|
1298
|
-
const
|
|
1299
|
-
geometry: new Point(fromLonLat(
|
|
1328
|
+
const o = [selectSingleShipData.value.lon, selectSingleShipData.value.lat], n = new Feature({
|
|
1329
|
+
geometry: new Point(fromLonLat(o))
|
|
1300
1330
|
});
|
|
1301
|
-
|
|
1331
|
+
n.set("data", selectSingleShipData.value), n.setStyle(
|
|
1302
1332
|
setShipStyle(!0)
|
|
1303
1333
|
), shipsMarkerList.push({
|
|
1304
1334
|
ship: selectSingleShipData.value,
|
|
1305
|
-
lonlat:
|
|
1306
|
-
feature:
|
|
1335
|
+
lonlat: o,
|
|
1336
|
+
feature: n
|
|
1307
1337
|
}), selectShipsVectorSource == null || selectShipsVectorSource.clear(), selectShipsVectorSource = new VectorSource({
|
|
1308
|
-
features: [
|
|
1338
|
+
features: [n]
|
|
1309
1339
|
}), selectShipsLayer.value = new VectorLayer({
|
|
1310
1340
|
source: selectShipsVectorSource
|
|
1311
1341
|
}), setVisibleFeatureById(shipsVectorSource, selectSingleShipData.value.id, !0);
|
|
1312
|
-
const
|
|
1313
|
-
return
|
|
1314
|
-
}, setVisibleFeatureById = (e, t,
|
|
1315
|
-
e && e.forEachFeature((
|
|
1316
|
-
const
|
|
1317
|
-
|
|
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());
|
|
1318
1348
|
});
|
|
1319
|
-
}, findShip = (e, t,
|
|
1320
|
-
var
|
|
1349
|
+
}, findShip = (e, t, o = !0) => {
|
|
1350
|
+
var l, r, i, c, s;
|
|
1321
1351
|
if (!e || !mapInstance$5.value) return;
|
|
1322
|
-
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) => {
|
|
1323
1353
|
var m;
|
|
1324
1354
|
return ((m = d.get("data")) == null ? void 0 : m.id) === e;
|
|
1325
1355
|
});
|
|
1326
|
-
if (
|
|
1356
|
+
if (n ? selectedShipData.value = n.get("data") : t && (selectedShipData.value = t), !t) {
|
|
1327
1357
|
console.error("找不到船舶");
|
|
1328
1358
|
return;
|
|
1329
1359
|
}
|
|
1330
|
-
if (
|
|
1360
|
+
if (o && ((c = selectedShipData.value) != null && c.lon) && ((s = selectedShipData.value) != null && s.lat)) {
|
|
1331
1361
|
const d = mapInstance$5.value.getView(), m = new Point([selectedShipData.value.lon, selectedShipData.value.lat]);
|
|
1332
1362
|
d.setCenter(transform(m.getCoordinates(), projection.data, projection.mercator));
|
|
1333
1363
|
const u = d.getZoom(), f = u < mapZoom.findShipMin ? mapZoom.findShip : u;
|
|
1334
1364
|
d.setZoom(f);
|
|
1335
1365
|
}
|
|
1336
|
-
return
|
|
1366
|
+
return setTimeout(() => {
|
|
1367
|
+
selectSingleShipMarker(t);
|
|
1368
|
+
}, 50), n;
|
|
1337
1369
|
}, clearSelectFeature = () => {
|
|
1338
1370
|
var e;
|
|
1339
1371
|
if (selectedShipData.value) {
|
|
@@ -1358,49 +1390,49 @@ const renderShips = (e) => {
|
|
|
1358
1390
|
switchBtnShow.value[e] = t, renderShips(allShips.value);
|
|
1359
1391
|
}, rerenderShip = () => {
|
|
1360
1392
|
renderShips(allShips.value);
|
|
1361
|
-
}, 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) => {
|
|
1362
1394
|
var m, u;
|
|
1363
1395
|
if (!t || !mapInstance$4.value) return;
|
|
1364
1396
|
document.querySelectorAll(".truck-custom-content").forEach((f) => f.parentNode.removeChild(f));
|
|
1365
|
-
const
|
|
1366
|
-
|
|
1397
|
+
const r = document.createElement("div");
|
|
1398
|
+
r.innerHTML = o;
|
|
1367
1399
|
const i = new Overlay({
|
|
1368
|
-
element:
|
|
1400
|
+
element: r,
|
|
1369
1401
|
position: t,
|
|
1370
1402
|
// 初始位置
|
|
1371
|
-
positioning:
|
|
1372
|
-
stopEvent:
|
|
1403
|
+
positioning: n,
|
|
1404
|
+
stopEvent: l
|
|
1373
1405
|
// 设置不阻拦事件
|
|
1374
1406
|
});
|
|
1375
|
-
if (
|
|
1376
|
-
let f = !1, p = [0, 0],
|
|
1377
|
-
|
|
1407
|
+
if (l) {
|
|
1408
|
+
let f = !1, p = [0, 0], w = [0, 0];
|
|
1409
|
+
r.addEventListener("mousedown", function(h) {
|
|
1378
1410
|
var g;
|
|
1379
|
-
f = !0, h.clientX, h.clientY, p = (g = mapInstance$4.value) == null ? void 0 : g.getCoordinateFromPixel([h.clientX - 200, h.clientY - 200]),
|
|
1380
|
-
h.clientX -
|
|
1381
|
-
h.clientY -
|
|
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
|
|
1382
1414
|
], h.preventDefault();
|
|
1383
1415
|
}), document.addEventListener("mousemove", function(h) {
|
|
1384
1416
|
var g;
|
|
1385
1417
|
if (f) {
|
|
1386
|
-
const T = (g = mapInstance$4.value) == null ? void 0 : g.getCoordinateFromPixel([h.clientX -
|
|
1387
|
-
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]);
|
|
1388
1420
|
}
|
|
1389
1421
|
}), document.addEventListener("mouseup", function() {
|
|
1390
1422
|
f = !1;
|
|
1391
1423
|
});
|
|
1392
1424
|
}
|
|
1393
1425
|
(m = mapInstance$4.value) == null || m.addOverlay(i);
|
|
1394
|
-
const
|
|
1395
|
-
|
|
1426
|
+
const c = r.querySelector(".close-button");
|
|
1427
|
+
c && c.addEventListener("click", () => {
|
|
1396
1428
|
var f, p;
|
|
1397
|
-
(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);
|
|
1398
1430
|
});
|
|
1399
|
-
const
|
|
1431
|
+
const s = JSON.parse(JSON.stringify(t)), d = (u = mapInstance$4.value) == null ? void 0 : u.getCoordinateFromPixel(s);
|
|
1400
1432
|
return i.setPosition(d), i;
|
|
1401
1433
|
}, mapInstance$3 = ref(), renderTrackSetInstance = (e) => mapInstance$3.value = e, showTracks = ref([]), trackList = ref([]);
|
|
1402
1434
|
ref(null);
|
|
1403
|
-
const trackId = ref(""), cursor = ref(0), renderTrack = (e, t,
|
|
1435
|
+
const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, l = "ship") => {
|
|
1404
1436
|
var m;
|
|
1405
1437
|
if (nextTick(() => {
|
|
1406
1438
|
hiddenAllShips();
|
|
@@ -1409,76 +1441,76 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, r = "ship")
|
|
|
1409
1441
|
((m = showTracks.value) == null ? void 0 : m.findIndex((u) => u.id === e)) < 0 && showTracks.value.push({ id: e, length: "" });
|
|
1410
1442
|
return;
|
|
1411
1443
|
}
|
|
1412
|
-
const
|
|
1444
|
+
const r = {};
|
|
1413
1445
|
t.forEach((u) => {
|
|
1414
1446
|
u.state ? u.state = Number(u.state) : delete u.state;
|
|
1415
|
-
}), trackId.value = e,
|
|
1416
|
-
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(
|
|
1417
1449
|
(u) => transform([u.lon, u.lat], projection.data, projection.mercator)
|
|
1418
|
-
),
|
|
1450
|
+
), s = new LineString(c), d = formatUtils.formatLength(s, n) || "--";
|
|
1419
1451
|
nextTick(() => {
|
|
1420
1452
|
var f, p;
|
|
1421
|
-
const u = (f = showTracks.value) == null ? void 0 : f.findIndex((
|
|
1422
|
-
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(() => {
|
|
1423
1455
|
resetTrackView(e);
|
|
1424
1456
|
}).then(() => {
|
|
1425
1457
|
}), (p = mapInstance$3.value) == null || p.on("moveend", () => {
|
|
1426
|
-
showTrackLayer.value && (trackLabels.value = [], renderTrackLine(
|
|
1458
|
+
showTrackLayer.value && (trackLabels.value = [], renderTrackLine(r, e, o));
|
|
1427
1459
|
}), renderTrackPointPopup();
|
|
1428
1460
|
}).then(() => {
|
|
1429
1461
|
});
|
|
1430
1462
|
}, renderTrackPointPopup = () => {
|
|
1431
1463
|
var t;
|
|
1432
1464
|
const e = ref(null);
|
|
1433
|
-
(t = mapInstance$3.value) == null || t.on("pointermove", (
|
|
1434
|
-
var
|
|
1435
|
-
e.value && ((
|
|
1436
|
-
const
|
|
1437
|
-
if (
|
|
1438
|
-
const
|
|
1439
|
-
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;
|
|
1440
1472
|
let d = "";
|
|
1441
|
-
|
|
1473
|
+
s != null && s.stayTime && (d = `
|
|
1442
1474
|
<div class="item w-100">
|
|
1443
1475
|
<div class="item-label">停泊时间约</div>
|
|
1444
|
-
<div class="item-item">${formatMinutesToDDHHMM(Number(
|
|
1476
|
+
<div class="item-item">${formatMinutesToDDHHMM(Number(s.stayTime))}</div>
|
|
1445
1477
|
</div>
|
|
1446
1478
|
`);
|
|
1447
1479
|
const m = `
|
|
1448
1480
|
<div class="track-point-popup">
|
|
1449
1481
|
<div class="item">
|
|
1450
1482
|
<div class="item-label">状态</div>
|
|
1451
|
-
<div class="item-item">${
|
|
1483
|
+
<div class="item-item">${s != null && s.sailStatus ? SHIP_SAIL_STATUS[String(s.sailStatus)] : DEFAULT_VALUE}</div>
|
|
1452
1484
|
</div>
|
|
1453
1485
|
<div class="item">
|
|
1454
1486
|
<div class="item-label">航速</div>
|
|
1455
|
-
<div class="item-item">${
|
|
1487
|
+
<div class="item-item">${s.speed || DEFAULT_VALUE}</div>
|
|
1456
1488
|
</div>
|
|
1457
1489
|
<div class="item">
|
|
1458
1490
|
<div class="item-label">艏向</div>
|
|
1459
|
-
<div class="item-item">${
|
|
1491
|
+
<div class="item-item">${s.hdg || DEFAULT_VALUE}</div>
|
|
1460
1492
|
</div>
|
|
1461
1493
|
<div class="item">
|
|
1462
1494
|
<div class="item-label">航向</div>
|
|
1463
|
-
<div class="item-item">${
|
|
1495
|
+
<div class="item-item">${s.cog || DEFAULT_VALUE}</div>
|
|
1464
1496
|
</div>
|
|
1465
1497
|
<div class="item">
|
|
1466
1498
|
<div class="item-label">经度</div>
|
|
1467
|
-
<div class="item-item">${
|
|
1499
|
+
<div class="item-item">${s.lon || DEFAULT_VALUE}</div>
|
|
1468
1500
|
</div>
|
|
1469
1501
|
<div class="item">
|
|
1470
1502
|
<div class="item-label">纬度</div>
|
|
1471
|
-
<div class="item-item">${
|
|
1503
|
+
<div class="item-item">${s.lat || DEFAULT_VALUE}</div>
|
|
1472
1504
|
</div>
|
|
1473
1505
|
<div class="item w-100">
|
|
1474
1506
|
<div class="item-label">时间</div>
|
|
1475
|
-
<div class="item-item">${
|
|
1507
|
+
<div class="item-item">${s.time}</div>
|
|
1476
1508
|
</div>
|
|
1477
1509
|
${d ?? d}
|
|
1478
|
-
</div>`, u = (i = mapInstance$3.value) == null ? void 0 : i.getPixelFromCoordinate(
|
|
1479
|
-
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");
|
|
1480
1512
|
} else
|
|
1481
|
-
(
|
|
1513
|
+
(c = mapInstance$3.value) == null || c.removeOverlay(e.value);
|
|
1482
1514
|
});
|
|
1483
1515
|
}, removeAllTrackLayer = () => {
|
|
1484
1516
|
var e;
|
|
@@ -1486,21 +1518,21 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, r = "ship")
|
|
|
1486
1518
|
}, playTrack = (e, t) => {
|
|
1487
1519
|
handlePlay(String(e), t);
|
|
1488
1520
|
}, resetTrackView = (e) => {
|
|
1489
|
-
var
|
|
1490
|
-
const t = mapInstance$3.value.getView(),
|
|
1491
|
-
if (!
|
|
1492
|
-
const
|
|
1493
|
-
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)
|
|
1494
1526
|
try {
|
|
1495
|
-
const
|
|
1496
|
-
t.fit(
|
|
1497
|
-
} catch (
|
|
1498
|
-
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);
|
|
1499
1531
|
}
|
|
1500
1532
|
}, formatMinutesToDDHHMM = (e) => {
|
|
1501
|
-
const t = hooks.duration(e, "minutes"),
|
|
1502
|
-
let
|
|
1503
|
-
return
|
|
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;
|
|
1504
1536
|
}, _hoisted_1$3 = {
|
|
1505
1537
|
key: 0,
|
|
1506
1538
|
class: "more-tool-panel"
|
|
@@ -1515,25 +1547,25 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, r = "ship")
|
|
|
1515
1547
|
},
|
|
1516
1548
|
emits: ["switchGreenDot", "switchMapTile"],
|
|
1517
1549
|
setup(e, { emit: t }) {
|
|
1518
|
-
var p,
|
|
1519
|
-
const
|
|
1520
|
-
|
|
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));
|
|
1521
1553
|
}, m = () => {
|
|
1522
|
-
|
|
1554
|
+
l("switchMapTile", n.mapTileMode === BaseMapType.vector ? BaseMapType.satellite : BaseMapType.vector);
|
|
1523
1555
|
}, u = () => {
|
|
1524
1556
|
var h, g;
|
|
1525
|
-
i.value ? (h =
|
|
1557
|
+
i.value ? (h = c.value) == null || h.removeInteraction() : (g = c.value) == null || g.addInteraction(), i.value = !i.value;
|
|
1526
1558
|
}, f = () => {
|
|
1527
1559
|
var h;
|
|
1528
|
-
(h =
|
|
1560
|
+
(h = c.value) == null || h.removeInteraction(), i.value = !1;
|
|
1529
1561
|
};
|
|
1530
1562
|
return onMounted(() => {
|
|
1531
1563
|
nextTick(() => {
|
|
1532
1564
|
var h;
|
|
1533
|
-
(h =
|
|
1534
|
-
var T,
|
|
1535
|
-
const g = (
|
|
1536
|
-
g && (
|
|
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);
|
|
1537
1569
|
});
|
|
1538
1570
|
});
|
|
1539
1571
|
}), (h, g) => (openBlock(), createElementBlock(Fragment, null, [
|
|
@@ -1552,7 +1584,7 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, r = "ship")
|
|
|
1552
1584
|
]), 2)) : createCommentVNode("", !0),
|
|
1553
1585
|
h.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
|
|
1554
1586
|
key: 1,
|
|
1555
|
-
class: normalizeClass(`switch-btn ${
|
|
1587
|
+
class: normalizeClass(`switch-btn ${s.value && "active"} ${(h.disableGreenDot || r.value >= unref(mapZoom).shipGreenDotMax) && "disabled"}`),
|
|
1556
1588
|
onClick: d
|
|
1557
1589
|
}, g[6] || (g[6] = [
|
|
1558
1590
|
createElementVNode("i", { class: "map-iconfont icon-ship" }, null, -1),
|
|
@@ -1603,7 +1635,7 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, r = "ship")
|
|
|
1603
1635
|
]), 2),
|
|
1604
1636
|
h.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
|
|
1605
1637
|
key: 0,
|
|
1606
|
-
class: normalizeClass(`switch-btn ${
|
|
1638
|
+
class: normalizeClass(`switch-btn ${s.value && "active"} ${(h.disableGreenDot || r.value >= unref(mapZoom).shipGreenDotMax) && "disabled"}`),
|
|
1607
1639
|
onClick: d
|
|
1608
1640
|
}, g[12] || (g[12] = [
|
|
1609
1641
|
createElementVNode("i", { class: "map-iconfont icon-ship" }, null, -1),
|
|
@@ -1623,7 +1655,7 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, r = "ship")
|
|
|
1623
1655
|
i.value ? (openBlock(), createBlock(Measure, {
|
|
1624
1656
|
key: 0,
|
|
1625
1657
|
ref_key: "measureRef",
|
|
1626
|
-
ref:
|
|
1658
|
+
ref: c,
|
|
1627
1659
|
visible: i.value,
|
|
1628
1660
|
"onUpdate:visible": g[4] || (g[4] = (T) => i.value = T),
|
|
1629
1661
|
onClose: f,
|
|
@@ -1635,16 +1667,16 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, r = "ship")
|
|
|
1635
1667
|
}), ToolPanel = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-ef931f65"]]), _hoisted_1$2 = { id: "scale-line-container" }, _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
1636
1668
|
__name: "scaleLine",
|
|
1637
1669
|
setup(e, { expose: t }) {
|
|
1638
|
-
const
|
|
1670
|
+
const o = inject("mapInstance");
|
|
1639
1671
|
return t({
|
|
1640
|
-
setScaleLine: (
|
|
1641
|
-
var
|
|
1642
|
-
const
|
|
1643
|
-
units:
|
|
1672
|
+
setScaleLine: (l) => {
|
|
1673
|
+
var c;
|
|
1674
|
+
const r = new ScaleLine$1({
|
|
1675
|
+
units: l || "metric"
|
|
1644
1676
|
}), i = document.getElementById("scale-line-container");
|
|
1645
|
-
i && (
|
|
1677
|
+
i && (r.setTarget(i), (c = o.value) == null || c.addControl(r));
|
|
1646
1678
|
}
|
|
1647
|
-
}), (
|
|
1679
|
+
}), (l, r) => (openBlock(), createElementBlock("div", _hoisted_1$2));
|
|
1648
1680
|
}
|
|
1649
1681
|
}), ScaleLine = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-8c27b246"]]), _hoisted_1$1 = { class: "zoom" }, _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
1650
1682
|
__name: "zoomControl",
|
|
@@ -1654,22 +1686,22 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, r = "ship")
|
|
|
1654
1686
|
}
|
|
1655
1687
|
},
|
|
1656
1688
|
setup(e) {
|
|
1657
|
-
const t = inject("mapInstance"),
|
|
1689
|
+
const t = inject("mapInstance"), o = () => {
|
|
1658
1690
|
if (!t.value) return;
|
|
1659
|
-
const
|
|
1660
|
-
|
|
1661
|
-
},
|
|
1691
|
+
const l = t.value.getView(), r = l.getZoom();
|
|
1692
|
+
r && l.setZoom(r + 1);
|
|
1693
|
+
}, n = () => {
|
|
1662
1694
|
if (!t.value) return;
|
|
1663
|
-
const
|
|
1664
|
-
|
|
1695
|
+
const l = t.value.getView(), r = l.getZoom();
|
|
1696
|
+
r && l.setZoom(r - 1);
|
|
1665
1697
|
};
|
|
1666
|
-
return (
|
|
1698
|
+
return (l, r) => (openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
1667
1699
|
createElementVNode("div", {
|
|
1668
|
-
onClick:
|
|
1700
|
+
onClick: o,
|
|
1669
1701
|
class: "button big-button"
|
|
1670
1702
|
}, "+"),
|
|
1671
1703
|
createElementVNode("div", {
|
|
1672
|
-
onClick:
|
|
1704
|
+
onClick: n,
|
|
1673
1705
|
class: "button small-button"
|
|
1674
1706
|
}, "-")
|
|
1675
1707
|
]));
|
|
@@ -1680,20 +1712,20 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, r = "ship")
|
|
|
1680
1712
|
type: { default: COPY_RIGHT_TYPE.HORIZONTAL }
|
|
1681
1713
|
},
|
|
1682
1714
|
setup(e) {
|
|
1683
|
-
useCssVars((
|
|
1684
|
-
|
|
1715
|
+
useCssVars((r) => ({
|
|
1716
|
+
"4bfada56": l.value
|
|
1685
1717
|
}));
|
|
1686
|
-
const t = e,
|
|
1687
|
-
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, [
|
|
1688
1720
|
createElementVNode("img", {
|
|
1689
|
-
src: unref(CDN_URL) +
|
|
1690
|
-
width:
|
|
1721
|
+
src: unref(CDN_URL) + o.value,
|
|
1722
|
+
width: n.value,
|
|
1691
1723
|
class: "logo",
|
|
1692
1724
|
alt: ""
|
|
1693
1725
|
}, null, 8, _hoisted_2)
|
|
1694
1726
|
]));
|
|
1695
1727
|
}
|
|
1696
|
-
}), 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();
|
|
1697
1729
|
dotImage$1.src = `${CDN_URL}/map/truck-dot.svg`;
|
|
1698
1730
|
dotImage$1.crossOrigin = "anonymous";
|
|
1699
1731
|
const dotActiveImage$1 = new Image();
|
|
@@ -1705,31 +1737,31 @@ cameraImage.crossOrigin = "anonymous";
|
|
|
1705
1737
|
const loadImage = new Image();
|
|
1706
1738
|
loadImage.src = `${CDN_URL}/map/map-load.svg`;
|
|
1707
1739
|
loadImage.crossOrigin = "anonymous";
|
|
1708
|
-
const setTruckStyle = (e, t,
|
|
1709
|
-
renderer: (
|
|
1710
|
-
const i =
|
|
1740
|
+
const setTruckStyle = (e, t, o, n) => new Style({
|
|
1741
|
+
renderer: (l, r) => {
|
|
1742
|
+
const i = r.context;
|
|
1711
1743
|
i.save();
|
|
1712
|
-
let
|
|
1713
|
-
i.scale(
|
|
1714
|
-
let [
|
|
1715
|
-
|
|
1716
|
-
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;
|
|
1717
1749
|
let f = 180;
|
|
1718
|
-
const p = 56,
|
|
1750
|
+
const p = 56, w = "#FFFFFF";
|
|
1719
1751
|
let h = 176;
|
|
1720
1752
|
const g = 52;
|
|
1721
|
-
let T = "#164AFF",
|
|
1722
|
-
|
|
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";
|
|
1723
1755
|
const b = `${t.slice(0, 2) + " · " + t.slice(2)}`;
|
|
1724
|
-
if (i.fillText(b, m + 12, u + 32), i.save(), i.restore(),
|
|
1725
|
-
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;
|
|
1726
1758
|
let x = 0;
|
|
1727
|
-
|
|
1728
|
-
v === DEVICE_TYPE.CAMERA && (i.drawImage(cameraImage,
|
|
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);
|
|
1729
1761
|
});
|
|
1730
1762
|
}
|
|
1731
1763
|
const V = dotImage$1;
|
|
1732
|
-
i.drawImage(V,
|
|
1764
|
+
i.drawImage(V, s + f / 2 - 90, d, 50 / c, 50 / c), i.restore();
|
|
1733
1765
|
}
|
|
1734
1766
|
}), mapInstance$2 = ref(), renderDashboardSetInstance = (e) => mapInstance$2.value = e;
|
|
1735
1767
|
ref([]);
|
|
@@ -1737,15 +1769,15 @@ let truckMarkerList = [], trucksVectorSource;
|
|
|
1737
1769
|
const renderTrucksMarker = (e) => {
|
|
1738
1770
|
if (deleteAllTruckMarkers(), !!mapInstance$2.value)
|
|
1739
1771
|
return e.forEach((t) => {
|
|
1740
|
-
const
|
|
1741
|
-
geometry: new Point(fromLonLat(
|
|
1772
|
+
const o = formatUtils.convertSixHundredThousandToLatLng(t.lon, t.lat), n = new Feature({
|
|
1773
|
+
geometry: new Point(fromLonLat(o))
|
|
1742
1774
|
});
|
|
1743
|
-
|
|
1775
|
+
n.set("data", t), n.setStyle(
|
|
1744
1776
|
setTruckStyle(!1, t.vno, t == null ? void 0 : t.vclColor, t == null ? void 0 : t.icons)
|
|
1745
1777
|
), truckMarkerList.push({
|
|
1746
1778
|
name: t.vno,
|
|
1747
|
-
lonlat:
|
|
1748
|
-
feature:
|
|
1779
|
+
lonlat: o,
|
|
1780
|
+
feature: n
|
|
1749
1781
|
});
|
|
1750
1782
|
}), trucksVectorSource = new VectorSource({
|
|
1751
1783
|
features: truckMarkerList.map((t) => t.feature)
|
|
@@ -1759,36 +1791,56 @@ const renderTrucksMarker = (e) => {
|
|
|
1759
1791
|
}, mapInstance$1 = ref(), renderTruckSetInstance = (e) => mapInstance$1.value = e, vehicle = ref(null), focusShipData = ref(), currentTruckOverlay = ref(null), findTruck = async (e) => {
|
|
1760
1792
|
if (!mapInstance$1.value) return;
|
|
1761
1793
|
focusShipData.value = e;
|
|
1762
|
-
const t = formatUtils.convertSixHundredThousandToLatLng(e.lon, e.lat),
|
|
1763
|
-
currentTruckOverlay.value = drawTruckIcon(e.vno,
|
|
1764
|
-
const
|
|
1765
|
-
|
|
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));
|
|
1766
1798
|
}, clearAllTruck = () => {
|
|
1767
1799
|
vehicle.value.clearAllShip();
|
|
1768
|
-
}, drawTruckIcon = (e, t,
|
|
1769
|
-
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);">
|
|
1770
1802
|
<img src="${CDN_URL}map/car-icon.gif" width="100%" height="100%" />
|
|
1771
1803
|
</div>`;
|
|
1772
|
-
return drawCustomContent(e, t,
|
|
1804
|
+
return drawCustomContent(e, t, n, "center-center");
|
|
1773
1805
|
}, removeTruckIcon = () => {
|
|
1774
1806
|
var t;
|
|
1775
1807
|
const e = (t = currentTruckOverlay.value) == null ? void 0 : t.getElement();
|
|
1776
1808
|
e && (e.innerHTML = "");
|
|
1777
1809
|
}, zoomTruckIcon = () => {
|
|
1778
|
-
var
|
|
1810
|
+
var r;
|
|
1779
1811
|
if (!mapInstance$1.value) return;
|
|
1780
|
-
const e = mapInstance$1.value.getView().getZoom(), t = 120,
|
|
1781
|
-
function
|
|
1782
|
-
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;
|
|
1783
1815
|
}
|
|
1784
|
-
const
|
|
1785
|
-
(
|
|
1786
|
-
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`;
|
|
1787
1819
|
});
|
|
1788
1820
|
}, mapInstance = ref(), drawPolygonSetInstance = (e) => mapInstance.value = e;
|
|
1789
1821
|
let layerState = "drawn", drawnState = "undrawn";
|
|
1790
1822
|
const source = new VectorSource();
|
|
1791
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
|
+
};
|
|
1792
1844
|
function createMeasureTooltip() {
|
|
1793
1845
|
var e;
|
|
1794
1846
|
measureTooltipElement != null && measureTooltipElement.parentNode && measureTooltipElement.parentNode.removeChild(measureTooltipElement), measureTooltipElement = document.createElement("div"), measureTooltipElement.className = "ol-tooltip ol-tooltip-draw-polygon", measureTooltip = new Overlay({
|
|
@@ -1809,108 +1861,97 @@ function createHelpTooltip() {
|
|
|
1809
1861
|
}
|
|
1810
1862
|
let squareLimitError = !1, lineLimitError = !1;
|
|
1811
1863
|
const validateSquareLimit = (e) => {
|
|
1812
|
-
let
|
|
1813
|
-
e == null || e.forEach((
|
|
1814
|
-
const d = transform(
|
|
1815
|
-
|
|
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);
|
|
1816
1868
|
});
|
|
1817
|
-
const i = (
|
|
1818
|
-
squareLimitError = i > 150 ||
|
|
1869
|
+
const i = (n - o) * 111, c = (r - l) * 111;
|
|
1870
|
+
squareLimitError = i > 150 || c > 150;
|
|
1819
1871
|
};
|
|
1820
1872
|
let storeFeature, callbackFunction = null;
|
|
1821
1873
|
const addInteraction = (e) => {
|
|
1822
|
-
var o,
|
|
1823
|
-
e && (callbackFunction = e), drawVector || init(), drawnState = "undrawn", layerState = "drawn", (o = mapInstance.value) == null || o.addLayer(drawVector)
|
|
1824
|
-
const t = new Style({
|
|
1825
|
-
stroke: new Stroke({
|
|
1826
|
-
color: "rgba(255, 255, 255, 1)",
|
|
1827
|
-
width: 1.5,
|
|
1828
|
-
lineDash: [10, 10]
|
|
1829
|
-
}),
|
|
1830
|
-
fill: new Fill({
|
|
1831
|
-
color: "rgba(255, 255, 255, 0.25)"
|
|
1832
|
-
})
|
|
1833
|
-
});
|
|
1834
|
-
draw = new Draw({
|
|
1874
|
+
var o, n;
|
|
1875
|
+
e && (callbackFunction = e), drawVector || init(), drawnState = "undrawn", layerState = "drawn", (o = mapInstance.value) == null || o.addLayer(drawVector), draw = new Draw({
|
|
1835
1876
|
type: "Polygon",
|
|
1836
1877
|
source,
|
|
1837
1878
|
trace: !0,
|
|
1838
|
-
style: [
|
|
1839
|
-
}), (
|
|
1840
|
-
let
|
|
1879
|
+
style: [drawPolygonStyle.drawing, circleStyle]
|
|
1880
|
+
}), (n = mapInstance.value) == null || n.addInteraction(draw), createMeasureTooltip(), createHelpTooltip();
|
|
1881
|
+
let t;
|
|
1841
1882
|
draw.on("drawstart", function(l) {
|
|
1842
|
-
var
|
|
1843
|
-
layerState = "drawn", sketch = l.feature,
|
|
1844
|
-
const c =
|
|
1845
|
-
if (lineLimitError = Number(getLength(
|
|
1846
|
-
<span class="text">面积:${
|
|
1847
|
-
`), helpTooltipElement &&
|
|
1848
|
-
let
|
|
1849
|
-
parseFloat(
|
|
1850
|
-
<div class="text ${squareLimitError ? "error" : ""}">面积:${
|
|
1851
|
-
<span class="text ${lineLimitError ? "error" : ""}">线段${
|
|
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>
|
|
1852
1893
|
<div><span class="text">单击继续,双击结束</span></div>
|
|
1853
1894
|
`;
|
|
1854
1895
|
}
|
|
1855
1896
|
}), drawnState = "drawing";
|
|
1856
1897
|
}), draw.on("drawend", function(l) {
|
|
1857
|
-
var
|
|
1898
|
+
var r;
|
|
1858
1899
|
if (l.feature.getGeometry()) {
|
|
1859
1900
|
storeFeature = l.feature;
|
|
1860
|
-
const
|
|
1861
|
-
|
|
1901
|
+
const i = endFn(l.feature);
|
|
1902
|
+
i != null && i.length && callbackFunction && callbackFunction(i);
|
|
1862
1903
|
}
|
|
1863
|
-
if (sketch = null, measureTooltipElement = null, createMeasureTooltip(),
|
|
1864
|
-
const
|
|
1865
|
-
|
|
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);
|
|
1866
1907
|
}
|
|
1867
1908
|
});
|
|
1868
1909
|
}, removeInteraction = () => {
|
|
1869
|
-
var e, t,
|
|
1910
|
+
var e, t, o;
|
|
1870
1911
|
if (mapInstance.value) {
|
|
1871
|
-
if (document.querySelectorAll(".ol-tooltip.ol-tooltip-draw-polygon").forEach((
|
|
1872
|
-
var
|
|
1873
|
-
(
|
|
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);
|
|
1874
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) {
|
|
1875
|
-
const
|
|
1876
|
-
|
|
1916
|
+
const n = mapInstance.value.getInteractions().getArray().find((l) => l.ol_uid === draw.ol_uid);
|
|
1917
|
+
n && ((o = mapInstance.value) == null || o.removeInteraction(n));
|
|
1877
1918
|
}
|
|
1878
1919
|
drawnState = "undrawn", layerState = "destroyed";
|
|
1879
1920
|
}
|
|
1880
1921
|
}, endFn = (e) => {
|
|
1881
|
-
var t,
|
|
1922
|
+
var t, o, n;
|
|
1882
1923
|
if (e.getGeometry()) {
|
|
1883
|
-
const
|
|
1884
|
-
(t = i[0]) == null || t.forEach((
|
|
1885
|
-
|
|
1924
|
+
const l = [], i = e.getGeometry().getCoordinates();
|
|
1925
|
+
(t = i[0]) == null || t.forEach((s) => {
|
|
1926
|
+
l.push(transform(s, projection.mercator, projection.data));
|
|
1886
1927
|
});
|
|
1887
|
-
const
|
|
1888
|
-
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", () => {
|
|
1889
1930
|
reset();
|
|
1890
1931
|
}), !lineLimitError && !squareLimitError)
|
|
1891
|
-
return
|
|
1892
|
-
draw && ((
|
|
1932
|
+
return l;
|
|
1933
|
+
draw && ((n = mapInstance.value) == null || n.removeInteraction(draw)), helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement);
|
|
1893
1934
|
}
|
|
1894
1935
|
}, initFeature = (e) => {
|
|
1895
|
-
var t,
|
|
1936
|
+
var t, o;
|
|
1896
1937
|
if (e && (callbackFunction = e), layerState = "drawn", storeFeature) {
|
|
1897
|
-
const
|
|
1898
|
-
if (!
|
|
1899
|
-
const
|
|
1938
|
+
const n = storeFeature.getGeometry();
|
|
1939
|
+
if (!n) return;
|
|
1940
|
+
const l = formatUtils.formatArea(n, LENGTH_UNIT.NM);
|
|
1900
1941
|
measureTooltipElement && (measureTooltipElement.innerHTML = `
|
|
1901
|
-
<span class="text">面积:${
|
|
1942
|
+
<span class="text">面积:${l}${lineLimitError || squareLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1902
1943
|
`), (t = drawVector.getSource()) == null || t.addFeature(storeFeature);
|
|
1903
|
-
const
|
|
1904
|
-
|
|
1944
|
+
const r = endFn(storeFeature);
|
|
1945
|
+
r != null && r.length && callbackFunction && callbackFunction(r);
|
|
1905
1946
|
const i = getCenter(storeFeature.getGeometry().getExtent());
|
|
1906
|
-
(
|
|
1947
|
+
(o = mapInstance.value) == null || o.getView().setCenter(i);
|
|
1907
1948
|
}
|
|
1908
1949
|
}, pointerMoveHandler = function(e) {
|
|
1909
|
-
var
|
|
1950
|
+
var o;
|
|
1910
1951
|
if (e.dragging)
|
|
1911
1952
|
return;
|
|
1912
1953
|
let t = "点击选择起点";
|
|
1913
|
-
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");
|
|
1914
1955
|
}, init = () => {
|
|
1915
1956
|
mapInstance.value && (circleStyle = new Style({
|
|
1916
1957
|
image: new CircleStyle({
|
|
@@ -1925,15 +1966,7 @@ const addInteraction = (e) => {
|
|
|
1925
1966
|
}
|
|
1926
1967
|
}), drawVector = new VectorLayer({
|
|
1927
1968
|
source,
|
|
1928
|
-
style:
|
|
1929
|
-
stroke: new Stroke({
|
|
1930
|
-
color: "rgba(255, 255, 255, 1)",
|
|
1931
|
-
width: 2
|
|
1932
|
-
}),
|
|
1933
|
-
fill: new Fill({
|
|
1934
|
-
color: "rgba(255, 255, 255, 0.3)"
|
|
1935
|
-
})
|
|
1936
|
-
})
|
|
1969
|
+
style: drawPolygonStyle.drawend
|
|
1937
1970
|
}), mapInstance.value.on("pointermove", pointerMoveHandler), mapInstance.value.getViewport().addEventListener("mouseout", function() {
|
|
1938
1971
|
var e;
|
|
1939
1972
|
(e = helpTooltipElement == null ? void 0 : helpTooltipElement.classList) == null || e.add("hidden");
|
|
@@ -1951,18 +1984,18 @@ const addInteraction = (e) => {
|
|
|
1951
1984
|
dotImage.crossOrigin = "anonymous";
|
|
1952
1985
|
const dotActiveImage = new Image();
|
|
1953
1986
|
dotActiveImage.crossOrigin = "anonymous";
|
|
1954
|
-
const setPointStyle = (e, t,
|
|
1955
|
-
const { color:
|
|
1956
|
-
return (
|
|
1957
|
-
renderer: (
|
|
1958
|
-
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;
|
|
1959
1992
|
d.save();
|
|
1960
1993
|
const m = 1;
|
|
1961
1994
|
d.scale(m, m);
|
|
1962
|
-
let [u, f] =
|
|
1995
|
+
let [u, f] = c;
|
|
1963
1996
|
u = u / m, f = f / m, d.font = "12px Arial";
|
|
1964
|
-
const p = d.measureText(t).width,
|
|
1965
|
-
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) {
|
|
1966
1999
|
const b = e ? dotActiveImage : dotImage;
|
|
1967
2000
|
d.drawImage(b, u - b.width / 2, f - b.height / 2, 40 / m, 40 / m);
|
|
1968
2001
|
}
|
|
@@ -1977,7 +2010,7 @@ class PointMarkerClass {
|
|
|
1977
2010
|
* 配置渲染点的样式
|
|
1978
2011
|
* @param options
|
|
1979
2012
|
*/
|
|
1980
|
-
constructor(t,
|
|
2013
|
+
constructor(t, o) {
|
|
1981
2014
|
I(this, "mapInstance");
|
|
1982
2015
|
// 渲染的数据
|
|
1983
2016
|
I(this, "pointMarkerList", []);
|
|
@@ -1988,7 +2021,7 @@ class PointMarkerClass {
|
|
|
1988
2021
|
I(this, "pointLayer");
|
|
1989
2022
|
// 颜色等其他设置
|
|
1990
2023
|
I(this, "options");
|
|
1991
|
-
this.mapInstance = t, this.options =
|
|
2024
|
+
this.mapInstance = t, this.options = o;
|
|
1992
2025
|
}
|
|
1993
2026
|
/**
|
|
1994
2027
|
* 渲染
|
|
@@ -2007,48 +2040,48 @@ class PointMarkerClass {
|
|
|
2007
2040
|
*/
|
|
2008
2041
|
renderPointMarker(t) {
|
|
2009
2042
|
if (this.deleteAllPointMarkers(), !this.mapInstance) return;
|
|
2010
|
-
let
|
|
2011
|
-
t.forEach((
|
|
2012
|
-
var
|
|
2013
|
-
const
|
|
2014
|
-
if (((
|
|
2015
|
-
|
|
2016
|
-
id:
|
|
2017
|
-
name:
|
|
2018
|
-
lonlat: [Number(
|
|
2019
|
-
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
|
|
2020
2053
|
};
|
|
2021
2054
|
else {
|
|
2022
|
-
const i = this.getFeature(
|
|
2055
|
+
const i = this.getFeature(n, l);
|
|
2023
2056
|
this.pointMarkerList.push({
|
|
2024
|
-
id:
|
|
2025
|
-
name:
|
|
2026
|
-
lonlat: [Number(
|
|
2057
|
+
id: n.id,
|
|
2058
|
+
name: n.name,
|
|
2059
|
+
lonlat: [Number(n.lon), Number(n.lat)],
|
|
2027
2060
|
feature: i,
|
|
2028
|
-
pointType:
|
|
2061
|
+
pointType: n.pointType
|
|
2029
2062
|
});
|
|
2030
2063
|
}
|
|
2031
|
-
}),
|
|
2032
|
-
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)]
|
|
2033
2066
|
}), this.pointLayer = new VectorLayer({
|
|
2034
2067
|
source: this.pointsVectorSource
|
|
2035
|
-
}), this.mapInstance.addLayer(this.pointLayer)
|
|
2068
|
+
}), this.mapInstance.addLayer(this.pointLayer);
|
|
2036
2069
|
}
|
|
2037
2070
|
// 删除 未选中的渲染点
|
|
2038
2071
|
deleteAllPointMarkers(t) {
|
|
2039
|
-
this.pointMarkerList.forEach((
|
|
2040
|
-
var
|
|
2041
|
-
|
|
2072
|
+
this.pointMarkerList.forEach((o) => {
|
|
2073
|
+
var n;
|
|
2074
|
+
o.feature && t !== o.id && ((n = this.pointsVectorSource) == null || n.removeFeature(o.feature));
|
|
2042
2075
|
});
|
|
2043
2076
|
}
|
|
2044
2077
|
// 取消高亮
|
|
2045
2078
|
cancelHighlightTruckMarker() {
|
|
2046
2079
|
if (!this.highlightPoint)
|
|
2047
2080
|
return;
|
|
2048
|
-
const { id: t, name:
|
|
2049
|
-
this.highlightPoint = void 0, this.pointMarkerList.find((
|
|
2050
|
-
|
|
2051
|
-
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)
|
|
2052
2085
|
);
|
|
2053
2086
|
});
|
|
2054
2087
|
}
|
|
@@ -2070,24 +2103,24 @@ class PointMarkerClass {
|
|
|
2070
2103
|
*/
|
|
2071
2104
|
highlightPointMarker(t) {
|
|
2072
2105
|
if (!this.mapInstance) return;
|
|
2073
|
-
const { id:
|
|
2106
|
+
const { id: o, name: n, fullName: l, lon: r, lat: i, pointType: c } = t, s = [Number(r), Number(i)];
|
|
2074
2107
|
this.highlightPoint = {
|
|
2075
|
-
id:
|
|
2076
|
-
name:
|
|
2077
|
-
fullName:
|
|
2078
|
-
lonlat:
|
|
2079
|
-
pointType:
|
|
2080
|
-
}, this.setPointCenter(
|
|
2108
|
+
id: o,
|
|
2109
|
+
name: n,
|
|
2110
|
+
fullName: l,
|
|
2111
|
+
lonlat: s,
|
|
2112
|
+
pointType: c
|
|
2113
|
+
}, this.setPointCenter(s);
|
|
2081
2114
|
}
|
|
2082
2115
|
// 获取feature
|
|
2083
|
-
getFeature(t,
|
|
2084
|
-
var
|
|
2085
|
-
const
|
|
2086
|
-
geometry: new Point(fromLonLat(
|
|
2116
|
+
getFeature(t, o) {
|
|
2117
|
+
var l;
|
|
2118
|
+
const n = new Feature({
|
|
2119
|
+
geometry: new Point(fromLonLat(o))
|
|
2087
2120
|
});
|
|
2088
|
-
return
|
|
2089
|
-
setPointStyle(((
|
|
2090
|
-
),
|
|
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;
|
|
2091
2124
|
}
|
|
2092
2125
|
/**
|
|
2093
2126
|
*
|
|
@@ -2097,12 +2130,12 @@ class PointMarkerClass {
|
|
|
2097
2130
|
* type 0: 不改变地图大小 1: 等于customZoom 2: 地图当前zoom > 传入的customZoom(缩小地图) 3: 地图当前zoom < 传入的customZoom(放大地图)
|
|
2098
2131
|
* }
|
|
2099
2132
|
*/
|
|
2100
|
-
setPointCenter(t,
|
|
2133
|
+
setPointCenter(t, o = { customZoom: mapZoom.findShip, type: 1 }) {
|
|
2101
2134
|
if (!this.mapInstance) return;
|
|
2102
|
-
const { customZoom:
|
|
2103
|
-
(
|
|
2104
|
-
const
|
|
2105
|
-
|
|
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));
|
|
2106
2139
|
}
|
|
2107
2140
|
}
|
|
2108
2141
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
@@ -2117,26 +2150,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2117
2150
|
logoType: {}
|
|
2118
2151
|
},
|
|
2119
2152
|
emits: ["zoomChanged", "extentChanged"],
|
|
2120
|
-
setup(e, { expose: t, emit:
|
|
2121
|
-
const
|
|
2122
|
-
provide("mapInstance",
|
|
2123
|
-
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);
|
|
2124
2157
|
let p;
|
|
2125
2158
|
((v) => {
|
|
2126
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";
|
|
2127
2160
|
})(p || (p = {}));
|
|
2128
|
-
const
|
|
2129
|
-
var
|
|
2161
|
+
const w = () => {
|
|
2162
|
+
var y, L;
|
|
2130
2163
|
const v = {
|
|
2131
2164
|
projection: projection.mercator,
|
|
2132
2165
|
// 地图投影坐标系
|
|
2133
|
-
zoom:
|
|
2166
|
+
zoom: s.zoom || (s.vehicleMode === "ship" ? mapZoom.default : mapZoom.truckDefault),
|
|
2134
2167
|
// 地图缩放级别(打开页面时默认级别)
|
|
2135
2168
|
minZoom: mapZoom.min,
|
|
2136
2169
|
// 地图缩放最小级别
|
|
2137
2170
|
maxZoom: mapZoom.max,
|
|
2138
2171
|
// 地图缩放最大级别
|
|
2139
|
-
center: transformUtils.lonLatToMercator(
|
|
2172
|
+
center: transformUtils.lonLatToMercator(s.center || mapDefaultCenter),
|
|
2140
2173
|
// 地图中心坐标
|
|
2141
2174
|
constrainResolution: !0,
|
|
2142
2175
|
// 需设为true禁用平滑缩放,zoom值为整数
|
|
@@ -2144,7 +2177,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2144
2177
|
// 禁用旋转
|
|
2145
2178
|
multiWorld: !0
|
|
2146
2179
|
};
|
|
2147
|
-
|
|
2180
|
+
n.value = new Map$1({
|
|
2148
2181
|
target: "map",
|
|
2149
2182
|
// 对应页面里 id 为 map 的元素
|
|
2150
2183
|
layers: [
|
|
@@ -2156,67 +2189,67 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2156
2189
|
p.greenMark
|
|
2157
2190
|
],
|
|
2158
2191
|
view: new View(v)
|
|
2159
|
-
}), h(), (
|
|
2160
|
-
findShip(String(
|
|
2161
|
-
});
|
|
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();
|
|
2162
2195
|
};
|
|
2163
2196
|
onMounted(() => {
|
|
2164
|
-
|
|
2197
|
+
w();
|
|
2165
2198
|
});
|
|
2166
2199
|
const h = () => {
|
|
2167
|
-
|
|
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));
|
|
2168
2201
|
}, g = (v) => {
|
|
2169
|
-
var
|
|
2170
|
-
|
|
2202
|
+
var y;
|
|
2203
|
+
s.vehicleMode !== "ship" && (v = !1), (y = n.value) == null || y.getLayers().forEach((L) => {
|
|
2171
2204
|
L.ol_uid === p.greenMark.ol_uid && (L.setVisible(v), u.value = v);
|
|
2172
2205
|
});
|
|
2173
|
-
}, T = ref(BaseMapType.satellite),
|
|
2174
|
-
var
|
|
2175
|
-
T.value = v, (
|
|
2206
|
+
}, T = ref(BaseMapType.satellite), M = (v) => {
|
|
2207
|
+
var y;
|
|
2208
|
+
T.value = v, (y = n.value) == null || y.getLayers().forEach((L) => {
|
|
2176
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);
|
|
2177
2210
|
});
|
|
2178
2211
|
}, b = () => {
|
|
2179
|
-
const v =
|
|
2180
|
-
|
|
2181
|
-
const L = v.calculateExtent(
|
|
2182
|
-
L &&
|
|
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);
|
|
2183
2216
|
}, V = (v) => {
|
|
2184
|
-
var k,
|
|
2217
|
+
var k, S, E, C, F;
|
|
2185
2218
|
d.value = v, g(v < mapZoom.shipGreenDotMax);
|
|
2186
|
-
const
|
|
2187
|
-
showTrackLayer.value ? (f.value = !1, L == null || L.setVisible(!1), (
|
|
2188
|
-
},
|
|
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) => {
|
|
2189
2222
|
const L = transform([v[0], v[1]], projection.mercator, projection.data), k = transform([v[2], v[3]], projection.mercator, projection.data);
|
|
2190
|
-
|
|
2223
|
+
c("extentChanged", { extent: [L, k], zoom: y });
|
|
2191
2224
|
};
|
|
2192
2225
|
return t({
|
|
2193
|
-
mapInstance:
|
|
2194
|
-
initMap:
|
|
2195
|
-
pointRender: (v,
|
|
2226
|
+
mapInstance: n,
|
|
2227
|
+
initMap: w,
|
|
2228
|
+
pointRender: (v, y) => new PointMarkerClass(v, y),
|
|
2196
2229
|
renderTrucksMarker,
|
|
2197
2230
|
renderShip: renderShips,
|
|
2198
|
-
renderTrack: (v,
|
|
2199
|
-
var k,
|
|
2200
|
-
currentTrackId.value = v, showTrackLayer.value = !0, m.value = !0, hiddenAllShips(), (
|
|
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);
|
|
2201
2234
|
},
|
|
2202
2235
|
findTruck,
|
|
2203
2236
|
removeTruckIcon,
|
|
2204
2237
|
clearAllTruck,
|
|
2205
2238
|
closeTrack: () => {
|
|
2206
|
-
var v,
|
|
2207
|
-
showTrackLayer.value = !1, (v = shipTrackVectorLayer.value) == null || v.setVisible(!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();
|
|
2208
2241
|
},
|
|
2209
2242
|
closeTruckTrack: () => {
|
|
2210
|
-
var v,
|
|
2211
|
-
showTrackLayer.value = !1, (v = shipTrackVectorLayer.value) == null || v.setVisible(!1), (
|
|
2243
|
+
var v, y;
|
|
2244
|
+
showTrackLayer.value = !1, (v = shipTrackVectorLayer.value) == null || v.setVisible(!1), (y = selectShipsLayer.value) == null || y.setVisible(!0), stopAnimation();
|
|
2212
2245
|
},
|
|
2213
2246
|
resetTrackView,
|
|
2214
2247
|
playTrack,
|
|
2215
2248
|
clearSelectFeature,
|
|
2216
2249
|
findShip,
|
|
2217
|
-
focusShip: (v,
|
|
2218
|
-
var k,
|
|
2219
|
-
hiddenOrther.value = L, (k = shipsLayer.value) == null || k.setVisible(!L), (
|
|
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);
|
|
2220
2253
|
},
|
|
2221
2254
|
showTracks,
|
|
2222
2255
|
removeAllTrackLayer,
|
|
@@ -2224,8 +2257,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2224
2257
|
rerenderShip,
|
|
2225
2258
|
switchGreenDot: () => g(!1),
|
|
2226
2259
|
zoomTruckIcon,
|
|
2227
|
-
renderTruckTrack: (v,
|
|
2228
|
-
showTrackLayer.value = !0, renderTrack(v,
|
|
2260
|
+
renderTruckTrack: (v, y, L) => {
|
|
2261
|
+
showTrackLayer.value = !0, renderTrack(v, y, L, LENGTH_UNIT.KM, "truck");
|
|
2229
2262
|
},
|
|
2230
2263
|
removerLayer: removeShipTrackLineFeatureByIndex,
|
|
2231
2264
|
renderMarker,
|
|
@@ -2233,18 +2266,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2233
2266
|
m.value = !0, setMarkerPosition(v);
|
|
2234
2267
|
},
|
|
2235
2268
|
getZoomAndCenter: () => {
|
|
2236
|
-
var
|
|
2237
|
-
const v = (
|
|
2269
|
+
var S;
|
|
2270
|
+
const v = (S = n.value) == null ? void 0 : S.getView();
|
|
2238
2271
|
if (!v) return null;
|
|
2239
|
-
const
|
|
2240
|
-
return { zoom:
|
|
2272
|
+
const y = Math.round(Number(v.getZoom())), { lon: L, lat: k } = transformUtils.mercatorToLonLat(v.getCenter());
|
|
2273
|
+
return { zoom: y, center: [L, k] };
|
|
2241
2274
|
},
|
|
2242
2275
|
setCenter: (v) => {
|
|
2243
2276
|
var k;
|
|
2244
|
-
const
|
|
2245
|
-
if (!
|
|
2277
|
+
const y = (k = n.value) == null ? void 0 : k.getView();
|
|
2278
|
+
if (!y) return null;
|
|
2246
2279
|
const L = new Point(v);
|
|
2247
|
-
|
|
2280
|
+
y.setCenter(transform(L.getCoordinates(), projection.data, projection.mercator));
|
|
2248
2281
|
},
|
|
2249
2282
|
drawPolygonTool,
|
|
2250
2283
|
setMapInstance: h,
|
|
@@ -2256,12 +2289,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2256
2289
|
transform: transformUtils,
|
|
2257
2290
|
format: formatUtils
|
|
2258
2291
|
}
|
|
2259
|
-
}), (v,
|
|
2292
|
+
}), (v, y) => (openBlock(), createElementBlock("div", {
|
|
2260
2293
|
class: "map-page map-container",
|
|
2261
2294
|
ref_key: "pageRef",
|
|
2262
|
-
ref:
|
|
2295
|
+
ref: l
|
|
2263
2296
|
}, [
|
|
2264
|
-
|
|
2297
|
+
y[0] || (y[0] = createElementVNode("div", {
|
|
2265
2298
|
id: "map",
|
|
2266
2299
|
class: "map"
|
|
2267
2300
|
}, null, -1)),
|
|
@@ -2272,7 +2305,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2272
2305
|
"show-track-layer": unref(showTrackLayer),
|
|
2273
2306
|
"map-tile-mode": T.value,
|
|
2274
2307
|
onSwitchGreenDot: g,
|
|
2275
|
-
onSwitchMapTile:
|
|
2308
|
+
onSwitchMapTile: M
|
|
2276
2309
|
}, {
|
|
2277
2310
|
toolPanel: withCtx(() => [
|
|
2278
2311
|
renderSlot(v.$slots, "toolPanel", {}, void 0, !0)
|
|
@@ -2282,17 +2315,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2282
2315
|
v.viewMode !== "WxMiniprogram" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2283
2316
|
createVNode(ScaleLine, {
|
|
2284
2317
|
ref_key: "scaleLineControl",
|
|
2285
|
-
ref:
|
|
2318
|
+
ref: r
|
|
2286
2319
|
}, null, 512),
|
|
2287
2320
|
createVNode(ZoomControl, {
|
|
2288
2321
|
ref_key: "zoomControl",
|
|
2289
2322
|
ref: i
|
|
2290
2323
|
}, null, 512)
|
|
2291
2324
|
], 64)) : createCommentVNode("", !0),
|
|
2292
|
-
createVNode(Copyright, {
|
|
2325
|
+
createVNode(Copyright, {
|
|
2326
|
+
type: v.logoType,
|
|
2327
|
+
"map-tile": T.value
|
|
2328
|
+
}, null, 8, ["type", "map-tile"])
|
|
2293
2329
|
], 512));
|
|
2294
2330
|
}
|
|
2295
|
-
}), Map = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
2331
|
+
}), Map = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-79369628"]]), ZhMap = withInstall(Map);
|
|
2296
2332
|
export {
|
|
2297
2333
|
BaseMapType as B,
|
|
2298
2334
|
CDN_URL as C,
|