zhihao-ui 1.2.20 → 1.2.22
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-Dr298ctb.js → BaseInfo-DCB7xgRw.js} +1 -1
- package/dist/es/{Button-CYr52jII.js → Button-Va8xfPJd.js} +2 -2
- package/dist/es/{DatePicker-vGQGWrmB.js → DatePicker-BrD1XS6-.js} +2 -2
- package/dist/es/DetailHeader-B9ttfBlv.js +59 -0
- package/dist/es/{DetailSubTitle-Cgs5HrKC.js → DetailSubTitle-BgbefcLD.js} +2 -2
- package/dist/es/{Dialog-stUaKQ4m.js → Dialog-CnqJMaPI.js} +31 -34
- package/dist/es/DiyDataTable-DHGMMFO9.js +315 -0
- package/dist/es/{EditInfoPair-DwwAGFc6.js → EditInfoPair-XiseN2F2.js} +3 -3
- package/dist/es/{FileWrapper-brjp8Thj.js → FileWrapper-CAwHicjK.js} +4 -4
- package/dist/es/{Grid-CIMCXeIw.js → Grid-CshEwvAH.js} +1 -1
- package/dist/es/{InfoPair-DZL6Vegw.js → InfoPair-DhVT8u-f.js} +3 -3
- package/dist/es/{Input-C4aIqSby.js → Input-CeiPnMtt.js} +3 -3
- package/dist/es/{Loading-DhEOgvVz.js → Loading-bv2DpqBO.js} +2 -2
- package/dist/es/Map-DhceUygQ.js +2020 -0
- package/dist/es/{MessageBox-d6upGeyX.js → MessageBox-2Vpy3Mva.js} +2 -2
- package/dist/es/{MoneyInput-DLMJRug1.js → MoneyInput-Deg1aj66.js} +7 -7
- package/dist/es/{PageHeadPanel-CldjeRYl.js → PageHeadPanel-BWjWkx8n.js} +2 -2
- package/dist/es/{Table-DwDzhuHY.js → Table-KSl_JT2q.js} +94 -94
- package/dist/es/{ToolTips-CLcRoFO4.js → ToolTips-Bw2lHQxC.js} +3 -3
- package/dist/es/index.js +21 -21
- package/dist/es/{utils-CbI5IWJJ.js → utils-D-zYpBSZ.js} +3 -3
- package/dist/es/{vendor-AIl6iHcE.js → vendor-gTOtiVzA.js} +6895 -6495
- package/dist/index.css +1 -1
- package/dist/types/components/DetailHeader/index.d.ts +9 -0
- package/dist/types/components/DetailHeader/types.d.ts +1 -0
- package/dist/types/components/Dialog/Dialog.vue.d.ts +2 -4
- package/dist/types/components/Dialog/index.d.ts +5 -10
- package/dist/types/components/DiyDataTable/DiyDataTable.vue.d.ts +8 -1
- package/dist/types/components/DiyDataTable/index.d.ts +12 -0
- package/dist/types/components/DiyDataTable/type.d.ts +3 -1
- package/dist/types/components/Map/Map.vue.d.ts +60 -5
- package/dist/types/components/Map/components/scaleLine.vue.d.ts +3 -1
- package/dist/types/components/Map/components/toolPanel.vue.d.ts +4 -0
- package/dist/types/components/Map/config.d.ts +2 -0
- package/dist/types/components/Map/index.d.ts +174 -9
- package/dist/types/components/Map/interface/entity/render.d.ts +12 -0
- package/dist/types/components/Map/interface/entity/shipInfoVo.d.ts +21 -3
- package/dist/types/components/Map/interface/entity/shipMapData.d.ts +2 -1
- package/dist/types/components/Map/render/canvasRender/canvasRender.d.ts +2 -1
- package/dist/types/components/Map/render/canvasRender/geometry.d.ts +3 -0
- package/dist/types/components/Map/render/canvasRender/renderCustomOverlay.d.ts +3 -1
- package/dist/types/components/Map/render/canvasRender/renderShipStyle.d.ts +3 -1
- package/dist/types/components/Map/render/canvasRender/renderTrackStyle.d.ts +5 -1
- package/dist/types/components/Map/render/drawPolygon.d.ts +4 -0
- package/dist/types/components/Map/render/renderDashboard.d.ts +3 -0
- package/dist/types/components/Map/render/renderMarker.d.ts +4 -3
- package/dist/types/components/Map/render/renderShip.d.ts +5 -2
- package/dist/types/components/Map/render/renderTrack.d.ts +3 -4
- package/dist/types/components/Map/render/renderTruck.d.ts +3 -1
- package/dist/types/components/Map/utils/common.d.ts +4 -8
- package/dist/types/components/Map/utils/format.d.ts +6 -14
- package/dist/types/components/Map/utils/store.d.ts +7 -1
- package/dist/types/components/Map/utils/transform.d.ts +13 -5
- package/dist/umd/index.css +1 -1
- package/dist/umd/index.umd.cjs +23 -23
- package/package.json +1 -1
- package/dist/es/DetailHeader-oqCdup4q.js +0 -58
- package/dist/es/DiyDataTable-A1P5k0Eh.js +0 -304
- package/dist/es/Map-DGFoAMyH.js +0 -1803
package/dist/es/Map-DGFoAMyH.js
DELETED
|
@@ -1,1803 +0,0 @@
|
|
|
1
|
-
var B = Object.defineProperty;
|
|
2
|
-
var A = (e, t, o) => t in e ? B(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
|
|
3
|
-
var L = (e, t, o) => A(e, typeof t != "symbol" ? t + "" : t, o);
|
|
4
|
-
import { ref, defineComponent, useModel, watch, resolveComponent, openBlock, createElementBlock, createElementVNode, createVNode, withCtx, Fragment, renderList, unref, createBlock, toDisplayString, createCommentVNode, mergeModels, nextTick, onMounted, normalizeClass, renderSlot } from "vue";
|
|
5
|
-
import { n as getArea, o as getLength, V as VectorSource, p as VectorLayer, S as Style, C as CircleStyle, F as Fill, q as Stroke, D as Draw, O as Overlay, u as unByKey, r as ElOption, T as Text, h as hooks, L as LineString, s as Feature, P as Point, t as fromLonLat, e as cloneDeep, G as GeoJSON, W as WebGLPointsLayer, v as transform, w as ScaleLine$1, I as Icon, x as Translate, y as toLonLat, M as MultiPoint, z as getCenter, A as TileLayer, X as XYZ, B as Map$1, H as View } from "./vendor-AIl6iHcE.js";
|
|
6
|
-
import { _ as _export_sfc } from "./Button-CYr52jII.js";
|
|
7
|
-
import { w as withInstall } from "./utils-CbI5IWJJ.js";
|
|
8
|
-
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 || {});
|
|
9
|
-
const LENGTH_UNIT_LABEL = {
|
|
10
|
-
1: "M",
|
|
11
|
-
// m
|
|
12
|
-
2: "KM",
|
|
13
|
-
// km
|
|
14
|
-
3: "NM"
|
|
15
|
-
// nm
|
|
16
|
-
};
|
|
17
|
-
var SWITCH_BTN = /* @__PURE__ */ ((e) => (e.Camera = "camera", e.Mobile = "mobile", e.WaterGauge = "waterGauge", e))(SWITCH_BTN || {});
|
|
18
|
-
class ShipMapData {
|
|
19
|
-
constructor(t, o, n, a, r, l, i, s, u, c, m, d, f, w, v, h, T, E, C, p, S, g) {
|
|
20
|
-
L(this, "id");
|
|
21
|
-
// mmsi
|
|
22
|
-
L(this, "mmsi");
|
|
23
|
-
// 船舶三角形填充色
|
|
24
|
-
L(this, "fill");
|
|
25
|
-
// 船类型 "7": "货船",
|
|
26
|
-
L(this, "shipType");
|
|
27
|
-
// 船名
|
|
28
|
-
L(this, "name");
|
|
29
|
-
// 长度
|
|
30
|
-
L(this, "length");
|
|
31
|
-
// 宽度
|
|
32
|
-
L(this, "breadth");
|
|
33
|
-
// 经度
|
|
34
|
-
L(this, "lon");
|
|
35
|
-
// 纬度
|
|
36
|
-
L(this, "lat");
|
|
37
|
-
// 时间
|
|
38
|
-
L(this, "createdAt");
|
|
39
|
-
// 速度
|
|
40
|
-
L(this, "speed");
|
|
41
|
-
// 来源
|
|
42
|
-
L(this, "from");
|
|
43
|
-
// 船状态 "stop":"静止","sail":"航行","work":"作业","danger":"危险","other":"其他"
|
|
44
|
-
L(this, "sailStatus");
|
|
45
|
-
// 船艏向
|
|
46
|
-
L(this, "hdg");
|
|
47
|
-
// 航迹向
|
|
48
|
-
L(this, "cog");
|
|
49
|
-
// 设备定位类型
|
|
50
|
-
L(this, "posType");
|
|
51
|
-
L(this, "type");
|
|
52
|
-
// 航向角度
|
|
53
|
-
L(this, "angle");
|
|
54
|
-
// 左侧是否显示色块
|
|
55
|
-
L(this, "leftIconColor");
|
|
56
|
-
L(this, "existDevice");
|
|
57
|
-
L(this, "existMobile");
|
|
58
|
-
L(this, "existWaterGauge");
|
|
59
|
-
this.id = t, this.mmsi = o, this.fill = n, this.shipType = a, this.name = r, this.length = l, this.breadth = i, this.lon = s, this.lat = u, this.createdAt = c, this.speed = m, this.from = d, this.sailStatus = f, this.hdg = w, this.cog = v, this.posType = h, this.type = T, this.angle = E, this.leftIconColor = C, this.existDevice = p, this.existMobile = S, this.existWaterGauge = g;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
const formatLength = function(e, t) {
|
|
63
|
-
const n = getLength(e);
|
|
64
|
-
let a = "";
|
|
65
|
-
switch (t) {
|
|
66
|
-
case LENGTH_UNIT.M:
|
|
67
|
-
a = Math.round(n * 100) / 100 + " m";
|
|
68
|
-
break;
|
|
69
|
-
case LENGTH_UNIT.KM:
|
|
70
|
-
a = Math.round(n / 1e3 * 100) / 100 + " km";
|
|
71
|
-
break;
|
|
72
|
-
case LENGTH_UNIT.NM:
|
|
73
|
-
a = (Math.round(n / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
return a;
|
|
77
|
-
}, convertSixHundredThousandToLatLng = function(e, t) {
|
|
78
|
-
const o = Number(t) / 6e5;
|
|
79
|
-
return [Number(e) / 6e5, o];
|
|
80
|
-
}, formatArea = (e, t) => {
|
|
81
|
-
const n = getArea(e);
|
|
82
|
-
let a;
|
|
83
|
-
switch (t) {
|
|
84
|
-
case LENGTH_UNIT.KM:
|
|
85
|
-
n > 1e4 ? a = Math.round(n / 1e6 * 100) / 100 + " km<sup>2</sup>" : a = Math.round(n * 100) / 100 + " m<sup>2</sup>";
|
|
86
|
-
break;
|
|
87
|
-
case LENGTH_UNIT.NM:
|
|
88
|
-
const r = Math.pow(1.852, 2);
|
|
89
|
-
n > 1e4 ? a = Math.round(n / 1e6 / r * 100) / 100 + " nm<sup>2</sup>" : a = Math.round(n * 100) / 100 + " m<sup>2</sup>";
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
return a;
|
|
93
|
-
}, convertShipMapData = (e) => {
|
|
94
|
-
const t = (o) => new ShipMapData(
|
|
95
|
-
o.id,
|
|
96
|
-
o.id,
|
|
97
|
-
// 船舶三角形填充色
|
|
98
|
-
o.fill || "#04C900",
|
|
99
|
-
"70",
|
|
100
|
-
o.name || o.cnname || o.enname,
|
|
101
|
-
o.len,
|
|
102
|
-
o.wid,
|
|
103
|
-
o.lon,
|
|
104
|
-
o.lat,
|
|
105
|
-
(/* @__PURE__ */ new Date()).getTime(),
|
|
106
|
-
o.spd,
|
|
107
|
-
o.from,
|
|
108
|
-
o.status,
|
|
109
|
-
Number(o.hdg),
|
|
110
|
-
o.cog,
|
|
111
|
-
Number(o.postype),
|
|
112
|
-
"other",
|
|
113
|
-
o.cog,
|
|
114
|
-
o.leftIconColor,
|
|
115
|
-
o.existDevice,
|
|
116
|
-
o.existMobile,
|
|
117
|
-
o.existWaterGauge
|
|
118
|
-
);
|
|
119
|
-
return Array.isArray(e) ? e.map((o) => t(o)) : t(e);
|
|
120
|
-
}, mapInstance = ref(), shipsLayer = ref(), largeAmountShipsLayer = ref(), selectShipsLayer = ref(), allShips = ref([]), selectSingleShipData = ref();
|
|
121
|
-
ref();
|
|
122
|
-
const trucksLayer = ref(), shipTrackLineFeatures = ref([]), trackLineVectorSource = ref(), shipTrackVectorLayer = ref();
|
|
123
|
-
ref();
|
|
124
|
-
ref();
|
|
125
|
-
const labels = ref([]), _hoisted_1$4 = {
|
|
126
|
-
key: 0,
|
|
127
|
-
class: "measure-panel"
|
|
128
|
-
}, _hoisted_2$2 = { class: "d-flex justify-content-between align-content-start w-100" }, _hoisted_3$2 = { class: "measure-history-list" }, _hoisted_4 = { class: "left-panel" }, _hoisted_5 = { class: "text index" }, _hoisted_6 = { class: "text" }, _hoisted_7 = ["onClick"], _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
129
|
-
__name: "measure",
|
|
130
|
-
props: /* @__PURE__ */ mergeModels({
|
|
131
|
-
viewMode: {}
|
|
132
|
-
}, {
|
|
133
|
-
visible: { type: Boolean },
|
|
134
|
-
visibleModifiers: {}
|
|
135
|
-
}),
|
|
136
|
-
emits: /* @__PURE__ */ mergeModels(["close"], ["update:visible"]),
|
|
137
|
-
setup(e, { expose: t, emit: o }) {
|
|
138
|
-
const n = o, a = useModel(e, "visible"), r = ref(String(LENGTH_UNIT.NM)), l = ref([]), i = ref(!1), s = new VectorSource();
|
|
139
|
-
let u, c, m, d, f;
|
|
140
|
-
const w = new VectorLayer({
|
|
141
|
-
source: s,
|
|
142
|
-
style: {
|
|
143
|
-
"fill-color": "rgba(255, 255, 255, 0.2)",
|
|
144
|
-
"stroke-color": "#ffcc33",
|
|
145
|
-
"stroke-width": 2,
|
|
146
|
-
"circle-radius": 7,
|
|
147
|
-
"circle-fill-color": "#ffcc33"
|
|
148
|
-
}
|
|
149
|
-
}), v = function(y) {
|
|
150
|
-
if (y.dragging)
|
|
151
|
-
return;
|
|
152
|
-
let k = "点击选择起点";
|
|
153
|
-
u && (k = "单击继续,双击结束"), c && (c.innerHTML = k, m.setPosition(y.coordinate), c.classList.remove("hidden"));
|
|
154
|
-
}, h = () => {
|
|
155
|
-
mapInstance.value && (mapInstance.value.on("pointermove", v), mapInstance.value.getViewport().addEventListener("mouseout", function() {
|
|
156
|
-
var y;
|
|
157
|
-
(y = c == null ? void 0 : c.classList) == null || y.add("hidden");
|
|
158
|
-
}), i.value = !0);
|
|
159
|
-
};
|
|
160
|
-
let T;
|
|
161
|
-
const E = new Style({
|
|
162
|
-
fill: new Fill({
|
|
163
|
-
color: "rgba(255, 255, 255, 0.2)"
|
|
164
|
-
}),
|
|
165
|
-
stroke: new Stroke({
|
|
166
|
-
color: "rgba(255,204,51)",
|
|
167
|
-
lineDash: [10, 10],
|
|
168
|
-
width: 2
|
|
169
|
-
}),
|
|
170
|
-
image: new CircleStyle({
|
|
171
|
-
radius: 5,
|
|
172
|
-
stroke: new Stroke({
|
|
173
|
-
color: "rgba(0, 0, 0, 0.7)"
|
|
174
|
-
}),
|
|
175
|
-
fill: new Fill({
|
|
176
|
-
color: "rgba(255, 255, 255, 0.2)"
|
|
177
|
-
})
|
|
178
|
-
})
|
|
179
|
-
});
|
|
180
|
-
function C() {
|
|
181
|
-
var y, k;
|
|
182
|
-
if (mapInstance.value) {
|
|
183
|
-
if (l.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((b) => {
|
|
184
|
-
var M;
|
|
185
|
-
(M = b == null ? void 0 : b.parentNode) == null || M.removeChild(b);
|
|
186
|
-
}), s.clear(), T) {
|
|
187
|
-
const b = mapInstance.value.getInteractions().getArray().find((M) => M.ol_uid === T.ol_uid);
|
|
188
|
-
b && ((y = mapInstance.value) == null || y.removeInteraction(b));
|
|
189
|
-
}
|
|
190
|
-
(k = mapInstance.value) == null || k.removeLayer(w), c != null && c.parentNode && c.parentNode.removeChild(c);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
function p() {
|
|
194
|
-
var k, b;
|
|
195
|
-
C(), (k = mapInstance.value) == null || k.addLayer(w), T = new Draw({
|
|
196
|
-
source: s,
|
|
197
|
-
type: "LineString",
|
|
198
|
-
style: function() {
|
|
199
|
-
return E;
|
|
200
|
-
}
|
|
201
|
-
}), (b = mapInstance.value) == null || b.addInteraction(T), g(), S();
|
|
202
|
-
let y;
|
|
203
|
-
T.on("drawstart", function(M) {
|
|
204
|
-
var N;
|
|
205
|
-
u = M.feature;
|
|
206
|
-
let F;
|
|
207
|
-
y = (N = u.getGeometry()) == null ? void 0 : N.on("change", function(P) {
|
|
208
|
-
const _ = P.target;
|
|
209
|
-
let x = formatLength(_, Number(r.value));
|
|
210
|
-
F = _.getLastCoordinate(), d && x && (d.innerHTML = x), f.setPosition(F);
|
|
211
|
-
});
|
|
212
|
-
}), T.on("drawend", function() {
|
|
213
|
-
d && (d.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), d != null && d.innerHTML && l.value.push(d == null ? void 0 : d.innerHTML), f.setOffset([0, -7]), u = null, d = null, g(), y && unByKey(y);
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
function S() {
|
|
217
|
-
var y;
|
|
218
|
-
c != null && c.parentNode && c.parentNode.removeChild(c), c = document.createElement("div"), c.className = "ol-tooltip hidden", m = new Overlay({
|
|
219
|
-
element: c,
|
|
220
|
-
offset: [15, 0],
|
|
221
|
-
positioning: "center-left"
|
|
222
|
-
}), (y = mapInstance.value) == null || y.addOverlay(m);
|
|
223
|
-
}
|
|
224
|
-
function g() {
|
|
225
|
-
var y;
|
|
226
|
-
d != null && d.parentNode && d.parentNode.removeChild(d), d = document.createElement("div"), d.className = "ol-tooltip ol-tooltip-measure", f = new Overlay({
|
|
227
|
-
element: d,
|
|
228
|
-
offset: [0, -15],
|
|
229
|
-
positioning: "bottom-center",
|
|
230
|
-
stopEvent: !1,
|
|
231
|
-
insertFirst: !1
|
|
232
|
-
}), (y = mapInstance.value) == null || y.addOverlay(f);
|
|
233
|
-
}
|
|
234
|
-
const I = (y) => {
|
|
235
|
-
var M, F;
|
|
236
|
-
l.value[y] && l.value.splice(y, 1);
|
|
237
|
-
const k = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
238
|
-
k[y] && ((F = (M = k[y]) == null ? void 0 : M.parentNode) == null || F.removeChild(k[y]));
|
|
239
|
-
const b = s.getFeatures();
|
|
240
|
-
b[y] && s.removeFeature(b[y]);
|
|
241
|
-
}, V = () => {
|
|
242
|
-
n("close");
|
|
243
|
-
};
|
|
244
|
-
return watch(() => a, () => {
|
|
245
|
-
a && !i.value && (h(), p());
|
|
246
|
-
}, { deep: !0, immediate: !0 }), t({
|
|
247
|
-
addInteraction: p,
|
|
248
|
-
removeInteraction: C
|
|
249
|
-
}), (y, k) => {
|
|
250
|
-
const b = resolveComponent("el-select");
|
|
251
|
-
return a.value && y.viewMode !== "WxMiniprogram" ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
252
|
-
createElementVNode("div", { class: "header" }, [
|
|
253
|
-
k[1] || (k[1] = createElementVNode("div", { class: "title" }, "测量", -1)),
|
|
254
|
-
createElementVNode("i", {
|
|
255
|
-
onClick: V,
|
|
256
|
-
class: "map-iconfont icon-close"
|
|
257
|
-
})
|
|
258
|
-
]),
|
|
259
|
-
createElementVNode("div", _hoisted_2$2, [
|
|
260
|
-
k[2] || (k[2] = createElementVNode("div", { class: "tips" }, "在地图上点击多个点测量距离,距离单位", -1)),
|
|
261
|
-
createVNode(b, {
|
|
262
|
-
class: "select-length-unit",
|
|
263
|
-
modelValue: r.value,
|
|
264
|
-
"onUpdate:modelValue": k[0] || (k[0] = (M) => r.value = M)
|
|
265
|
-
}, {
|
|
266
|
-
default: withCtx(() => [
|
|
267
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(Object.keys(unref(LENGTH_UNIT_LABEL)), (M) => (openBlock(), createBlock(unref(ElOption), {
|
|
268
|
-
key: M,
|
|
269
|
-
label: String(unref(LENGTH_UNIT_LABEL)[M]),
|
|
270
|
-
value: String(M)
|
|
271
|
-
}, null, 8, ["label", "value"]))), 128))
|
|
272
|
-
]),
|
|
273
|
-
_: 1
|
|
274
|
-
}, 8, ["modelValue"])
|
|
275
|
-
]),
|
|
276
|
-
createElementVNode("div", _hoisted_3$2, [
|
|
277
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(l.value, (M, F) => (openBlock(), createElementBlock("div", {
|
|
278
|
-
class: "measure-history-item",
|
|
279
|
-
key: F
|
|
280
|
-
}, [
|
|
281
|
-
createElementVNode("div", _hoisted_4, [
|
|
282
|
-
k[3] || (k[3] = createElementVNode("i", { class: "map-iconfont icon-line" }, null, -1)),
|
|
283
|
-
createElementVNode("span", _hoisted_5, "线段" + toDisplayString(F + 1), 1),
|
|
284
|
-
createElementVNode("span", _hoisted_6, toDisplayString(M), 1)
|
|
285
|
-
]),
|
|
286
|
-
createElementVNode("div", {
|
|
287
|
-
class: "delete-button",
|
|
288
|
-
onClick: (N) => I(F)
|
|
289
|
-
}, k[4] || (k[4] = [
|
|
290
|
-
createElementVNode("i", { class: "map-iconfont icon-delete" }, null, -1)
|
|
291
|
-
]), 8, _hoisted_7)
|
|
292
|
-
]))), 128))
|
|
293
|
-
])
|
|
294
|
-
])) : createCommentVNode("", !0);
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
}), Measure = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-007c38c9"]]), CDN_URL = "https://static.zhihaoscm.cn/", tiandituKey = "a6e8f78974f2581f2ca00485b40c948f", baseMap = {
|
|
298
|
-
// 矢量底图
|
|
299
|
-
tiandituTile: `http://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}`,
|
|
300
|
-
// 矢量注记
|
|
301
|
-
tiandituTileMark: `http://t0.tianditu.gov.cn/cva_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${tiandituKey}`,
|
|
302
|
-
// 影像底图
|
|
303
|
-
tiandituImgTile: `http://t0.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${tiandituKey}`,
|
|
304
|
-
// 影像注记
|
|
305
|
-
tiandituImgTileMark: `http://t0.tianditu.gov.cn/cia_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cia&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${tiandituKey}`,
|
|
306
|
-
// 绿点图
|
|
307
|
-
greenTile: `${CDN_URL}/map/tile/{z}/{x}/{y}.png`
|
|
308
|
-
}, mapZoom = {
|
|
309
|
-
// 地图默认层级
|
|
310
|
-
default: 6,
|
|
311
|
-
// 地图缩放最小层级
|
|
312
|
-
min: 3,
|
|
313
|
-
// 地图缩放最大层级
|
|
314
|
-
max: 18,
|
|
315
|
-
// 查看船舶详情时地图缩放层级
|
|
316
|
-
findShip: 13,
|
|
317
|
-
// 查看车辆详情时地图缩放层级
|
|
318
|
-
findTruck: 14,
|
|
319
|
-
// 船舶绿点图最大显示层级
|
|
320
|
-
shipGreenDotMax: 11,
|
|
321
|
-
// 查车图标显示层级
|
|
322
|
-
truckDefault: 14,
|
|
323
|
-
// 统计图标显示层级
|
|
324
|
-
truckStatistics: 8,
|
|
325
|
-
// 船形图标最小渲染层级
|
|
326
|
-
shipModelMin: 16,
|
|
327
|
-
// 船形图标最大渲染层级
|
|
328
|
-
shipModelMax: 18
|
|
329
|
-
}, mapDefaultCenter = [114.84, 30.52], projection = {
|
|
330
|
-
// 经纬度 源数据 地理坐标 WGS84
|
|
331
|
-
data: "EPSG:4326",
|
|
332
|
-
// 墨卡托投影坐标 渲染坐标
|
|
333
|
-
mercator: "EPSG:3857"
|
|
334
|
-
}, equatorialCircumference = 2003750834e-2;
|
|
335
|
-
function lonLatToMercator(e) {
|
|
336
|
-
const t = e[0] * equatorialCircumference / 180;
|
|
337
|
-
let o = Math.log(Math.tan((90 + e[1]) * Math.PI / 360)) / (Math.PI / 180);
|
|
338
|
-
return o = o * equatorialCircumference / 180, [t, o];
|
|
339
|
-
}
|
|
340
|
-
function mercatorToLonLat(e) {
|
|
341
|
-
let t = { lon: 0, lat: 0 }, o = e[0] / equatorialCircumference * 180, n = e[1] / equatorialCircumference * 180;
|
|
342
|
-
return n = 180 / Math.PI * (2 * Math.atan(Math.exp(n * Math.PI / 180)) - Math.PI / 2), t.lon = o, t.lat = n, t;
|
|
343
|
-
}
|
|
344
|
-
function getIconFont(unicode = "") {
|
|
345
|
-
return unicode.indexOf("&") !== -1 && (unicode = unicode.replace("&", "&")), unicode.indexOf("&") !== -1 && (unicode = unicode.replace("&", "&")), eval('("' + unicode.replace("&#x", "\\u").replace(";", "") + '")');
|
|
346
|
-
}
|
|
347
|
-
const multiplyPixelRatio = (e) => {
|
|
348
|
-
const t = window.devicePixelRatio || 1;
|
|
349
|
-
return e.map((o) => o.map((n) => n * t));
|
|
350
|
-
}, 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({
|
|
351
|
-
text: new Text({
|
|
352
|
-
font: "Normal 14px map-iconfont",
|
|
353
|
-
text: getIconFont(e),
|
|
354
|
-
fill: new Fill({ color: "#fff" }),
|
|
355
|
-
offsetY: -14
|
|
356
|
-
}),
|
|
357
|
-
zIndex: 100
|
|
358
|
-
}), labelAlpha = 0.8, labelFont = "500 12px Arial", labelOutSize = 2, labelHeight = 10, fillRectRadius = (e, t, o, n, a, r, l = 4) => {
|
|
359
|
-
e.beginPath(), e.moveTo(t + l, o), e.arcTo(t + n, o, t + n, o + l, l), e.arcTo(t + n, o + a, t + n - l, o + a, l), e.arcTo(t, o + a, t, o + a - l, l), e.arcTo(t, o, t + l, o, l), e.closePath(), e.fillStyle = r, e.fill();
|
|
360
|
-
}, getPixelFromCoordinate = (e) => {
|
|
361
|
-
if (!e || e.length === 0)
|
|
362
|
-
throw new Error("Points array is empty or invalid.");
|
|
363
|
-
let t = 1 / 0, o = 1 / 0, n = -1 / 0, a = -1 / 0;
|
|
364
|
-
for (const [r, l] of e)
|
|
365
|
-
r < t && (t = r), l < o && (o = l), r > n && (n = r), l > a && (a = l);
|
|
366
|
-
return [t, o, n, a];
|
|
367
|
-
}, calculatePolygonCentroid = (e) => {
|
|
368
|
-
if (!Array.isArray(e) || e.length < 3)
|
|
369
|
-
throw new Error("A polygon must have at least 3 coordinates.");
|
|
370
|
-
let t = 0, o = 0, n = 0;
|
|
371
|
-
const a = e.length;
|
|
372
|
-
for (let i = 0; i < a - 1; i++) {
|
|
373
|
-
const [s, u] = e[i], [c, m] = e[i + 1], d = s * m - c * u;
|
|
374
|
-
n += d, t += (s + c) * d, o += (u + m) * d;
|
|
375
|
-
}
|
|
376
|
-
if (n *= 0.5, n === 0)
|
|
377
|
-
throw new Error("多边形面积为零");
|
|
378
|
-
const r = t / (6 * n), l = o / (6 * n);
|
|
379
|
-
return [r, l];
|
|
380
|
-
}, rotateShapeModel = (e, t) => {
|
|
381
|
-
const [o, n] = calculatePolygonCentroid(e), a = t * Math.PI / 180, r = Math.cos(a), l = Math.sin(a);
|
|
382
|
-
return e.map(([i, s]) => {
|
|
383
|
-
const u = i - o, c = s - n, m = u * r - c * l + o, d = u * l + c * r + n;
|
|
384
|
-
return [m, d];
|
|
385
|
-
});
|
|
386
|
-
}, getTopLeftPoint = (e) => [e[0], e[3]], getBottomLeftPoint = (e) => [e[2], e[3]], getBottomRightPoint = (e) => [e[2], e[1]], getTopRighttPoint = (e) => [e[0], e[1]];
|
|
387
|
-
function calculateBounds(e, t, o, n, a) {
|
|
388
|
-
let r, l, i, s, u = e[0], c = e[1];
|
|
389
|
-
switch (t) {
|
|
390
|
-
case 0:
|
|
391
|
-
r = u + a, l = r + o, s = c - a, i = s - n;
|
|
392
|
-
break;
|
|
393
|
-
case 1:
|
|
394
|
-
r = u + a, l = r + o, s = c + n / 2, i = s - n;
|
|
395
|
-
break;
|
|
396
|
-
case 2:
|
|
397
|
-
r = u + a, l = r + o, s = c + a + n, i = s - n;
|
|
398
|
-
break;
|
|
399
|
-
case 3:
|
|
400
|
-
r = u - o / 2, l = r + o, s = c + a + n, i = s - n;
|
|
401
|
-
break;
|
|
402
|
-
case 4:
|
|
403
|
-
l = u, r = l - o, s = c + a + n, i = s - n;
|
|
404
|
-
break;
|
|
405
|
-
case 5:
|
|
406
|
-
l = u - a, r = l - o, s = c + n / 2, i = s - n;
|
|
407
|
-
break;
|
|
408
|
-
case 6:
|
|
409
|
-
l = u, r = l - o, s = c - a, i = s - n;
|
|
410
|
-
break;
|
|
411
|
-
case 7:
|
|
412
|
-
r = u - o / 2, l = r + o, s = c - a, i = s - n;
|
|
413
|
-
}
|
|
414
|
-
if (!(!r || !i || !l || !s))
|
|
415
|
-
return [Math.min(r, l), Math.min(i, s), Math.max(r, l), Math.max(i, s) + 1];
|
|
416
|
-
}
|
|
417
|
-
function calculateAnchorPoint(e, t, o = 70, n = 20, a = 20) {
|
|
418
|
-
let r = [0, 0];
|
|
419
|
-
switch (t) {
|
|
420
|
-
case 0:
|
|
421
|
-
r[0] = e[0] + a, r[1] = e[1] - a - n / 2;
|
|
422
|
-
break;
|
|
423
|
-
case 1:
|
|
424
|
-
r[0] = e[0] + a, r[1] = e[1];
|
|
425
|
-
break;
|
|
426
|
-
case 2:
|
|
427
|
-
r[0] = e[0] + a, r[1] = e[1] + a + n / 2;
|
|
428
|
-
break;
|
|
429
|
-
case 3:
|
|
430
|
-
r[0] = e[0], r[1] = e[1] + a + n / 4;
|
|
431
|
-
break;
|
|
432
|
-
case 4:
|
|
433
|
-
r[0] = Math.max(e[0] - a, e[0] - o / 2), r[1] = e[1] + a + n / 4;
|
|
434
|
-
break;
|
|
435
|
-
case 5:
|
|
436
|
-
r[0] = e[0] - a, r[1] = e[1];
|
|
437
|
-
break;
|
|
438
|
-
case 6:
|
|
439
|
-
r[0] = Math.max(e[0] - a, e[0] - o / 2), r[1] = e[1] - a - n / 4;
|
|
440
|
-
break;
|
|
441
|
-
case 7:
|
|
442
|
-
r[0] = e[0], r[1] = e[1] - a - n / 4;
|
|
443
|
-
}
|
|
444
|
-
return r;
|
|
445
|
-
}
|
|
446
|
-
function drawLabelBody(e, t, o) {
|
|
447
|
-
if (!e) return;
|
|
448
|
-
const {
|
|
449
|
-
font: n,
|
|
450
|
-
labelOutSize: a = 2,
|
|
451
|
-
labelHeight: r,
|
|
452
|
-
center: l,
|
|
453
|
-
text: i,
|
|
454
|
-
leftIcon: s,
|
|
455
|
-
shipColor: u,
|
|
456
|
-
lineLength: c = 20
|
|
457
|
-
} = o;
|
|
458
|
-
e.save(), n && (e.font = n);
|
|
459
|
-
let m = e.measureText(i).width + 2 * a;
|
|
460
|
-
(s || u) && (m += r + 4 * a), e.restore();
|
|
461
|
-
let d, f = -1, w = r + 3 * a;
|
|
462
|
-
if (f = 0, d = calculateBounds(l, f, m, w, c), d && f > -1) {
|
|
463
|
-
let v = getBottomLeftPoint(d), h = getTopRighttPoint(d);
|
|
464
|
-
return {
|
|
465
|
-
center: l,
|
|
466
|
-
x: calculateAnchorPoint(l, f, m, w, c),
|
|
467
|
-
l: h,
|
|
468
|
-
r: v,
|
|
469
|
-
bounds: d,
|
|
470
|
-
position: f
|
|
471
|
-
};
|
|
472
|
-
}
|
|
473
|
-
return null;
|
|
474
|
-
}
|
|
475
|
-
const drawText = (e, t) => {
|
|
476
|
-
if (!e) return;
|
|
477
|
-
const { center: o, text: n, textColor: a, leftIcon: r, rightIcons: l, font: i } = t;
|
|
478
|
-
e.save();
|
|
479
|
-
let [s, u] = o;
|
|
480
|
-
if (r) {
|
|
481
|
-
e.font = "21px map-iconfont";
|
|
482
|
-
let c = getIconFont(r.icon);
|
|
483
|
-
e.fillStyle = r.color, e.fillText(c, s + labelOutSize - 4, u + 3), s += 22;
|
|
484
|
-
}
|
|
485
|
-
if (l != null && l.length) {
|
|
486
|
-
e.font = "12px map-iconfont", e.fillStyle = "#3370ff";
|
|
487
|
-
let c = e.measureText(n).width + 6;
|
|
488
|
-
l.forEach((m, d) => {
|
|
489
|
-
let f = getIconFont(m), w = 20 * d;
|
|
490
|
-
e.fillText(f, s + c + w, u);
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
e.font = i || labelFont, e.fillStyle = a, e.fillText(n, s, u), e.restore();
|
|
494
|
-
}, drawPolygon = (e, t) => {
|
|
495
|
-
let {
|
|
496
|
-
points: o,
|
|
497
|
-
strokeColor: n,
|
|
498
|
-
fillColor: a,
|
|
499
|
-
shouldClosePath: r,
|
|
500
|
-
translation: l,
|
|
501
|
-
rotation: i,
|
|
502
|
-
rotationCenter: s,
|
|
503
|
-
scale: u,
|
|
504
|
-
globalAlpha: c
|
|
505
|
-
} = t;
|
|
506
|
-
if (c || (c = 1), o && e) {
|
|
507
|
-
e.save(), e.beginPath(), i && i !== 0 && s == null && e.rotate(i), l && e.translate(l[0], l[1]), i && (s != null && s.length) && e.rotate(i), u && e.scale(u, u), e.moveTo(o[0][0], o[0][1]);
|
|
508
|
-
for (let m = 1; m < o.length; m++)
|
|
509
|
-
e.lineTo(o[m][0], o[m][1]);
|
|
510
|
-
r && e.closePath(), n && (e.strokeStyle = n, e.stroke()), a && r && (c && (e.globalAlpha = c), e.fillStyle = a, e.fill()), e.restore();
|
|
511
|
-
}
|
|
512
|
-
}, drawLabel = (e, t) => {
|
|
513
|
-
const { center: o, text: n, color: a, textColor: r, bgColor: l, leftIcon: i, rightIcons: s } = t;
|
|
514
|
-
if (o && n) {
|
|
515
|
-
let u = {
|
|
516
|
-
font: labelFont,
|
|
517
|
-
labelOutSize,
|
|
518
|
-
labelHeight,
|
|
519
|
-
center: o,
|
|
520
|
-
text: n,
|
|
521
|
-
leftIcon: i
|
|
522
|
-
}, c = drawLabelBody(e, labels.value, u);
|
|
523
|
-
if (c) {
|
|
524
|
-
const { x: m, bounds: d, l: f } = c;
|
|
525
|
-
let w = [getTopLeftPoint(d), getBottomLeftPoint(d), getBottomRightPoint(d), getTopRighttPoint(d)];
|
|
526
|
-
labels.value.push(c), drawPolygon(e, {
|
|
527
|
-
points: [o, m],
|
|
528
|
-
strokeColor: a,
|
|
529
|
-
fillColor: "#000",
|
|
530
|
-
shouldClosePath: !0,
|
|
531
|
-
translation: void 0,
|
|
532
|
-
rotation: void 0,
|
|
533
|
-
rotationCenter: void 0,
|
|
534
|
-
scale: void 0,
|
|
535
|
-
globalAlpha: labelAlpha
|
|
536
|
-
}), s != null && s.length && s.forEach(() => {
|
|
537
|
-
w[1][0] += 20, w[2][0] += 20;
|
|
538
|
-
}), drawPolygon(e, {
|
|
539
|
-
points: w,
|
|
540
|
-
strokeColor: a,
|
|
541
|
-
fillColor: l,
|
|
542
|
-
shouldClosePath: !0
|
|
543
|
-
});
|
|
544
|
-
const [T, E] = f, C = {
|
|
545
|
-
center: [T, E + labelOutSize + labelHeight + 1],
|
|
546
|
-
text: n,
|
|
547
|
-
textColor: r,
|
|
548
|
-
leftIcon: i,
|
|
549
|
-
rightIcons: s
|
|
550
|
-
};
|
|
551
|
-
drawText(e, C);
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
return null;
|
|
555
|
-
}, stopIcon = "", stopColor = "#E31818", slowIcon = "", slowColor = "#1890FF", dropletsIcon = "", trackList$1 = ref([]);
|
|
556
|
-
let animationFeature, animationId;
|
|
557
|
-
const renderTrackLine = (e, t, o) => {
|
|
558
|
-
var r, l, i;
|
|
559
|
-
const n = e[t];
|
|
560
|
-
if (!n) return;
|
|
561
|
-
trackList$1.value = [], trackList$1.value = n.reverse().map((s, u) => (s.center = [s.lon, s.lat], s.centerPoint = lonLatToMercator(s.center), s.id = t, s.index = u, s.time = hooks(s.createdAt).format("YYYY-MM-DD HH:mm:ss"), s));
|
|
562
|
-
let a = trackList$1.value.map((s) => s.centerPoint);
|
|
563
|
-
if (a.length >= 2) {
|
|
564
|
-
let s = new LineString(a);
|
|
565
|
-
const u = new Feature({ geometry: s });
|
|
566
|
-
u.setStyle(
|
|
567
|
-
new Style({
|
|
568
|
-
stroke: new Stroke({
|
|
569
|
-
color: o,
|
|
570
|
-
width: 2
|
|
571
|
-
})
|
|
572
|
-
})
|
|
573
|
-
), u.setId(t), u.set("type", "line"), (l = (r = shipTrackVectorLayer.value) == null ? void 0 : r.getSource()) == null || l.clear(), shipTrackLineFeatures.value = [];
|
|
574
|
-
const c = shipTrackLineFeatures.value.findIndex((d) => d.getId() === t);
|
|
575
|
-
c >= 0 ? shipTrackLineFeatures.value[c] = u : shipTrackLineFeatures.value.push(u);
|
|
576
|
-
const m = createAnimatedIconFeature(o, a);
|
|
577
|
-
trackLineVectorSource.value = new VectorSource({
|
|
578
|
-
features: [...shipTrackLineFeatures.value, m]
|
|
579
|
-
}), animationFeature = m, shipTrackVectorLayer.value = new VectorLayer({
|
|
580
|
-
source: trackLineVectorSource.value
|
|
581
|
-
}), setTimeout(() => {
|
|
582
|
-
renderPoint(o);
|
|
583
|
-
}, 500), (i = mapInstance.value) == null || i.addLayer(shipTrackVectorLayer.value);
|
|
584
|
-
}
|
|
585
|
-
}, handlePlay = (e) => {
|
|
586
|
-
const t = trackLineVectorSource.value.getFeatures().filter((o) => {
|
|
587
|
-
var n;
|
|
588
|
-
return !!((n = o.get("data")) != null && n.lon);
|
|
589
|
-
}).map((o) => lonLatToMercator([o.get("data").lon, o.get("data").lat]));
|
|
590
|
-
startAnimation(t);
|
|
591
|
-
}, removeShipTrackLineFeatureByIndex = (e) => {
|
|
592
|
-
e >= 0 && e < shipTrackLineFeatures.value.length && shipTrackLineFeatures.value.splice(e, 1), trackLineVectorSource.value = new VectorSource({
|
|
593
|
-
features: [...shipTrackLineFeatures.value]
|
|
594
|
-
}), shipTrackVectorLayer.value && shipTrackVectorLayer.value.setSource(trackLineVectorSource.value);
|
|
595
|
-
}, createAnimatedIconFeature = (e, t) => {
|
|
596
|
-
const o = new Feature({
|
|
597
|
-
geometry: new Point(fromLonLat([t[0][0], t[0][1]]))
|
|
598
|
-
// 初始位置
|
|
599
|
-
}), n = new Style({
|
|
600
|
-
text: new Text({
|
|
601
|
-
font: "700 14px map-iconfont",
|
|
602
|
-
text: getIconFont(""),
|
|
603
|
-
fill: new Fill({ color: e })
|
|
604
|
-
})
|
|
605
|
-
});
|
|
606
|
-
return o.setStyle(n), o;
|
|
607
|
-
}, startAnimation = (e) => {
|
|
608
|
-
if (!animationFeature || !(e != null && e.length)) return;
|
|
609
|
-
let t = 0;
|
|
610
|
-
const o = e.length;
|
|
611
|
-
function n() {
|
|
612
|
-
if (t < o) {
|
|
613
|
-
const [a, r] = e[t];
|
|
614
|
-
animationFeature.getGeometry().setCoordinates(fromLonLat([a, r])), t++, animationId = requestAnimationFrame(n);
|
|
615
|
-
} else
|
|
616
|
-
cancelAnimationFrame(animationId), t = 0, startAnimation();
|
|
617
|
-
}
|
|
618
|
-
n();
|
|
619
|
-
}, renderPoint = (e) => {
|
|
620
|
-
if (!mapInstance.value) return;
|
|
621
|
-
let t = trackList$1.value || [];
|
|
622
|
-
if (!(t && t.length > 2)) return [];
|
|
623
|
-
let o = { 16: 24, 17: 15, default: 4 }, n = [], a = t.length;
|
|
624
|
-
for (let i = 0; i < a; i++) {
|
|
625
|
-
t[i].index = i;
|
|
626
|
-
let s = mapInstance.value.getPixelFromCoordinate(t[i].centerPoint);
|
|
627
|
-
if (s) {
|
|
628
|
-
let u = s.concat(s);
|
|
629
|
-
u = adjustBounds(u, [20, 20]);
|
|
630
|
-
let c = mapInstance.value.getView().getZoom();
|
|
631
|
-
if (!c) return;
|
|
632
|
-
if (c > 15) {
|
|
633
|
-
let d = o[c] || o.default;
|
|
634
|
-
u = adjustBounds(u, [d, d]);
|
|
635
|
-
}
|
|
636
|
-
let m = !0;
|
|
637
|
-
if (t[i].state !== "0") {
|
|
638
|
-
for (let d = 0; d < n.length; d++)
|
|
639
|
-
if (isOverlapping(u, n[d].bounds)) {
|
|
640
|
-
m = !1;
|
|
641
|
-
break;
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
m && (t[i].bounds = u, n.push(t[i]));
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
const r = getIconStyle(stopIcon), l = getIconStyle(slowIcon);
|
|
648
|
-
n.forEach((i) => {
|
|
649
|
-
var c, m;
|
|
650
|
-
let s = new Feature({
|
|
651
|
-
geometry: new Point(i.centerPoint)
|
|
652
|
-
});
|
|
653
|
-
s.set("type", "track_point"), s.set("data", i), s.setStyle(
|
|
654
|
-
new Style({
|
|
655
|
-
image: new CircleStyle({
|
|
656
|
-
fill: new Fill({ color: e }),
|
|
657
|
-
stroke: new Stroke({ color: "#fff", width: 2 }),
|
|
658
|
-
radius: 3
|
|
659
|
-
})
|
|
660
|
-
})
|
|
661
|
-
), trackLineVectorSource.value.addFeature(s);
|
|
662
|
-
const u = new Feature({
|
|
663
|
-
geometry: new Point(fromLonLat(i.center))
|
|
664
|
-
});
|
|
665
|
-
if (u.set("type", "track_label"), u.setStyle(
|
|
666
|
-
setTrackLabelStyle(i, e)
|
|
667
|
-
), console.log("trackLabelFeature"), trackLineVectorSource.value.addFeature(u), typeof i == "object" && i.hasOwnProperty("state")) {
|
|
668
|
-
let d = new Feature({
|
|
669
|
-
geometry: new Point(i.centerPoint)
|
|
670
|
-
});
|
|
671
|
-
d.set("type", "track_icon");
|
|
672
|
-
let f = new Style({
|
|
673
|
-
text: new Text({
|
|
674
|
-
font: "Normal 22px map-iconfont",
|
|
675
|
-
text: getIconFont(dropletsIcon),
|
|
676
|
-
offsetY: -10
|
|
677
|
-
}),
|
|
678
|
-
zIndex: 99
|
|
679
|
-
}), w = [];
|
|
680
|
-
i.state === "0" ? ((c = f.getText()) == null || c.setFill(new Fill({ color: stopColor })), w.push(r)) : ((m = f.getText()) == null || m.setFill(new Fill({ color: slowColor })), w.push(l)), w.push(f), d.setStyle(w), trackLineVectorSource.value.addFeature(d);
|
|
681
|
-
}
|
|
682
|
-
}), renderArrow(n, e), renderIconPoint();
|
|
683
|
-
}, renderArrow = (e, t) => {
|
|
684
|
-
const o = e.length;
|
|
685
|
-
o || (e.push(trackList$1.value[0]), e.push(trackList$1.value[trackList$1.value.length - 1]));
|
|
686
|
-
for (let n = 0; n < o - 1; n++) {
|
|
687
|
-
let a, r = e[n], l = (e[n + 1].index + r.index) / 2;
|
|
688
|
-
if (l % 2 === 0)
|
|
689
|
-
a = trackList$1.value[l].centerPoint;
|
|
690
|
-
else {
|
|
691
|
-
let i = trackList$1.value[Math.floor(l)], s = trackList$1.value[Math.ceil(l)];
|
|
692
|
-
if (i && s) {
|
|
693
|
-
let [u, c] = i.centerPoint, [m, d] = s.centerPoint;
|
|
694
|
-
a = [(u + m) / 2, (c + d) / 2];
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
if (a) {
|
|
698
|
-
let i = new Feature({
|
|
699
|
-
geometry: new Point(a)
|
|
700
|
-
});
|
|
701
|
-
i.set("type", "track_arrow"), i.setStyle(
|
|
702
|
-
new Style({
|
|
703
|
-
text: new Text({
|
|
704
|
-
font: "700 14px map-iconfont",
|
|
705
|
-
text: getIconFont(""),
|
|
706
|
-
fill: new Fill({ color: t }),
|
|
707
|
-
rotation: 1
|
|
708
|
-
// getRotation(
|
|
709
|
-
// pointList[index].center,
|
|
710
|
-
// pointList[index + 1].center
|
|
711
|
-
// ),
|
|
712
|
-
})
|
|
713
|
-
})
|
|
714
|
-
), trackLineVectorSource.value.addFeature(i);
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
}, renderIconPoint = () => {
|
|
718
|
-
const e = "", t = "#fcdc3f", o = "#ff0000";
|
|
719
|
-
(trackList$1.value.length < 2 ? [trackList$1.value[0]] : [trackList$1.value[0], trackList$1.value[trackList$1.value.length - 1]]).forEach((a) => {
|
|
720
|
-
let r = new Feature({
|
|
721
|
-
geometry: new Point(a.centerPoint)
|
|
722
|
-
});
|
|
723
|
-
r.set("type", "track_begin"), r.set("data", a);
|
|
724
|
-
const l = a.index === 0 && trackList$1.value.length >= 2 ? t : o;
|
|
725
|
-
r.setStyle(
|
|
726
|
-
new Style({
|
|
727
|
-
text: new Text({
|
|
728
|
-
font: "Normal 14px map-iconfont",
|
|
729
|
-
text: getIconFont(e),
|
|
730
|
-
fill: new Fill({ color: l })
|
|
731
|
-
}),
|
|
732
|
-
zIndex: 101
|
|
733
|
-
})
|
|
734
|
-
), trackLineVectorSource.value.addFeature(r);
|
|
735
|
-
});
|
|
736
|
-
}, setTrackLabelStyle = (e, t) => new Style({
|
|
737
|
-
renderer: (o, n) => {
|
|
738
|
-
const a = n.context, i = {
|
|
739
|
-
center: o,
|
|
740
|
-
text: e.time,
|
|
741
|
-
color: t,
|
|
742
|
-
textColor: "#000",
|
|
743
|
-
bgColor: "rgba(255,255,255,.8)"
|
|
744
|
-
};
|
|
745
|
-
drawLabel(a, i);
|
|
746
|
-
}
|
|
747
|
-
}), triangleModel = multiplyPixelRatio([
|
|
748
|
-
[0, -8],
|
|
749
|
-
[5, 8],
|
|
750
|
-
[-5, 8]
|
|
751
|
-
]), shipShapeModel = multiplyPixelRatio([
|
|
752
|
-
[0, -4.545],
|
|
753
|
-
[-0.56, -3.909],
|
|
754
|
-
[-1, -2.727],
|
|
755
|
-
[-1, 3.636],
|
|
756
|
-
[-0.8, 4.545],
|
|
757
|
-
[0.8, 4.545],
|
|
758
|
-
[1, 3.636],
|
|
759
|
-
[1, -2.727],
|
|
760
|
-
[0.56, -3.909],
|
|
761
|
-
[0, -4.545]
|
|
762
|
-
]), shipDirectPath = {
|
|
763
|
-
left: {
|
|
764
|
-
0: [
|
|
765
|
-
[0, 0],
|
|
766
|
-
[0, -8],
|
|
767
|
-
[-4, -8]
|
|
768
|
-
],
|
|
769
|
-
1: [
|
|
770
|
-
[0, 0],
|
|
771
|
-
[0, -16],
|
|
772
|
-
[-6, -16]
|
|
773
|
-
],
|
|
774
|
-
2: [
|
|
775
|
-
[0, 0],
|
|
776
|
-
[0, -24],
|
|
777
|
-
[-8, -24]
|
|
778
|
-
]
|
|
779
|
-
},
|
|
780
|
-
right: {
|
|
781
|
-
0: [
|
|
782
|
-
[0, 0],
|
|
783
|
-
[0, -8],
|
|
784
|
-
[-4, -8]
|
|
785
|
-
],
|
|
786
|
-
1: [
|
|
787
|
-
[0, 0],
|
|
788
|
-
[0, -16],
|
|
789
|
-
[-6, -16]
|
|
790
|
-
],
|
|
791
|
-
2: [
|
|
792
|
-
[0, 0],
|
|
793
|
-
[0, -24],
|
|
794
|
-
[-8, -24]
|
|
795
|
-
]
|
|
796
|
-
},
|
|
797
|
-
front: {
|
|
798
|
-
0: [
|
|
799
|
-
[0, 0],
|
|
800
|
-
[0, -8]
|
|
801
|
-
],
|
|
802
|
-
1: [
|
|
803
|
-
[0, 0],
|
|
804
|
-
[0, -16]
|
|
805
|
-
],
|
|
806
|
-
2: [
|
|
807
|
-
[0, 0],
|
|
808
|
-
[0, -24]
|
|
809
|
-
]
|
|
810
|
-
}
|
|
811
|
-
}, speedCondition = [[1, 10], [10, 20], [20, 1 / 0]], drawShipModelByZoom = { 16: [200, 30], 17: [50, 5], 18: [1, 1] }, setBlankStyle = () => new Style({
|
|
812
|
-
image: new CircleStyle({
|
|
813
|
-
radius: 0
|
|
814
|
-
})
|
|
815
|
-
}), setShipStyle = (e) => new Style({
|
|
816
|
-
renderer: (t, o) => {
|
|
817
|
-
const n = o.context, a = o.feature.get("data");
|
|
818
|
-
try {
|
|
819
|
-
const r = drawShipBody(n, a, t);
|
|
820
|
-
r && (drawHeading(n, a, r), e && drawSelectBounds(n, r)), drawShipLabel(n, a, t);
|
|
821
|
-
} catch {
|
|
822
|
-
return !1;
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
}), drawShipBody = (e, t, o) => {
|
|
826
|
-
if (!mapInstance.value) return;
|
|
827
|
-
const n = mapInstance.value.getView().getZoom();
|
|
828
|
-
if (!n) return;
|
|
829
|
-
let a = [];
|
|
830
|
-
const [r, l] = drawShipModelByZoom[n] || [0, 0], [i, s] = o;
|
|
831
|
-
if (n <= mapZoom.shipModelMax && n > mapZoom.shipModelMin && t.length >= r && t.breadth >= l)
|
|
832
|
-
a = rotateShapeModel(drawCurrentShipShapeModel(t, n), t.angle).map((c) => {
|
|
833
|
-
const [m, d] = c;
|
|
834
|
-
return [i + m, s + d];
|
|
835
|
-
});
|
|
836
|
-
else {
|
|
837
|
-
const u = rotateShapeModel(triangleModel, t.angle);
|
|
838
|
-
o.length === 2 && (a = u.map((c) => {
|
|
839
|
-
const [m, d] = c;
|
|
840
|
-
return [i + m, s + d];
|
|
841
|
-
}));
|
|
842
|
-
}
|
|
843
|
-
if (!(a.length > 2)) return !1;
|
|
844
|
-
e.save(), e.beginPath(), e.moveTo(a[0][0], a[0][1]);
|
|
845
|
-
for (let u = 1; u < a.length; u++)
|
|
846
|
-
e.lineTo(a[u][0], a[u][1]);
|
|
847
|
-
return e.closePath(), e.strokeStyle = "#000", e.lineWidth = 1, e.stroke(), e.fillStyle = t.fill, e.fill(), e.restore(), a;
|
|
848
|
-
}, drawHeading = (e, t, o) => {
|
|
849
|
-
const [n, a] = o[0], r = getShipDirectPath(t);
|
|
850
|
-
if (r) {
|
|
851
|
-
let l = r.map(function(i) {
|
|
852
|
-
let [s, u] = i;
|
|
853
|
-
return [s + n, u + a];
|
|
854
|
-
});
|
|
855
|
-
if (e.save(), e.beginPath(), t.angle > 0) {
|
|
856
|
-
e.translate(n, a);
|
|
857
|
-
const i = t.angle * Math.PI / 180;
|
|
858
|
-
e.rotate(i), e.translate(-n, -a);
|
|
859
|
-
}
|
|
860
|
-
e.moveTo(n, a);
|
|
861
|
-
for (let i = 1; i < l.length; i++) {
|
|
862
|
-
let [s, u] = l[i];
|
|
863
|
-
e.lineTo(s, u);
|
|
864
|
-
}
|
|
865
|
-
e.strokeStyle = "#000", e.lineWidth = 1, e.stroke(), e.restore();
|
|
866
|
-
}
|
|
867
|
-
}, drawSelectBounds = (e, t) => {
|
|
868
|
-
let [o, n, a, r] = getPixelFromCoordinate(t);
|
|
869
|
-
const l = 4;
|
|
870
|
-
o -= l, n -= l, a += l, r += l, e.save(), e.strokeStyle = "#ff0000", e.lineWidth = 4;
|
|
871
|
-
const i = 8;
|
|
872
|
-
e.beginPath(), e.moveTo(o + i, r), e.lineTo(o, r), e.lineTo(o, r - i), e.moveTo(o, n + i), e.lineTo(o, n), e.lineTo(o + i, n), e.moveTo(a - i, n), e.lineTo(a, n), e.lineTo(a, n + i), e.moveTo(a, r - i), e.lineTo(a, r), e.lineTo(a - i, r), e.stroke(), e.restore();
|
|
873
|
-
}, drawShipLabel = (e, t, o) => {
|
|
874
|
-
const [n, a] = o, r = n - 0, l = a - 0, i = t.name;
|
|
875
|
-
let s;
|
|
876
|
-
t.leftIconColor && (s = { color: t.leftIconColor, icon: "" });
|
|
877
|
-
let u = getShipCustomIcon(t);
|
|
878
|
-
drawLabel(e, {
|
|
879
|
-
center: [r, l],
|
|
880
|
-
text: i,
|
|
881
|
-
color: "#fff",
|
|
882
|
-
textColor: "#000",
|
|
883
|
-
bgColor: "#fff",
|
|
884
|
-
leftIcon: s,
|
|
885
|
-
rightIcons: u
|
|
886
|
-
});
|
|
887
|
-
}, drawCurrentShipShapeModel = (e, t) => {
|
|
888
|
-
let o = 0;
|
|
889
|
-
t === 17 ? o = 0.425 : t === 18 && (o = 0.857);
|
|
890
|
-
const n = e.length / 4 * o, a = e.breadth * o;
|
|
891
|
-
let r = cloneDeep(shipShapeModel);
|
|
892
|
-
return r = r.map(([l, i]) => [l * a, i * n]), r;
|
|
893
|
-
}, getShipDirectPath = (e) => {
|
|
894
|
-
let { speed: t, hdg: o, cog: n } = e, a = "", r = null;
|
|
895
|
-
if (t && t > 1 && (o !== null && o != 511 && n !== null ? n - o >= 3 ? a = "left" : n - o <= -3 ? a = "right" : a = "front" : a = "front", a && t))
|
|
896
|
-
for (let l in speedCondition) {
|
|
897
|
-
let i = speedCondition[l];
|
|
898
|
-
if (t >= i[0] && t < i[1]) {
|
|
899
|
-
r = shipDirectPath[a][l];
|
|
900
|
-
break;
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
return r;
|
|
904
|
-
}, getShipCustomIcon = (e) => {
|
|
905
|
-
let t = [];
|
|
906
|
-
return e.existDevice && t.push(""), e.existMobile && t.push(""), e.existWaterGauge && t.push(""), t || [];
|
|
907
|
-
};
|
|
908
|
-
let shipsMarkerList = [], shipsVectorSource, largeAmountShipsSource;
|
|
909
|
-
const selectedShipData = ref(null);
|
|
910
|
-
let selectShipsVectorSource;
|
|
911
|
-
const renderShips = (e) => {
|
|
912
|
-
var o, n, a, r;
|
|
913
|
-
if (!mapInstance.value) return;
|
|
914
|
-
const t = mapInstance.value.getView().getZoom();
|
|
915
|
-
if (selectedShipData.value && nextTick(() => {
|
|
916
|
-
selectSingleShipMarker(selectedShipData.value);
|
|
917
|
-
}).then((l) => {
|
|
918
|
-
}), !(!t || t < mapZoom.shipGreenDotMax))
|
|
919
|
-
return allShips.value = e, t > mapZoom.shipGreenDotMax && t < mapZoom.shipModelMin ? ((o = shipsLayer.value) == null || o.setVisible(!1), (n = largeAmountShipsLayer.value) == null || n.setVisible(!0), renderLargeAmountShips(e)) : ((a = largeAmountShipsLayer.value) == null || a.setVisible(!1), (r = shipsLayer.value) == null || r.setVisible(!0), renderShipsMarker(e));
|
|
920
|
-
}, renderLargeAmountShips = (e) => {
|
|
921
|
-
if (!mapInstance.value) return;
|
|
922
|
-
const t = e.map((o) => ({
|
|
923
|
-
type: "Feature",
|
|
924
|
-
geometry: {
|
|
925
|
-
type: "Point",
|
|
926
|
-
coordinates: [o.lon, o.lat]
|
|
927
|
-
},
|
|
928
|
-
properties: o
|
|
929
|
-
}));
|
|
930
|
-
return largeAmountShipsSource == null || largeAmountShipsSource.clear(), largeAmountShipsSource = new VectorSource({
|
|
931
|
-
features: new GeoJSON().readFeatures({
|
|
932
|
-
type: "FeatureCollection",
|
|
933
|
-
features: t
|
|
934
|
-
}, {
|
|
935
|
-
featureProjection: projection.mercator
|
|
936
|
-
})
|
|
937
|
-
}), largeAmountShipsLayer.value = new WebGLPointsLayer({
|
|
938
|
-
source: largeAmountShipsSource,
|
|
939
|
-
style: {
|
|
940
|
-
"shape-points": 3,
|
|
941
|
-
"shape-radius": 9,
|
|
942
|
-
"shape-fill-color": "#04C900",
|
|
943
|
-
// 'shape-fill-color': ['get', 'data.fill'],
|
|
944
|
-
"shape-rotate-with-view": !1,
|
|
945
|
-
"shape-rotation": [
|
|
946
|
-
"+",
|
|
947
|
-
["get", "cog"],
|
|
948
|
-
// 获取 'cog' 属性值
|
|
949
|
-
180
|
|
950
|
-
// 将值旋转 180 度
|
|
951
|
-
],
|
|
952
|
-
"shape-scale": [0.8, 1.2],
|
|
953
|
-
"shape-stroke-color": "#000000",
|
|
954
|
-
// 边框颜色为黑色
|
|
955
|
-
"shape-stroke-width": 0.5
|
|
956
|
-
// 边框宽度为0.5px
|
|
957
|
-
}
|
|
958
|
-
}), mapInstance.value.addLayer(largeAmountShipsLayer.value), largeAmountShipsLayer.value;
|
|
959
|
-
}, renderShipsMarker = (e) => {
|
|
960
|
-
if (!mapInstance.value) return;
|
|
961
|
-
deleteAllShipMarkers();
|
|
962
|
-
let t = convertShipMapData(e);
|
|
963
|
-
if (t = customFilterShips(t), !!(t != null && t.length))
|
|
964
|
-
return t.forEach((o) => {
|
|
965
|
-
const n = [o.lon, o.lat], a = new Feature({
|
|
966
|
-
geometry: new Point(fromLonLat(n))
|
|
967
|
-
});
|
|
968
|
-
a.set("data", o), a.setStyle(
|
|
969
|
-
setShipStyle(!1, o.id)
|
|
970
|
-
), shipsMarkerList.push({
|
|
971
|
-
ship: o,
|
|
972
|
-
lonlat: n,
|
|
973
|
-
feature: a
|
|
974
|
-
});
|
|
975
|
-
}), shipsVectorSource = new VectorSource({
|
|
976
|
-
features: shipsMarkerList.map((o) => o.feature)
|
|
977
|
-
}), shipsLayer.value = new VectorLayer({
|
|
978
|
-
source: shipsVectorSource
|
|
979
|
-
}), mapInstance.value.addLayer(shipsLayer.value), shipsLayer.value;
|
|
980
|
-
}, customFilterShips = (e) => {
|
|
981
|
-
let t = cloneDeep(e);
|
|
982
|
-
return t = t.filter((o) => {
|
|
983
|
-
var a, r, l;
|
|
984
|
-
let n = getFilterItem(o).every(({ btnShow: i, value: s }) => i ? !!s : !0);
|
|
985
|
-
return switchBtnShow.value.camera || switchBtnShow.value.mobile || switchBtnShow.value.waterGauge ? ((a = selectedShipData.value) == null ? void 0 : a.id) === o.id && clearSelectFeature() : (r = selectedShipData.value) != null && r.id && findShip((l = selectedShipData.value) == null ? void 0 : l.id, selectedShipData.value, !1), n;
|
|
986
|
-
}), t;
|
|
987
|
-
}, getFilterItem = (e) => [
|
|
988
|
-
{ btnShow: switchBtnShow.value.camera, value: e == null ? void 0 : e.existDevice },
|
|
989
|
-
{ btnShow: switchBtnShow.value.mobile, value: e == null ? void 0 : e.existMobile },
|
|
990
|
-
{ btnShow: switchBtnShow.value.waterGauge, value: e == null ? void 0 : e.existWaterGauge }
|
|
991
|
-
], deleteAllShipMarkers = () => {
|
|
992
|
-
shipsMarkerList.forEach((e) => {
|
|
993
|
-
e.feature && (shipsVectorSource == null || shipsVectorSource.removeFeature(e.feature));
|
|
994
|
-
}), shipsMarkerList = [];
|
|
995
|
-
}, selectSingleShipMarker = (e) => {
|
|
996
|
-
if (!mapInstance.value) return;
|
|
997
|
-
selectSingleShipData.value = convertShipMapData(e);
|
|
998
|
-
const t = [selectSingleShipData.value.lon, selectSingleShipData.value.lat], o = new Feature({
|
|
999
|
-
geometry: new Point(fromLonLat(t))
|
|
1000
|
-
});
|
|
1001
|
-
return o.set("data", selectSingleShipData.value), o.setStyle(
|
|
1002
|
-
setShipStyle(!0, selectSingleShipData.value.id)
|
|
1003
|
-
), shipsMarkerList.push({
|
|
1004
|
-
ship: selectSingleShipData.value,
|
|
1005
|
-
lonlat: t,
|
|
1006
|
-
feature: o
|
|
1007
|
-
}), selectShipsVectorSource == null || selectShipsVectorSource.clear(), selectShipsVectorSource = new VectorSource({
|
|
1008
|
-
features: [o]
|
|
1009
|
-
}), selectShipsLayer.value = new VectorLayer({
|
|
1010
|
-
source: selectShipsVectorSource
|
|
1011
|
-
}), setVisibleFeatureById(selectSingleShipData.value.id, !0), mapInstance.value.addLayer(selectShipsLayer.value), selectShipsLayer.value.setVisible(!0), selectShipsLayer.value;
|
|
1012
|
-
}, setVisibleFeatureById = (e, t) => {
|
|
1013
|
-
shipsVectorSource && shipsVectorSource.forEachFeature((o) => {
|
|
1014
|
-
const n = o.get("data");
|
|
1015
|
-
n && n.id === e && o.setStyle(t ? setShipStyle(!1, n.id) : setBlankStyle());
|
|
1016
|
-
});
|
|
1017
|
-
}, findShip = (e, t, o = !0) => {
|
|
1018
|
-
var a, r, l, i, s;
|
|
1019
|
-
if (!e || !mapInstance.value) return;
|
|
1020
|
-
const n = (l = (r = (a = shipsLayer.value) == null ? void 0 : a.getSource()) == null ? void 0 : r.getFeatures()) == null ? void 0 : l.find((u) => {
|
|
1021
|
-
var c;
|
|
1022
|
-
return ((c = u.get("data")) == null ? void 0 : c.id) === e;
|
|
1023
|
-
});
|
|
1024
|
-
if (n ? selectedShipData.value = n : t && (selectedShipData.value = t), !t) {
|
|
1025
|
-
console.error("找不到船舶");
|
|
1026
|
-
return;
|
|
1027
|
-
}
|
|
1028
|
-
if (selectSingleShipMarker(t), o && ((i = selectedShipData.value) != null && i.lon) && ((s = selectedShipData.value) != null && s.lat)) {
|
|
1029
|
-
const u = mapInstance.value.getView(), c = new Point([selectedShipData.value.lon, selectedShipData.value.lat]);
|
|
1030
|
-
u.setCenter(transform(c.getCoordinates(), projection.data, projection.mercator));
|
|
1031
|
-
const m = u.getZoom(), d = m < mapZoom.findShip ? mapZoom.findShip : m;
|
|
1032
|
-
u.setZoom(d);
|
|
1033
|
-
}
|
|
1034
|
-
return n;
|
|
1035
|
-
}, clearSelectFeature = () => {
|
|
1036
|
-
var e;
|
|
1037
|
-
selectedShipData.value && setVisibleFeatureById((e = selectedShipData.value) == null ? void 0 : e.id, !1), selectedShipData.value = null, mapInstance.value && (selectShipsVectorSource == null || selectShipsVectorSource.clear(), selectShipsLayer.value = new VectorLayer({
|
|
1038
|
-
source: selectShipsVectorSource
|
|
1039
|
-
}), mapInstance.value.addLayer(selectShipsLayer.value), selectShipsLayer.value.setVisible(!1));
|
|
1040
|
-
}, hiddenAllShips = () => {
|
|
1041
|
-
var e, t;
|
|
1042
|
-
(e = shipsLayer.value) == null || e.setVisible(!1), (t = largeAmountShipsLayer.value) == null || t.setVisible(!1);
|
|
1043
|
-
}, switchBtnShow = ref({
|
|
1044
|
-
// 船舶摄像头过滤开关
|
|
1045
|
-
[SWITCH_BTN.Camera]: !1,
|
|
1046
|
-
// 船舶联系方式过滤开关
|
|
1047
|
-
[SWITCH_BTN.Mobile]: !1,
|
|
1048
|
-
// 船舶水尺过滤开关
|
|
1049
|
-
[SWITCH_BTN.WaterGauge]: !1
|
|
1050
|
-
}), switchFilterItem = (e, t) => {
|
|
1051
|
-
switchBtnShow.value[e] = t, renderShips(allShips.value);
|
|
1052
|
-
}, rerenderShip = () => {
|
|
1053
|
-
renderShips(allShips.value);
|
|
1054
|
-
}, showTracks = ref([]), trackList = ref([]);
|
|
1055
|
-
ref(null);
|
|
1056
|
-
const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, a = "ship") => {
|
|
1057
|
-
var c;
|
|
1058
|
-
if (nextTick(() => {
|
|
1059
|
-
hiddenAllShips();
|
|
1060
|
-
}).then((m) => {
|
|
1061
|
-
}), (t == null ? void 0 : t.length) < 2) {
|
|
1062
|
-
((c = showTracks.value) == null ? void 0 : c.findIndex((m) => m.id === e)) < 0 && showTracks.value.push({ id: e, length: "" });
|
|
1063
|
-
return;
|
|
1064
|
-
}
|
|
1065
|
-
let r = {};
|
|
1066
|
-
t.forEach((m) => {
|
|
1067
|
-
m.state ? m.state = Number(m.state) : delete m.state;
|
|
1068
|
-
}), trackId.value = e, r[e] = t, trackList.value = t;
|
|
1069
|
-
const l = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], i = r[e].map(
|
|
1070
|
-
(m) => transform([m.lon, m.lat], projection.data, projection.mercator)
|
|
1071
|
-
), s = new LineString(i), u = formatLength(s, n) || "--";
|
|
1072
|
-
nextTick(() => {
|
|
1073
|
-
var d;
|
|
1074
|
-
const m = (d = showTracks.value) == null ? void 0 : d.findIndex((f) => f.id === e);
|
|
1075
|
-
m < 0 ? showTracks.value.push({ id: e, length: u }) : showTracks.value[m].length = u, renderTrackLine(r, e, o), ++cursor.value, cursor.value > l.length && (cursor.value = 0), resetTrackView(e);
|
|
1076
|
-
}).then(() => {
|
|
1077
|
-
});
|
|
1078
|
-
}, removeAllTrackLayer = () => {
|
|
1079
|
-
var e;
|
|
1080
|
-
showTracks.value = [], (e = trackLineVectorSource.value) == null || e.clear();
|
|
1081
|
-
}, playTrack = (e, t) => {
|
|
1082
|
-
handlePlay();
|
|
1083
|
-
}, resetTrackView = (e) => {
|
|
1084
|
-
var a;
|
|
1085
|
-
const t = mapInstance.value.getView(), o = e ? shipTrackLineFeatures.value.find((r) => r.getId() === e) : shipTrackLineFeatures.value[0];
|
|
1086
|
-
if (!o) return;
|
|
1087
|
-
const n = (a = o == null ? void 0 : o.getGeometry()) == null ? void 0 : a.getExtent();
|
|
1088
|
-
if (n != null && n.length)
|
|
1089
|
-
try {
|
|
1090
|
-
t.fit(n);
|
|
1091
|
-
} catch (r) {
|
|
1092
|
-
console.log(r);
|
|
1093
|
-
}
|
|
1094
|
-
}, _hoisted_1$3 = {
|
|
1095
|
-
key: 0,
|
|
1096
|
-
class: "more-tool-panel"
|
|
1097
|
-
}, _hoisted_2$1 = { class: "switch-buttons" }, _hoisted_3$1 = { class: "tool-components" }, _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
1098
|
-
__name: "toolPanel",
|
|
1099
|
-
props: {
|
|
1100
|
-
vehicleMode: {},
|
|
1101
|
-
viewMode: {},
|
|
1102
|
-
disableGreenDot: { type: Boolean },
|
|
1103
|
-
showTrackLayer: { type: Boolean }
|
|
1104
|
-
},
|
|
1105
|
-
emits: ["switchGreenDot", "switchMapTile"],
|
|
1106
|
-
setup(e, { emit: t }) {
|
|
1107
|
-
var f, w;
|
|
1108
|
-
const o = e, n = t, a = ref(((w = (f = mapInstance.value) == null ? void 0 : f.getView()) == null ? void 0 : w.getZoom()) || mapZoom.default), r = ref(!1), l = ref(null), i = ref(!0), s = () => {
|
|
1109
|
-
o.disableGreenDot || a.value >= mapZoom.shipGreenDotMax || (i.value = !i.value, n("switchGreenDot", i.value));
|
|
1110
|
-
}, u = ref(BaseMapType.vector), c = () => {
|
|
1111
|
-
u.value = u.value === BaseMapType.vector ? BaseMapType.satellite : BaseMapType.vector, n("switchMapTile", u.value);
|
|
1112
|
-
}, m = () => {
|
|
1113
|
-
var v, h;
|
|
1114
|
-
r.value ? (v = l.value) == null || v.removeInteraction() : (h = l.value) == null || h.addInteraction(), r.value = !r.value;
|
|
1115
|
-
}, d = () => {
|
|
1116
|
-
var v;
|
|
1117
|
-
(v = l.value) == null || v.removeInteraction(), r.value = !1;
|
|
1118
|
-
};
|
|
1119
|
-
return onMounted(() => {
|
|
1120
|
-
nextTick(() => {
|
|
1121
|
-
var v;
|
|
1122
|
-
(v = mapInstance.value) == null || v.on("moveend", () => {
|
|
1123
|
-
var T, E;
|
|
1124
|
-
const h = (E = (T = mapInstance.value) == null ? void 0 : T.getView()) == null ? void 0 : E.getZoom();
|
|
1125
|
-
h && (a.value = h);
|
|
1126
|
-
});
|
|
1127
|
-
});
|
|
1128
|
-
}), (v, h) => (openBlock(), createElementBlock(Fragment, null, [
|
|
1129
|
-
createElementVNode("div", {
|
|
1130
|
-
class: normalizeClass(`tool-panel ${v.viewMode}`)
|
|
1131
|
-
}, [
|
|
1132
|
-
v.viewMode === "WxMiniprogram" ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
|
|
1133
|
-
createElementVNode("div", _hoisted_2$1, [
|
|
1134
|
-
v.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
|
|
1135
|
-
key: 0,
|
|
1136
|
-
class: normalizeClass(["switch-btn", `${r.value && "active"}`]),
|
|
1137
|
-
onClick: m
|
|
1138
|
-
}, h[5] || (h[5] = [
|
|
1139
|
-
createElementVNode("i", { class: "map-iconfont icon-measure" }, null, -1),
|
|
1140
|
-
createElementVNode("div", { class: "button-text" }, "测距", -1)
|
|
1141
|
-
]), 2)) : createCommentVNode("", !0),
|
|
1142
|
-
v.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
|
|
1143
|
-
key: 1,
|
|
1144
|
-
class: normalizeClass(`switch-btn ${i.value && "active"} ${(v.disableGreenDot || a.value >= unref(mapZoom).shipGreenDotMax) && "disabled"}`),
|
|
1145
|
-
onClick: s
|
|
1146
|
-
}, h[6] || (h[6] = [
|
|
1147
|
-
createElementVNode("i", { class: "map-iconfont icon-ship" }, null, -1),
|
|
1148
|
-
createElementVNode("div", { class: "button-text" }, "绿点", -1)
|
|
1149
|
-
]), 2)) : createCommentVNode("", !0),
|
|
1150
|
-
v.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
|
|
1151
|
-
key: 2,
|
|
1152
|
-
class: normalizeClass(`switch-btn ${u.value === unref(BaseMapType).vector && "active"}`),
|
|
1153
|
-
onClick: h[0] || (h[0] = (T) => c())
|
|
1154
|
-
}, h[7] || (h[7] = [
|
|
1155
|
-
createElementVNode("i", { class: "map-iconfont icon-space" }, null, -1),
|
|
1156
|
-
createElementVNode("div", { class: "button-text" }, "图层", -1)
|
|
1157
|
-
]), 2)) : createCommentVNode("", !0),
|
|
1158
|
-
v.vehicleMode === "truck" ? (openBlock(), createElementBlock("div", {
|
|
1159
|
-
key: 3,
|
|
1160
|
-
class: normalizeClass(`switch-btn ${u.value === unref(BaseMapType).satellite && "active"}`),
|
|
1161
|
-
onClick: h[1] || (h[1] = (T) => c())
|
|
1162
|
-
}, h[8] || (h[8] = [
|
|
1163
|
-
createElementVNode("i", { class: "map-iconfont icon-space" }, null, -1),
|
|
1164
|
-
createElementVNode("div", { class: "button-text" }, "卫星", -1)
|
|
1165
|
-
]), 2)) : createCommentVNode("", !0),
|
|
1166
|
-
v.showTrackLayer ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
|
|
1167
|
-
createElementVNode("div", {
|
|
1168
|
-
class: "switch-btn multiple",
|
|
1169
|
-
onClick: h[2] || (h[2] = (T) => unref(playTrack)(0, 1))
|
|
1170
|
-
}, h[9] || (h[9] = [
|
|
1171
|
-
createElementVNode("i", { class: "map-iconfont icon-play" }, null, -1),
|
|
1172
|
-
createElementVNode("div", { class: "button-text" }, "播放轨迹", -1)
|
|
1173
|
-
])),
|
|
1174
|
-
createElementVNode("div", {
|
|
1175
|
-
class: "switch-btn multiple",
|
|
1176
|
-
onClick: h[3] || (h[3] = (T) => unref(resetTrackView)())
|
|
1177
|
-
}, h[10] || (h[10] = [
|
|
1178
|
-
createElementVNode("i", { class: "map-iconfont icon-center" }, null, -1),
|
|
1179
|
-
createElementVNode("div", { class: "button-text" }, "轨迹居中", -1)
|
|
1180
|
-
]))
|
|
1181
|
-
], 64)) : createCommentVNode("", !0),
|
|
1182
|
-
renderSlot(v.$slots, "toolPanel", {}, void 0, !0)
|
|
1183
|
-
])
|
|
1184
|
-
])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
1185
|
-
v.vehicleMode === "ship" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
1186
|
-
createElementVNode("div", {
|
|
1187
|
-
class: normalizeClass(["switch-btn", `${r.value && "active"}`]),
|
|
1188
|
-
onClick: m
|
|
1189
|
-
}, h[11] || (h[11] = [
|
|
1190
|
-
createElementVNode("i", { class: "map-iconfont icon-measure" }, null, -1),
|
|
1191
|
-
createElementVNode("div", { class: "button-text" }, "测距", -1)
|
|
1192
|
-
]), 2),
|
|
1193
|
-
v.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
|
|
1194
|
-
key: 0,
|
|
1195
|
-
class: normalizeClass(`switch-btn ${i.value && "active"} ${(v.disableGreenDot || a.value >= unref(mapZoom).shipGreenDotMax) && "disabled"}`),
|
|
1196
|
-
onClick: s
|
|
1197
|
-
}, h[12] || (h[12] = [
|
|
1198
|
-
createElementVNode("i", { class: "map-iconfont icon-ship" }, null, -1),
|
|
1199
|
-
createElementVNode("div", { class: "button-text" }, "绿点", -1)
|
|
1200
|
-
]), 2)) : createCommentVNode("", !0)
|
|
1201
|
-
], 64)) : createCommentVNode("", !0),
|
|
1202
|
-
createElementVNode("div", {
|
|
1203
|
-
class: normalizeClass(["switch-btn", { active: u.value === unref(BaseMapType).satellite }]),
|
|
1204
|
-
onClick: c
|
|
1205
|
-
}, h[13] || (h[13] = [
|
|
1206
|
-
createElementVNode("i", { class: "map-iconfont icon-space" }, null, -1),
|
|
1207
|
-
createElementVNode("div", { class: "button-text" }, "卫星", -1)
|
|
1208
|
-
]), 2)
|
|
1209
|
-
], 64))
|
|
1210
|
-
], 2),
|
|
1211
|
-
createElementVNode("div", _hoisted_3$1, [
|
|
1212
|
-
r.value ? (openBlock(), createBlock(Measure, {
|
|
1213
|
-
key: 0,
|
|
1214
|
-
ref_key: "measureRef",
|
|
1215
|
-
ref: l,
|
|
1216
|
-
visible: r.value,
|
|
1217
|
-
"onUpdate:visible": h[4] || (h[4] = (T) => r.value = T),
|
|
1218
|
-
onClose: d,
|
|
1219
|
-
"view-mode": v.viewMode
|
|
1220
|
-
}, null, 8, ["visible", "view-mode"])) : createCommentVNode("", !0)
|
|
1221
|
-
])
|
|
1222
|
-
], 64));
|
|
1223
|
-
}
|
|
1224
|
-
}), ToolPanel = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-1b8ea4b1"]]), _hoisted_1$2 = { id: "scale-line-container" }, _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
1225
|
-
__name: "scaleLine",
|
|
1226
|
-
setup(e, { expose: t }) {
|
|
1227
|
-
const o = new ScaleLine$1({
|
|
1228
|
-
units: "nautical"
|
|
1229
|
-
});
|
|
1230
|
-
return t({
|
|
1231
|
-
setScaleLine: () => {
|
|
1232
|
-
o.setTarget(document.getElementById("scale-line-container")), mapInstance.value.addControl(o);
|
|
1233
|
-
}
|
|
1234
|
-
}), (a, r) => (openBlock(), createElementBlock("div", _hoisted_1$2));
|
|
1235
|
-
}
|
|
1236
|
-
}), ScaleLine = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-e51b19b1"]]), _hoisted_1$1 = { class: "zoom" }, _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
1237
|
-
__name: "zoomControl",
|
|
1238
|
-
props: {
|
|
1239
|
-
map: {
|
|
1240
|
-
type: Object
|
|
1241
|
-
}
|
|
1242
|
-
},
|
|
1243
|
-
setup(e) {
|
|
1244
|
-
const t = () => {
|
|
1245
|
-
if (!mapInstance.value) return;
|
|
1246
|
-
const n = mapInstance.value.getView(), a = n.getZoom();
|
|
1247
|
-
a && n.setZoom(a + 1);
|
|
1248
|
-
}, o = () => {
|
|
1249
|
-
if (!mapInstance.value) return;
|
|
1250
|
-
const n = mapInstance.value.getView(), a = n.getZoom();
|
|
1251
|
-
a && n.setZoom(a - 1);
|
|
1252
|
-
};
|
|
1253
|
-
return (n, a) => (openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
1254
|
-
createElementVNode("div", {
|
|
1255
|
-
onClick: t,
|
|
1256
|
-
class: "button big-button"
|
|
1257
|
-
}, "+"),
|
|
1258
|
-
createElementVNode("div", {
|
|
1259
|
-
onClick: o,
|
|
1260
|
-
class: "button small-button"
|
|
1261
|
-
}, "-")
|
|
1262
|
-
]));
|
|
1263
|
-
}
|
|
1264
|
-
}), ZoomControl = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-f2b62b21"]]), _hoisted_1 = { class: "copyright" }, _hoisted_2 = { class: "tdt-control-copyright tdt-control" }, _hoisted_3 = ["src"], _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
1265
|
-
__name: "copyright",
|
|
1266
|
-
setup(e) {
|
|
1267
|
-
return (t, o) => (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
1268
|
-
createElementVNode("div", _hoisted_2, [
|
|
1269
|
-
createElementVNode("img", {
|
|
1270
|
-
src: unref(CDN_URL) + "map/tdt-logo.png",
|
|
1271
|
-
width: "53px",
|
|
1272
|
-
height: "22px",
|
|
1273
|
-
class: "logo",
|
|
1274
|
-
alt: ""
|
|
1275
|
-
}, null, 8, _hoisted_3),
|
|
1276
|
-
o[0] || (o[0] = createElementVNode("div", { class: "copyright-text" }, "GS(2024)0568号 - 甲测资字1100471", -1))
|
|
1277
|
-
]),
|
|
1278
|
-
o[1] || (o[1] = createElementVNode("div", {
|
|
1279
|
-
id: "dataSource",
|
|
1280
|
-
class: "tdt-control data-source"
|
|
1281
|
-
}, "数据来源:自然资源部 & NavInfo", -1))
|
|
1282
|
-
]));
|
|
1283
|
-
}
|
|
1284
|
-
}), Copyright = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-9c5c2f7b"]]), dotImage = new Image();
|
|
1285
|
-
dotImage.src = `${CDN_URL}/map/truck-dot.svg`;
|
|
1286
|
-
dotImage.crossOrigin = "anonymous";
|
|
1287
|
-
const dotActiveImage = new Image();
|
|
1288
|
-
dotActiveImage.src = `${CDN_URL}/map/truck-dot-active.svg`;
|
|
1289
|
-
dotActiveImage.crossOrigin = "anonymous";
|
|
1290
|
-
const cameraImage = new Image();
|
|
1291
|
-
cameraImage.src = `${CDN_URL}/map/map-camera.svg`;
|
|
1292
|
-
cameraImage.crossOrigin = "anonymous";
|
|
1293
|
-
const loadImage = new Image();
|
|
1294
|
-
loadImage.src = `${CDN_URL}/map/map-load.svg`;
|
|
1295
|
-
loadImage.crossOrigin = "anonymous";
|
|
1296
|
-
const setTruckStyle = (e, t, o, n) => new Style({
|
|
1297
|
-
renderer: (a, r) => {
|
|
1298
|
-
const l = r.context;
|
|
1299
|
-
l.save();
|
|
1300
|
-
let i = 1;
|
|
1301
|
-
l.scale(i, i);
|
|
1302
|
-
let [s, u] = a;
|
|
1303
|
-
s = s / i - 20, u = u / i;
|
|
1304
|
-
const c = s - 70, m = u - 68;
|
|
1305
|
-
let d = 180;
|
|
1306
|
-
const f = 56, w = "#FFFFFF";
|
|
1307
|
-
let v = 176;
|
|
1308
|
-
const h = 52;
|
|
1309
|
-
let T = "#164AFF", E = "#FFFFFF";
|
|
1310
|
-
o === CAR_COLOR.YELLOW ? (v = 176, T = "#FFC81E", E = "rgba(0,0,0,0.88)") : o === CAR_COLOR.Y_GREEN && (d = 200, v = 196, T = "#8FED7C", E = "rgba(0,0,0,0.88)"), n != null && n.length && (d += n.length * 56), fillRectRadius(l, c, m, d, f, w), fillRectRadius(l, c + 2, m + 2, v, h, T), o === CAR_COLOR.Y_GREEN && fillRectRadius(l, c + 2, m + 2, 68, h, "#FFC81E"), l.save(), l.restore(), l.fillStyle = E, l.font = "bold 28px Arial", l.textAlign = "left", l.textBaseline = "middle";
|
|
1311
|
-
const C = `${t.slice(0, 2) + " · " + t.slice(2)}`;
|
|
1312
|
-
if (l.fillText(C, c + 12, m + 32), l.save(), l.restore(), n != null && n.length) {
|
|
1313
|
-
const S = l.measureText(C).width + 12;
|
|
1314
|
-
let g = 0;
|
|
1315
|
-
n.forEach((I) => {
|
|
1316
|
-
I === DEVICE_TYPE.CAMERA && (l.drawImage(cameraImage, s - 54 + S + g * 56, u - 64, 50, 50), ++g), I === DEVICE_TYPE.LOAD && (l.drawImage(loadImage, s - 54 + S + g * 56, u - 64, 50, 50), ++g);
|
|
1317
|
-
});
|
|
1318
|
-
}
|
|
1319
|
-
const p = dotImage;
|
|
1320
|
-
l.drawImage(p, s + d / 2 - 90, u, 50 / i, 50 / i), l.restore();
|
|
1321
|
-
}
|
|
1322
|
-
});
|
|
1323
|
-
ref([]);
|
|
1324
|
-
let truckMarkerList = [], trucksVectorSource;
|
|
1325
|
-
const renderTrucksMarker = (e) => {
|
|
1326
|
-
if (deleteAllTruckMarkers(), !!mapInstance.value)
|
|
1327
|
-
return e.forEach((t) => {
|
|
1328
|
-
const o = convertSixHundredThousandToLatLng(t.lon, t.lat), n = new Feature({
|
|
1329
|
-
geometry: new Point(fromLonLat(o))
|
|
1330
|
-
});
|
|
1331
|
-
n.set("data", t), n.setStyle(
|
|
1332
|
-
setTruckStyle(!1, t.vno, t == null ? void 0 : t.vclColor, t == null ? void 0 : t.icons)
|
|
1333
|
-
), truckMarkerList.push({
|
|
1334
|
-
name: t.vno,
|
|
1335
|
-
lonlat: o,
|
|
1336
|
-
feature: n
|
|
1337
|
-
});
|
|
1338
|
-
}), trucksVectorSource = new VectorSource({
|
|
1339
|
-
features: truckMarkerList.map((t) => t.feature)
|
|
1340
|
-
}), trucksLayer.value = new VectorLayer({
|
|
1341
|
-
source: trucksVectorSource
|
|
1342
|
-
}), mapInstance.value.addLayer(trucksLayer.value), trucksLayer.value;
|
|
1343
|
-
}, deleteAllTruckMarkers = () => {
|
|
1344
|
-
truckMarkerList.forEach((e) => {
|
|
1345
|
-
e.feature && (trucksVectorSource == null || trucksVectorSource.removeFeature(e.feature));
|
|
1346
|
-
}), truckMarkerList = [];
|
|
1347
|
-
}, drawCustomContent = (e, t, o, n = "top-left", a = !1) => {
|
|
1348
|
-
var c, m;
|
|
1349
|
-
if (!t || !mapInstance.value) return;
|
|
1350
|
-
document.querySelectorAll(".truck-custom-content").forEach((d) => d.parentNode.removeChild(d));
|
|
1351
|
-
const r = document.createElement("div");
|
|
1352
|
-
r.innerHTML = o;
|
|
1353
|
-
const l = new Overlay({
|
|
1354
|
-
element: r,
|
|
1355
|
-
position: t,
|
|
1356
|
-
// 初始位置
|
|
1357
|
-
positioning: n,
|
|
1358
|
-
stopEvent: a
|
|
1359
|
-
// 设置不阻拦事件
|
|
1360
|
-
});
|
|
1361
|
-
if (a) {
|
|
1362
|
-
let d = !1, f = [0, 0], w = [0, 0];
|
|
1363
|
-
r.addEventListener("mousedown", function(v) {
|
|
1364
|
-
var h;
|
|
1365
|
-
d = !0, v.clientX, v.clientY, f = (h = mapInstance.value) == null ? void 0 : h.getCoordinateFromPixel([v.clientX - 200, v.clientY - 200]), w = [
|
|
1366
|
-
v.clientX - r.getBoundingClientRect().left + 160,
|
|
1367
|
-
v.clientY - r.getBoundingClientRect().top + 84
|
|
1368
|
-
], v.preventDefault();
|
|
1369
|
-
}), document.addEventListener("mousemove", function(v) {
|
|
1370
|
-
var h;
|
|
1371
|
-
if (d) {
|
|
1372
|
-
let T = (h = mapInstance.value) == null ? void 0 : h.getCoordinateFromPixel([v.clientX - w[0], v.clientY - w[1]]), E = T[0] - f[0], C = T[1] - f[1];
|
|
1373
|
-
l.setPosition([f[0] + E, f[1] + C]);
|
|
1374
|
-
}
|
|
1375
|
-
}), document.addEventListener("mouseup", function() {
|
|
1376
|
-
d = !1;
|
|
1377
|
-
});
|
|
1378
|
-
}
|
|
1379
|
-
(c = mapInstance.value) == null || c.addOverlay(l);
|
|
1380
|
-
const i = r.querySelector(".close-button");
|
|
1381
|
-
i && i.addEventListener("click", () => {
|
|
1382
|
-
var d, f;
|
|
1383
|
-
(d = mapInstance.value) == null || d.removeOverlay(l), (f = r.parentNode) == null || f.removeChild(r);
|
|
1384
|
-
});
|
|
1385
|
-
let s = JSON.parse(JSON.stringify(t));
|
|
1386
|
-
const u = (m = mapInstance.value) == null ? void 0 : m.getCoordinateFromPixel(s);
|
|
1387
|
-
return l.setPosition(u), l;
|
|
1388
|
-
}, vehicle = ref(null), focusShipData = ref(), currentTruckOverlay = ref(null), findTruck = async (e) => {
|
|
1389
|
-
if (!mapInstance.value) return;
|
|
1390
|
-
focusShipData.value = e;
|
|
1391
|
-
const t = convertSixHundredThousandToLatLng(e.lon, e.lat), o = mapInstance.value.getPixelFromCoordinate(transform(t, projection.data, projection.mercator));
|
|
1392
|
-
currentTruckOverlay.value = drawTruckIcon(e.vno, o, e == null ? void 0 : e.drc);
|
|
1393
|
-
const n = mapInstance.value.getView(), a = new Point(t);
|
|
1394
|
-
n.setCenter(transform(a.getCoordinates(), projection.data, projection.mercator));
|
|
1395
|
-
}, clearAllTruck = () => {
|
|
1396
|
-
vehicle.value.clearAllShip();
|
|
1397
|
-
}, drawTruckIcon = (e, t, o) => {
|
|
1398
|
-
const n = `<div id="${e}" class="ol-custom-content truck-custom-content" style="width: 80px; height: 80px; transform: rotate(${o}deg);">
|
|
1399
|
-
<img src="${CDN_URL}map/car-icon.gif" width="100%" height="100%" />
|
|
1400
|
-
</div>`;
|
|
1401
|
-
return drawCustomContent(e, t, n, "center-center");
|
|
1402
|
-
}, removeTruckIcon = () => {
|
|
1403
|
-
var t;
|
|
1404
|
-
const e = (t = currentTruckOverlay.value) == null ? void 0 : t.getElement();
|
|
1405
|
-
e && (e.innerHTML = "");
|
|
1406
|
-
}, zoomTruckIcon = () => {
|
|
1407
|
-
var r;
|
|
1408
|
-
if (!mapInstance.value) return;
|
|
1409
|
-
const e = mapInstance.value.getView().getZoom(), t = 120, o = 60;
|
|
1410
|
-
function n(l) {
|
|
1411
|
-
return l < 14 ? o : l >= 14 && l <= 18 ? Math.round((l - 14) * (t - o) / 4 + o) : t;
|
|
1412
|
-
}
|
|
1413
|
-
const a = n(e);
|
|
1414
|
-
(r = document.querySelectorAll(".truck-custom-content")) == null || r.forEach((l) => {
|
|
1415
|
-
l.style.width = `${a}px`, l.style.height = `${a}px`;
|
|
1416
|
-
});
|
|
1417
|
-
}, markerPosition = ref(""), marker = ref(), createIconStyle = (e) => new Style({
|
|
1418
|
-
image: new Icon({
|
|
1419
|
-
src: CDN_URL + "map/poi-marker-default.png",
|
|
1420
|
-
anchor: [0.5, 1]
|
|
1421
|
-
}),
|
|
1422
|
-
text: new Text({
|
|
1423
|
-
text: e,
|
|
1424
|
-
offsetY: -90,
|
|
1425
|
-
// 调整文本位置,使其位于标记上方
|
|
1426
|
-
font: "12px",
|
|
1427
|
-
fill: new Fill({
|
|
1428
|
-
color: "#000"
|
|
1429
|
-
}),
|
|
1430
|
-
stroke: new Stroke({
|
|
1431
|
-
color: "#fff",
|
|
1432
|
-
width: 2
|
|
1433
|
-
}),
|
|
1434
|
-
backgroundFill: new Fill({
|
|
1435
|
-
color: "#fff"
|
|
1436
|
-
// 设置文本背景填充颜色
|
|
1437
|
-
}),
|
|
1438
|
-
backgroundStroke: new Stroke({
|
|
1439
|
-
color: "#000",
|
|
1440
|
-
// 设置文本背景描边颜色
|
|
1441
|
-
width: 1
|
|
1442
|
-
}),
|
|
1443
|
-
padding: [2, 2, 2, 2]
|
|
1444
|
-
// 设置文本背景的内边距
|
|
1445
|
-
})
|
|
1446
|
-
}), renderMarker = (e, t = !0, o = !0) => {
|
|
1447
|
-
var c;
|
|
1448
|
-
if (!mapInstance.value || !e || e.split(",").length !== 2) return;
|
|
1449
|
-
const [n, a] = e.split(",").map(Number);
|
|
1450
|
-
marker.value = new Feature({
|
|
1451
|
-
geometry: new Point(fromLonLat([n, a]))
|
|
1452
|
-
});
|
|
1453
|
-
const r = o ? `${n}, ${a}` : "";
|
|
1454
|
-
(c = marker.value) == null || c.setStyle(createIconStyle(r));
|
|
1455
|
-
const l = new VectorSource({
|
|
1456
|
-
features: [marker.value]
|
|
1457
|
-
}), i = new VectorLayer({
|
|
1458
|
-
source: l
|
|
1459
|
-
}), s = mapInstance.value.getView();
|
|
1460
|
-
if (mapInstance.value.addLayer(i), t) {
|
|
1461
|
-
const m = new Translate({
|
|
1462
|
-
layers: [i]
|
|
1463
|
-
});
|
|
1464
|
-
m.on("translating", function(d) {
|
|
1465
|
-
var v;
|
|
1466
|
-
const f = d.features.item(0).getGeometry().getCoordinates(), w = toLonLat(f);
|
|
1467
|
-
markerPosition.value = `${w[0].toFixed(6)}, ${w[1].toFixed(6)}`, (v = marker.value) == null || v.setStyle(createIconStyle(markerPosition.value));
|
|
1468
|
-
}), mapInstance.value.addInteraction(m);
|
|
1469
|
-
}
|
|
1470
|
-
const u = new Point([n, a]);
|
|
1471
|
-
s.setCenter(transform(u.getCoordinates(), projection.data, projection.mercator)), s.setZoom(mapZoom.findShip);
|
|
1472
|
-
}, setMarkerPosition = (e) => {
|
|
1473
|
-
var a, r;
|
|
1474
|
-
if (!mapInstance.value) return;
|
|
1475
|
-
const t = mapInstance.value.getView(), o = e.split(",").map(Number);
|
|
1476
|
-
(r = (a = marker.value) == null ? void 0 : a.getGeometry()) == null || r.setCoordinates(fromLonLat([o[0], o[1]]));
|
|
1477
|
-
const n = new Point([o[0], o[1]]);
|
|
1478
|
-
t.setCenter(transform(n.getCoordinates(), projection.data, projection.mercator));
|
|
1479
|
-
};
|
|
1480
|
-
let layerState = "drawn", drawnState = "undrawn";
|
|
1481
|
-
const source = new VectorSource();
|
|
1482
|
-
let sketch, helpTooltipElement, helpTooltip, measureTooltipElement, measureTooltip, circleStyle, drawVector, draw;
|
|
1483
|
-
function createMeasureTooltip() {
|
|
1484
|
-
var e;
|
|
1485
|
-
measureTooltipElement != null && measureTooltipElement.parentNode && measureTooltipElement.parentNode.removeChild(measureTooltipElement), measureTooltipElement = document.createElement("div"), measureTooltipElement.className = "ol-tooltip ol-tooltip-draw-polygon", measureTooltip = new Overlay({
|
|
1486
|
-
element: measureTooltipElement,
|
|
1487
|
-
offset: [0, -15],
|
|
1488
|
-
positioning: "bottom-center",
|
|
1489
|
-
stopEvent: !1,
|
|
1490
|
-
insertFirst: !1
|
|
1491
|
-
}), (e = mapInstance.value) == null || e.addOverlay(measureTooltip);
|
|
1492
|
-
}
|
|
1493
|
-
function createHelpTooltip() {
|
|
1494
|
-
var e;
|
|
1495
|
-
helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement), helpTooltipElement = document.createElement("div"), helpTooltipElement.className = "ol-tooltip ol-help-tooltip hidden", helpTooltip = new Overlay({
|
|
1496
|
-
element: helpTooltipElement,
|
|
1497
|
-
offset: [15, 0],
|
|
1498
|
-
positioning: "center-left"
|
|
1499
|
-
}), (e = mapInstance.value) == null || e.addOverlay(helpTooltip);
|
|
1500
|
-
}
|
|
1501
|
-
let squareLimitError = !1, lineLimitError = !1;
|
|
1502
|
-
const validateSquareLimit = (e) => {
|
|
1503
|
-
let o = 1 / 0, n = -1 / 0, a = 1 / 0, r = -1 / 0;
|
|
1504
|
-
e == null || e.forEach((s) => {
|
|
1505
|
-
const u = transform(s, projection.mercator, projection.data), c = u[0], m = u[1];
|
|
1506
|
-
o = Math.min(o, m), n = Math.max(n, m), a = Math.min(a, c), r = Math.max(r, c);
|
|
1507
|
-
});
|
|
1508
|
-
const l = (n - o) * 111, i = (r - a) * 111;
|
|
1509
|
-
squareLimitError = l > 150 || i > 150;
|
|
1510
|
-
};
|
|
1511
|
-
let storeFeature;
|
|
1512
|
-
const addInteraction = (e) => {
|
|
1513
|
-
var o, n;
|
|
1514
|
-
drawVector || init(), drawnState = "undrawn", layerState = "drawn", (o = mapInstance.value) == null || o.addLayer(drawVector), draw = new Draw({
|
|
1515
|
-
type: "Polygon",
|
|
1516
|
-
// source: drawVector.getSource(),
|
|
1517
|
-
source,
|
|
1518
|
-
trace: !0,
|
|
1519
|
-
style: [
|
|
1520
|
-
{
|
|
1521
|
-
"stroke-color": "rgba(255, 255, 255, 1)",
|
|
1522
|
-
"stroke-width": 1.5,
|
|
1523
|
-
"stroke-line-dash": [10, 10],
|
|
1524
|
-
"fill-color": "rgba(255, 255, 255, 0.25)"
|
|
1525
|
-
// "circle-radius": 6,
|
|
1526
|
-
// "circle-fill-color": "rgb(51,112,255, 1)"
|
|
1527
|
-
},
|
|
1528
|
-
new Style(circleStyle)
|
|
1529
|
-
]
|
|
1530
|
-
}), (n = mapInstance.value) == null || n.addInteraction(draw), createMeasureTooltip(), createHelpTooltip();
|
|
1531
|
-
let t;
|
|
1532
|
-
draw.on("drawstart", function(a) {
|
|
1533
|
-
var r;
|
|
1534
|
-
layerState = "drawn", sketch = a.feature, t = (r = sketch.getGeometry()) == null ? void 0 : r.on("change", function(l) {
|
|
1535
|
-
const i = l.target;
|
|
1536
|
-
let s = formatArea(i, LENGTH_UNIT.NM);
|
|
1537
|
-
const c = i.getCoordinates()[0], m = new LineString([c[c.length - 2], c[c.length - 1]]);
|
|
1538
|
-
let d = formatLength(m, LENGTH_UNIT.NM);
|
|
1539
|
-
if (lineLimitError = Number(getLength(m) / 1e3) > 150, validateSquareLimit(c), measureTooltipElement && s && (measureTooltipElement.innerHTML = `
|
|
1540
|
-
<span class="text">面积:${s}${lineLimitError || squareLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1541
|
-
`), helpTooltipElement && s) {
|
|
1542
|
-
let f = "";
|
|
1543
|
-
parseFloat(s) > 0 && (f = `
|
|
1544
|
-
<div class="text ${squareLimitError ? "error" : ""}">面积:${s}${squareLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</div>`), helpTooltipElement.innerHTML = `${f}
|
|
1545
|
-
<span class="text ${lineLimitError ? "error" : ""}">线段${c.length - 2}:${d}${lineLimitError ? '<span class="error pl-4">超出可以绘画的距离</span>' : ""}</span>
|
|
1546
|
-
<div><span class="text">单击继续,双击结束</span></div>
|
|
1547
|
-
`;
|
|
1548
|
-
}
|
|
1549
|
-
}), drawnState = "drawing";
|
|
1550
|
-
}), draw.on("drawend", function(a) {
|
|
1551
|
-
if (a.feature.getGeometry()) {
|
|
1552
|
-
storeFeature = a.feature;
|
|
1553
|
-
const r = endFn(a.feature);
|
|
1554
|
-
r != null && r.length && e && e(r);
|
|
1555
|
-
}
|
|
1556
|
-
sketch = null, measureTooltipElement = null, createMeasureTooltip(), t && unByKey(t), drawnState = "drawend";
|
|
1557
|
-
});
|
|
1558
|
-
}, removeInteraction = () => {
|
|
1559
|
-
var e, t, o;
|
|
1560
|
-
if (mapInstance.value) {
|
|
1561
|
-
if (document.querySelectorAll(".ol-tooltip.ol-tooltip-draw-polygon").forEach((n) => {
|
|
1562
|
-
var a;
|
|
1563
|
-
(a = n == null ? void 0 : n.parentNode) == null || a.removeChild(n);
|
|
1564
|
-
}), 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) {
|
|
1565
|
-
const n = mapInstance.value.getInteractions().getArray().find((a) => a.ol_uid === draw.ol_uid);
|
|
1566
|
-
n && ((o = mapInstance.value) == null || o.removeInteraction(n));
|
|
1567
|
-
}
|
|
1568
|
-
drawnState = "undrawn", layerState = "destroyed";
|
|
1569
|
-
}
|
|
1570
|
-
}, endFn = (e) => {
|
|
1571
|
-
var t, o, n;
|
|
1572
|
-
if (e.getGeometry()) {
|
|
1573
|
-
const a = [], l = e.getGeometry().getCoordinates();
|
|
1574
|
-
(t = l[0]) == null || t.forEach((s) => {
|
|
1575
|
-
a.push(transform(s, projection.mercator, projection.data));
|
|
1576
|
-
});
|
|
1577
|
-
const i = l[0][l[0].length - 2];
|
|
1578
|
-
if (i && measureTooltip.setPosition(i), 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", () => {
|
|
1579
|
-
reset();
|
|
1580
|
-
}), !lineLimitError && !squareLimitError)
|
|
1581
|
-
return a;
|
|
1582
|
-
draw && ((n = mapInstance.value) == null || n.removeInteraction(draw)), helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement);
|
|
1583
|
-
}
|
|
1584
|
-
}, initFeature = (e) => {
|
|
1585
|
-
var t, o;
|
|
1586
|
-
if (layerState = "drawn", storeFeature) {
|
|
1587
|
-
const n = storeFeature.getGeometry();
|
|
1588
|
-
if (!n) return;
|
|
1589
|
-
const a = formatArea(n, LENGTH_UNIT.NM);
|
|
1590
|
-
measureTooltipElement && (measureTooltipElement.innerHTML = `
|
|
1591
|
-
<span class="text">面积:${a}${lineLimitError || squareLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1592
|
-
`), (t = drawVector.getSource()) == null || t.addFeature(storeFeature);
|
|
1593
|
-
const r = endFn(storeFeature);
|
|
1594
|
-
r != null && r.length && e && e(r);
|
|
1595
|
-
const l = getCenter(storeFeature.getGeometry().getExtent());
|
|
1596
|
-
(o = mapInstance.value) == null || o.getView().setCenter(l);
|
|
1597
|
-
}
|
|
1598
|
-
}, pointerMoveHandler = function(e) {
|
|
1599
|
-
var o;
|
|
1600
|
-
if (e.dragging)
|
|
1601
|
-
return;
|
|
1602
|
-
let t = "点击选择起点";
|
|
1603
|
-
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");
|
|
1604
|
-
}, init = () => {
|
|
1605
|
-
mapInstance.value && (circleStyle = {
|
|
1606
|
-
image: new CircleStyle({
|
|
1607
|
-
radius: 5,
|
|
1608
|
-
fill: new Fill({
|
|
1609
|
-
color: "rgb(51,112,255, 1)"
|
|
1610
|
-
})
|
|
1611
|
-
}),
|
|
1612
|
-
geometry: function(e) {
|
|
1613
|
-
const t = e.getGeometry().getCoordinates();
|
|
1614
|
-
return new MultiPoint(t);
|
|
1615
|
-
}
|
|
1616
|
-
}, drawVector = new VectorLayer({
|
|
1617
|
-
source,
|
|
1618
|
-
style: new Style({
|
|
1619
|
-
stroke: new Stroke({
|
|
1620
|
-
color: "rgba(255, 255, 255, 1)",
|
|
1621
|
-
width: 2
|
|
1622
|
-
}),
|
|
1623
|
-
fill: new Fill({
|
|
1624
|
-
color: "rgba(255, 255, 255, 0.3)"
|
|
1625
|
-
})
|
|
1626
|
-
})
|
|
1627
|
-
}), mapInstance.value.on("pointermove", pointerMoveHandler), mapInstance.value.getViewport().addEventListener("mouseout", function() {
|
|
1628
|
-
var e;
|
|
1629
|
-
(e = helpTooltipElement == null ? void 0 : helpTooltipElement.classList) == null || e.add("hidden");
|
|
1630
|
-
}), mapInstance.value.on("dblclick", function(e) {
|
|
1631
|
-
drawnState !== "undrawn" && (e.stopPropagation(), e.preventDefault());
|
|
1632
|
-
}));
|
|
1633
|
-
}, reset = () => {
|
|
1634
|
-
removeInteraction(), addInteraction(), storeFeature = null;
|
|
1635
|
-
}, drawPolygonTool = {
|
|
1636
|
-
addInteraction,
|
|
1637
|
-
removeInteraction,
|
|
1638
|
-
initFeature,
|
|
1639
|
-
reset
|
|
1640
|
-
}, _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1641
|
-
__name: "Map",
|
|
1642
|
-
props: {
|
|
1643
|
-
zoom: {},
|
|
1644
|
-
center: {},
|
|
1645
|
-
vehicleMode: {},
|
|
1646
|
-
viewMode: {},
|
|
1647
|
-
mmsi: {},
|
|
1648
|
-
shipData: {}
|
|
1649
|
-
},
|
|
1650
|
-
emits: ["zoomChanged", "extentChanged"],
|
|
1651
|
-
setup(e, { expose: t, emit: o }) {
|
|
1652
|
-
const n = ref(null), a = ref(null), r = ref(null), l = o, i = e, s = ref(i.zoom || mapZoom.default), u = ref(!1), c = ref(!0), m = ref(!0), d = ref(!1);
|
|
1653
|
-
let f;
|
|
1654
|
-
((p) => {
|
|
1655
|
-
p[p.tiandituTile = new TileLayer({ source: new XYZ({ url: baseMap.tiandituTile }) })] = "tiandituTile", p[p.tiandituTileMark = new TileLayer({ source: new XYZ({ url: baseMap.tiandituTileMark }) })] = "tiandituTileMark", p[p.tiandituImgTile = new TileLayer({ source: new XYZ({ url: baseMap.tiandituImgTile }), visible: !1 })] = "tiandituImgTile", p[p.tiandituImgTileMark = new TileLayer({ source: new XYZ({ url: baseMap.tiandituImgTileMark }), visible: !1 })] = "tiandituImgTileMark", p[p.greenMark = new TileLayer({ source: new XYZ({ url: baseMap.greenTile }) })] = "greenMark";
|
|
1656
|
-
})(f || (f = {}));
|
|
1657
|
-
const w = () => {
|
|
1658
|
-
var S, g;
|
|
1659
|
-
const p = {
|
|
1660
|
-
projection: projection.mercator,
|
|
1661
|
-
// 地图投影坐标系
|
|
1662
|
-
zoom: i.zoom || (i.vehicleMode === "ship" ? mapZoom.default : mapZoom.truckDefault),
|
|
1663
|
-
// 地图缩放级别(打开页面时默认级别)
|
|
1664
|
-
minZoom: mapZoom.min,
|
|
1665
|
-
// 地图缩放最小级别
|
|
1666
|
-
maxZoom: mapZoom.max,
|
|
1667
|
-
// 地图缩放最大级别
|
|
1668
|
-
center: lonLatToMercator(i.center || mapDefaultCenter),
|
|
1669
|
-
// 深圳坐标
|
|
1670
|
-
constrainResolution: !1,
|
|
1671
|
-
// 禁用旋转
|
|
1672
|
-
multiWorld: !0
|
|
1673
|
-
};
|
|
1674
|
-
mapInstance.value = new Map$1({
|
|
1675
|
-
target: "map",
|
|
1676
|
-
// 对应页面里 id 为 map 的元素
|
|
1677
|
-
layers: [
|
|
1678
|
-
// 图层
|
|
1679
|
-
f.tiandituTile,
|
|
1680
|
-
f.tiandituTileMark,
|
|
1681
|
-
f.tiandituImgTile,
|
|
1682
|
-
f.tiandituImgTileMark,
|
|
1683
|
-
f.greenMark
|
|
1684
|
-
],
|
|
1685
|
-
view: new View(p)
|
|
1686
|
-
}), (S = a.value) == null || S.setScaleLine(), (g = mapInstance.value) == null || g.on("moveend", T), v(i.vehicleMode === "ship"), h(i.vehicleMode === "ship" ? BaseMapType.satellite : BaseMapType.vector), i.viewMode === "findShip" && i.mmsi && i.shipData && nextTick(() => {
|
|
1687
|
-
findShip(String(i.mmsi), i.shipData);
|
|
1688
|
-
});
|
|
1689
|
-
};
|
|
1690
|
-
onMounted(() => {
|
|
1691
|
-
w();
|
|
1692
|
-
});
|
|
1693
|
-
const v = (p) => {
|
|
1694
|
-
var S;
|
|
1695
|
-
(S = mapInstance.value) == null || S.getLayers().forEach((g) => {
|
|
1696
|
-
g.ol_uid === f.greenMark.ol_uid && (g.setVisible(p), c.value = p);
|
|
1697
|
-
});
|
|
1698
|
-
}, h = (p) => {
|
|
1699
|
-
var S;
|
|
1700
|
-
console.log("mode", p), (S = mapInstance.value) == null || S.getLayers().forEach((g) => {
|
|
1701
|
-
(g.ol_uid === f.tiandituTile.ol_uid || g.ol_uid === f.tiandituTileMark.ol_uid || g.ol_uid === f.tiandituImgTile.ol_uid || g.ol_uid === f.tiandituImgTileMark.ol_uid) && g.setVisible(!1), (p === BaseMapType.vector && (g.ol_uid === f.tiandituTile.ol_uid || g.ol_uid === f.tiandituTileMark.ol_uid) || p === BaseMapType.satellite && (g.ol_uid === f.tiandituImgTile.ol_uid || g.ol_uid === f.tiandituImgTileMark.ol_uid)) && (console.log(p, g.ol_uid), g.setVisible(!0));
|
|
1702
|
-
});
|
|
1703
|
-
}, T = () => {
|
|
1704
|
-
const p = mapInstance.value.getView(), S = p.getZoom();
|
|
1705
|
-
S && E(S);
|
|
1706
|
-
const g = p.calculateExtent(mapInstance.value.getSize());
|
|
1707
|
-
g && S && C(g, S);
|
|
1708
|
-
}, E = (p) => {
|
|
1709
|
-
var I, V, y;
|
|
1710
|
-
s.value = p;
|
|
1711
|
-
const S = (I = mapInstance.value) == null ? void 0 : I.getLayers(), g = i.vehicleMode === "ship" ? S == null ? void 0 : S.getArray().find((k) => k.ol_uid === f.greenMark.ol_uid) : void 0;
|
|
1712
|
-
!u.value && c.value && p < mapZoom.shipGreenDotMax ? (m.value = !0, g == null || g.setVisible(!0), (V = shipsLayer.value) == null || V.setVisible(!1), (y = largeAmountShipsLayer.value) == null || y.setVisible(!1)) : (m.value = !1, g == null || g.setVisible(!1)), l("zoomChanged", p);
|
|
1713
|
-
}, C = (p, S) => {
|
|
1714
|
-
const g = transform([p[0], p[1]], projection.mercator, projection.data), I = transform([p[2], p[3]], projection.mercator, projection.data);
|
|
1715
|
-
l("extentChanged", { extent: [g, I], zoom: S });
|
|
1716
|
-
};
|
|
1717
|
-
return t({
|
|
1718
|
-
mapInstance,
|
|
1719
|
-
initMap: w,
|
|
1720
|
-
renderTrucksMarker,
|
|
1721
|
-
renderShip: renderShips,
|
|
1722
|
-
renderTrack: (p, S, g) => {
|
|
1723
|
-
var I, V;
|
|
1724
|
-
d.value = !0, u.value = !0, hiddenAllShips(), (V = (I = largeAmountShipsLayer.value) == null ? void 0 : I.getSource()) == null || V.clear(), renderTrack(p, S, g, LENGTH_UNIT.NM);
|
|
1725
|
-
},
|
|
1726
|
-
findTruck,
|
|
1727
|
-
removeTruckIcon,
|
|
1728
|
-
clearAllTruck,
|
|
1729
|
-
closeTrack: () => {
|
|
1730
|
-
var p, S;
|
|
1731
|
-
d.value = !1, (p = shipTrackVectorLayer.value) == null || p.setVisible(!1), (S = selectShipsLayer.value) == null || S.setVisible(!0), selectSingleShipData.value && setVisibleFeatureById(selectSingleShipData.value.id, !0);
|
|
1732
|
-
},
|
|
1733
|
-
closeTruckTrack: () => {
|
|
1734
|
-
var p, S;
|
|
1735
|
-
d.value = !1, (p = shipTrackVectorLayer.value) == null || p.setVisible(!1), (S = selectShipsLayer.value) == null || S.setVisible(!0);
|
|
1736
|
-
},
|
|
1737
|
-
resetTrackView,
|
|
1738
|
-
playTrack,
|
|
1739
|
-
clearSelectFeature,
|
|
1740
|
-
findShip,
|
|
1741
|
-
focusShip: (p, S, g = !0) => {
|
|
1742
|
-
var I, V;
|
|
1743
|
-
(I = shipsLayer.value) == null || I.setVisible(g), (V = largeAmountShipsLayer.value) == null || V.setVisible(!1), findShip(p, S);
|
|
1744
|
-
},
|
|
1745
|
-
showTracks,
|
|
1746
|
-
removeAllTrackLayer,
|
|
1747
|
-
switchFilterItem,
|
|
1748
|
-
rerenderShip,
|
|
1749
|
-
switchGreenDot: () => v(!1),
|
|
1750
|
-
zoomTruckIcon,
|
|
1751
|
-
renderTruckTrack: (p, S, g) => {
|
|
1752
|
-
d.value = !0, renderTrack(p, S, g, LENGTH_UNIT.KM, "truck");
|
|
1753
|
-
},
|
|
1754
|
-
removerLayer: removeShipTrackLineFeatureByIndex,
|
|
1755
|
-
renderMarker,
|
|
1756
|
-
setMarkerPosition,
|
|
1757
|
-
getZoomAndCenter: () => {
|
|
1758
|
-
var V;
|
|
1759
|
-
const p = (V = mapInstance.value) == null ? void 0 : V.getView();
|
|
1760
|
-
if (!p) return null;
|
|
1761
|
-
const S = parseInt(String(p.getZoom())), { lon: g, lat: I } = mercatorToLonLat(p.getCenter());
|
|
1762
|
-
return { zoom: S, center: [g, I] };
|
|
1763
|
-
},
|
|
1764
|
-
drawPolygonTool
|
|
1765
|
-
}), (p, S) => (openBlock(), createElementBlock("div", {
|
|
1766
|
-
class: "map-page map-container",
|
|
1767
|
-
ref_key: "pageRef",
|
|
1768
|
-
ref: n
|
|
1769
|
-
}, [
|
|
1770
|
-
S[0] || (S[0] = createElementVNode("div", {
|
|
1771
|
-
id: "map",
|
|
1772
|
-
class: "map"
|
|
1773
|
-
}, null, -1)),
|
|
1774
|
-
createVNode(ToolPanel, {
|
|
1775
|
-
"vehicle-mode": p.vehicleMode,
|
|
1776
|
-
"view-mode": p.viewMode,
|
|
1777
|
-
"disable-green-dot": u.value,
|
|
1778
|
-
"show-track-layer": d.value,
|
|
1779
|
-
onSwitchGreenDot: v,
|
|
1780
|
-
onSwitchMapTile: h
|
|
1781
|
-
}, {
|
|
1782
|
-
toolPanel: withCtx(() => [
|
|
1783
|
-
renderSlot(p.$slots, "toolPanel", {}, void 0, !0)
|
|
1784
|
-
]),
|
|
1785
|
-
_: 3
|
|
1786
|
-
}, 8, ["vehicle-mode", "view-mode", "disable-green-dot", "show-track-layer"]),
|
|
1787
|
-
p.viewMode !== "WxMiniprogram" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
1788
|
-
createVNode(ScaleLine, {
|
|
1789
|
-
ref_key: "scaleLineControl",
|
|
1790
|
-
ref: a
|
|
1791
|
-
}, null, 512),
|
|
1792
|
-
createVNode(ZoomControl, {
|
|
1793
|
-
ref_key: "zoomControl",
|
|
1794
|
-
ref: r
|
|
1795
|
-
}, null, 512)
|
|
1796
|
-
], 64)) : createCommentVNode("", !0),
|
|
1797
|
-
createVNode(Copyright)
|
|
1798
|
-
], 512));
|
|
1799
|
-
}
|
|
1800
|
-
}), Map = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-bfb8b74c"]]), ZhMap = withInstall(Map);
|
|
1801
|
-
export {
|
|
1802
|
-
ZhMap as Z
|
|
1803
|
-
};
|