zhihao-ui 1.2.31 → 1.2.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/{BaseInfo-CAuR2Id0.js → BaseInfo-C4sgm12k.js} +1 -1
- package/dist/es/{BaseItem-CQzBP1WX.js → BaseItem-BFxwaTMt.js} +5 -5
- package/dist/es/{Button-D-R-2Fix.js → Button-BbUxF68h.js} +2 -2
- package/dist/es/DatePicker-Ci7cvNBv.js +73 -0
- package/dist/es/{DetailHeader-CBN9CqAp.js → DetailHeader-CjOQGsUf.js} +3 -3
- package/dist/es/{DetailSubTitle-DsnSxPKH.js → DetailSubTitle-D0yLSSyv.js} +2 -2
- package/dist/es/{Dialog-C_hAbDgU.js → Dialog-CiO2p3lS.js} +3 -3
- package/dist/es/{DiyDataTable-CXSUoapn.js → DiyDataTable-BF1_jzWq.js} +4 -4
- package/dist/es/{EditInfoPair-C0Ielr4q.js → EditInfoPair-BJQiTE2F.js} +3 -3
- package/dist/es/{FileWrapper-DFqY2SD_.js → FileWrapper-x299zfxX.js} +4 -4
- package/dist/es/{Grid-CLg9sn2Y.js → Grid-CXOlWZvI.js} +2 -2
- package/dist/es/{InfoPair-6agPuvqq.js → InfoPair-DIGArRxD.js} +3 -3
- package/dist/es/{Input-CzlIXSCf.js → Input-DhjDFkPC.js} +3 -3
- package/dist/es/{Loading-ClE8eADM.js → Loading-BUKmsH3_.js} +2 -2
- package/dist/es/{Map-BJc6GMOA.js → Map-DOYV-j68.js} +465 -452
- package/dist/es/{MessageBox-CBMAgp6C.js → MessageBox-DJR9qhIT.js} +2 -2
- package/dist/es/{MoneyInput-EODuzFjO.js → MoneyInput-CPvzXyjc.js} +17 -16
- package/dist/es/{PageHeadPanel-DDnMIqmC.js → PageHeadPanel-BAkSI9xv.js} +2 -2
- package/dist/es/{Table-D7YUOcI0.js → Table-C0SJnAXO.js} +5 -5
- package/dist/es/{ToolTips-BpZo8gsa.js → ToolTips-BFpd9Tho.js} +3 -3
- package/dist/es/index.js +40 -41
- package/dist/es/utils-hD_p7bGY.js +14 -0
- package/dist/es/{vendor-Cq716b5Q.js → vendor-Bonn9k5m.js} +26 -26
- package/dist/index.css +1 -1
- package/dist/types/components/Map/Map.vue.d.ts +11 -3
- package/dist/types/components/Map/config.d.ts +1 -0
- package/dist/types/components/Map/index.d.ts +51 -31
- package/dist/types/components/Map/interface/entity/render.d.ts +1 -0
- package/dist/types/components/Map/render/canvasRender/renderTrackStyle.d.ts +4 -2
- package/dist/types/components/Map/utils/store.d.ts +4 -2
- package/dist/types/components/utils.d.ts +1 -0
- package/dist/umd/index.css +1 -1
- package/dist/umd/index.umd.cjs +19 -19
- package/package.json +1 -1
- package/dist/es/DatePicker-BDz_yTX2.js +0 -36
- package/dist/es/utils-BbWQLYZL.js +0 -52
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var I = (e, t, n) =>
|
|
4
|
-
import { o as getArea, p as getLength, V as VectorSource, q as VectorLayer, S as Style, C as CircleStyle, F as Fill, r as Stroke, D as Draw, O as Overlay, u as unByKey, s as ElSelect, t as ElOption, T as Text, v as fromLonLat, w as transformExtent, x as hooks, L as LineString, y as Feature, P as Point, z as Polyline, A as getVectorContext, h as cloneDeep, G as GeoJSON, W as WebGLPointsLayer, B as Circle, H as transform, I as buffer, J as ScaleLine$1, K as Icon, M as Translate, N as toLonLat, Q as MultiPoint, R as getCenter, U as TileLayer, X as XYZ, Y as Map$1, Z as View } from "./vendor-Cq716b5Q.js";
|
|
1
|
+
var A = Object.defineProperty;
|
|
2
|
+
var D = (e, t, n) => t in e ? A(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var I = (e, t, n) => D(e, typeof t != "symbol" ? t + "" : t, n);
|
|
5
4
|
import { defineComponent, inject, useModel, ref, watch, openBlock, createElementBlock, createElementVNode, createVNode, unref, withCtx, Fragment, renderList, toDisplayString, createCommentVNode, mergeModels, nextTick, onMounted, normalizeClass, renderSlot, createBlock, provide } from "vue";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
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
|
+
import { _ as _export_sfc } from "./Button-BbUxF68h.js";
|
|
7
|
+
import { g as getForegroundColor } from "./DatePicker-Ci7cvNBv.js";
|
|
8
|
+
import { w as withInstall } from "./utils-hD_p7bGY.js";
|
|
8
9
|
var BaseMapType = /* @__PURE__ */ ((e) => (e[e.vector = 0] = "vector", e[e.satellite = 1] = "satellite", e))(BaseMapType || {}), CAR_COLOR = /* @__PURE__ */ ((e) => (e[e.BLUE = 1] = "BLUE", e[e.YELLOW = 2] = "YELLOW", e[e.Y_GREEN = 3] = "Y_GREEN", e))(CAR_COLOR || {}), DEVICE_TYPE = /* @__PURE__ */ ((e) => (e[e.HOST = 1] = "HOST", e[e.TALK = 2] = "TALK", e[e.STORAGE = 3] = "STORAGE", e[e.INTERNET = 4] = "INTERNET", e[e.CAMERA = 5] = "CAMERA", e[e.LOAD = 6] = "LOAD", e))(DEVICE_TYPE || {}), LENGTH_UNIT = /* @__PURE__ */ ((e) => (e[e.M = 1] = "M", e[e.KM = 2] = "KM", e[e.NM = 3] = "NM", e))(LENGTH_UNIT || {}), SWITCH_BTN = /* @__PURE__ */ ((e) => (e.Camera = "camera", e.Mobile = "mobile", e.WaterGauge = "waterGauge", e))(SWITCH_BTN || {}), SHIP_SAIL_STATUS = /* @__PURE__ */ ((e) => (e[e.发动机使用中 = 0] = "发动机使用中", e[e.锚泊 = 1] = "锚泊", e[e.未操作 = 2] = "未操作", e[e.操纵能力受限 = 3] = "操纵能力受限", e[e.吃水受限 = 4] = "吃水受限", e[e.系泊 = 5] = "系泊", e[e.搁浅 = 6] = "搁浅", e[e.从事捕捞 = 7] = "从事捕捞", e[e.航行中 = 8] = "航行中", e[e.留作将来修正导航状态 = 9] = "留作将来修正导航状态", e[e.高速船留用 = 10] = "高速船留用", e[e.机动船尾推作业 = 11] = "机动船尾推作业", e[e.机动船顶推或侧推作业 = 12] = "机动船顶推或侧推作业", e[e.飞翼船留用 = 13] = "飞翼船留用", e[e.现行的 = 14] = "现行的", e[e.未定义 = 15] = "未定义", e))(SHIP_SAIL_STATUS || {});
|
|
9
10
|
class ShipMapData {
|
|
10
|
-
constructor(t, n, o, r, l, i, s, c, d, m, u, f, p, y,
|
|
11
|
+
constructor(t, n, o, r, l, i, s, c, d, m, u, f, p, y, v, g, M, S, b, C, F, x, h, w) {
|
|
11
12
|
I(this, "id");
|
|
12
13
|
// mmsi
|
|
13
14
|
I(this, "mmsi");
|
|
@@ -49,7 +50,7 @@ class ShipMapData {
|
|
|
49
50
|
I(this, "existWaterGauge");
|
|
50
51
|
I(this, "selected");
|
|
51
52
|
I(this, "blinkColors");
|
|
52
|
-
this.id = t, this.mmsi = n, this.fill = o, this.shipType = r, this.name = l, this.length = i, this.breadth = s, this.lon = c, this.lat = d, this.createdAt = m, this.speed = u, this.from = f, this.sailStatus = p, this.hdg = y, this.cog =
|
|
53
|
+
this.id = t, this.mmsi = n, this.fill = o, this.shipType = r, this.name = l, this.length = i, this.breadth = s, this.lon = c, this.lat = d, this.createdAt = m, this.speed = u, this.from = f, this.sailStatus = p, this.hdg = y, this.cog = v, this.posType = g, this.type = M, this.angle = S, this.leftIconColor = b, this.existDevice = C, this.existMobile = F, this.existWaterGauge = x, this.selected = h, this.blinkColors = w;
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
const formatLength = function(e, t) {
|
|
@@ -131,7 +132,7 @@ const formatLength = function(e, t) {
|
|
|
131
132
|
setup(e, { expose: t, emit: n }) {
|
|
132
133
|
const o = inject("mapInstance"), r = n, l = useModel(e, "visible"), i = ref("3"), s = ref([]), c = ref(!1), d = new VectorSource();
|
|
133
134
|
let m, u, f, p, y;
|
|
134
|
-
const
|
|
135
|
+
const v = new VectorLayer({
|
|
135
136
|
source: d,
|
|
136
137
|
style: {
|
|
137
138
|
"fill-color": "rgba(255, 255, 255, 0.2)",
|
|
@@ -143,15 +144,15 @@ const formatLength = function(e, t) {
|
|
|
143
144
|
}), g = function(L) {
|
|
144
145
|
if (L.dragging)
|
|
145
146
|
return;
|
|
146
|
-
let
|
|
147
|
-
m && (
|
|
148
|
-
},
|
|
147
|
+
let T = "点击选择起点";
|
|
148
|
+
m && (T = "单击继续,双击结束"), u && (u.innerHTML = T, f.setPosition(L.coordinate), u.classList.remove("hidden"));
|
|
149
|
+
}, M = () => {
|
|
149
150
|
o.value && (o.value.on("pointermove", g), o.value.getViewport().addEventListener("mouseout", function() {
|
|
150
151
|
var L;
|
|
151
152
|
(L = u == null ? void 0 : u.classList) == null || L.add("hidden");
|
|
152
153
|
}), c.value = !0);
|
|
153
154
|
};
|
|
154
|
-
let
|
|
155
|
+
let S;
|
|
155
156
|
const b = new Style({
|
|
156
157
|
fill: new Fill({
|
|
157
158
|
color: "rgba(255, 255, 255, 0.2)"
|
|
@@ -171,49 +172,49 @@ const formatLength = function(e, t) {
|
|
|
171
172
|
})
|
|
172
173
|
})
|
|
173
174
|
});
|
|
174
|
-
function
|
|
175
|
-
var L,
|
|
175
|
+
function C() {
|
|
176
|
+
var L, T;
|
|
176
177
|
if (o.value) {
|
|
177
|
-
if (s.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((
|
|
178
|
-
var
|
|
179
|
-
(
|
|
180
|
-
}), d.clear(),
|
|
181
|
-
const
|
|
182
|
-
|
|
178
|
+
if (s.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((E) => {
|
|
179
|
+
var V;
|
|
180
|
+
(V = E == null ? void 0 : E.parentNode) == null || V.removeChild(E);
|
|
181
|
+
}), d.clear(), S) {
|
|
182
|
+
const E = o.value.getInteractions().getArray().find((V) => V.ol_uid === S.ol_uid);
|
|
183
|
+
E && ((L = o.value) == null || L.removeInteraction(E));
|
|
183
184
|
}
|
|
184
|
-
(
|
|
185
|
+
(T = o.value) == null || T.removeLayer(v), u != null && u.parentNode && u.parentNode.removeChild(u), p != null && p.parentNode && p.parentNode.removeChild(p);
|
|
185
186
|
}
|
|
186
187
|
}
|
|
187
|
-
function
|
|
188
|
-
var
|
|
189
|
-
|
|
188
|
+
function F() {
|
|
189
|
+
var T, E;
|
|
190
|
+
C(), (T = o.value) == null || T.addLayer(v), S = new Draw({
|
|
190
191
|
source: d,
|
|
191
192
|
type: "LineString",
|
|
192
193
|
style: function() {
|
|
193
194
|
return b;
|
|
194
195
|
}
|
|
195
|
-
}), (
|
|
196
|
+
}), (E = o.value) == null || E.addInteraction(S), h(), x();
|
|
196
197
|
let L;
|
|
197
|
-
|
|
198
|
+
S.on("drawstart", function(V) {
|
|
198
199
|
var N;
|
|
199
|
-
m =
|
|
200
|
+
m = V.feature;
|
|
200
201
|
let $;
|
|
201
202
|
L = (N = m.getGeometry()) == null ? void 0 : N.on("change", function(B) {
|
|
202
203
|
const P = B.target;
|
|
203
204
|
let R = formatUtils.formatLength(P, Number(i.value));
|
|
204
205
|
$ = P.getLastCoordinate(), p && R && (p.innerHTML = R), y.setPosition($);
|
|
205
206
|
});
|
|
206
|
-
}),
|
|
207
|
-
var
|
|
208
|
-
p && (p.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), p != null && p.innerHTML && (s.value.push(p == null ? void 0 : p.innerHTML), p.innerHTML = `${p.innerHTML}<div class="ol-tooltip-delete-button" data-index="${((
|
|
207
|
+
}), S.on("drawend", function() {
|
|
208
|
+
var V, $;
|
|
209
|
+
p && (p.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), p != null && p.innerHTML && (s.value.push(p == null ? void 0 : p.innerHTML), p.innerHTML = `${p.innerHTML}<div class="ol-tooltip-delete-button" data-index="${((V = s.value) == null ? void 0 : V.length) - 1}"><i class="map-iconfont icon-delete"></i></div>`), ($ = document.querySelector(".ol-tooltip-delete-button:last-child")) == null || $.addEventListener("click", (N) => {
|
|
209
210
|
var P;
|
|
210
211
|
N.preventDefault(), N.stopPropagation();
|
|
211
212
|
const B = (P = N.target) == null ? void 0 : P.getAttribute("data-index");
|
|
212
213
|
B && w(B);
|
|
213
|
-
}), y.setOffset([0, -7]), m = null, p = null,
|
|
214
|
+
}), y.setOffset([0, -7]), m = null, p = null, h(), L && unByKey(L);
|
|
214
215
|
});
|
|
215
216
|
}
|
|
216
|
-
function
|
|
217
|
+
function x() {
|
|
217
218
|
var L;
|
|
218
219
|
u != null && u.parentNode && u.parentNode.removeChild(u), u = document.createElement("div"), u.className = "ol-tooltip hidden", f = new Overlay({
|
|
219
220
|
element: u,
|
|
@@ -221,7 +222,7 @@ const formatLength = function(e, t) {
|
|
|
221
222
|
positioning: "center-left"
|
|
222
223
|
}), (L = o.value) == null || L.addOverlay(f);
|
|
223
224
|
}
|
|
224
|
-
function
|
|
225
|
+
function h() {
|
|
225
226
|
var L;
|
|
226
227
|
p != null && p.parentNode && p.parentNode.removeChild(p), p = document.createElement("div"), p.className = "ol-tooltip ol-tooltip-measure", y = new Overlay({
|
|
227
228
|
element: p,
|
|
@@ -232,34 +233,34 @@ const formatLength = function(e, t) {
|
|
|
232
233
|
}), (L = o.value) == null || L.addOverlay(y);
|
|
233
234
|
}
|
|
234
235
|
const w = (L) => {
|
|
235
|
-
var
|
|
236
|
+
var V, $;
|
|
236
237
|
s.value[L] && s.value.splice(L, 1);
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
},
|
|
238
|
+
const T = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
239
|
+
T[L] && (($ = (V = T[L]) == null ? void 0 : V.parentNode) == null || $.removeChild(T[L]));
|
|
240
|
+
const E = d.getFeatures();
|
|
241
|
+
E[L] && d.removeFeature(E[L]);
|
|
242
|
+
}, k = () => {
|
|
242
243
|
r("close");
|
|
243
244
|
};
|
|
244
245
|
return watch(() => l, () => {
|
|
245
|
-
l && !c.value && (
|
|
246
|
+
l && !c.value && (M(), F());
|
|
246
247
|
}, { deep: !0, immediate: !0 }), t({
|
|
247
|
-
addInteraction:
|
|
248
|
-
removeInteraction:
|
|
249
|
-
}), (L,
|
|
248
|
+
addInteraction: F,
|
|
249
|
+
removeInteraction: C
|
|
250
|
+
}), (L, T) => l.value && L.viewMode !== "WxMiniprogram" ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
250
251
|
createElementVNode("div", { class: "header" }, [
|
|
251
|
-
|
|
252
|
+
T[1] || (T[1] = createElementVNode("div", { class: "title" }, "测量", -1)),
|
|
252
253
|
createElementVNode("i", {
|
|
253
|
-
onClick:
|
|
254
|
+
onClick: k,
|
|
254
255
|
class: "map-iconfont icon-close"
|
|
255
256
|
})
|
|
256
257
|
]),
|
|
257
258
|
createElementVNode("div", _hoisted_2$2, [
|
|
258
|
-
|
|
259
|
+
T[2] || (T[2] = createElementVNode("div", { class: "tips" }, "在地图上点击多个点测量距离,距离单位", -1)),
|
|
259
260
|
createVNode(unref(ElSelect), {
|
|
260
261
|
class: "select-length-unit",
|
|
261
262
|
modelValue: i.value,
|
|
262
|
-
"onUpdate:modelValue":
|
|
263
|
+
"onUpdate:modelValue": T[0] || (T[0] = (E) => i.value = E)
|
|
263
264
|
}, {
|
|
264
265
|
default: withCtx(() => [
|
|
265
266
|
createVNode(unref(ElOption), {
|
|
@@ -279,26 +280,88 @@ const formatLength = function(e, t) {
|
|
|
279
280
|
}, 8, ["modelValue"])
|
|
280
281
|
]),
|
|
281
282
|
createElementVNode("div", _hoisted_3$2, [
|
|
282
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(s.value, (
|
|
283
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(s.value, (E, V) => (openBlock(), createElementBlock("div", {
|
|
283
284
|
class: "measure-history-item",
|
|
284
|
-
key:
|
|
285
|
+
key: V
|
|
285
286
|
}, [
|
|
286
287
|
createElementVNode("div", _hoisted_4, [
|
|
287
|
-
|
|
288
|
-
createElementVNode("span", _hoisted_5, "线段" + toDisplayString(
|
|
289
|
-
createElementVNode("span", _hoisted_6, toDisplayString(
|
|
288
|
+
T[3] || (T[3] = createElementVNode("i", { class: "map-iconfont icon-line" }, null, -1)),
|
|
289
|
+
createElementVNode("span", _hoisted_5, "线段" + toDisplayString(V + 1), 1),
|
|
290
|
+
createElementVNode("span", _hoisted_6, toDisplayString(E), 1)
|
|
290
291
|
]),
|
|
291
292
|
createElementVNode("div", {
|
|
292
293
|
class: "delete-button",
|
|
293
|
-
onClick: ($) => w(
|
|
294
|
-
},
|
|
294
|
+
onClick: ($) => w(V)
|
|
295
|
+
}, T[4] || (T[4] = [
|
|
295
296
|
createElementVNode("i", { class: "map-iconfont icon-delete" }, null, -1)
|
|
296
297
|
]), 8, _hoisted_7)
|
|
297
298
|
]))), 128))
|
|
298
299
|
])
|
|
299
300
|
])) : createCommentVNode("", !0);
|
|
300
301
|
}
|
|
301
|
-
}), Measure = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-955a605e"]]),
|
|
302
|
+
}), Measure = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-955a605e"]]), mapInstance$8 = ref(), renderMarkerSetInstance = (e) => mapInstance$8.value = e, markerPosition = ref(""), marker = ref(), createIconStyle = (e) => new Style({
|
|
303
|
+
image: new Icon({
|
|
304
|
+
src: CDN_URL + "map/poi-marker-default.png",
|
|
305
|
+
anchor: [0.5, 1]
|
|
306
|
+
}),
|
|
307
|
+
text: new Text({
|
|
308
|
+
text: e,
|
|
309
|
+
offsetY: -90,
|
|
310
|
+
// 调整文本位置,使其位于标记上方
|
|
311
|
+
font: "12px",
|
|
312
|
+
fill: new Fill({
|
|
313
|
+
color: "#000"
|
|
314
|
+
}),
|
|
315
|
+
stroke: new Stroke({
|
|
316
|
+
color: "#fff",
|
|
317
|
+
width: 2
|
|
318
|
+
}),
|
|
319
|
+
backgroundFill: new Fill({
|
|
320
|
+
color: "#fff"
|
|
321
|
+
// 设置文本背景填充颜色
|
|
322
|
+
}),
|
|
323
|
+
backgroundStroke: new Stroke({
|
|
324
|
+
color: "#000",
|
|
325
|
+
// 设置文本背景描边颜色
|
|
326
|
+
width: 1
|
|
327
|
+
}),
|
|
328
|
+
padding: [2, 2, 2, 2]
|
|
329
|
+
// 设置文本背景的内边距
|
|
330
|
+
})
|
|
331
|
+
}), renderMarker = (e, t = !0, n = !0) => {
|
|
332
|
+
var m;
|
|
333
|
+
if (!mapInstance$8.value || !e || e.split(",").length !== 2) return;
|
|
334
|
+
const [o, r] = e.split(",").map(Number);
|
|
335
|
+
marker.value = new Feature({
|
|
336
|
+
geometry: new Point(fromLonLat([o, r]))
|
|
337
|
+
});
|
|
338
|
+
const l = n ? `${o}, ${r}` : "";
|
|
339
|
+
(m = marker.value) == null || m.setStyle(createIconStyle(l));
|
|
340
|
+
const i = new VectorSource({
|
|
341
|
+
features: [marker.value]
|
|
342
|
+
}), s = new VectorLayer({
|
|
343
|
+
source: i
|
|
344
|
+
}), c = mapInstance$8.value.getView();
|
|
345
|
+
if (mapInstance$8.value.addLayer(s), t) {
|
|
346
|
+
const u = new Translate({
|
|
347
|
+
layers: [s]
|
|
348
|
+
});
|
|
349
|
+
u.on("translating", function(f) {
|
|
350
|
+
var v;
|
|
351
|
+
const p = f.features.item(0).getGeometry().getCoordinates(), y = toLonLat(p);
|
|
352
|
+
markerPosition.value = `${y[0].toFixed(6)}, ${y[1].toFixed(6)}`, (v = marker.value) == null || v.setStyle(createIconStyle(markerPosition.value));
|
|
353
|
+
}), mapInstance$8.value.addInteraction(u);
|
|
354
|
+
}
|
|
355
|
+
const d = new Point([o, r]);
|
|
356
|
+
c.setCenter(transform(d.getCoordinates(), projection.data, projection.mercator)), c.setZoom(mapZoom.findShip);
|
|
357
|
+
}, setMarkerPosition = (e) => {
|
|
358
|
+
var r, l;
|
|
359
|
+
if (!mapInstance$8.value) return;
|
|
360
|
+
const t = mapInstance$8.value.getView(), n = e.split(",").map(Number);
|
|
361
|
+
(l = (r = marker.value) == null ? void 0 : r.getGeometry()) == null || l.setCoordinates(fromLonLat([n[0], n[1]]));
|
|
362
|
+
const o = new Point([n[0], n[1]]);
|
|
363
|
+
t.setCenter(transform(o.getCoordinates(), projection.data, projection.mercator)), t.setZoom(mapZoom.markerPosition);
|
|
364
|
+
}, CDN_URL = "https://static.zhihaoscm.cn/", tiandituKey = "a6e8f78974f2581f2ca00485b40c948f", zhongkeKey = "15c81cc0a191a232e0a0ca1a51c3ca81", baseMap = {
|
|
302
365
|
// 矢量底图
|
|
303
366
|
// zhongkeTile: `https://api.open.geovisearth.com/map/v1/vec/{z}/{x}/{y}?token=${zhongkeKey}&format=png&tmsIds=w`,
|
|
304
367
|
tiandituTile: `https://t0.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${tiandituKey}`,
|
|
@@ -332,7 +395,8 @@ const formatLength = function(e, t) {
|
|
|
332
395
|
// 船形图标最小渲染层级
|
|
333
396
|
shipModelMin: 13,
|
|
334
397
|
// 船形图标最大渲染层级
|
|
335
|
-
shipModelMax: 18
|
|
398
|
+
shipModelMax: 18,
|
|
399
|
+
markerPosition: 14
|
|
336
400
|
}, renderShipsLimit = 200, mapDefaultCenter = [114.84, 30.52], projection = {
|
|
337
401
|
// 经纬度 源数据 地理坐标 WGS84
|
|
338
402
|
data: "EPSG:4326",
|
|
@@ -382,11 +446,11 @@ const multiplyPixelRatio = (e) => {
|
|
|
382
446
|
}
|
|
383
447
|
function i(u, f, p = {}) {
|
|
384
448
|
if (p.final)
|
|
385
|
-
return function(
|
|
386
|
-
return (i(
|
|
449
|
+
return function(x, h) {
|
|
450
|
+
return (i(h, x) + 180) % 360;
|
|
387
451
|
}(u, f);
|
|
388
|
-
const y = l(u),
|
|
389
|
-
return o(Math.atan2(
|
|
452
|
+
const y = l(u), v = l(f), g = r(y[0]), M = r(v[0]), S = r(y[1]), b = r(v[1]), C = Math.sin(M - g) * Math.cos(b), F = Math.cos(S) * Math.sin(b) - Math.sin(S) * Math.cos(b) * Math.cos(M - g);
|
|
453
|
+
return o(Math.atan2(C, F));
|
|
390
454
|
}
|
|
391
455
|
function s(u) {
|
|
392
456
|
return !isNaN(u) && u !== null && !Array.isArray(u);
|
|
@@ -504,39 +568,39 @@ function drawLabelBody(e, t, n) {
|
|
|
504
568
|
e.save(), o && (e.font = o);
|
|
505
569
|
let f = e.measureText(s).width + 2 * r;
|
|
506
570
|
(c || d) && (f += l + 4 * r), e.restore();
|
|
507
|
-
let p, y = 20,
|
|
571
|
+
let p, y = 20, v = -1, g = l + 3 * r;
|
|
508
572
|
if (m)
|
|
509
|
-
for (let
|
|
510
|
-
p = calculateBounds(i,
|
|
511
|
-
let
|
|
573
|
+
for (let M = 0; M < 8; M++) {
|
|
574
|
+
p = calculateBounds(i, M, f, g, m);
|
|
575
|
+
let S = !1;
|
|
512
576
|
for (let b = 0; b < t.length; ++b) {
|
|
513
|
-
let
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
577
|
+
let C = t[b].bounds, F = [
|
|
578
|
+
C[0] - y,
|
|
579
|
+
C[1] - y,
|
|
580
|
+
C[2] + y,
|
|
581
|
+
C[3] + y
|
|
518
582
|
];
|
|
519
|
-
if (p && isOverlapping(p,
|
|
520
|
-
|
|
583
|
+
if (p && isOverlapping(p, F)) {
|
|
584
|
+
S = !0;
|
|
521
585
|
break;
|
|
522
586
|
}
|
|
523
587
|
}
|
|
524
|
-
if (!
|
|
525
|
-
|
|
588
|
+
if (!S) {
|
|
589
|
+
v = M;
|
|
526
590
|
break;
|
|
527
591
|
}
|
|
528
592
|
}
|
|
529
593
|
else
|
|
530
|
-
|
|
531
|
-
if (u &&
|
|
532
|
-
let
|
|
594
|
+
v = 0, p = calculateBounds(i, v, f, g, m);
|
|
595
|
+
if (u && v === -1 && (v = 0), p && v > -1) {
|
|
596
|
+
let M = getBottomLeftPoint(p), S = getTopRighttPoint(p);
|
|
533
597
|
return {
|
|
534
598
|
center: i,
|
|
535
|
-
x: calculateAnchorPoint(i,
|
|
536
|
-
l:
|
|
537
|
-
r:
|
|
599
|
+
x: calculateAnchorPoint(i, v, f, g, m),
|
|
600
|
+
l: S,
|
|
601
|
+
r: M,
|
|
538
602
|
bounds: p,
|
|
539
|
-
position:
|
|
603
|
+
position: v,
|
|
540
604
|
name: s
|
|
541
605
|
};
|
|
542
606
|
} else
|
|
@@ -597,10 +661,10 @@ const drawLabel = (e, t, n) => {
|
|
|
597
661
|
(u = t.blinkColors) != null && u.length && (s = t.fill, i = getForegroundColor(t.fill));
|
|
598
662
|
let y = drawLabelBody(e, n, p);
|
|
599
663
|
if (y) {
|
|
600
|
-
const { x:
|
|
601
|
-
let
|
|
664
|
+
const { x: v, bounds: g, l: M } = y;
|
|
665
|
+
let S = [getTopLeftPoint(g), getBottomLeftPoint(g), getBottomRightPoint(g), getTopRighttPoint(g)];
|
|
602
666
|
n.find((w) => w.name === r) || n.push(y), drawPolygon(e, {
|
|
603
|
-
points: [o,
|
|
667
|
+
points: [o, v],
|
|
604
668
|
strokeColor: l,
|
|
605
669
|
fillColor: "#000",
|
|
606
670
|
shouldClosePath: !0,
|
|
@@ -610,31 +674,32 @@ const drawLabel = (e, t, n) => {
|
|
|
610
674
|
scale: void 0,
|
|
611
675
|
globalAlpha: labelAlpha
|
|
612
676
|
}), d != null && d.length && d.forEach(() => {
|
|
613
|
-
|
|
677
|
+
S[1][0] += 20, S[2][0] += 20;
|
|
614
678
|
});
|
|
615
|
-
const
|
|
616
|
-
points:
|
|
679
|
+
const C = {
|
|
680
|
+
points: S,
|
|
617
681
|
strokeColor: l,
|
|
618
682
|
fillColor: s,
|
|
619
683
|
shouldClosePath: !0
|
|
620
|
-
}, [
|
|
621
|
-
center: [
|
|
684
|
+
}, [F, x] = M, h = {
|
|
685
|
+
center: [F, x + labelOutSize + labelHeight + 1],
|
|
622
686
|
text: r,
|
|
623
687
|
textColor: i,
|
|
624
688
|
leftIcon: c,
|
|
625
689
|
rightIcons: d,
|
|
626
690
|
blinkColors: t.blinkColors
|
|
627
691
|
};
|
|
628
|
-
if (drawPolygon(e,
|
|
629
|
-
let w = Date.now(),
|
|
692
|
+
if (drawPolygon(e, C), drawText(e, h), ((f = t == null ? void 0 : t.blinkColors) == null ? void 0 : f.length) > 0) {
|
|
693
|
+
let w = Date.now(), k = 0;
|
|
630
694
|
const L = [];
|
|
631
|
-
t.blinkColors.forEach((
|
|
632
|
-
L.push(
|
|
633
|
-
}), intervalId[t.
|
|
634
|
-
const
|
|
635
|
-
|
|
695
|
+
t.blinkColors.forEach((T) => {
|
|
696
|
+
L.push(T), L.push("white");
|
|
697
|
+
}), intervalId[t.id] && clearInterval(intervalId[t.id]), intervalId[t.id] = setInterval(() => {
|
|
698
|
+
const T = Date.now();
|
|
699
|
+
T - w >= 500 && (k = (k + 1) % L.length, w = T, C.fillColor = L[k], drawPolygon(e, C), h.textColor = getForegroundColor(C.fillColor), drawText(e, h));
|
|
636
700
|
}, 10);
|
|
637
|
-
}
|
|
701
|
+
} else
|
|
702
|
+
shipLabels.value.find((k) => k.name === r) && (clearInterval(intervalId[t.id]), drawPolygon(e, C), drawText(e, h));
|
|
638
703
|
}
|
|
639
704
|
}
|
|
640
705
|
return null;
|
|
@@ -689,9 +754,9 @@ function mercatorToLonLat(e, t = "lonlat") {
|
|
|
689
754
|
}
|
|
690
755
|
function calculateBoundingBox(e) {
|
|
691
756
|
let t = 1 / 0, n = -1 / 0, o = 1 / 0, r = -1 / 0;
|
|
692
|
-
e.forEach((
|
|
693
|
-
const [g,
|
|
694
|
-
t = Math.min(t,
|
|
757
|
+
e.forEach((v) => {
|
|
758
|
+
const [g, M] = v;
|
|
759
|
+
t = Math.min(t, M), n = Math.max(n, M), o = Math.min(o, g), r = Math.max(r, g);
|
|
695
760
|
});
|
|
696
761
|
const l = r - o, i = n - t, s = Math.max(l, i), c = (o + r) / 2, d = (t + n) / 2, m = s / 2, u = c - m, f = c + m, p = d - m, y = d + m;
|
|
697
762
|
return [f, p, u, y];
|
|
@@ -702,7 +767,7 @@ const transformUtils = {
|
|
|
702
767
|
lonLatToMercator,
|
|
703
768
|
mercatorToLonLat,
|
|
704
769
|
calculateBoundingBox
|
|
705
|
-
}, mapInstance$
|
|
770
|
+
}, mapInstance$7 = ref(), renderTrackStyleSetInstance = (e) => mapInstance$7.value = e, stopIcon = "", stopColor = "#E31818", slowIcon = "", slowColor = "#1890FF", dropletsIcon = "", trackList$1 = ref([]), renderTrackLine = (e, t, n) => {
|
|
706
771
|
var l, i, s;
|
|
707
772
|
const o = e[t];
|
|
708
773
|
if (!o) return;
|
|
@@ -724,13 +789,13 @@ const transformUtils = {
|
|
|
724
789
|
features: [...shipTrackLineFeatures.value]
|
|
725
790
|
}), shipTrackVectorLayer.value = new VectorLayer({
|
|
726
791
|
source: trackLineVectorSource.value
|
|
727
|
-
}), renderPoint(n), (s = mapInstance$
|
|
792
|
+
}), renderPoint(n), (s = mapInstance$7.value) == null || s.addLayer(shipTrackVectorLayer.value);
|
|
728
793
|
}
|
|
729
794
|
}, handlePlay = (e, t) => {
|
|
730
|
-
const n = allTracks.value[e];
|
|
795
|
+
const n = allTracks.value[String(e)];
|
|
731
796
|
playAnimation(n.map((o) => [o.lon, o.lat]), t);
|
|
732
|
-
}, removeShipTrackLineFeatureByIndex = (e) => {
|
|
733
|
-
e >= 0 && e < shipTrackLineFeatures.value.length && (shipTrackLineFeatures.value.splice(e, 1), allTracks.value
|
|
797
|
+
}, removeShipTrackLineFeatureByIndex = (e, t) => {
|
|
798
|
+
e >= 0 && e < shipTrackLineFeatures.value.length && (shipTrackLineFeatures.value.splice(e, 1), delete allTracks.value[t]), trackLineVectorSource.value = new VectorSource({
|
|
734
799
|
features: [...shipTrackLineFeatures.value]
|
|
735
800
|
}), shipTrackVectorLayer.value && shipTrackVectorLayer.value.setSource(trackLineVectorSource.value);
|
|
736
801
|
}, createAnimatedIconFeature = (e, t) => {
|
|
@@ -773,12 +838,12 @@ const moveFeature = (e, t) => {
|
|
|
773
838
|
), d = getRotation(transformUtils.mercatorToLonLat(i, "array"), transformUtils.mercatorToLonLat(s, "array")) * Math.PI / 180;
|
|
774
839
|
geoMarkerStyle.getText().setRotation(d), position.setCoordinates(l);
|
|
775
840
|
const m = getVectorContext(e);
|
|
776
|
-
m.context_.save(), m.setStyle(geoMarkerStyle), m.drawGeometry(position), m.context_.restore(), (u = mapInstance$
|
|
841
|
+
m.context_.save(), m.setStyle(geoMarkerStyle), m.drawGeometry(position), m.context_.restore(), (u = mapInstance$7.value) == null || u.render();
|
|
777
842
|
}, startAnimation = () => {
|
|
778
843
|
trackAnimating.value = !0, showTrackAnimatMarker.value = !0, lastTime = Date.now(), distance = 0, position = startMarker.getGeometry().clone(), vectorLayer.on("postrender", moveFeatureHandler), geoMarker.setGeometry(null);
|
|
779
844
|
}, stopAnimation = () => {
|
|
780
845
|
var e;
|
|
781
|
-
trackAnimating.value && (trackAnimating.value = !1, geoMarker.setGeometry(null), vectorLayer.un("postrender", moveFeatureHandler), (e = mapInstance$
|
|
846
|
+
trackAnimating.value && (trackAnimating.value = !1, geoMarker.setGeometry(null), vectorLayer.un("postrender", moveFeatureHandler), (e = mapInstance$7.value) == null || e.removeLayer(vectorLayer), vectorLayer = null, geoMarker = null);
|
|
782
847
|
}, playAnimation = (e, t) => {
|
|
783
848
|
var n;
|
|
784
849
|
trackAnimating.value && stopAnimation(), polyline = new Polyline({
|
|
@@ -799,19 +864,19 @@ const moveFeature = (e, t) => {
|
|
|
799
864
|
source: new VectorSource({
|
|
800
865
|
features: [geoMarker]
|
|
801
866
|
})
|
|
802
|
-
}), (n = mapInstance$
|
|
867
|
+
}), (n = mapInstance$7.value) == null || n.addLayer(vectorLayer), moveFeatureHandler = (o) => moveFeature(o, t), startAnimation();
|
|
803
868
|
}, renderPoint = (e) => {
|
|
804
|
-
if (!mapInstance$
|
|
869
|
+
if (!mapInstance$7.value) return;
|
|
805
870
|
let t = trackList$1.value || [];
|
|
806
871
|
if (!(t && t.length > 1)) return [];
|
|
807
872
|
let n = { 16: 24, 17: 15, default: 4 }, o = [], r = t.length;
|
|
808
873
|
for (let s = 0; s < r; s++) {
|
|
809
874
|
t[s].index = s;
|
|
810
|
-
let c = mapInstance$
|
|
875
|
+
let c = mapInstance$7.value.getPixelFromCoordinate(t[s].centerPoint);
|
|
811
876
|
if (c) {
|
|
812
877
|
let d = c.concat(c);
|
|
813
878
|
d = adjustBounds(d, [20, 20]);
|
|
814
|
-
let m = mapInstance$
|
|
879
|
+
let m = mapInstance$7.value.getView().getZoom();
|
|
815
880
|
if (!m) return;
|
|
816
881
|
if (m > 15) {
|
|
817
882
|
let f = n[m] || n.default;
|
|
@@ -834,16 +899,23 @@ const moveFeature = (e, t) => {
|
|
|
834
899
|
let d = new Feature({
|
|
835
900
|
geometry: new Point(s.centerPoint)
|
|
836
901
|
});
|
|
837
|
-
d.set("type", "track_point"), d.set("data", s), d.setStyle(
|
|
902
|
+
d.set("type", "track_point"), d.set("data", s), d.setStyle([
|
|
838
903
|
new Style({
|
|
904
|
+
// 扩大交互热区
|
|
905
|
+
image: new CircleStyle({
|
|
906
|
+
stroke: new Stroke({ color: "rgba(0, 0, 0, 0.01)", width: 20 }),
|
|
907
|
+
radius: 3
|
|
908
|
+
})
|
|
909
|
+
}),
|
|
910
|
+
new Style({
|
|
911
|
+
// 轨迹点样式
|
|
839
912
|
image: new CircleStyle({
|
|
840
913
|
fill: new Fill({ color: e }),
|
|
841
914
|
stroke: new Stroke({ color: "#fff", width: 2 }),
|
|
842
|
-
radius: 3
|
|
843
|
-
hitDetectionRadius: 10
|
|
915
|
+
radius: 3
|
|
844
916
|
})
|
|
845
917
|
})
|
|
846
|
-
), trackLineVectorSource.value.addFeature(d);
|
|
918
|
+
]), trackLineVectorSource.value.addFeature(d);
|
|
847
919
|
const m = new Feature({
|
|
848
920
|
geometry: new Point(fromLonLat(s.center))
|
|
849
921
|
});
|
|
@@ -861,8 +933,8 @@ const moveFeature = (e, t) => {
|
|
|
861
933
|
offsetY: -10
|
|
862
934
|
}),
|
|
863
935
|
zIndex: 99
|
|
864
|
-
}),
|
|
865
|
-
Number(s.state) === 0 ? ((u = y.getText()) == null || u.setFill(new Fill({ color: stopColor })),
|
|
936
|
+
}), v = [];
|
|
937
|
+
Number(s.state) === 0 ? ((u = y.getText()) == null || u.setFill(new Fill({ color: stopColor })), v.push(l)) : Number(s.state) === 1 && ((f = y.getText()) == null || f.setFill(new Fill({ color: slowColor })), v.push(i)), v.push(y), p.setStyle(v), trackLineVectorSource.value.addFeature(p);
|
|
866
938
|
}
|
|
867
939
|
}), renderArrow(o, e), renderIconPoint();
|
|
868
940
|
}, renderArrow = (e, t) => {
|
|
@@ -999,7 +1071,7 @@ const moveFeature = (e, t) => {
|
|
|
999
1071
|
image: new CircleStyle({
|
|
1000
1072
|
radius: 0
|
|
1001
1073
|
})
|
|
1002
|
-
}), mapInstance$
|
|
1074
|
+
}), 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({
|
|
1003
1075
|
renderer: (t, n) => {
|
|
1004
1076
|
const o = n.context, r = n.feature.get("data"), l = r.length / 2;
|
|
1005
1077
|
o.beginPath(), o.arc(
|
|
@@ -1017,8 +1089,8 @@ const moveFeature = (e, t) => {
|
|
|
1017
1089
|
}
|
|
1018
1090
|
}
|
|
1019
1091
|
}), drawShipBody = (e, t, n) => {
|
|
1020
|
-
if (!mapInstance$
|
|
1021
|
-
const o = Math.round(Number(mapInstance$
|
|
1092
|
+
if (!mapInstance$6.value) return;
|
|
1093
|
+
const o = Math.round(Number(mapInstance$6.value.getView().getZoom()));
|
|
1022
1094
|
if (!o) return;
|
|
1023
1095
|
let r = [];
|
|
1024
1096
|
const [l, i] = drawShipModelByZoom[o] || [0, 0], [s, c] = n;
|
|
@@ -1071,6 +1143,7 @@ const moveFeature = (e, t) => {
|
|
|
1071
1143
|
t.leftIconColor && (c = { color: t.leftIconColor, icon: "" });
|
|
1072
1144
|
let d = getShipCustomIcon(t);
|
|
1073
1145
|
const m = {
|
|
1146
|
+
id: t.id,
|
|
1074
1147
|
center: [l, i],
|
|
1075
1148
|
text: s,
|
|
1076
1149
|
fill: t.fill,
|
|
@@ -1104,21 +1177,21 @@ const moveFeature = (e, t) => {
|
|
|
1104
1177
|
}, getShipCustomIcon = (e) => {
|
|
1105
1178
|
let t = [];
|
|
1106
1179
|
return e.existDevice && t.push(""), e.existMobile && t.push(""), e.existWaterGauge && t.push(""), t || [];
|
|
1107
|
-
}, mapInstance$
|
|
1180
|
+
}, mapInstance$5 = ref(), renderShipSetInstance = (e) => mapInstance$5.value = e;
|
|
1108
1181
|
let shipsMarkerList = [], shipsVectorSource, largeAmountShipsSource;
|
|
1109
1182
|
const selectedShipData = ref(null);
|
|
1110
1183
|
let selectShipsVectorSource;
|
|
1111
1184
|
const renderShips = (e) => {
|
|
1112
1185
|
var n, o, r, l;
|
|
1113
|
-
if (!mapInstance$
|
|
1114
|
-
const t = Math.round(Number(mapInstance$
|
|
1186
|
+
if (!mapInstance$5.value || showTrackLayer.value) return;
|
|
1187
|
+
const t = Math.round(Number(mapInstance$5.value.getView().getZoom()));
|
|
1115
1188
|
if (selectedShipData.value && nextTick(() => {
|
|
1116
1189
|
selectSingleShipMarker(selectedShipData.value);
|
|
1117
1190
|
}).then((i) => {
|
|
1118
1191
|
}), !(!t || t < mapZoom.shipGreenDotMax) && (allShips.value = e, !hiddenOrther.value))
|
|
1119
1192
|
return t >= mapZoom.shipGreenDotMax && t < mapZoom.shipModelMin ? ((n = shipsLayer.value) == null || n.setVisible(!1), (o = largeAmountShipsLayer.value) == null || o.setVisible(!0), renderLargeAmountShips(e)) : ((r = largeAmountShipsLayer.value) == null || r.setVisible(!1), (l = shipsLayer.value) == null || l.setVisible(!0), renderShipsMarker(e));
|
|
1120
1193
|
}, renderLargeAmountShips = (e) => {
|
|
1121
|
-
if (!mapInstance$
|
|
1194
|
+
if (!mapInstance$5.value) return;
|
|
1122
1195
|
const t = e.map((n) => ({
|
|
1123
1196
|
type: "Feature",
|
|
1124
1197
|
geometry: {
|
|
@@ -1164,10 +1237,10 @@ const renderShips = (e) => {
|
|
|
1164
1237
|
"shape-stroke-width": 0.5
|
|
1165
1238
|
// 边框宽度为0.5px
|
|
1166
1239
|
}
|
|
1167
|
-
}), mapInstance$
|
|
1240
|
+
}), mapInstance$5.value.addLayer(largeAmountShipsLayer.value), largeAmountShipsLayer.value;
|
|
1168
1241
|
}, renderShipsMarker = (e) => {
|
|
1169
1242
|
var n;
|
|
1170
|
-
if (!mapInstance$
|
|
1243
|
+
if (!mapInstance$5.value) return;
|
|
1171
1244
|
deleteAllShipMarkers();
|
|
1172
1245
|
let t = convertShipMapData(e);
|
|
1173
1246
|
if (t = customFilterShips(t), !!(t != null && t.length))
|
|
@@ -1186,7 +1259,7 @@ const renderShips = (e) => {
|
|
|
1186
1259
|
features: shipsMarkerList.map((o) => o.feature)
|
|
1187
1260
|
}), shipsLayer.value = new VectorLayer({
|
|
1188
1261
|
source: shipsVectorSource
|
|
1189
|
-
}), (n = mapInstance$
|
|
1262
|
+
}), (n = mapInstance$5.value) == null || n.addLayer(shipsLayer.value), shipsLayer.value;
|
|
1190
1263
|
}, customFilterShips = (e) => {
|
|
1191
1264
|
let t = cloneDeep(e);
|
|
1192
1265
|
return t = t.filter((n) => {
|
|
@@ -1204,7 +1277,7 @@ const renderShips = (e) => {
|
|
|
1204
1277
|
}), shipsMarkerList = [];
|
|
1205
1278
|
}, selectSingleShipMarker = (e) => {
|
|
1206
1279
|
var l;
|
|
1207
|
-
if (!mapInstance$
|
|
1280
|
+
if (!mapInstance$5.value) return;
|
|
1208
1281
|
const t = cloneDeep(selectSingleShipData.value);
|
|
1209
1282
|
selectSingleShipData.value = convertShipMapData(e);
|
|
1210
1283
|
const n = [selectSingleShipData.value.lon, selectSingleShipData.value.lat], o = new Feature({
|
|
@@ -1222,7 +1295,7 @@ const renderShips = (e) => {
|
|
|
1222
1295
|
source: selectShipsVectorSource
|
|
1223
1296
|
}), setVisibleFeatureById(shipsVectorSource, selectSingleShipData.value.id, !0);
|
|
1224
1297
|
const r = (l = shipsLayer.value) == null ? void 0 : l.getSource();
|
|
1225
|
-
return r && (t && setVisibleFeatureById(r, t.id, !0), setVisibleFeatureById(r, selectSingleShipData.value.id, !1)), mapInstance$
|
|
1298
|
+
return r && (t && setVisibleFeatureById(r, t.id, !0), setVisibleFeatureById(r, selectSingleShipData.value.id, !1)), mapInstance$5.value.addLayer(selectShipsLayer.value), selectShipsLayer.value.setVisible(!0), selectShipsLayer.value;
|
|
1226
1299
|
}, setVisibleFeatureById = (e, t, n) => {
|
|
1227
1300
|
e && e.forEachFeature((o) => {
|
|
1228
1301
|
const r = o.get("data");
|
|
@@ -1230,7 +1303,7 @@ const renderShips = (e) => {
|
|
|
1230
1303
|
});
|
|
1231
1304
|
}, findShip = (e, t, n = !0) => {
|
|
1232
1305
|
var r, l, i, s, c;
|
|
1233
|
-
if (
|
|
1306
|
+
if (!e || !mapInstance$5.value) return;
|
|
1234
1307
|
const o = (i = (l = (r = shipsLayer.value) == null ? void 0 : r.getSource()) == null ? void 0 : l.getFeatures()) == null ? void 0 : i.find((d) => {
|
|
1235
1308
|
var m;
|
|
1236
1309
|
return ((m = d.get("data")) == null ? void 0 : m.id) === e;
|
|
@@ -1240,7 +1313,7 @@ const renderShips = (e) => {
|
|
|
1240
1313
|
return;
|
|
1241
1314
|
}
|
|
1242
1315
|
if (n && ((s = selectedShipData.value) != null && s.lon) && ((c = selectedShipData.value) != null && c.lat)) {
|
|
1243
|
-
const d = mapInstance$
|
|
1316
|
+
const d = mapInstance$5.value.getView(), m = new Point([selectedShipData.value.lon, selectedShipData.value.lat]);
|
|
1244
1317
|
d.setCenter(transform(m.getCoordinates(), projection.data, projection.mercator));
|
|
1245
1318
|
const u = d.getZoom(), f = u < mapZoom.findShipMin ? mapZoom.findShip : u;
|
|
1246
1319
|
d.setZoom(f);
|
|
@@ -1253,9 +1326,9 @@ const renderShips = (e) => {
|
|
|
1253
1326
|
const t = (e = shipsLayer.value) == null ? void 0 : e.getSource();
|
|
1254
1327
|
t && setVisibleFeatureById(t, selectSingleShipData.value.id, !0);
|
|
1255
1328
|
}
|
|
1256
|
-
selectedShipData.value = null, mapInstance$
|
|
1329
|
+
selectedShipData.value = null, mapInstance$5.value && (selectShipsVectorSource == null || selectShipsVectorSource.clear(), selectShipsLayer.value = new VectorLayer({
|
|
1257
1330
|
source: selectShipsVectorSource
|
|
1258
|
-
}), mapInstance$
|
|
1331
|
+
}), mapInstance$5.value.addLayer(selectShipsLayer.value), selectShipsLayer.value.setVisible(!1));
|
|
1259
1332
|
}, hiddenAllShips = () => {
|
|
1260
1333
|
var e, t;
|
|
1261
1334
|
(e = shipsLayer.value) == null || e.setVisible(!1), (t = largeAmountShipsLayer.value) == null || t.setVisible(!1);
|
|
@@ -1270,9 +1343,9 @@ const renderShips = (e) => {
|
|
|
1270
1343
|
switchBtnShow.value[e] = t, renderShips(allShips.value);
|
|
1271
1344
|
}, rerenderShip = () => {
|
|
1272
1345
|
renderShips(allShips.value);
|
|
1273
|
-
}, mapInstance$
|
|
1346
|
+
}, mapInstance$4 = ref(), renderCustomOverlaySetInstance = (e) => mapInstance$4.value = e, drawCustomContent = (e, t, n, o = "top-left", r = !1) => {
|
|
1274
1347
|
var m, u;
|
|
1275
|
-
if (!t || !mapInstance$
|
|
1348
|
+
if (!t || !mapInstance$4.value) return;
|
|
1276
1349
|
document.querySelectorAll(".truck-custom-content").forEach((f) => f.parentNode.removeChild(f));
|
|
1277
1350
|
const l = document.createElement("div");
|
|
1278
1351
|
l.innerHTML = n;
|
|
@@ -1286,32 +1359,32 @@ const renderShips = (e) => {
|
|
|
1286
1359
|
});
|
|
1287
1360
|
if (r) {
|
|
1288
1361
|
let f = !1, p = [0, 0], y = [0, 0];
|
|
1289
|
-
l.addEventListener("mousedown", function(
|
|
1362
|
+
l.addEventListener("mousedown", function(v) {
|
|
1290
1363
|
var g;
|
|
1291
|
-
f = !0,
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
],
|
|
1295
|
-
}), document.addEventListener("mousemove", function(
|
|
1364
|
+
f = !0, v.clientX, v.clientY, p = (g = mapInstance$4.value) == null ? void 0 : g.getCoordinateFromPixel([v.clientX - 200, v.clientY - 200]), y = [
|
|
1365
|
+
v.clientX - l.getBoundingClientRect().left + 160,
|
|
1366
|
+
v.clientY - l.getBoundingClientRect().top + 84
|
|
1367
|
+
], v.preventDefault();
|
|
1368
|
+
}), document.addEventListener("mousemove", function(v) {
|
|
1296
1369
|
var g;
|
|
1297
1370
|
if (f) {
|
|
1298
|
-
let
|
|
1299
|
-
i.setPosition([p[0] +
|
|
1371
|
+
let M = (g = mapInstance$4.value) == null ? void 0 : g.getCoordinateFromPixel([v.clientX - y[0], v.clientY - y[1]]), S = M[0] - p[0], b = M[1] - p[1];
|
|
1372
|
+
i.setPosition([p[0] + S, p[1] + b]);
|
|
1300
1373
|
}
|
|
1301
1374
|
}), document.addEventListener("mouseup", function() {
|
|
1302
1375
|
f = !1;
|
|
1303
1376
|
});
|
|
1304
1377
|
}
|
|
1305
|
-
(m = mapInstance$
|
|
1378
|
+
(m = mapInstance$4.value) == null || m.addOverlay(i);
|
|
1306
1379
|
const s = l.querySelector(".close-button");
|
|
1307
1380
|
s && s.addEventListener("click", () => {
|
|
1308
1381
|
var f, p;
|
|
1309
|
-
(f = mapInstance$
|
|
1382
|
+
(f = mapInstance$4.value) == null || f.removeOverlay(i), (p = l.parentNode) == null || p.removeChild(l);
|
|
1310
1383
|
});
|
|
1311
1384
|
let c = JSON.parse(JSON.stringify(t));
|
|
1312
|
-
const d = (u = mapInstance$
|
|
1385
|
+
const d = (u = mapInstance$4.value) == null ? void 0 : u.getCoordinateFromPixel(c);
|
|
1313
1386
|
return i.setPosition(d), i;
|
|
1314
|
-
}, mapInstance$
|
|
1387
|
+
}, mapInstance$3 = ref(), renderTrackSetInstance = (e) => mapInstance$3.value = e, showTracks = ref([]), trackList = ref([]);
|
|
1315
1388
|
ref(null);
|
|
1316
1389
|
const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, r = "ship") => {
|
|
1317
1390
|
var m;
|
|
@@ -1335,7 +1408,7 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, r = "ship")
|
|
|
1335
1408
|
u < 0 ? showTracks.value.push({ id: e, length: d }) : showTracks.value[u].length = d, ++cursor.value, cursor.value > i.length && (cursor.value = 0), renderTrackLine(l, e, n), nextTick(() => {
|
|
1336
1409
|
resetTrackView(e);
|
|
1337
1410
|
}).then(() => {
|
|
1338
|
-
}), (p = mapInstance$
|
|
1411
|
+
}), (p = mapInstance$3.value) == null || p.on("moveend", () => {
|
|
1339
1412
|
showTrackLayer.value && (trackLabels.value = [], renderTrackLine(l, e, n));
|
|
1340
1413
|
}), renderTrackPointPopup();
|
|
1341
1414
|
}).then(() => {
|
|
@@ -1343,10 +1416,10 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, r = "ship")
|
|
|
1343
1416
|
}, renderTrackPointPopup = () => {
|
|
1344
1417
|
var t;
|
|
1345
1418
|
const e = ref(null);
|
|
1346
|
-
(t = mapInstance$
|
|
1419
|
+
(t = mapInstance$3.value) == null || t.on("pointermove", (n) => {
|
|
1347
1420
|
var r, l, i, s;
|
|
1348
|
-
e.value && ((r = mapInstance$
|
|
1349
|
-
const o = (l = mapInstance$
|
|
1421
|
+
e.value && ((r = mapInstance$3.value) == null || r.removeOverlay(e.value));
|
|
1422
|
+
const o = (l = mapInstance$3.value) == null ? void 0 : l.forEachFeatureAtPixel(n.pixel, (c) => c);
|
|
1350
1423
|
if (o) {
|
|
1351
1424
|
const c = o.get("data");
|
|
1352
1425
|
if (!(c != null && c.time)) return;
|
|
@@ -1388,10 +1461,10 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, r = "ship")
|
|
|
1388
1461
|
<div class="item-item">${c.time}</div>
|
|
1389
1462
|
</div>
|
|
1390
1463
|
${d ?? d}
|
|
1391
|
-
</div>`, u = (i = mapInstance$
|
|
1464
|
+
</div>`, u = (i = mapInstance$3.value) == null ? void 0 : i.getPixelFromCoordinate(n.coordinate);
|
|
1392
1465
|
e.value = drawCustomContent(c.time, u, m, "center-center");
|
|
1393
1466
|
} else
|
|
1394
|
-
(s = mapInstance$
|
|
1467
|
+
(s = mapInstance$3.value) == null || s.removeOverlay(e.value);
|
|
1395
1468
|
});
|
|
1396
1469
|
}, removeAllTrackLayer = () => {
|
|
1397
1470
|
var e;
|
|
@@ -1400,7 +1473,7 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, r = "ship")
|
|
|
1400
1473
|
handlePlay(String(e), t);
|
|
1401
1474
|
}, resetTrackView = (e) => {
|
|
1402
1475
|
var r;
|
|
1403
|
-
const t = mapInstance$
|
|
1476
|
+
const t = mapInstance$3.value.getView(), n = e ? shipTrackLineFeatures.value.find((l) => l.getId() === e) : shipTrackLineFeatures.value[0];
|
|
1404
1477
|
if (!n) return;
|
|
1405
1478
|
const o = (r = n == null ? void 0 : n.getGeometry()) == null ? void 0 : r.getExtent();
|
|
1406
1479
|
if (o != null && o.length)
|
|
@@ -1430,28 +1503,28 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, r = "ship")
|
|
|
1430
1503
|
}, m = () => {
|
|
1431
1504
|
r("switchMapTile", o.mapTileMode === BaseMapType.vector ? BaseMapType.satellite : BaseMapType.vector);
|
|
1432
1505
|
}, u = () => {
|
|
1433
|
-
var
|
|
1434
|
-
i.value ? (
|
|
1506
|
+
var v, g;
|
|
1507
|
+
i.value ? (v = s.value) == null || v.removeInteraction() : (g = s.value) == null || g.addInteraction(), i.value = !i.value;
|
|
1435
1508
|
}, f = () => {
|
|
1436
|
-
var
|
|
1437
|
-
(
|
|
1509
|
+
var v;
|
|
1510
|
+
(v = s.value) == null || v.removeInteraction(), i.value = !1;
|
|
1438
1511
|
};
|
|
1439
1512
|
return onMounted(() => {
|
|
1440
1513
|
nextTick(() => {
|
|
1441
|
-
var
|
|
1442
|
-
(
|
|
1443
|
-
var
|
|
1444
|
-
const g = (
|
|
1514
|
+
var v;
|
|
1515
|
+
(v = n.value) == null || v.on("moveend", () => {
|
|
1516
|
+
var M, S;
|
|
1517
|
+
const g = (S = (M = n.value) == null ? void 0 : M.getView()) == null ? void 0 : S.getZoom();
|
|
1445
1518
|
g && (l.value = g);
|
|
1446
1519
|
});
|
|
1447
1520
|
});
|
|
1448
|
-
}), (
|
|
1521
|
+
}), (v, g) => (openBlock(), createElementBlock(Fragment, null, [
|
|
1449
1522
|
createElementVNode("div", {
|
|
1450
|
-
class: normalizeClass(`tool-panel ${
|
|
1523
|
+
class: normalizeClass(`tool-panel ${v.viewMode}`)
|
|
1451
1524
|
}, [
|
|
1452
|
-
|
|
1525
|
+
v.viewMode === "WxMiniprogram" ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
|
|
1453
1526
|
createElementVNode("div", _hoisted_2$1, [
|
|
1454
|
-
|
|
1527
|
+
v.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
|
|
1455
1528
|
key: 0,
|
|
1456
1529
|
class: normalizeClass(["switch-btn", `${i.value && "active"}`]),
|
|
1457
1530
|
onClick: u
|
|
@@ -1459,50 +1532,50 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, r = "ship")
|
|
|
1459
1532
|
createElementVNode("i", { class: "map-iconfont icon-measure" }, null, -1),
|
|
1460
1533
|
createElementVNode("div", { class: "button-text" }, "测距", -1)
|
|
1461
1534
|
]), 2)) : createCommentVNode("", !0),
|
|
1462
|
-
|
|
1535
|
+
v.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
|
|
1463
1536
|
key: 1,
|
|
1464
|
-
class: normalizeClass(`switch-btn ${c.value && "active"} ${(
|
|
1537
|
+
class: normalizeClass(`switch-btn ${c.value && "active"} ${(v.disableGreenDot || l.value >= unref(mapZoom).shipGreenDotMax) && "disabled"}`),
|
|
1465
1538
|
onClick: d
|
|
1466
1539
|
}, g[6] || (g[6] = [
|
|
1467
1540
|
createElementVNode("i", { class: "map-iconfont icon-ship" }, null, -1),
|
|
1468
1541
|
createElementVNode("div", { class: "button-text" }, "绿点", -1)
|
|
1469
1542
|
]), 2)) : createCommentVNode("", !0),
|
|
1470
|
-
|
|
1543
|
+
v.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
|
|
1471
1544
|
key: 2,
|
|
1472
|
-
class: normalizeClass(`switch-btn ${
|
|
1473
|
-
onClick: g[0] || (g[0] = (
|
|
1545
|
+
class: normalizeClass(`switch-btn ${v.mapTileMode === unref(BaseMapType).satellite && "active"}`),
|
|
1546
|
+
onClick: g[0] || (g[0] = (M) => m())
|
|
1474
1547
|
}, g[7] || (g[7] = [
|
|
1475
1548
|
createElementVNode("i", { class: "map-iconfont icon-space" }, null, -1),
|
|
1476
1549
|
createElementVNode("div", { class: "button-text" }, "图层", -1)
|
|
1477
1550
|
]), 2)) : createCommentVNode("", !0),
|
|
1478
|
-
|
|
1551
|
+
v.vehicleMode === "truck" ? (openBlock(), createElementBlock("div", {
|
|
1479
1552
|
key: 3,
|
|
1480
|
-
class: normalizeClass(`switch-btn ${
|
|
1481
|
-
onClick: g[1] || (g[1] = (
|
|
1553
|
+
class: normalizeClass(`switch-btn ${v.mapTileMode === unref(BaseMapType).satellite && "active"}`),
|
|
1554
|
+
onClick: g[1] || (g[1] = (M) => m())
|
|
1482
1555
|
}, g[8] || (g[8] = [
|
|
1483
1556
|
createElementVNode("i", { class: "map-iconfont icon-space" }, null, -1),
|
|
1484
1557
|
createElementVNode("div", { class: "button-text" }, "卫星", -1)
|
|
1485
1558
|
]), 2)) : createCommentVNode("", !0),
|
|
1486
|
-
|
|
1559
|
+
v.showTrackLayer ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
|
|
1487
1560
|
createElementVNode("div", {
|
|
1488
1561
|
class: "switch-btn multiple",
|
|
1489
|
-
onClick: g[2] || (g[2] = (
|
|
1562
|
+
onClick: g[2] || (g[2] = (M) => unref(playTrack)(unref(currentTrackId), 1))
|
|
1490
1563
|
}, g[9] || (g[9] = [
|
|
1491
1564
|
createElementVNode("i", { class: "map-iconfont icon-play" }, null, -1),
|
|
1492
1565
|
createElementVNode("div", { class: "button-text" }, "播放轨迹", -1)
|
|
1493
1566
|
])),
|
|
1494
1567
|
createElementVNode("div", {
|
|
1495
1568
|
class: "switch-btn multiple",
|
|
1496
|
-
onClick: g[3] || (g[3] = (
|
|
1569
|
+
onClick: g[3] || (g[3] = (M) => unref(resetTrackView)())
|
|
1497
1570
|
}, g[10] || (g[10] = [
|
|
1498
1571
|
createElementVNode("i", { class: "map-iconfont icon-center" }, null, -1),
|
|
1499
1572
|
createElementVNode("div", { class: "button-text" }, "轨迹居中", -1)
|
|
1500
1573
|
]))
|
|
1501
1574
|
], 64)) : createCommentVNode("", !0),
|
|
1502
|
-
renderSlot(
|
|
1575
|
+
renderSlot(v.$slots, "toolPanel", {}, void 0, !0)
|
|
1503
1576
|
])
|
|
1504
1577
|
])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
1505
|
-
|
|
1578
|
+
v.vehicleMode === "ship" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
1506
1579
|
createElementVNode("div", {
|
|
1507
1580
|
class: normalizeClass(["switch-btn", `${i.value && "active"}`]),
|
|
1508
1581
|
onClick: u
|
|
@@ -1510,9 +1583,9 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, r = "ship")
|
|
|
1510
1583
|
createElementVNode("i", { class: "map-iconfont icon-measure" }, null, -1),
|
|
1511
1584
|
createElementVNode("div", { class: "button-text" }, "测距", -1)
|
|
1512
1585
|
]), 2),
|
|
1513
|
-
|
|
1586
|
+
v.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
|
|
1514
1587
|
key: 0,
|
|
1515
|
-
class: normalizeClass(`switch-btn ${c.value && "active"} ${(
|
|
1588
|
+
class: normalizeClass(`switch-btn ${c.value && "active"} ${(v.disableGreenDot || l.value >= unref(mapZoom).shipGreenDotMax) && "disabled"}`),
|
|
1516
1589
|
onClick: d
|
|
1517
1590
|
}, g[12] || (g[12] = [
|
|
1518
1591
|
createElementVNode("i", { class: "map-iconfont icon-ship" }, null, -1),
|
|
@@ -1520,7 +1593,7 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, r = "ship")
|
|
|
1520
1593
|
]), 2)) : createCommentVNode("", !0)
|
|
1521
1594
|
], 64)) : createCommentVNode("", !0),
|
|
1522
1595
|
createElementVNode("div", {
|
|
1523
|
-
class: normalizeClass(["switch-btn", { active:
|
|
1596
|
+
class: normalizeClass(["switch-btn", { active: v.mapTileMode === unref(BaseMapType).satellite }]),
|
|
1524
1597
|
onClick: m
|
|
1525
1598
|
}, g[13] || (g[13] = [
|
|
1526
1599
|
createElementVNode("i", { class: "map-iconfont icon-space" }, null, -1),
|
|
@@ -1534,9 +1607,9 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, n, o, r = "ship")
|
|
|
1534
1607
|
ref_key: "measureRef",
|
|
1535
1608
|
ref: s,
|
|
1536
1609
|
visible: i.value,
|
|
1537
|
-
"onUpdate:visible": g[4] || (g[4] = (
|
|
1610
|
+
"onUpdate:visible": g[4] || (g[4] = (M) => i.value = M),
|
|
1538
1611
|
onClose: f,
|
|
1539
|
-
"view-mode":
|
|
1612
|
+
"view-mode": v.viewMode
|
|
1540
1613
|
}, null, 8, ["visible", "view-mode"])) : createCommentVNode("", !0)
|
|
1541
1614
|
])
|
|
1542
1615
|
], 64));
|
|
@@ -1626,26 +1699,26 @@ const setTruckStyle = (e, t, n, o) => new Style({
|
|
|
1626
1699
|
const m = c - 70, u = d - 68;
|
|
1627
1700
|
let f = 180;
|
|
1628
1701
|
const p = 56, y = "#FFFFFF";
|
|
1629
|
-
let
|
|
1702
|
+
let v = 176;
|
|
1630
1703
|
const g = 52;
|
|
1631
|
-
let
|
|
1632
|
-
n === CAR_COLOR.YELLOW ? (
|
|
1704
|
+
let M = "#164AFF", S = "#FFFFFF";
|
|
1705
|
+
n === CAR_COLOR.YELLOW ? (v = 176, M = "#FFC81E", S = "rgba(0,0,0,0.88)") : n === CAR_COLOR.Y_GREEN && (f = 200, v = 196, M = "#8FED7C", S = "rgba(0,0,0,0.88)"), o != null && o.length && (f += o.length * 56), fillRectRadius(i, m, u, f, p, y), fillRectRadius(i, m + 2, u + 2, v, g, M), n === CAR_COLOR.Y_GREEN && fillRectRadius(i, m + 2, u + 2, 68, g, "#FFC81E"), i.save(), i.restore(), i.fillStyle = S, i.font = "bold 28px Arial", i.textAlign = "left", i.textBaseline = "middle";
|
|
1633
1706
|
const b = `${t.slice(0, 2) + " · " + t.slice(2)}`;
|
|
1634
1707
|
if (i.fillText(b, m + 12, u + 32), i.save(), i.restore(), o != null && o.length) {
|
|
1635
|
-
const
|
|
1636
|
-
let
|
|
1637
|
-
o.forEach((
|
|
1638
|
-
|
|
1708
|
+
const F = i.measureText(b).width + 12;
|
|
1709
|
+
let x = 0;
|
|
1710
|
+
o.forEach((h) => {
|
|
1711
|
+
h === DEVICE_TYPE.CAMERA && (i.drawImage(cameraImage, c - 54 + F + x * 56, d - 64, 50, 50), ++x), h === DEVICE_TYPE.LOAD && (i.drawImage(loadImage, c - 54 + F + x * 56, d - 64, 50, 50), ++x);
|
|
1639
1712
|
});
|
|
1640
1713
|
}
|
|
1641
|
-
const
|
|
1642
|
-
i.drawImage(
|
|
1714
|
+
const C = dotImage$1;
|
|
1715
|
+
i.drawImage(C, c + f / 2 - 90, d, 50 / s, 50 / s), i.restore();
|
|
1643
1716
|
}
|
|
1644
|
-
}), mapInstance$
|
|
1717
|
+
}), mapInstance$2 = ref(), renderDashboardSetInstance = (e) => mapInstance$2.value = e;
|
|
1645
1718
|
ref([]);
|
|
1646
1719
|
let truckMarkerList = [], trucksVectorSource;
|
|
1647
1720
|
const renderTrucksMarker = (e) => {
|
|
1648
|
-
if (deleteAllTruckMarkers(), !!mapInstance$
|
|
1721
|
+
if (deleteAllTruckMarkers(), !!mapInstance$2.value)
|
|
1649
1722
|
return e.forEach((t) => {
|
|
1650
1723
|
const n = formatUtils.convertSixHundredThousandToLatLng(t.lon, t.lat), o = new Feature({
|
|
1651
1724
|
geometry: new Point(fromLonLat(n))
|
|
@@ -1661,17 +1734,17 @@ const renderTrucksMarker = (e) => {
|
|
|
1661
1734
|
features: truckMarkerList.map((t) => t.feature)
|
|
1662
1735
|
}), trucksLayer.value = new VectorLayer({
|
|
1663
1736
|
source: trucksVectorSource
|
|
1664
|
-
}), mapInstance$
|
|
1737
|
+
}), mapInstance$2.value.addLayer(trucksLayer.value), trucksLayer.value;
|
|
1665
1738
|
}, deleteAllTruckMarkers = () => {
|
|
1666
1739
|
truckMarkerList.forEach((e) => {
|
|
1667
1740
|
e.feature && (trucksVectorSource == null || trucksVectorSource.removeFeature(e.feature));
|
|
1668
1741
|
}), truckMarkerList = [];
|
|
1669
|
-
}, mapInstance$
|
|
1670
|
-
if (!mapInstance$
|
|
1742
|
+
}, mapInstance$1 = ref(), renderTruckSetInstance = (e) => mapInstance$1.value = e, vehicle = ref(null), focusShipData = ref(), currentTruckOverlay = ref(null), findTruck = async (e) => {
|
|
1743
|
+
if (!mapInstance$1.value) return;
|
|
1671
1744
|
focusShipData.value = e;
|
|
1672
|
-
const t = formatUtils.convertSixHundredThousandToLatLng(e.lon, e.lat), n = mapInstance$
|
|
1745
|
+
const t = formatUtils.convertSixHundredThousandToLatLng(e.lon, e.lat), n = mapInstance$1.value.getPixelFromCoordinate(transform(t, projection.data, projection.mercator));
|
|
1673
1746
|
currentTruckOverlay.value = drawTruckIcon(e.vno, n, e == null ? void 0 : e.drc);
|
|
1674
|
-
const o = mapInstance$
|
|
1747
|
+
const o = mapInstance$1.value.getView(), r = new Point(t);
|
|
1675
1748
|
o.setCenter(transform(r.getCoordinates(), projection.data, projection.mercator));
|
|
1676
1749
|
}, clearAllTruck = () => {
|
|
1677
1750
|
vehicle.value.clearAllShip();
|
|
@@ -1686,8 +1759,8 @@ const renderTrucksMarker = (e) => {
|
|
|
1686
1759
|
e && (e.innerHTML = "");
|
|
1687
1760
|
}, zoomTruckIcon = () => {
|
|
1688
1761
|
var l;
|
|
1689
|
-
if (!mapInstance$
|
|
1690
|
-
const e = mapInstance$
|
|
1762
|
+
if (!mapInstance$1.value) return;
|
|
1763
|
+
const e = mapInstance$1.value.getView().getZoom(), t = 120, n = 60;
|
|
1691
1764
|
function o(i) {
|
|
1692
1765
|
return i < 14 ? n : i >= 14 && i <= 18 ? Math.round((i - 14) * (t - n) / 4 + n) : t;
|
|
1693
1766
|
}
|
|
@@ -1695,68 +1768,6 @@ const renderTrucksMarker = (e) => {
|
|
|
1695
1768
|
(l = document.querySelectorAll(".truck-custom-content")) == null || l.forEach((i) => {
|
|
1696
1769
|
i.style.width = `${r}px`, i.style.height = `${r}px`;
|
|
1697
1770
|
});
|
|
1698
|
-
}, mapInstance$1 = ref(), renderMarkerSetInstance = (e) => mapInstance$1.value = e, markerPosition = ref(""), marker = ref(), createIconStyle = (e) => new Style({
|
|
1699
|
-
image: new Icon({
|
|
1700
|
-
src: CDN_URL + "map/poi-marker-default.png",
|
|
1701
|
-
anchor: [0.5, 1]
|
|
1702
|
-
}),
|
|
1703
|
-
text: new Text({
|
|
1704
|
-
text: e,
|
|
1705
|
-
offsetY: -90,
|
|
1706
|
-
// 调整文本位置,使其位于标记上方
|
|
1707
|
-
font: "12px",
|
|
1708
|
-
fill: new Fill({
|
|
1709
|
-
color: "#000"
|
|
1710
|
-
}),
|
|
1711
|
-
stroke: new Stroke({
|
|
1712
|
-
color: "#fff",
|
|
1713
|
-
width: 2
|
|
1714
|
-
}),
|
|
1715
|
-
backgroundFill: new Fill({
|
|
1716
|
-
color: "#fff"
|
|
1717
|
-
// 设置文本背景填充颜色
|
|
1718
|
-
}),
|
|
1719
|
-
backgroundStroke: new Stroke({
|
|
1720
|
-
color: "#000",
|
|
1721
|
-
// 设置文本背景描边颜色
|
|
1722
|
-
width: 1
|
|
1723
|
-
}),
|
|
1724
|
-
padding: [2, 2, 2, 2]
|
|
1725
|
-
// 设置文本背景的内边距
|
|
1726
|
-
})
|
|
1727
|
-
}), renderMarker = (e, t = !0, n = !0) => {
|
|
1728
|
-
var m;
|
|
1729
|
-
if (!mapInstance$1.value || !e || e.split(",").length !== 2) return;
|
|
1730
|
-
const [o, r] = e.split(",").map(Number);
|
|
1731
|
-
marker.value = new Feature({
|
|
1732
|
-
geometry: new Point(fromLonLat([o, r]))
|
|
1733
|
-
});
|
|
1734
|
-
const l = n ? `${o}, ${r}` : "";
|
|
1735
|
-
(m = marker.value) == null || m.setStyle(createIconStyle(l));
|
|
1736
|
-
const i = new VectorSource({
|
|
1737
|
-
features: [marker.value]
|
|
1738
|
-
}), s = new VectorLayer({
|
|
1739
|
-
source: i
|
|
1740
|
-
}), c = mapInstance$1.value.getView();
|
|
1741
|
-
if (mapInstance$1.value.addLayer(s), t) {
|
|
1742
|
-
const u = new Translate({
|
|
1743
|
-
layers: [s]
|
|
1744
|
-
});
|
|
1745
|
-
u.on("translating", function(f) {
|
|
1746
|
-
var h;
|
|
1747
|
-
const p = f.features.item(0).getGeometry().getCoordinates(), y = toLonLat(p);
|
|
1748
|
-
markerPosition.value = `${y[0].toFixed(6)}, ${y[1].toFixed(6)}`, (h = marker.value) == null || h.setStyle(createIconStyle(markerPosition.value));
|
|
1749
|
-
}), mapInstance$1.value.addInteraction(u);
|
|
1750
|
-
}
|
|
1751
|
-
const d = new Point([o, r]);
|
|
1752
|
-
c.setCenter(transform(d.getCoordinates(), projection.data, projection.mercator)), c.setZoom(mapZoom.findShip);
|
|
1753
|
-
}, setMarkerPosition = (e) => {
|
|
1754
|
-
var r, l;
|
|
1755
|
-
if (!mapInstance$1.value) return;
|
|
1756
|
-
const t = mapInstance$1.value.getView(), n = e.split(",").map(Number);
|
|
1757
|
-
(l = (r = marker.value) == null ? void 0 : r.getGeometry()) == null || l.setCoordinates(fromLonLat([n[0], n[1]]));
|
|
1758
|
-
const o = new Point([n[0], n[1]]);
|
|
1759
|
-
t.setCenter(transform(o.getCoordinates(), projection.data, projection.mercator));
|
|
1760
1771
|
}, mapInstance = ref(), drawPolygonSetInstance = (e) => mapInstance.value = e;
|
|
1761
1772
|
let layerState = "drawn", drawnState = "undrawn";
|
|
1762
1773
|
const source = new VectorSource();
|
|
@@ -1922,190 +1933,7 @@ const addInteraction = (e) => {
|
|
|
1922
1933
|
removeInteraction,
|
|
1923
1934
|
initFeature,
|
|
1924
1935
|
reset
|
|
1925
|
-
},
|
|
1926
|
-
__name: "Map",
|
|
1927
|
-
props: {
|
|
1928
|
-
zoom: {},
|
|
1929
|
-
center: {},
|
|
1930
|
-
vehicleMode: {},
|
|
1931
|
-
viewMode: {},
|
|
1932
|
-
mmsi: {},
|
|
1933
|
-
shipData: {}
|
|
1934
|
-
},
|
|
1935
|
-
emits: ["zoomChanged", "extentChanged"],
|
|
1936
|
-
setup(e, { expose: t, emit: n }) {
|
|
1937
|
-
const o = ref();
|
|
1938
|
-
provide("mapInstance", o);
|
|
1939
|
-
const r = ref(null), l = ref(null), i = ref(null), s = n, c = e, d = ref(c.zoom || mapZoom.default), m = ref(!1), u = ref(!0), f = ref(!0);
|
|
1940
|
-
let p;
|
|
1941
|
-
((v) => {
|
|
1942
|
-
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";
|
|
1943
|
-
})(p || (p = {}));
|
|
1944
|
-
const y = () => {
|
|
1945
|
-
var k, w;
|
|
1946
|
-
const v = {
|
|
1947
|
-
projection: projection.mercator,
|
|
1948
|
-
// 地图投影坐标系
|
|
1949
|
-
zoom: c.zoom || (c.vehicleMode === "ship" ? mapZoom.default : mapZoom.truckDefault),
|
|
1950
|
-
// 地图缩放级别(打开页面时默认级别)
|
|
1951
|
-
minZoom: mapZoom.min,
|
|
1952
|
-
// 地图缩放最小级别
|
|
1953
|
-
maxZoom: mapZoom.max,
|
|
1954
|
-
// 地图缩放最大级别
|
|
1955
|
-
center: transformUtils.lonLatToMercator(c.center || mapDefaultCenter),
|
|
1956
|
-
// 地图中心坐标
|
|
1957
|
-
constrainResolution: !0,
|
|
1958
|
-
// 需设为true禁用平滑缩放,zoom值为整数
|
|
1959
|
-
enableRotation: !1,
|
|
1960
|
-
// 禁用旋转
|
|
1961
|
-
multiWorld: !0
|
|
1962
|
-
};
|
|
1963
|
-
o.value = new Map$1({
|
|
1964
|
-
target: "map",
|
|
1965
|
-
// 对应页面里 id 为 map 的元素
|
|
1966
|
-
layers: [
|
|
1967
|
-
// 图层
|
|
1968
|
-
p.tiandituTile,
|
|
1969
|
-
p.tiandituTileMark,
|
|
1970
|
-
p.tiandituImgTile,
|
|
1971
|
-
p.tiandituImgTileMark,
|
|
1972
|
-
p.greenMark
|
|
1973
|
-
],
|
|
1974
|
-
view: new View(v)
|
|
1975
|
-
}), h(), (k = l.value) == null || k.setScaleLine(c.vehicleMode === "ship" && "nautical"), (w = o.value) == null || w.on("moveend", b), g(v.zoom < mapZoom.shipGreenDotMax), M(c.vehicleMode === "ship" || c.viewMode === "findShip" ? BaseMapType.satellite : BaseMapType.vector), c.viewMode === "findShip" && c.mmsi && c.shipData && nextTick(() => {
|
|
1976
|
-
findShip(String(c.mmsi), c.shipData);
|
|
1977
|
-
});
|
|
1978
|
-
};
|
|
1979
|
-
onMounted(() => {
|
|
1980
|
-
y();
|
|
1981
|
-
});
|
|
1982
|
-
const h = () => {
|
|
1983
|
-
o.value && (renderCustomOverlaySetInstance(o.value), renderTruckSetInstance(o.value), drawPolygonSetInstance(o.value), renderShipStyleSetInstance(o.value), renderTrackStyleSetInstance(o.value), renderDashboardSetInstance(o.value), renderMarkerSetInstance(o.value), renderShipSetInstance(o.value), renderTrackSetInstance(o.value));
|
|
1984
|
-
}, g = (v) => {
|
|
1985
|
-
var k;
|
|
1986
|
-
c.vehicleMode !== "ship" && (v = !1), (k = o.value) == null || k.getLayers().forEach((w) => {
|
|
1987
|
-
w.ol_uid === p.greenMark.ol_uid && (w.setVisible(v), u.value = v);
|
|
1988
|
-
});
|
|
1989
|
-
}, T = ref(BaseMapType.satellite), M = (v) => {
|
|
1990
|
-
var k;
|
|
1991
|
-
T.value = v, (k = o.value) == null || k.getLayers().forEach((w) => {
|
|
1992
|
-
(w.ol_uid === p.tiandituTile.ol_uid || w.ol_uid === p.tiandituTileMark.ol_uid || w.ol_uid === p.tiandituImgTile.ol_uid || w.ol_uid === p.tiandituImgTileMark.ol_uid) && w.setVisible(!1), (v === BaseMapType.vector && (w.ol_uid === p.tiandituTile.ol_uid || w.ol_uid === p.tiandituTileMark.ol_uid) || v === BaseMapType.satellite && (w.ol_uid === p.tiandituImgTile.ol_uid || w.ol_uid === p.tiandituImgTileMark.ol_uid)) && w.setVisible(!0);
|
|
1993
|
-
});
|
|
1994
|
-
}, b = () => {
|
|
1995
|
-
const v = o.value.getView(), k = v.getZoom();
|
|
1996
|
-
k && E(k);
|
|
1997
|
-
const w = v.calculateExtent(o.value.getSize());
|
|
1998
|
-
w && k && x(w, k);
|
|
1999
|
-
}, E = (v) => {
|
|
2000
|
-
var C, L, S, V, F;
|
|
2001
|
-
d.value = v, g(v < mapZoom.shipGreenDotMax);
|
|
2002
|
-
const k = (C = o.value) == null ? void 0 : C.getLayers(), w = c.vehicleMode === "ship" ? k == null ? void 0 : k.getArray().find(($) => $.ol_uid === p.greenMark.ol_uid) : void 0;
|
|
2003
|
-
showTrackLayer.value ? (f.value = !1, w == null || w.setVisible(!1), (L = shipsLayer.value) == null || L.setVisible(!1), (S = largeAmountShipsLayer.value) == null || S.setVisible(!1)) : !m.value && u.value && v <= mapZoom.shipGreenDotMax ? (f.value = !0, w == null || w.setVisible(!0), (V = shipsLayer.value) == null || V.setVisible(!1), (F = largeAmountShipsLayer.value) == null || F.setVisible(!1)) : (f.value = !1, w == null || w.setVisible(!1)), s("zoomChanged", v);
|
|
2004
|
-
}, x = (v, k) => {
|
|
2005
|
-
const w = transform([v[0], v[1]], projection.mercator, projection.data), C = transform([v[2], v[3]], projection.mercator, projection.data);
|
|
2006
|
-
s("extentChanged", { extent: [w, C], zoom: k });
|
|
2007
|
-
};
|
|
2008
|
-
return t({
|
|
2009
|
-
mapInstance: o,
|
|
2010
|
-
initMap: y,
|
|
2011
|
-
renderTrucksMarker,
|
|
2012
|
-
renderShip: renderShips,
|
|
2013
|
-
renderTrack: (v, k, w) => {
|
|
2014
|
-
var C, L;
|
|
2015
|
-
currentTrackId.value = v, showTrackLayer.value = !0, m.value = !0, hiddenAllShips(), (L = (C = largeAmountShipsLayer.value) == null ? void 0 : C.getSource()) == null || L.clear(), renderTrack(v, k, w, LENGTH_UNIT.NM);
|
|
2016
|
-
},
|
|
2017
|
-
findTruck,
|
|
2018
|
-
removeTruckIcon,
|
|
2019
|
-
clearAllTruck,
|
|
2020
|
-
closeTrack: () => {
|
|
2021
|
-
var v, k;
|
|
2022
|
-
showTrackLayer.value = !1, (v = shipTrackVectorLayer.value) == null || v.setVisible(!1), (k = selectShipsLayer.value) == null || k.setVisible(!0), m.value = !1, g(d.value < mapZoom.shipGreenDotMax), allTracks.value = [], stopAnimation();
|
|
2023
|
-
},
|
|
2024
|
-
closeTruckTrack: () => {
|
|
2025
|
-
var v, k;
|
|
2026
|
-
showTrackLayer.value = !1, (v = shipTrackVectorLayer.value) == null || v.setVisible(!1), (k = selectShipsLayer.value) == null || k.setVisible(!0), stopAnimation();
|
|
2027
|
-
},
|
|
2028
|
-
resetTrackView,
|
|
2029
|
-
playTrack,
|
|
2030
|
-
clearSelectFeature,
|
|
2031
|
-
findShip,
|
|
2032
|
-
focusShip: (v, k, w = !0) => {
|
|
2033
|
-
var C, L;
|
|
2034
|
-
hiddenOrther.value = w, (C = shipsLayer.value) == null || C.setVisible(!w), (L = largeAmountShipsLayer.value) == null || L.setVisible(!1), findShip(v, k);
|
|
2035
|
-
},
|
|
2036
|
-
showTracks,
|
|
2037
|
-
removeAllTrackLayer,
|
|
2038
|
-
switchFilterItem,
|
|
2039
|
-
rerenderShip,
|
|
2040
|
-
switchGreenDot: () => g(!1),
|
|
2041
|
-
zoomTruckIcon,
|
|
2042
|
-
renderTruckTrack: (v, k, w) => {
|
|
2043
|
-
showTrackLayer.value = !0, renderTrack(v, k, w, LENGTH_UNIT.KM, "truck");
|
|
2044
|
-
},
|
|
2045
|
-
removerLayer: removeShipTrackLineFeatureByIndex,
|
|
2046
|
-
renderMarker,
|
|
2047
|
-
setMarkerPosition,
|
|
2048
|
-
getZoomAndCenter: () => {
|
|
2049
|
-
var L;
|
|
2050
|
-
const v = (L = o.value) == null ? void 0 : L.getView();
|
|
2051
|
-
if (!v) return null;
|
|
2052
|
-
const k = Math.round(Number(v.getZoom())), { lon: w, lat: C } = transformUtils.mercatorToLonLat(v.getCenter());
|
|
2053
|
-
return { zoom: k, center: [w, C] };
|
|
2054
|
-
},
|
|
2055
|
-
setCenter: (v) => {
|
|
2056
|
-
var C;
|
|
2057
|
-
const k = (C = o.value) == null ? void 0 : C.getView();
|
|
2058
|
-
if (!k) return null;
|
|
2059
|
-
const w = new Point(v);
|
|
2060
|
-
k.setCenter(transform(w.getCoordinates(), projection.data, projection.mercator));
|
|
2061
|
-
},
|
|
2062
|
-
drawPolygonTool,
|
|
2063
|
-
setMapInstance: h,
|
|
2064
|
-
config: {
|
|
2065
|
-
mapZoom,
|
|
2066
|
-
projection
|
|
2067
|
-
},
|
|
2068
|
-
utils: {
|
|
2069
|
-
transform: transformUtils,
|
|
2070
|
-
format: formatUtils
|
|
2071
|
-
}
|
|
2072
|
-
}), (v, k) => (openBlock(), createElementBlock("div", {
|
|
2073
|
-
class: "map-page map-container",
|
|
2074
|
-
ref_key: "pageRef",
|
|
2075
|
-
ref: r
|
|
2076
|
-
}, [
|
|
2077
|
-
k[0] || (k[0] = createElementVNode("div", {
|
|
2078
|
-
id: "map",
|
|
2079
|
-
class: "map"
|
|
2080
|
-
}, null, -1)),
|
|
2081
|
-
createVNode(ToolPanel, {
|
|
2082
|
-
"vehicle-mode": v.vehicleMode,
|
|
2083
|
-
"view-mode": v.viewMode,
|
|
2084
|
-
"disable-green-dot": m.value,
|
|
2085
|
-
"show-track-layer": unref(showTrackLayer),
|
|
2086
|
-
"map-tile-mode": T.value,
|
|
2087
|
-
onSwitchGreenDot: g,
|
|
2088
|
-
onSwitchMapTile: M
|
|
2089
|
-
}, {
|
|
2090
|
-
toolPanel: withCtx(() => [
|
|
2091
|
-
renderSlot(v.$slots, "toolPanel", {}, void 0, !0)
|
|
2092
|
-
]),
|
|
2093
|
-
_: 3
|
|
2094
|
-
}, 8, ["vehicle-mode", "view-mode", "disable-green-dot", "show-track-layer", "map-tile-mode"]),
|
|
2095
|
-
v.viewMode !== "WxMiniprogram" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2096
|
-
createVNode(ScaleLine, {
|
|
2097
|
-
ref_key: "scaleLineControl",
|
|
2098
|
-
ref: l
|
|
2099
|
-
}, null, 512),
|
|
2100
|
-
createVNode(ZoomControl, {
|
|
2101
|
-
ref_key: "zoomControl",
|
|
2102
|
-
ref: i
|
|
2103
|
-
}, null, 512)
|
|
2104
|
-
], 64)) : createCommentVNode("", !0),
|
|
2105
|
-
createVNode(Copyright)
|
|
2106
|
-
], 512));
|
|
2107
|
-
}
|
|
2108
|
-
}), Map = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-d4bd9364"]]), dotImage = new Image();
|
|
1936
|
+
}, dotImage = new Image();
|
|
2109
1937
|
dotImage.crossOrigin = "anonymous";
|
|
2110
1938
|
const dotActiveImage = new Image();
|
|
2111
1939
|
dotActiveImage.crossOrigin = "anonymous";
|
|
@@ -2119,8 +1947,8 @@ const setPointStyle = (e, t, n) => {
|
|
|
2119
1947
|
d.scale(m, m);
|
|
2120
1948
|
let [u, f] = s;
|
|
2121
1949
|
u = u / m, f = f / m, d.font = "12px Arial";
|
|
2122
|
-
const p = d.measureText(t).width, y = u - p / 2,
|
|
2123
|
-
if (fillRectRadius(d, y,
|
|
1950
|
+
const p = d.measureText(t).width, y = u - p / 2, v = f - 10, g = p + 4, M = 20, S = e && i || o;
|
|
1951
|
+
if (fillRectRadius(d, y, v + 30, g, M, S), d.save(), d.restore(), d.fillStyle = e ? "#FFFFFF" : "#000000", d.textAlign = "center", d.textBaseline = "middle", d.fillText(t, y + (p + 4) / 2, v + 41), d.save(), d.restore(), r || l) {
|
|
2124
1952
|
const b = e ? dotActiveImage : dotImage;
|
|
2125
1953
|
d.drawImage(b, u - b.width / 2, f - b.height / 2, 40 / m, 40 / m);
|
|
2126
1954
|
}
|
|
@@ -2263,12 +2091,197 @@ class PointMarkerClass {
|
|
|
2263
2091
|
l.setCenter(transform(s.getCoordinates(), projection.data, projection.mercator));
|
|
2264
2092
|
}
|
|
2265
2093
|
}
|
|
2266
|
-
const
|
|
2094
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
2095
|
+
__name: "Map",
|
|
2096
|
+
props: {
|
|
2097
|
+
zoom: {},
|
|
2098
|
+
center: {},
|
|
2099
|
+
vehicleMode: {},
|
|
2100
|
+
viewMode: {},
|
|
2101
|
+
mmsi: {},
|
|
2102
|
+
shipData: {}
|
|
2103
|
+
},
|
|
2104
|
+
emits: ["zoomChanged", "extentChanged"],
|
|
2105
|
+
setup(e, { expose: t, emit: n }) {
|
|
2106
|
+
const o = ref();
|
|
2107
|
+
provide("mapInstance", o);
|
|
2108
|
+
const r = ref(null), l = ref(null), i = ref(null), s = n, c = e, d = ref(c.zoom || mapZoom.default), m = ref(!1), u = ref(!0), f = ref(!0);
|
|
2109
|
+
let p;
|
|
2110
|
+
((h) => {
|
|
2111
|
+
h[h.tiandituTile = new TileLayer({ source: new XYZ({ url: baseMap.tiandituTile }) })] = "tiandituTile", h[h.tiandituTileMark = new TileLayer({ source: new XYZ({ url: baseMap.tiandituTileMark }) })] = "tiandituTileMark", h[h.tiandituImgTile = new TileLayer({ source: new XYZ({ url: baseMap.tiandituImgTile }), visible: !1 })] = "tiandituImgTile", h[h.tiandituImgTileMark = new TileLayer({ source: new XYZ({ url: baseMap.tiandituImgTileMark }), visible: !1 })] = "tiandituImgTileMark", h[h.greenMark = new TileLayer({ source: new XYZ({ url: baseMap.greenTile }) })] = "greenMark";
|
|
2112
|
+
})(p || (p = {}));
|
|
2113
|
+
const y = () => {
|
|
2114
|
+
var w, k;
|
|
2115
|
+
const h = {
|
|
2116
|
+
projection: projection.mercator,
|
|
2117
|
+
// 地图投影坐标系
|
|
2118
|
+
zoom: c.zoom || (c.vehicleMode === "ship" ? mapZoom.default : mapZoom.truckDefault),
|
|
2119
|
+
// 地图缩放级别(打开页面时默认级别)
|
|
2120
|
+
minZoom: mapZoom.min,
|
|
2121
|
+
// 地图缩放最小级别
|
|
2122
|
+
maxZoom: mapZoom.max,
|
|
2123
|
+
// 地图缩放最大级别
|
|
2124
|
+
center: transformUtils.lonLatToMercator(c.center || mapDefaultCenter),
|
|
2125
|
+
// 地图中心坐标
|
|
2126
|
+
constrainResolution: !0,
|
|
2127
|
+
// 需设为true禁用平滑缩放,zoom值为整数
|
|
2128
|
+
enableRotation: !1,
|
|
2129
|
+
// 禁用旋转
|
|
2130
|
+
multiWorld: !0
|
|
2131
|
+
};
|
|
2132
|
+
o.value = new Map$1({
|
|
2133
|
+
target: "map",
|
|
2134
|
+
// 对应页面里 id 为 map 的元素
|
|
2135
|
+
layers: [
|
|
2136
|
+
// 图层
|
|
2137
|
+
p.tiandituTile,
|
|
2138
|
+
p.tiandituTileMark,
|
|
2139
|
+
p.tiandituImgTile,
|
|
2140
|
+
p.tiandituImgTileMark,
|
|
2141
|
+
p.greenMark
|
|
2142
|
+
],
|
|
2143
|
+
view: new View(h)
|
|
2144
|
+
}), v(), (w = l.value) == null || w.setScaleLine(c.vehicleMode === "ship" && "nautical"), (k = o.value) == null || k.on("moveend", b), g(h.zoom < mapZoom.shipGreenDotMax), S(c.vehicleMode === "ship" || c.viewMode === "findShip" ? BaseMapType.satellite : BaseMapType.vector), c.viewMode === "findShip" && c.mmsi && c.shipData && nextTick(() => {
|
|
2145
|
+
findShip(String(c.mmsi), c.shipData);
|
|
2146
|
+
});
|
|
2147
|
+
};
|
|
2148
|
+
onMounted(() => {
|
|
2149
|
+
y();
|
|
2150
|
+
});
|
|
2151
|
+
const v = () => {
|
|
2152
|
+
o.value && (renderCustomOverlaySetInstance(o.value), renderTruckSetInstance(o.value), drawPolygonSetInstance(o.value), renderShipStyleSetInstance(o.value), renderTrackStyleSetInstance(o.value), renderDashboardSetInstance(o.value), renderMarkerSetInstance(o.value), renderShipSetInstance(o.value), renderTrackSetInstance(o.value));
|
|
2153
|
+
}, g = (h) => {
|
|
2154
|
+
var w;
|
|
2155
|
+
c.vehicleMode !== "ship" && (h = !1), (w = o.value) == null || w.getLayers().forEach((k) => {
|
|
2156
|
+
k.ol_uid === p.greenMark.ol_uid && (k.setVisible(h), u.value = h);
|
|
2157
|
+
});
|
|
2158
|
+
}, M = ref(BaseMapType.satellite), S = (h) => {
|
|
2159
|
+
var w;
|
|
2160
|
+
M.value = h, (w = o.value) == null || w.getLayers().forEach((k) => {
|
|
2161
|
+
(k.ol_uid === p.tiandituTile.ol_uid || k.ol_uid === p.tiandituTileMark.ol_uid || k.ol_uid === p.tiandituImgTile.ol_uid || k.ol_uid === p.tiandituImgTileMark.ol_uid) && k.setVisible(!1), (h === BaseMapType.vector && (k.ol_uid === p.tiandituTile.ol_uid || k.ol_uid === p.tiandituTileMark.ol_uid) || h === BaseMapType.satellite && (k.ol_uid === p.tiandituImgTile.ol_uid || k.ol_uid === p.tiandituImgTileMark.ol_uid)) && k.setVisible(!0);
|
|
2162
|
+
});
|
|
2163
|
+
}, b = () => {
|
|
2164
|
+
const h = o.value.getView(), w = h.getZoom();
|
|
2165
|
+
w && C(w);
|
|
2166
|
+
const k = h.calculateExtent(o.value.getSize());
|
|
2167
|
+
k && w && F(k, w);
|
|
2168
|
+
}, C = (h) => {
|
|
2169
|
+
var L, T, E, V, $;
|
|
2170
|
+
d.value = h, g(h < mapZoom.shipGreenDotMax);
|
|
2171
|
+
const w = (L = o.value) == null ? void 0 : L.getLayers(), k = c.vehicleMode === "ship" ? w == null ? void 0 : w.getArray().find((N) => N.ol_uid === p.greenMark.ol_uid) : void 0;
|
|
2172
|
+
showTrackLayer.value ? (f.value = !1, k == null || k.setVisible(!1), (T = shipsLayer.value) == null || T.setVisible(!1), (E = largeAmountShipsLayer.value) == null || E.setVisible(!1)) : !m.value && u.value && h <= mapZoom.shipGreenDotMax ? (f.value = !0, k == null || k.setVisible(!0), (V = shipsLayer.value) == null || V.setVisible(!1), ($ = largeAmountShipsLayer.value) == null || $.setVisible(!1)) : (f.value = !1, k == null || k.setVisible(!1)), s("zoomChanged", h);
|
|
2173
|
+
}, F = (h, w) => {
|
|
2174
|
+
const k = transform([h[0], h[1]], projection.mercator, projection.data), L = transform([h[2], h[3]], projection.mercator, projection.data);
|
|
2175
|
+
s("extentChanged", { extent: [k, L], zoom: w });
|
|
2176
|
+
};
|
|
2177
|
+
return t({
|
|
2178
|
+
mapInstance: o,
|
|
2179
|
+
initMap: y,
|
|
2180
|
+
pointRender: (h, w) => new PointMarkerClass(h, w),
|
|
2181
|
+
renderTrucksMarker,
|
|
2182
|
+
renderShip: renderShips,
|
|
2183
|
+
renderTrack: (h, w, k) => {
|
|
2184
|
+
var L, T;
|
|
2185
|
+
currentTrackId.value = h, showTrackLayer.value = !0, m.value = !0, hiddenAllShips(), (T = (L = largeAmountShipsLayer.value) == null ? void 0 : L.getSource()) == null || T.clear(), renderTrack(h, w, k, LENGTH_UNIT.NM);
|
|
2186
|
+
},
|
|
2187
|
+
findTruck,
|
|
2188
|
+
removeTruckIcon,
|
|
2189
|
+
clearAllTruck,
|
|
2190
|
+
closeTrack: () => {
|
|
2191
|
+
var h, w;
|
|
2192
|
+
showTrackLayer.value = !1, (h = shipTrackVectorLayer.value) == null || h.setVisible(!1), (w = selectShipsLayer.value) == null || w.setVisible(!0), m.value = !1, g(d.value < mapZoom.shipGreenDotMax), allTracks.value = [], stopAnimation();
|
|
2193
|
+
},
|
|
2194
|
+
closeTruckTrack: () => {
|
|
2195
|
+
var h, w;
|
|
2196
|
+
showTrackLayer.value = !1, (h = shipTrackVectorLayer.value) == null || h.setVisible(!1), (w = selectShipsLayer.value) == null || w.setVisible(!0), stopAnimation();
|
|
2197
|
+
},
|
|
2198
|
+
resetTrackView,
|
|
2199
|
+
playTrack,
|
|
2200
|
+
clearSelectFeature,
|
|
2201
|
+
findShip,
|
|
2202
|
+
focusShip: (h, w, k = !0) => {
|
|
2203
|
+
var L, T;
|
|
2204
|
+
hiddenOrther.value = k, (L = shipsLayer.value) == null || L.setVisible(!k), (T = largeAmountShipsLayer.value) == null || T.setVisible(!1), findShip(h, w);
|
|
2205
|
+
},
|
|
2206
|
+
showTracks,
|
|
2207
|
+
removeAllTrackLayer,
|
|
2208
|
+
switchFilterItem,
|
|
2209
|
+
rerenderShip,
|
|
2210
|
+
switchGreenDot: () => g(!1),
|
|
2211
|
+
zoomTruckIcon,
|
|
2212
|
+
renderTruckTrack: (h, w, k) => {
|
|
2213
|
+
showTrackLayer.value = !0, renderTrack(h, w, k, LENGTH_UNIT.KM, "truck");
|
|
2214
|
+
},
|
|
2215
|
+
removerLayer: removeShipTrackLineFeatureByIndex,
|
|
2216
|
+
renderMarker,
|
|
2217
|
+
setMarkerPosition: (h) => {
|
|
2218
|
+
m.value = !0, setMarkerPosition(h);
|
|
2219
|
+
},
|
|
2220
|
+
getZoomAndCenter: () => {
|
|
2221
|
+
var T;
|
|
2222
|
+
const h = (T = o.value) == null ? void 0 : T.getView();
|
|
2223
|
+
if (!h) return null;
|
|
2224
|
+
const w = Math.round(Number(h.getZoom())), { lon: k, lat: L } = transformUtils.mercatorToLonLat(h.getCenter());
|
|
2225
|
+
return { zoom: w, center: [k, L] };
|
|
2226
|
+
},
|
|
2227
|
+
setCenter: (h) => {
|
|
2228
|
+
var L;
|
|
2229
|
+
const w = (L = o.value) == null ? void 0 : L.getView();
|
|
2230
|
+
if (!w) return null;
|
|
2231
|
+
const k = new Point(h);
|
|
2232
|
+
w.setCenter(transform(k.getCoordinates(), projection.data, projection.mercator));
|
|
2233
|
+
},
|
|
2234
|
+
drawPolygonTool,
|
|
2235
|
+
setMapInstance: v,
|
|
2236
|
+
config: {
|
|
2237
|
+
mapZoom,
|
|
2238
|
+
projection
|
|
2239
|
+
},
|
|
2240
|
+
utils: {
|
|
2241
|
+
transform: transformUtils,
|
|
2242
|
+
format: formatUtils
|
|
2243
|
+
}
|
|
2244
|
+
}), (h, w) => (openBlock(), createElementBlock("div", {
|
|
2245
|
+
class: "map-page map-container",
|
|
2246
|
+
ref_key: "pageRef",
|
|
2247
|
+
ref: r
|
|
2248
|
+
}, [
|
|
2249
|
+
w[0] || (w[0] = createElementVNode("div", {
|
|
2250
|
+
id: "map",
|
|
2251
|
+
class: "map"
|
|
2252
|
+
}, null, -1)),
|
|
2253
|
+
createVNode(ToolPanel, {
|
|
2254
|
+
"vehicle-mode": h.vehicleMode,
|
|
2255
|
+
"view-mode": h.viewMode,
|
|
2256
|
+
"disable-green-dot": m.value,
|
|
2257
|
+
"show-track-layer": unref(showTrackLayer),
|
|
2258
|
+
"map-tile-mode": M.value,
|
|
2259
|
+
onSwitchGreenDot: g,
|
|
2260
|
+
onSwitchMapTile: S
|
|
2261
|
+
}, {
|
|
2262
|
+
toolPanel: withCtx(() => [
|
|
2263
|
+
renderSlot(h.$slots, "toolPanel", {}, void 0, !0)
|
|
2264
|
+
]),
|
|
2265
|
+
_: 3
|
|
2266
|
+
}, 8, ["vehicle-mode", "view-mode", "disable-green-dot", "show-track-layer", "map-tile-mode"]),
|
|
2267
|
+
h.viewMode !== "WxMiniprogram" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2268
|
+
createVNode(ScaleLine, {
|
|
2269
|
+
ref_key: "scaleLineControl",
|
|
2270
|
+
ref: l
|
|
2271
|
+
}, null, 512),
|
|
2272
|
+
createVNode(ZoomControl, {
|
|
2273
|
+
ref_key: "zoomControl",
|
|
2274
|
+
ref: i
|
|
2275
|
+
}, null, 512)
|
|
2276
|
+
], 64)) : createCommentVNode("", !0),
|
|
2277
|
+
createVNode(Copyright)
|
|
2278
|
+
], 512));
|
|
2279
|
+
}
|
|
2280
|
+
}), Map = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-02481ec2"]]), ZhMap = withInstall(Map);
|
|
2267
2281
|
export {
|
|
2268
2282
|
CDN_URL as C,
|
|
2269
2283
|
DEFAULT_VALUE as D,
|
|
2270
2284
|
LOG_DATE_FORMAT as L,
|
|
2271
|
-
PointMarkerClass as P,
|
|
2272
2285
|
ZhMap as Z,
|
|
2273
2286
|
mapDefaultCenter as a,
|
|
2274
2287
|
baseMap as b,
|