zhihao-ui 1.2.7 → 1.2.8
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-CboHDiqp.js → BaseInfo-Dv-eon6t.js} +1 -1
- package/dist/es/Button-DBbUF88w.js +51 -0
- package/dist/es/{DatePicker-AcRbvS-8.js → DatePicker-CWQoV03Q.js} +13 -13
- package/dist/es/{DetailHeader-CoaVXtN3.js → DetailHeader-C_mAB8-2.js} +3 -3
- package/dist/es/{DetailSubTitle-Csp4LjFx.js → DetailSubTitle-DD7Yllhf.js} +2 -2
- package/dist/es/Dialog-DyDSVm-6.js +109 -0
- package/dist/es/{DiyDataTable-CP7yYQaU.js → DiyDataTable-cJVfvtax.js} +4 -4
- package/dist/es/{EditInfoPair-DBbRqppY.js → EditInfoPair-D0b5jY5Y.js} +3 -3
- package/dist/es/{FileWrapper-BwQhQopY.js → FileWrapper-CMSYWmEz.js} +4 -4
- package/dist/es/{Grid-B-FutGih.js → Grid-B5O9dZNI.js} +1 -1
- package/dist/es/{InfoPair-WmMCXoUh.js → InfoPair-Do3sSVw-.js} +3 -3
- package/dist/es/{Input-DFnH7_jo.js → Input-DVpd0Yte.js} +11 -11
- package/dist/es/{Loading-BW6Doqh_.js → Loading-DwtfOhMD.js} +2 -2
- package/dist/es/{Map-IjNHD4K5.js → Map-CMiThYaG.js} +641 -315
- package/dist/es/MessageBox-BowhqMYW.js +48 -0
- package/dist/es/{MoneyInput-BwkFhS2B.js → MoneyInput-CaTrJLi1.js} +7 -7
- package/dist/es/{PageHeadPanel-BhR3Bq1A.js → PageHeadPanel-_mKu2rMQ.js} +2 -2
- package/dist/es/{ToolTips-BEYXkt4n.js → ToolTips-BTCP0N--.js} +3 -3
- package/dist/es/index.js +30 -28
- package/dist/es/{utils-B1dH8Kx6.js → utils-DZ8-2Fg2.js} +1 -1
- package/dist/es/{vendor-Cu-cEPs_.js → vendor-BY-fHNA3.js} +9646 -8896
- package/dist/index.css +1 -1
- package/dist/types/components/ButtonGroup/ButtonGroup.test.d.ts +1 -0
- package/dist/types/components/ButtonGroup/ButtonGroup.vue.d.ts +37 -0
- package/dist/types/components/ButtonGroup/index.d.ts +38 -0
- package/dist/types/components/Dialog/Dialog.test.d.ts +1 -0
- package/dist/types/components/Dialog/Dialog.vue.d.ts +187 -14
- package/dist/types/components/Dialog/index.d.ts +296 -25
- package/dist/types/components/Dialog/types.d.ts +15 -5
- package/dist/types/components/Map/Map.vue.d.ts +15 -5
- package/dist/types/components/Map/index.d.ts +27 -0
- package/dist/types/components/Map/interface/entity/render.d.ts +32 -0
- package/dist/types/components/Map/interface/entity/shipInfoVo.d.ts +4 -0
- package/dist/types/components/Map/interface/index.d.ts +1 -0
- package/dist/types/components/Map/render/canvasRender/canvasRender.d.ts +5 -3
- package/dist/types/components/Map/render/drawPolygon.d.ts +9 -0
- package/dist/types/components/MessageBox/MessageBox.test.d.ts +1 -0
- package/dist/types/components/MessageBox/MessageBox.vue.d.ts +11 -218
- package/dist/types/components/MessageBox/index.d.ts +4 -342
- package/dist/types/components/index.d.ts +1 -0
- package/dist/umd/index.css +1 -1
- package/dist/umd/index.umd.cjs +25 -17
- package/package.json +1 -1
- package/dist/es/Button-C1Q6WvkI.js +0 -32
- package/dist/es/Dialog-CtU-qGdR.js +0 -74
- package/dist/es/MessageBox-CjuBt74R.js +0 -100
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var R = (e, t, o) => t in e ?
|
|
3
|
-
var
|
|
1
|
+
var A = Object.defineProperty;
|
|
2
|
+
var R = (e, t, o) => t in e ? A(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
|
|
3
|
+
var T = (e, t, o) => R(e, typeof t != "symbol" ? t + "" : t, o);
|
|
4
4
|
import { ref, defineComponent, useModel, watch, resolveComponent, openBlock, createElementBlock, createElementVNode, createVNode, withCtx, Fragment, renderList, unref, createBlock, toDisplayString, createCommentVNode, mergeModels, normalizeClass, nextTick, onMounted } from "vue";
|
|
5
|
-
import {
|
|
6
|
-
import { _ as _export_sfc } from "./Button-
|
|
7
|
-
import { w as withInstall } from "./utils-
|
|
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, s as ScaleLine$1, T as Text, t as Feature, P as Point, v as fromLonLat, e as cloneDeep, G as GeoJSON, W as WebGLPointsLayer, w as transform, h as hooks, L as LineString, 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-BY-fHNA3.js";
|
|
6
|
+
import { _ as _export_sfc } from "./Button-DBbUF88w.js";
|
|
7
|
+
import { w as withInstall } from "./utils-DZ8-2Fg2.js";
|
|
8
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
9
|
const LENGTH_UNIT_LABEL = {
|
|
10
10
|
1: "M",
|
|
@@ -16,47 +16,47 @@ const LENGTH_UNIT_LABEL = {
|
|
|
16
16
|
};
|
|
17
17
|
var SWITCH_BTN = /* @__PURE__ */ ((e) => (e.Camera = "camera", e.Mobile = "mobile", e.WaterGauge = "waterGauge", e))(SWITCH_BTN || {});
|
|
18
18
|
class ShipMapData {
|
|
19
|
-
constructor(t, o, n, a, r, l, s,
|
|
20
|
-
|
|
19
|
+
constructor(t, o, n, a, r, l, s, i, d, u, p, c, f, g, y, k, L, E, m, v, h, I) {
|
|
20
|
+
T(this, "id");
|
|
21
21
|
// mmsi
|
|
22
|
-
|
|
22
|
+
T(this, "mmsi");
|
|
23
23
|
// 船舶三角形填充色
|
|
24
|
-
|
|
24
|
+
T(this, "fill");
|
|
25
25
|
// 船类型 "7": "货船",
|
|
26
|
-
|
|
26
|
+
T(this, "shipType");
|
|
27
27
|
// 船名
|
|
28
|
-
|
|
28
|
+
T(this, "name");
|
|
29
29
|
// 长度
|
|
30
|
-
|
|
30
|
+
T(this, "length");
|
|
31
31
|
// 宽度
|
|
32
|
-
|
|
32
|
+
T(this, "breadth");
|
|
33
33
|
// 经度
|
|
34
|
-
|
|
34
|
+
T(this, "lon");
|
|
35
35
|
// 纬度
|
|
36
|
-
|
|
36
|
+
T(this, "lat");
|
|
37
37
|
// 时间
|
|
38
|
-
|
|
38
|
+
T(this, "createdAt");
|
|
39
39
|
// 速度
|
|
40
|
-
|
|
40
|
+
T(this, "speed");
|
|
41
41
|
// 来源
|
|
42
|
-
|
|
42
|
+
T(this, "from");
|
|
43
43
|
// 船状态 "stop":"静止","sail":"航行","work":"作业","danger":"危险","other":"其他"
|
|
44
|
-
|
|
44
|
+
T(this, "sailStatus");
|
|
45
45
|
// 船艏向
|
|
46
|
-
|
|
46
|
+
T(this, "hdg");
|
|
47
47
|
// 航迹向
|
|
48
|
-
|
|
48
|
+
T(this, "cog");
|
|
49
49
|
// 设备定位类型
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
T(this, "posType");
|
|
51
|
+
T(this, "type");
|
|
52
52
|
// 航向角度
|
|
53
|
-
|
|
53
|
+
T(this, "angle");
|
|
54
54
|
// 左侧是否显示色块
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
this.id = t, this.mmsi = o, this.fill = n, this.shipType = a, this.name = r, this.length = l, this.breadth = s, this.lon =
|
|
55
|
+
T(this, "leftIconColor");
|
|
56
|
+
T(this, "existDevice");
|
|
57
|
+
T(this, "existMobile");
|
|
58
|
+
T(this, "existWaterGauge");
|
|
59
|
+
this.id = t, this.mmsi = o, this.fill = n, this.shipType = a, this.name = r, this.length = l, this.breadth = s, this.lon = i, this.lat = d, this.createdAt = u, this.speed = p, this.from = c, this.sailStatus = f, this.hdg = g, this.cog = y, this.posType = k, this.type = L, this.angle = E, this.leftIconColor = m, this.existDevice = v, this.existMobile = h, this.existWaterGauge = I;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
const formatLength = function(e, t) {
|
|
@@ -77,6 +77,19 @@ const formatLength = function(e, t) {
|
|
|
77
77
|
}, convertSixHundredThousandToLatLng = function(e, t) {
|
|
78
78
|
const o = Number(t) / 6e5;
|
|
79
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;
|
|
80
93
|
}, convertShipMapData = (e) => {
|
|
81
94
|
const t = (o) => new ShipMapData(
|
|
82
95
|
o.id,
|
|
@@ -97,7 +110,11 @@ const formatLength = function(e, t) {
|
|
|
97
110
|
o.cog,
|
|
98
111
|
Number(o.postype),
|
|
99
112
|
"other",
|
|
100
|
-
o.cog
|
|
113
|
+
o.cog,
|
|
114
|
+
o.leftIconColor,
|
|
115
|
+
o.existDevice,
|
|
116
|
+
o.existMobile,
|
|
117
|
+
o.existWaterGauge
|
|
101
118
|
);
|
|
102
119
|
return Array.isArray(e) ? e.map((o) => t(o)) : t(e);
|
|
103
120
|
}, mapInstance = ref(), shipsLayer = ref(), selectShipsLayer = ref(), allShips = ref([]), largeAmountShipsLayer = ref();
|
|
@@ -116,10 +133,10 @@ const labels = ref([]), _hoisted_1$4 = {
|
|
|
116
133
|
},
|
|
117
134
|
emits: /* @__PURE__ */ mergeModels(["close"], ["update:visible"]),
|
|
118
135
|
setup(e, { expose: t, emit: o }) {
|
|
119
|
-
const n = o, a = useModel(e, "visible"), r = ref(LENGTH_UNIT.NM), l = ref([]), s = ref(!1),
|
|
120
|
-
let d, u,
|
|
121
|
-
const
|
|
122
|
-
source:
|
|
136
|
+
const n = o, a = useModel(e, "visible"), r = ref(LENGTH_UNIT.NM), l = ref([]), s = ref(!1), i = new VectorSource();
|
|
137
|
+
let d, u, p, c, f;
|
|
138
|
+
const g = new VectorLayer({
|
|
139
|
+
source: i,
|
|
123
140
|
style: {
|
|
124
141
|
"fill-color": "rgba(255, 255, 255, 0.2)",
|
|
125
142
|
"stroke-color": "#ffcc33",
|
|
@@ -127,19 +144,19 @@ const labels = ref([]), _hoisted_1$4 = {
|
|
|
127
144
|
"circle-radius": 7,
|
|
128
145
|
"circle-fill-color": "#ffcc33"
|
|
129
146
|
}
|
|
130
|
-
}),
|
|
131
|
-
if (
|
|
147
|
+
}), y = function(S) {
|
|
148
|
+
if (S.dragging)
|
|
132
149
|
return;
|
|
133
|
-
let
|
|
134
|
-
d && (
|
|
135
|
-
},
|
|
136
|
-
mapInstance.value && (mapInstance.value.on("pointermove",
|
|
137
|
-
var
|
|
138
|
-
(
|
|
150
|
+
let w = "点击选择起点";
|
|
151
|
+
d && (w = "单击继续,双击结束"), u && (u.innerHTML = w, p.setPosition(S.coordinate), u.classList.remove("hidden"));
|
|
152
|
+
}, k = () => {
|
|
153
|
+
mapInstance.value && (mapInstance.value.on("pointermove", y), mapInstance.value.getViewport().addEventListener("mouseout", function() {
|
|
154
|
+
var S;
|
|
155
|
+
(S = u == null ? void 0 : u.classList) == null || S.add("hidden");
|
|
139
156
|
}), s.value = !0);
|
|
140
157
|
};
|
|
141
|
-
let
|
|
142
|
-
const
|
|
158
|
+
let L;
|
|
159
|
+
const E = new Style({
|
|
143
160
|
fill: new Fill({
|
|
144
161
|
color: "rgba(255, 255, 255, 0.2)"
|
|
145
162
|
}),
|
|
@@ -158,110 +175,110 @@ const labels = ref([]), _hoisted_1$4 = {
|
|
|
158
175
|
})
|
|
159
176
|
})
|
|
160
177
|
});
|
|
161
|
-
function
|
|
162
|
-
var
|
|
178
|
+
function m() {
|
|
179
|
+
var S, w;
|
|
163
180
|
l.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((_) => {
|
|
164
|
-
var
|
|
165
|
-
(
|
|
166
|
-
}),
|
|
181
|
+
var M;
|
|
182
|
+
(M = _ == null ? void 0 : _.parentNode) == null || M.removeChild(_);
|
|
183
|
+
}), i.clear(), (S = mapInstance.value) == null || S.removeInteraction(L), (w = mapInstance.value) == null || w.removeLayer(g), u != null && u.parentNode && u.parentNode.removeChild(u);
|
|
167
184
|
}
|
|
168
185
|
function v() {
|
|
169
|
-
var
|
|
170
|
-
|
|
171
|
-
source:
|
|
186
|
+
var w, _;
|
|
187
|
+
m(), (w = mapInstance.value) == null || w.addLayer(g), L = new Draw({
|
|
188
|
+
source: i,
|
|
172
189
|
type: "LineString",
|
|
173
190
|
style: function() {
|
|
174
|
-
return
|
|
191
|
+
return E;
|
|
175
192
|
}
|
|
176
|
-
}), (_ = mapInstance.value) == null || _.addInteraction(
|
|
177
|
-
let
|
|
178
|
-
|
|
193
|
+
}), (_ = mapInstance.value) == null || _.addInteraction(L), I(), h();
|
|
194
|
+
let S;
|
|
195
|
+
L.on("drawstart", function(M) {
|
|
179
196
|
var F;
|
|
180
|
-
d =
|
|
181
|
-
let
|
|
182
|
-
|
|
183
|
-
const N =
|
|
184
|
-
let
|
|
185
|
-
|
|
197
|
+
d = M.feature;
|
|
198
|
+
let b;
|
|
199
|
+
S = (F = d.getGeometry()) == null ? void 0 : F.on("change", function(P) {
|
|
200
|
+
const N = P.target;
|
|
201
|
+
let x = formatLength(N, r.value);
|
|
202
|
+
b = N.getLastCoordinate(), c && x && (c.innerHTML = x), f.setPosition(b);
|
|
186
203
|
});
|
|
187
|
-
}),
|
|
188
|
-
|
|
204
|
+
}), L.on("drawend", function() {
|
|
205
|
+
c && (c.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), c != null && c.innerHTML && l.value.push(c == null ? void 0 : c.innerHTML), f.setOffset([0, -7]), d = null, c = null, I(), S && unByKey(S);
|
|
189
206
|
});
|
|
190
207
|
}
|
|
191
|
-
function
|
|
192
|
-
var
|
|
193
|
-
u != null && u.parentNode && u.parentNode.removeChild(u), u = document.createElement("div"), u.className = "ol-tooltip hidden",
|
|
208
|
+
function h() {
|
|
209
|
+
var S;
|
|
210
|
+
u != null && u.parentNode && u.parentNode.removeChild(u), u = document.createElement("div"), u.className = "ol-tooltip hidden", p = new Overlay({
|
|
194
211
|
element: u,
|
|
195
212
|
offset: [15, 0],
|
|
196
213
|
positioning: "center-left"
|
|
197
|
-
}), (
|
|
214
|
+
}), (S = mapInstance.value) == null || S.addOverlay(p);
|
|
198
215
|
}
|
|
199
|
-
function
|
|
200
|
-
var
|
|
201
|
-
|
|
202
|
-
element:
|
|
216
|
+
function I() {
|
|
217
|
+
var S;
|
|
218
|
+
c != null && c.parentNode && c.parentNode.removeChild(c), c = document.createElement("div"), c.className = "ol-tooltip ol-tooltip-measure", f = new Overlay({
|
|
219
|
+
element: c,
|
|
203
220
|
offset: [0, -15],
|
|
204
221
|
positioning: "bottom-center",
|
|
205
222
|
stopEvent: !1,
|
|
206
223
|
insertFirst: !1
|
|
207
|
-
}), (
|
|
224
|
+
}), (S = mapInstance.value) == null || S.addOverlay(f);
|
|
208
225
|
}
|
|
209
|
-
const
|
|
210
|
-
var
|
|
211
|
-
l.value[
|
|
212
|
-
const
|
|
213
|
-
S
|
|
214
|
-
const _ =
|
|
215
|
-
_[
|
|
216
|
-
},
|
|
226
|
+
const C = (S) => {
|
|
227
|
+
var M, b;
|
|
228
|
+
l.value[S] && l.value.splice(S, 1);
|
|
229
|
+
const w = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
230
|
+
w[S] && ((b = (M = w[S]) == null ? void 0 : M.parentNode) == null || b.removeChild(w[S]));
|
|
231
|
+
const _ = i.getFeatures();
|
|
232
|
+
_[S] && i.removeFeature(_[S]);
|
|
233
|
+
}, V = () => {
|
|
217
234
|
n("close");
|
|
218
235
|
};
|
|
219
236
|
return watch(() => a, () => {
|
|
220
|
-
a && !s.value && (
|
|
237
|
+
a && !s.value && (k(), v());
|
|
221
238
|
}, { deep: !0, immediate: !0 }), t({
|
|
222
239
|
addInteraction: v,
|
|
223
|
-
removeInteraction:
|
|
224
|
-
}), (
|
|
240
|
+
removeInteraction: m
|
|
241
|
+
}), (S, w) => {
|
|
225
242
|
const _ = resolveComponent("el-select");
|
|
226
243
|
return a.value ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
227
244
|
createElementVNode("div", { class: "header" }, [
|
|
228
|
-
|
|
245
|
+
w[1] || (w[1] = createElementVNode("div", { class: "title" }, "测量", -1)),
|
|
229
246
|
createElementVNode("i", {
|
|
230
|
-
onClick:
|
|
247
|
+
onClick: V,
|
|
231
248
|
class: "map-iconfont icon-close"
|
|
232
249
|
})
|
|
233
250
|
]),
|
|
234
251
|
createElementVNode("div", _hoisted_2$2, [
|
|
235
|
-
|
|
252
|
+
w[2] || (w[2] = createElementVNode("div", { class: "tips" }, "在地图上点击多个点测量距离,距离单位", -1)),
|
|
236
253
|
createVNode(_, {
|
|
237
254
|
class: "select-length-unit",
|
|
238
255
|
modelValue: r.value,
|
|
239
|
-
"onUpdate:modelValue":
|
|
256
|
+
"onUpdate:modelValue": w[0] || (w[0] = (M) => r.value = M)
|
|
240
257
|
}, {
|
|
241
258
|
default: withCtx(() => [
|
|
242
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(LENGTH_UNIT_LABEL), (
|
|
243
|
-
key: unref(LENGTH_UNIT)[
|
|
244
|
-
label:
|
|
245
|
-
value: unref(LENGTH_UNIT)[
|
|
259
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(unref(LENGTH_UNIT_LABEL), (M) => (openBlock(), createBlock(unref(ElOption), {
|
|
260
|
+
key: unref(LENGTH_UNIT)[M],
|
|
261
|
+
label: M,
|
|
262
|
+
value: unref(LENGTH_UNIT)[M]
|
|
246
263
|
}, null, 8, ["label", "value"]))), 128))
|
|
247
264
|
]),
|
|
248
265
|
_: 1
|
|
249
266
|
}, 8, ["modelValue"])
|
|
250
267
|
]),
|
|
251
268
|
createElementVNode("div", _hoisted_3$1, [
|
|
252
|
-
(openBlock(!0), createElementBlock(Fragment, null, renderList(l.value, (
|
|
269
|
+
(openBlock(!0), createElementBlock(Fragment, null, renderList(l.value, (M, b) => (openBlock(), createElementBlock("div", {
|
|
253
270
|
class: "measure-history-item",
|
|
254
|
-
key:
|
|
271
|
+
key: b
|
|
255
272
|
}, [
|
|
256
273
|
createElementVNode("div", _hoisted_4, [
|
|
257
|
-
|
|
258
|
-
createElementVNode("span", _hoisted_5, "线段" + toDisplayString(
|
|
259
|
-
createElementVNode("span", _hoisted_6, toDisplayString(
|
|
274
|
+
w[3] || (w[3] = createElementVNode("i", { class: "map-iconfont icon-a-Frame-11" }, null, -1)),
|
|
275
|
+
createElementVNode("span", _hoisted_5, "线段" + toDisplayString(b + 1), 1),
|
|
276
|
+
createElementVNode("span", _hoisted_6, toDisplayString(M), 1)
|
|
260
277
|
]),
|
|
261
278
|
createElementVNode("div", {
|
|
262
279
|
class: "delete-button",
|
|
263
|
-
onClick: (F) =>
|
|
264
|
-
},
|
|
280
|
+
onClick: (F) => C(b)
|
|
281
|
+
}, w[4] || (w[4] = [
|
|
265
282
|
createElementVNode("i", { class: "map-iconfont icon-a-delete1" }, null, -1)
|
|
266
283
|
]), 8, _hoisted_7)
|
|
267
284
|
]))), 128))
|
|
@@ -269,7 +286,7 @@ const labels = ref([]), _hoisted_1$4 = {
|
|
|
269
286
|
])) : createCommentVNode("", !0);
|
|
270
287
|
};
|
|
271
288
|
}
|
|
272
|
-
}), Measure = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-
|
|
289
|
+
}), Measure = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-650abf6f"]]), _hoisted_1$3 = { class: "tool-panel" }, _hoisted_2$1 = { class: "tool-components" }, _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
273
290
|
__name: "toolPanel",
|
|
274
291
|
props: {
|
|
275
292
|
vehicleMode: {}
|
|
@@ -278,36 +295,37 @@ const labels = ref([]), _hoisted_1$4 = {
|
|
|
278
295
|
setup(e, { emit: t }) {
|
|
279
296
|
const o = t, n = ref(!1), a = ref(null), r = ref(!0), l = () => {
|
|
280
297
|
r.value = !r.value, o("switchGreenDot", r.value);
|
|
281
|
-
}, s = ref(BaseMapType.vector),
|
|
298
|
+
}, s = ref(BaseMapType.vector), i = () => {
|
|
282
299
|
s.value = s.value === BaseMapType.vector ? BaseMapType.satellite : BaseMapType.vector, o("switchMapTile", s.value);
|
|
283
300
|
}, d = () => {
|
|
284
|
-
var
|
|
285
|
-
n.value ? (
|
|
301
|
+
var p, c;
|
|
302
|
+
n.value ? (p = a.value) == null || p.removeInteraction() : (c = a.value) == null || c.addInteraction(), n.value = !n.value;
|
|
286
303
|
}, u = () => {
|
|
287
|
-
var
|
|
288
|
-
(
|
|
304
|
+
var p;
|
|
305
|
+
(p = a.value) == null || p.removeInteraction(), n.value = !1;
|
|
289
306
|
};
|
|
290
|
-
return (
|
|
307
|
+
return (p, c) => (openBlock(), createElementBlock(Fragment, null, [
|
|
291
308
|
createElementVNode("div", _hoisted_1$3, [
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
309
|
+
p.vehicleMode === "ship" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
310
|
+
createElementVNode("div", {
|
|
311
|
+
class: normalizeClass(["switch-btn", `${n.value && "active"}`]),
|
|
312
|
+
onClick: d
|
|
313
|
+
}, c[1] || (c[1] = [
|
|
314
|
+
createElementVNode("i", { class: "map-iconfont icon-measure" }, null, -1),
|
|
315
|
+
createElementVNode("div", { class: "button-text" }, "测距", -1)
|
|
316
|
+
]), 2),
|
|
317
|
+
createElementVNode("div", {
|
|
318
|
+
class: normalizeClass(["switch-btn", { active: r.value }]),
|
|
319
|
+
onClick: l
|
|
320
|
+
}, c[2] || (c[2] = [
|
|
321
|
+
createElementVNode("i", { class: "map-iconfont icon-ship" }, null, -1),
|
|
322
|
+
createElementVNode("div", { class: "button-text" }, "绿点", -1)
|
|
323
|
+
]), 2)
|
|
324
|
+
], 64)) : createCommentVNode("", !0),
|
|
307
325
|
createElementVNode("div", {
|
|
308
326
|
class: normalizeClass(["switch-btn", { active: s.value === unref(BaseMapType).satellite }]),
|
|
309
|
-
onClick:
|
|
310
|
-
},
|
|
327
|
+
onClick: i
|
|
328
|
+
}, c[3] || (c[3] = [
|
|
311
329
|
createElementVNode("i", { class: "map-iconfont icon-space" }, null, -1),
|
|
312
330
|
createElementVNode("div", { class: "button-text" }, "卫星", -1)
|
|
313
331
|
]), 2)
|
|
@@ -318,13 +336,13 @@ const labels = ref([]), _hoisted_1$4 = {
|
|
|
318
336
|
ref_key: "measureRef",
|
|
319
337
|
ref: a,
|
|
320
338
|
visible: n.value,
|
|
321
|
-
"onUpdate:visible":
|
|
339
|
+
"onUpdate:visible": c[0] || (c[0] = (f) => n.value = f),
|
|
322
340
|
onClose: u
|
|
323
341
|
}, null, 8, ["visible"])) : createCommentVNode("", !0)
|
|
324
342
|
])
|
|
325
343
|
], 64));
|
|
326
344
|
}
|
|
327
|
-
}), ToolPanel = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-
|
|
345
|
+
}), ToolPanel = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-9c83c550"]]), _hoisted_1$2 = { id: "scale-line-container" }, _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
328
346
|
__name: "scaleLine",
|
|
329
347
|
setup(e, { expose: t }) {
|
|
330
348
|
const o = new ScaleLine$1({
|
|
@@ -386,6 +404,8 @@ const labels = ref([]), _hoisted_1$4 = {
|
|
|
386
404
|
findShip: 13,
|
|
387
405
|
// 船舶绿点图最大显示层级
|
|
388
406
|
shipGreenDotMax: 11,
|
|
407
|
+
// 查车图标显示层级
|
|
408
|
+
truckDefault: 14,
|
|
389
409
|
// 船形图标最小渲染层级
|
|
390
410
|
shipModelMin: 16,
|
|
391
411
|
// 船形图标最大渲染层级
|
|
@@ -484,7 +504,7 @@ function createPoint(e, t, o) {
|
|
|
484
504
|
}, t, o);
|
|
485
505
|
}
|
|
486
506
|
function calculateAngle(e, t, o) {
|
|
487
|
-
const n = convertToRadians(e), a = convertToRadians(t), r = n[0] % 360 * (Math.PI / 180), l = a[0] % 360 * (Math.PI / 180), s = n[1] % 360 * (Math.PI / 180),
|
|
507
|
+
const n = convertToRadians(e), a = convertToRadians(t), r = n[0] % 360 * (Math.PI / 180), l = a[0] % 360 * (Math.PI / 180), s = n[1] % 360 * (Math.PI / 180), i = a[1] % 360 * (Math.PI / 180), d = Math.sin(l - r) * Math.cos(i), u = Math.cos(s) * Math.sin(i) - Math.sin(s) * Math.cos(i) * Math.cos(l - r);
|
|
488
508
|
return 180 * Math.atan2(d, u) % (2 * Math.PI) / Math.PI;
|
|
489
509
|
}
|
|
490
510
|
const getAngle = (e, t) => {
|
|
@@ -505,8 +525,8 @@ const getAngle = (e, t) => {
|
|
|
505
525
|
let t = 0, o = 0, n = 0;
|
|
506
526
|
const a = e.length;
|
|
507
527
|
for (let s = 0; s < a - 1; s++) {
|
|
508
|
-
const [
|
|
509
|
-
n +=
|
|
528
|
+
const [i, d] = e[s], [u, p] = e[s + 1], c = i * p - u * d;
|
|
529
|
+
n += c, t += (i + u) * c, o += (d + p) * c;
|
|
510
530
|
}
|
|
511
531
|
if (n *= 0.5, n === 0)
|
|
512
532
|
throw new Error("多边形面积为零");
|
|
@@ -514,40 +534,40 @@ const getAngle = (e, t) => {
|
|
|
514
534
|
return [r, l];
|
|
515
535
|
}, rotateShapeModel = (e, t) => {
|
|
516
536
|
const [o, n] = calculatePolygonCentroid(e), a = t * Math.PI / 180, r = Math.cos(a), l = Math.sin(a);
|
|
517
|
-
return e.map(([s,
|
|
518
|
-
const d = s - o, u =
|
|
519
|
-
return [
|
|
537
|
+
return e.map(([s, i]) => {
|
|
538
|
+
const d = s - o, u = i - n, p = d * r - u * l + o, c = d * l + u * r + n;
|
|
539
|
+
return [p, c];
|
|
520
540
|
});
|
|
521
541
|
}, getTopLeftPoint = (e) => [e[0], e[3]], getBottomLeftPoint = (e) => [e[2], e[3]], getBottomRightPoint = (e) => [e[2], e[1]], getTopRighttPoint = (e) => [e[0], e[1]];
|
|
522
542
|
function calculateBounds(e, t, o, n, a) {
|
|
523
|
-
let r, l, s,
|
|
543
|
+
let r, l, s, i, d = e[0], u = e[1];
|
|
524
544
|
switch (t) {
|
|
525
545
|
case 0:
|
|
526
|
-
r = d + a, l = r + o,
|
|
546
|
+
r = d + a, l = r + o, i = u - a, s = i - n;
|
|
527
547
|
break;
|
|
528
548
|
case 1:
|
|
529
|
-
r = d + a, l = r + o,
|
|
549
|
+
r = d + a, l = r + o, i = u + n / 2, s = i - n;
|
|
530
550
|
break;
|
|
531
551
|
case 2:
|
|
532
|
-
r = d + a, l = r + o,
|
|
552
|
+
r = d + a, l = r + o, i = u + a + n, s = i - n;
|
|
533
553
|
break;
|
|
534
554
|
case 3:
|
|
535
|
-
r = d - o / 2, l = r + o,
|
|
555
|
+
r = d - o / 2, l = r + o, i = u + a + n, s = i - n;
|
|
536
556
|
break;
|
|
537
557
|
case 4:
|
|
538
|
-
l = d, r = l - o,
|
|
558
|
+
l = d, r = l - o, i = u + a + n, s = i - n;
|
|
539
559
|
break;
|
|
540
560
|
case 5:
|
|
541
|
-
l = d - a, r = l - o,
|
|
561
|
+
l = d - a, r = l - o, i = u + n / 2, s = i - n;
|
|
542
562
|
break;
|
|
543
563
|
case 6:
|
|
544
|
-
l = d, r = l - o,
|
|
564
|
+
l = d, r = l - o, i = u - a, s = i - n;
|
|
545
565
|
break;
|
|
546
566
|
case 7:
|
|
547
|
-
r = d - o / 2, l = r + o,
|
|
567
|
+
r = d - o / 2, l = r + o, i = u - a, s = i - n;
|
|
548
568
|
}
|
|
549
|
-
if (!(!r || !s || !l || !
|
|
550
|
-
return [Math.min(r, l), Math.min(s,
|
|
569
|
+
if (!(!r || !s || !l || !i))
|
|
570
|
+
return [Math.min(r, l), Math.min(s, i), Math.max(r, l), Math.max(s, i) + 1];
|
|
551
571
|
}
|
|
552
572
|
function calculateAnchorPoint(e, t, o = 70, n = 20, a = 20) {
|
|
553
573
|
let r = [0, 0];
|
|
@@ -586,45 +606,104 @@ function drawLabelBody(e, t, o) {
|
|
|
586
606
|
labelHeight: r,
|
|
587
607
|
center: l,
|
|
588
608
|
text: s,
|
|
589
|
-
|
|
609
|
+
leftIcon: i,
|
|
610
|
+
shipColor: d,
|
|
611
|
+
lineLength: u = 20
|
|
590
612
|
} = o;
|
|
591
613
|
e.save(), n && (e.font = n);
|
|
592
|
-
let
|
|
593
|
-
e.restore();
|
|
594
|
-
let
|
|
595
|
-
if (
|
|
596
|
-
let
|
|
614
|
+
let p = e.measureText(s).width + 2 * a;
|
|
615
|
+
(i || d) && (p += r + 4 * a), e.restore();
|
|
616
|
+
let c, f = -1, g = r + 3 * a;
|
|
617
|
+
if (f = 0, c = calculateBounds(l, f, p, g, u), c && f > -1) {
|
|
618
|
+
let y = getBottomLeftPoint(c), k = getTopRighttPoint(c);
|
|
597
619
|
return {
|
|
598
620
|
center: l,
|
|
599
|
-
x: calculateAnchorPoint(l,
|
|
600
|
-
l:
|
|
601
|
-
r:
|
|
602
|
-
bounds:
|
|
603
|
-
position:
|
|
621
|
+
x: calculateAnchorPoint(l, f, p, g, u),
|
|
622
|
+
l: k,
|
|
623
|
+
r: y,
|
|
624
|
+
bounds: c,
|
|
625
|
+
position: f
|
|
604
626
|
};
|
|
605
627
|
}
|
|
606
628
|
return null;
|
|
607
629
|
}
|
|
608
|
-
const drawText = (e, t
|
|
630
|
+
const drawText = (e, t) => {
|
|
609
631
|
if (!e) return;
|
|
632
|
+
const { center: o, text: n, textColor: a, leftIcon: r, rightIcons: l, font: s } = t;
|
|
610
633
|
e.save();
|
|
611
|
-
let [
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
e.
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
634
|
+
let [i, d] = o;
|
|
635
|
+
if (r) {
|
|
636
|
+
e.font = "21px map-iconfont";
|
|
637
|
+
let u = getIconFont(r.icon);
|
|
638
|
+
e.fillStyle = r.color, e.fillText(u, i + labelOutSize - 4, d + 3), i += 22;
|
|
639
|
+
}
|
|
640
|
+
if (l != null && l.length) {
|
|
641
|
+
e.font = "12px map-iconfont", e.fillStyle = "#3370ff";
|
|
642
|
+
let u = e.measureText(n).width + 6;
|
|
643
|
+
l.forEach((p, c) => {
|
|
644
|
+
let f = getIconFont(p), g = 20 * c;
|
|
645
|
+
e.fillText(f, i + u + g, d);
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
e.font = s || labelFont, e.fillStyle = a, e.fillText(n, i, d), e.restore();
|
|
649
|
+
}, drawPolygon = (e, t) => {
|
|
650
|
+
let {
|
|
651
|
+
points: o,
|
|
652
|
+
strokeColor: n,
|
|
653
|
+
fillColor: a,
|
|
654
|
+
shouldClosePath: r,
|
|
655
|
+
translation: l,
|
|
656
|
+
rotation: s,
|
|
657
|
+
rotationCenter: i,
|
|
658
|
+
scale: d,
|
|
659
|
+
globalAlpha: u
|
|
660
|
+
} = t;
|
|
661
|
+
if (u || (u = 1), o && e) {
|
|
662
|
+
e.save(), e.beginPath(), s && s !== 0 && i == null && e.rotate(s), l && e.translate(l[0], l[1]), s && (i != null && i.length) && e.rotate(s), d && e.scale(d, d), e.moveTo(o[0][0], o[0][1]);
|
|
663
|
+
for (let p = 1; p < o.length; p++)
|
|
664
|
+
e.lineTo(o[p][0], o[p][1]);
|
|
665
|
+
r && e.closePath(), n && (e.strokeStyle = n, e.stroke()), a && r && (u && (e.globalAlpha = u), e.fillStyle = a, e.fill()), e.restore();
|
|
619
666
|
}
|
|
620
|
-
}, drawLabel = (e, t
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
667
|
+
}, drawLabel = (e, t) => {
|
|
668
|
+
const { center: o, text: n, color: a, textColor: r, bgColor: l, leftIcon: s, rightIcons: i } = t;
|
|
669
|
+
if (o && n) {
|
|
670
|
+
let d = {
|
|
671
|
+
font: labelFont,
|
|
672
|
+
labelOutSize,
|
|
673
|
+
labelHeight,
|
|
674
|
+
center: o,
|
|
675
|
+
text: n,
|
|
676
|
+
leftIcon: s
|
|
677
|
+
}, u = drawLabelBody(e, labels.value, d);
|
|
678
|
+
if (u) {
|
|
679
|
+
const { x: p, bounds: c, l: f } = u;
|
|
680
|
+
let g = [getTopLeftPoint(c), getBottomLeftPoint(c), getBottomRightPoint(c), getTopRighttPoint(c)];
|
|
681
|
+
labels.value.push(u), drawPolygon(e, {
|
|
682
|
+
points: [o, p],
|
|
683
|
+
strokeColor: a,
|
|
684
|
+
fillColor: "#000",
|
|
685
|
+
shouldClosePath: !0,
|
|
686
|
+
translation: void 0,
|
|
687
|
+
rotation: void 0,
|
|
688
|
+
rotationCenter: void 0,
|
|
689
|
+
scale: void 0,
|
|
690
|
+
globalAlpha: labelAlpha
|
|
691
|
+
}), i != null && i.length && i.forEach(() => {
|
|
692
|
+
g[1][0] += 20, g[2][0] += 20;
|
|
693
|
+
}), drawPolygon(e, {
|
|
694
|
+
points: g,
|
|
695
|
+
strokeColor: a,
|
|
696
|
+
fillColor: l,
|
|
697
|
+
shouldClosePath: !0
|
|
698
|
+
});
|
|
699
|
+
const [L, E] = f, m = {
|
|
700
|
+
center: [L, E + labelOutSize + labelHeight + 1],
|
|
701
|
+
text: n,
|
|
702
|
+
textColor: r,
|
|
703
|
+
leftIcon: s,
|
|
704
|
+
rightIcons: i
|
|
705
|
+
};
|
|
706
|
+
drawText(e, m);
|
|
628
707
|
}
|
|
629
708
|
}
|
|
630
709
|
return null;
|
|
@@ -646,25 +725,25 @@ const setTruckStyle = (e, t, o, n) => new Style({
|
|
|
646
725
|
l.save();
|
|
647
726
|
let s = 1;
|
|
648
727
|
l.scale(s, s);
|
|
649
|
-
let [
|
|
650
|
-
|
|
651
|
-
const u =
|
|
652
|
-
let
|
|
653
|
-
const
|
|
654
|
-
let
|
|
655
|
-
const
|
|
656
|
-
let
|
|
657
|
-
o === CAR_COLOR.YELLOW ? (
|
|
658
|
-
const
|
|
659
|
-
if (l.fillText(
|
|
660
|
-
const
|
|
661
|
-
let
|
|
662
|
-
n.forEach((
|
|
663
|
-
|
|
728
|
+
let [i, d] = a;
|
|
729
|
+
i = i / s - 20, d = d / s;
|
|
730
|
+
const u = i - 70, p = d - 68;
|
|
731
|
+
let c = 180;
|
|
732
|
+
const f = 56, g = "#FFFFFF";
|
|
733
|
+
let y = 176;
|
|
734
|
+
const k = 52;
|
|
735
|
+
let L = "#164AFF", E = "#FFFFFF";
|
|
736
|
+
o === CAR_COLOR.YELLOW ? (y = 176, L = "#FFC81E", E = "rgba(0,0,0,0.88)") : o === CAR_COLOR.Y_GREEN && (c = 200, y = 196, L = "#8FED7C", E = "rgba(0,0,0,0.88)"), n != null && n.length && (c += n.length * 56), fillRectRadius(l, u, p, c, f, g), fillRectRadius(l, u + 2, p + 2, y, k, L), o === CAR_COLOR.Y_GREEN && fillRectRadius(l, u + 2, p + 2, 68, k, "#FFC81E"), l.save(), l.restore(), l.fillStyle = E, l.font = "bold 28px Arial", l.textAlign = "left", l.textBaseline = "middle";
|
|
737
|
+
const m = `${t.slice(0, 2) + " · " + t.slice(2)}`;
|
|
738
|
+
if (l.fillText(m, u + 12, p + 32), l.save(), l.restore(), n != null && n.length) {
|
|
739
|
+
const h = l.measureText(m).width + 12;
|
|
740
|
+
let I = 0;
|
|
741
|
+
n.forEach((C) => {
|
|
742
|
+
C === DEVICE_TYPE.CAMERA && (l.drawImage(cameraImage, i - 54 + h + I * 56, d - 64, 50, 50), ++I), C === DEVICE_TYPE.LOAD && (l.drawImage(loadImage, i - 54 + h + I * 56, d - 64, 50, 50), ++I);
|
|
664
743
|
});
|
|
665
744
|
}
|
|
666
745
|
const v = dotImage;
|
|
667
|
-
l.drawImage(v,
|
|
746
|
+
l.drawImage(v, i + c / 2 - 90, d, 50 / s, 50 / s), l.restore();
|
|
668
747
|
}
|
|
669
748
|
});
|
|
670
749
|
ref([]);
|
|
@@ -770,17 +849,17 @@ const renderTrucksMarker = (e) => {
|
|
|
770
849
|
const n = mapInstance.value.getView().getZoom();
|
|
771
850
|
if (!n) return;
|
|
772
851
|
let a = [];
|
|
773
|
-
const [r, l] = drawShipModelByZoom[n] || [0, 0], [s,
|
|
852
|
+
const [r, l] = drawShipModelByZoom[n] || [0, 0], [s, i] = o;
|
|
774
853
|
if (n <= mapZoom.shipModelMax && n > mapZoom.shipModelMin && t.length >= r && t.breadth >= l)
|
|
775
854
|
a = rotateShapeModel(drawCurrentShipShapeModel(t, n), t.angle).map((u) => {
|
|
776
|
-
const [
|
|
777
|
-
return [s +
|
|
855
|
+
const [p, c] = u;
|
|
856
|
+
return [s + p, i + c];
|
|
778
857
|
});
|
|
779
858
|
else {
|
|
780
859
|
const d = rotateShapeModel(triangleModel, t.angle);
|
|
781
860
|
o.length === 2 && (a = d.map((u) => {
|
|
782
|
-
const [
|
|
783
|
-
return [s +
|
|
861
|
+
const [p, c] = u;
|
|
862
|
+
return [s + p, i + c];
|
|
784
863
|
}));
|
|
785
864
|
}
|
|
786
865
|
if (!(a.length > 2)) return !1;
|
|
@@ -792,8 +871,8 @@ const renderTrucksMarker = (e) => {
|
|
|
792
871
|
const [n, a] = o[0], r = getShipDirectPath(t);
|
|
793
872
|
if (r) {
|
|
794
873
|
let l = r.map(function(s) {
|
|
795
|
-
let [
|
|
796
|
-
return [
|
|
874
|
+
let [i, d] = s;
|
|
875
|
+
return [i + n, d + a];
|
|
797
876
|
});
|
|
798
877
|
if (e.save(), e.beginPath(), t.angle > 0) {
|
|
799
878
|
e.translate(n, a);
|
|
@@ -802,8 +881,8 @@ const renderTrucksMarker = (e) => {
|
|
|
802
881
|
}
|
|
803
882
|
e.moveTo(n, a);
|
|
804
883
|
for (let s = 1; s < l.length; s++) {
|
|
805
|
-
let [
|
|
806
|
-
e.lineTo(
|
|
884
|
+
let [i, d] = l[s];
|
|
885
|
+
e.lineTo(i, d);
|
|
807
886
|
}
|
|
808
887
|
e.strokeStyle = "#000", e.lineWidth = 1, e.stroke(), e.restore();
|
|
809
888
|
}
|
|
@@ -815,7 +894,18 @@ const renderTrucksMarker = (e) => {
|
|
|
815
894
|
e.beginPath(), e.moveTo(o + s, r), e.lineTo(o, r), e.lineTo(o, r - s), e.moveTo(o, n + s), e.lineTo(o, n), e.lineTo(o + s, n), e.moveTo(a - s, n), e.lineTo(a, n), e.lineTo(a, n + s), e.moveTo(a, r - s), e.lineTo(a, r), e.lineTo(a - s, r), e.stroke(), e.restore();
|
|
816
895
|
}, drawShipLabel = (e, t, o) => {
|
|
817
896
|
const [n, a] = o, r = n - 0, l = a - 0, s = t.name;
|
|
818
|
-
|
|
897
|
+
let i;
|
|
898
|
+
t.leftIconColor && (i = { color: t.leftIconColor, icon: "" });
|
|
899
|
+
let d = getShipCustomIcon(t);
|
|
900
|
+
drawLabel(e, {
|
|
901
|
+
center: [r, l],
|
|
902
|
+
text: s,
|
|
903
|
+
color: "#fff",
|
|
904
|
+
textColor: "#000",
|
|
905
|
+
bgColor: "#fff",
|
|
906
|
+
leftIcon: i,
|
|
907
|
+
rightIcons: d
|
|
908
|
+
});
|
|
819
909
|
}, drawCurrentShipShapeModel = (e, t) => {
|
|
820
910
|
let o = 0;
|
|
821
911
|
t === 17 ? o = 0.425 : t === 18 && (o = 0.857);
|
|
@@ -833,6 +923,9 @@ const renderTrucksMarker = (e) => {
|
|
|
833
923
|
}
|
|
834
924
|
}
|
|
835
925
|
return r;
|
|
926
|
+
}, getShipCustomIcon = (e) => {
|
|
927
|
+
let t = [];
|
|
928
|
+
return e.existDevice && t.push(""), e.existMobile && t.push(""), e.existWaterGauge && t.push(""), t || [];
|
|
836
929
|
};
|
|
837
930
|
let shipsMarkerList = [], shipsVectorSource, largeAmountShipsSource;
|
|
838
931
|
const selectedShipData = ref(null);
|
|
@@ -904,7 +997,7 @@ const renderShips = (e) => {
|
|
|
904
997
|
let t = cloneDeep(e);
|
|
905
998
|
return t = t.filter((o) => {
|
|
906
999
|
var a, r, l;
|
|
907
|
-
let n = getFilterItem(o).every(({ btnShow: s, value:
|
|
1000
|
+
let n = getFilterItem(o).every(({ btnShow: s, value: i }) => s ? !!i : !0);
|
|
908
1001
|
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;
|
|
909
1002
|
}), t;
|
|
910
1003
|
}, getFilterItem = (e) => [
|
|
@@ -926,13 +1019,13 @@ const renderShips = (e) => {
|
|
|
926
1019
|
ship: t,
|
|
927
1020
|
lonlat: o,
|
|
928
1021
|
feature: n
|
|
929
|
-
}), selectShipsVectorSource = new VectorSource({
|
|
1022
|
+
}), selectShipsVectorSource == null || selectShipsVectorSource.clear(), selectShipsVectorSource = new VectorSource({
|
|
930
1023
|
features: [n]
|
|
931
1024
|
}), selectShipsLayer.value = new VectorLayer({
|
|
932
1025
|
source: selectShipsVectorSource
|
|
933
1026
|
}), mapInstance.value.addLayer(selectShipsLayer.value), selectShipsLayer.value.setVisible(!0), selectShipsLayer.value;
|
|
934
1027
|
}, findShip = (e, t, o = !0) => {
|
|
935
|
-
var a, r, l, s,
|
|
1028
|
+
var a, r, l, s, i;
|
|
936
1029
|
if (!e || !mapInstance.value) return;
|
|
937
1030
|
const n = (l = (r = (a = shipsLayer.value) == null ? void 0 : a.getSource()) == null ? void 0 : r.getFeatures()) == null ? void 0 : l.find((d) => {
|
|
938
1031
|
var u;
|
|
@@ -941,16 +1034,16 @@ const renderShips = (e) => {
|
|
|
941
1034
|
if (n)
|
|
942
1035
|
selectedShipData.value = n;
|
|
943
1036
|
else if (t)
|
|
944
|
-
selectedShipData.value = t
|
|
1037
|
+
selectedShipData.value = t;
|
|
945
1038
|
else {
|
|
946
1039
|
console.error("找不到船舶");
|
|
947
1040
|
return;
|
|
948
1041
|
}
|
|
949
|
-
if (o && ((s = selectedShipData.value) != null && s.lon) && ((
|
|
1042
|
+
if (selectSingleShipMarker(t), o && ((s = selectedShipData.value) != null && s.lon) && ((i = selectedShipData.value) != null && i.lat)) {
|
|
950
1043
|
const d = mapInstance.value.getView(), u = new Point([selectedShipData.value.lon, selectedShipData.value.lat]);
|
|
951
1044
|
d.setCenter(transform(u.getCoordinates(), projection.data, projection.mercator));
|
|
952
|
-
const
|
|
953
|
-
d.setZoom(
|
|
1045
|
+
const p = d.getZoom(), c = p < mapZoom.findShip ? mapZoom.findShip : p;
|
|
1046
|
+
d.setZoom(c);
|
|
954
1047
|
}
|
|
955
1048
|
return n;
|
|
956
1049
|
}, clearSelectFeature = () => {
|
|
@@ -975,21 +1068,21 @@ const renderShips = (e) => {
|
|
|
975
1068
|
var r, l;
|
|
976
1069
|
const n = e[t];
|
|
977
1070
|
if (!n) return;
|
|
978
|
-
(r = trackLineVectorSource.value) == null || r.clear(), trackList$1.value = [], trackList$1.value = n.reverse().map((s,
|
|
1071
|
+
(r = trackLineVectorSource.value) == null || r.clear(), trackList$1.value = [], trackList$1.value = n.reverse().map((s, i) => (s.center = [s.lon, s.lat], s.centerPoint = lonLatToMercator(s.center), s.id = t, s.index = i, s.time = hooks(s.createdAt).format("YYYY-MM-DD HH:mm:ss"), s));
|
|
979
1072
|
let a = trackList$1.value.map((s) => s.centerPoint);
|
|
980
1073
|
if (a.length >= 2) {
|
|
981
1074
|
let s = new LineString(a);
|
|
982
|
-
const
|
|
983
|
-
|
|
1075
|
+
const i = new Feature({ geometry: s });
|
|
1076
|
+
i.setStyle(
|
|
984
1077
|
new Style({
|
|
985
1078
|
stroke: new Stroke({
|
|
986
1079
|
color: o,
|
|
987
1080
|
width: 2
|
|
988
1081
|
})
|
|
989
1082
|
})
|
|
990
|
-
),
|
|
1083
|
+
), i.setId(t), i.set("type", "line");
|
|
991
1084
|
const d = shipTrackLineFeatures.value.findIndex((u) => u.getId() === t);
|
|
992
|
-
d >= 0 ? shipTrackLineFeatures.value[d] =
|
|
1085
|
+
d >= 0 ? shipTrackLineFeatures.value[d] = i : shipTrackLineFeatures.value.push(i), trackLineVectorSource.value = new VectorSource({
|
|
993
1086
|
features: shipTrackLineFeatures.value
|
|
994
1087
|
}), shipTrackVectorLayer.value = new VectorLayer({
|
|
995
1088
|
source: trackLineVectorSource.value
|
|
@@ -1004,34 +1097,34 @@ const renderShips = (e) => {
|
|
|
1004
1097
|
let o = { 16: 24, 17: 15, default: 4 }, n = [], a = t.length;
|
|
1005
1098
|
for (let s = 0; s < a; s++) {
|
|
1006
1099
|
t[s].index = s;
|
|
1007
|
-
let
|
|
1008
|
-
if (
|
|
1009
|
-
let d =
|
|
1100
|
+
let i = mapInstance.value.getPixelFromCoordinate(t[s].centerPoint);
|
|
1101
|
+
if (i) {
|
|
1102
|
+
let d = i.concat(i);
|
|
1010
1103
|
d = adjustBounds(d, [20, 20]);
|
|
1011
1104
|
let u = mapInstance.value.getView().getZoom();
|
|
1012
1105
|
if (!u) return;
|
|
1013
1106
|
if (u > 15) {
|
|
1014
|
-
let
|
|
1015
|
-
d = adjustBounds(d, [
|
|
1107
|
+
let c = o[u] || o.default;
|
|
1108
|
+
d = adjustBounds(d, [c, c]);
|
|
1016
1109
|
}
|
|
1017
|
-
let
|
|
1110
|
+
let p = !0;
|
|
1018
1111
|
if (t[s].state !== "0") {
|
|
1019
|
-
for (let
|
|
1020
|
-
if (isOverlapping(d, n[
|
|
1021
|
-
|
|
1112
|
+
for (let c = 0; c < n.length; c++)
|
|
1113
|
+
if (isOverlapping(d, n[c].bounds)) {
|
|
1114
|
+
p = !1;
|
|
1022
1115
|
break;
|
|
1023
1116
|
}
|
|
1024
1117
|
}
|
|
1025
|
-
|
|
1118
|
+
p && (t[s].bounds = d, n.push(t[s]));
|
|
1026
1119
|
}
|
|
1027
1120
|
}
|
|
1028
1121
|
const r = getIconStyle(stopIcon), l = getIconStyle(slowIcon);
|
|
1029
1122
|
n.forEach((s) => {
|
|
1030
|
-
var u,
|
|
1031
|
-
let
|
|
1123
|
+
var u, p;
|
|
1124
|
+
let i = new Feature({
|
|
1032
1125
|
geometry: new Point(s.centerPoint)
|
|
1033
1126
|
});
|
|
1034
|
-
|
|
1127
|
+
i.set("type", "track_point"), i.set("data", s), i.setStyle(
|
|
1035
1128
|
new Style({
|
|
1036
1129
|
image: new CircleStyle({
|
|
1037
1130
|
fill: new Fill({ color: e }),
|
|
@@ -1039,26 +1132,26 @@ const renderShips = (e) => {
|
|
|
1039
1132
|
radius: 3
|
|
1040
1133
|
})
|
|
1041
1134
|
})
|
|
1042
|
-
), trackLineVectorSource.value.addFeature(
|
|
1135
|
+
), trackLineVectorSource.value.addFeature(i);
|
|
1043
1136
|
const d = new Feature({
|
|
1044
1137
|
geometry: new Point(fromLonLat(s.center))
|
|
1045
1138
|
});
|
|
1046
1139
|
if (d.set("type", "track_label"), d.setStyle(
|
|
1047
1140
|
setTrackLabelStyle(s, e)
|
|
1048
1141
|
), console.log("trackLabelFeature"), trackLineVectorSource.value.addFeature(d), typeof s == "object" && s.hasOwnProperty("state")) {
|
|
1049
|
-
let
|
|
1142
|
+
let c = new Feature({
|
|
1050
1143
|
geometry: new Point(s.centerPoint)
|
|
1051
1144
|
});
|
|
1052
|
-
|
|
1053
|
-
let
|
|
1145
|
+
c.set("type", "track_icon");
|
|
1146
|
+
let f = new Style({
|
|
1054
1147
|
text: new Text({
|
|
1055
|
-
font: "Normal 22px iconfont",
|
|
1148
|
+
font: "Normal 22px map-iconfont",
|
|
1056
1149
|
text: getIconFont(dropletsIcon),
|
|
1057
1150
|
offsetY: -10
|
|
1058
1151
|
}),
|
|
1059
1152
|
zIndex: 99
|
|
1060
|
-
}),
|
|
1061
|
-
s.state === "0" ? ((u =
|
|
1153
|
+
}), g = [];
|
|
1154
|
+
s.state === "0" ? ((u = f.getText()) == null || u.setFill(new Fill({ color: stopColor })), g.push(r)) : ((p = f.getText()) == null || p.setFill(new Fill({ color: slowColor })), g.push(l)), g.push(f), c.setStyle(g), trackLineVectorSource.value.addFeature(c);
|
|
1062
1155
|
}
|
|
1063
1156
|
}), renderArrow(n, e), renderIconPoint();
|
|
1064
1157
|
}, renderArrow = (e, t) => {
|
|
@@ -1069,10 +1162,10 @@ const renderShips = (e) => {
|
|
|
1069
1162
|
if (l % 2 === 0)
|
|
1070
1163
|
a = trackList$1.value[l].centerPoint;
|
|
1071
1164
|
else {
|
|
1072
|
-
let s = trackList$1.value[Math.floor(l)],
|
|
1073
|
-
if (s &&
|
|
1074
|
-
let [d, u] = s.centerPoint, [
|
|
1075
|
-
a = [(d +
|
|
1165
|
+
let s = trackList$1.value[Math.floor(l)], i = trackList$1.value[Math.ceil(l)];
|
|
1166
|
+
if (s && i) {
|
|
1167
|
+
let [d, u] = s.centerPoint, [p, c] = i.centerPoint;
|
|
1168
|
+
a = [(d + p) / 2, (u + c) / 2];
|
|
1076
1169
|
}
|
|
1077
1170
|
}
|
|
1078
1171
|
if (a) {
|
|
@@ -1082,7 +1175,7 @@ const renderShips = (e) => {
|
|
|
1082
1175
|
s.set("type", "track_arrow"), s.setStyle(
|
|
1083
1176
|
new Style({
|
|
1084
1177
|
text: new Text({
|
|
1085
|
-
font: "700 14px iconfont",
|
|
1178
|
+
font: "700 14px map-iconfont",
|
|
1086
1179
|
text: getIconFont(""),
|
|
1087
1180
|
fill: new Fill({ color: t }),
|
|
1088
1181
|
rotation: getAngle(
|
|
@@ -1105,7 +1198,7 @@ const renderShips = (e) => {
|
|
|
1105
1198
|
r.setStyle(
|
|
1106
1199
|
new Style({
|
|
1107
1200
|
text: new Text({
|
|
1108
|
-
font: "Normal 14px iconfont",
|
|
1201
|
+
font: "Normal 14px map-iconfont",
|
|
1109
1202
|
text: getIconFont(e),
|
|
1110
1203
|
fill: new Fill({ color: l })
|
|
1111
1204
|
}),
|
|
@@ -1115,8 +1208,14 @@ const renderShips = (e) => {
|
|
|
1115
1208
|
});
|
|
1116
1209
|
}, setTrackLabelStyle = (e, t) => new Style({
|
|
1117
1210
|
renderer: (o, n) => {
|
|
1118
|
-
const a = n.context
|
|
1119
|
-
|
|
1211
|
+
const a = n.context, s = {
|
|
1212
|
+
center: o,
|
|
1213
|
+
text: e.time,
|
|
1214
|
+
color: t,
|
|
1215
|
+
textColor: "#000",
|
|
1216
|
+
bgColor: "rgba(255,255,255,.8)"
|
|
1217
|
+
};
|
|
1218
|
+
drawLabel(a, s);
|
|
1120
1219
|
}
|
|
1121
1220
|
}), showTracks = ref([]), trackList = ref([]);
|
|
1122
1221
|
ref(null);
|
|
@@ -1124,22 +1223,22 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, a = "ship")
|
|
|
1124
1223
|
var u;
|
|
1125
1224
|
if (nextTick(() => {
|
|
1126
1225
|
hiddenAllShips();
|
|
1127
|
-
}).then((
|
|
1226
|
+
}).then((p) => {
|
|
1128
1227
|
}), (t == null ? void 0 : t.length) < 2) {
|
|
1129
|
-
((u = showTracks.value) == null ? void 0 : u.findIndex((
|
|
1228
|
+
((u = showTracks.value) == null ? void 0 : u.findIndex((p) => p.id === e)) < 0 && showTracks.value.push({ id: e, length: "" });
|
|
1130
1229
|
return;
|
|
1131
1230
|
}
|
|
1132
1231
|
let r = {};
|
|
1133
|
-
t.forEach((
|
|
1134
|
-
|
|
1232
|
+
t.forEach((p) => {
|
|
1233
|
+
p.state ? p.state = Number(p.state) : delete p.state;
|
|
1135
1234
|
}), trackId.value = e, r[e] = t, trackList.value = t;
|
|
1136
1235
|
const l = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], s = r[e].map(
|
|
1137
|
-
(
|
|
1138
|
-
),
|
|
1236
|
+
(p) => transform([p.lon, p.lat], projection.data, projection.mercator)
|
|
1237
|
+
), i = new LineString(s), d = formatLength(i, n) || "--";
|
|
1139
1238
|
nextTick(() => {
|
|
1140
|
-
var
|
|
1141
|
-
const
|
|
1142
|
-
|
|
1239
|
+
var c;
|
|
1240
|
+
const p = (c = showTracks.value) == null ? void 0 : c.findIndex((f) => f.id === e);
|
|
1241
|
+
p < 0 ? showTracks.value.push({ id: e, length: d }) : showTracks.value[p].length = d, renderTrackLine(r, e, o), ++cursor.value, cursor.value > l.length && (cursor.value = 0), resetTrackView(e);
|
|
1143
1242
|
}).then(() => {
|
|
1144
1243
|
});
|
|
1145
1244
|
}, removeAllTrackLayer = () => {
|
|
@@ -1155,9 +1254,9 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, a = "ship")
|
|
|
1155
1254
|
console.log(r);
|
|
1156
1255
|
}
|
|
1157
1256
|
}, drawCustomContent = (e, t, o, n = "top-left", a = !1) => {
|
|
1158
|
-
var u,
|
|
1257
|
+
var u, p;
|
|
1159
1258
|
if (!t || !mapInstance.value) return;
|
|
1160
|
-
document.querySelectorAll(".truck-custom-content").forEach((
|
|
1259
|
+
document.querySelectorAll(".truck-custom-content").forEach((c) => c.parentNode.removeChild(c));
|
|
1161
1260
|
const r = document.createElement("div");
|
|
1162
1261
|
r.innerHTML = o;
|
|
1163
1262
|
const l = new Overlay({
|
|
@@ -1169,31 +1268,31 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, a = "ship")
|
|
|
1169
1268
|
// 设置不阻拦事件
|
|
1170
1269
|
});
|
|
1171
1270
|
if (a) {
|
|
1172
|
-
let
|
|
1173
|
-
r.addEventListener("mousedown", function(
|
|
1174
|
-
var
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
],
|
|
1179
|
-
}), document.addEventListener("mousemove", function(
|
|
1180
|
-
var
|
|
1181
|
-
if (
|
|
1182
|
-
let
|
|
1183
|
-
l.setPosition([
|
|
1271
|
+
let c = !1, f = [0, 0], g = [0, 0];
|
|
1272
|
+
r.addEventListener("mousedown", function(y) {
|
|
1273
|
+
var k;
|
|
1274
|
+
c = !0, y.clientX, y.clientY, f = (k = mapInstance.value) == null ? void 0 : k.getCoordinateFromPixel([y.clientX - 200, y.clientY - 200]), g = [
|
|
1275
|
+
y.clientX - r.getBoundingClientRect().left + 160,
|
|
1276
|
+
y.clientY - r.getBoundingClientRect().top + 84
|
|
1277
|
+
], y.preventDefault();
|
|
1278
|
+
}), document.addEventListener("mousemove", function(y) {
|
|
1279
|
+
var k;
|
|
1280
|
+
if (c) {
|
|
1281
|
+
let L = (k = mapInstance.value) == null ? void 0 : k.getCoordinateFromPixel([y.clientX - g[0], y.clientY - g[1]]), E = L[0] - f[0], m = L[1] - f[1];
|
|
1282
|
+
l.setPosition([f[0] + E, f[1] + m]);
|
|
1184
1283
|
}
|
|
1185
1284
|
}), document.addEventListener("mouseup", function() {
|
|
1186
|
-
|
|
1285
|
+
c = !1;
|
|
1187
1286
|
});
|
|
1188
1287
|
}
|
|
1189
1288
|
(u = mapInstance.value) == null || u.addOverlay(l);
|
|
1190
1289
|
const s = r.querySelector(".close-button");
|
|
1191
1290
|
s && s.addEventListener("click", () => {
|
|
1192
|
-
var
|
|
1193
|
-
(
|
|
1291
|
+
var c, f;
|
|
1292
|
+
(c = mapInstance.value) == null || c.removeOverlay(l), (f = r.parentNode) == null || f.removeChild(r);
|
|
1194
1293
|
});
|
|
1195
|
-
let
|
|
1196
|
-
const d = (
|
|
1294
|
+
let i = JSON.parse(JSON.stringify(t));
|
|
1295
|
+
const d = (p = mapInstance.value) == null ? void 0 : p.getCoordinateFromPixel(i);
|
|
1197
1296
|
return l.setPosition(d), l;
|
|
1198
1297
|
}, vehicle = ref(null), focusShipData = ref(), currentTruckOverlay = ref(null), findTruck = async (e) => {
|
|
1199
1298
|
if (!mapInstance.value) return;
|
|
@@ -1224,6 +1323,226 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, a = "ship")
|
|
|
1224
1323
|
(r = document.querySelectorAll(".truck-custom-content")) == null || r.forEach((l) => {
|
|
1225
1324
|
l.style.width = `${a}px`, l.style.height = `${a}px`;
|
|
1226
1325
|
});
|
|
1326
|
+
}, markerPosition = ref(""), marker = ref(), createIconStyle = (e) => new Style({
|
|
1327
|
+
image: new Icon({
|
|
1328
|
+
src: CDN_URL + "map/poi-marker-default.png",
|
|
1329
|
+
anchor: [0.5, 1]
|
|
1330
|
+
}),
|
|
1331
|
+
text: new Text({
|
|
1332
|
+
text: e,
|
|
1333
|
+
offsetY: -90,
|
|
1334
|
+
// 调整文本位置,使其位于标记上方
|
|
1335
|
+
font: "12px",
|
|
1336
|
+
fill: new Fill({
|
|
1337
|
+
color: "#000"
|
|
1338
|
+
}),
|
|
1339
|
+
stroke: new Stroke({
|
|
1340
|
+
color: "#fff",
|
|
1341
|
+
width: 2
|
|
1342
|
+
}),
|
|
1343
|
+
backgroundFill: new Fill({
|
|
1344
|
+
color: "#fff"
|
|
1345
|
+
// 设置文本背景填充颜色
|
|
1346
|
+
}),
|
|
1347
|
+
backgroundStroke: new Stroke({
|
|
1348
|
+
color: "#000",
|
|
1349
|
+
// 设置文本背景描边颜色
|
|
1350
|
+
width: 1
|
|
1351
|
+
}),
|
|
1352
|
+
padding: [2, 2, 2, 2]
|
|
1353
|
+
// 设置文本背景的内边距
|
|
1354
|
+
})
|
|
1355
|
+
}), renderMarker = (e, t = !0, o = !0) => {
|
|
1356
|
+
var u;
|
|
1357
|
+
if (!mapInstance.value || !e || e.split(",").length !== 2) return;
|
|
1358
|
+
const [n, a] = e.split(",").map(Number);
|
|
1359
|
+
marker.value = new Feature({
|
|
1360
|
+
geometry: new Point(fromLonLat([n, a]))
|
|
1361
|
+
});
|
|
1362
|
+
const r = o ? `${n}, ${a}` : "";
|
|
1363
|
+
(u = marker.value) == null || u.setStyle(createIconStyle(r));
|
|
1364
|
+
const l = new VectorSource({
|
|
1365
|
+
features: [marker.value]
|
|
1366
|
+
}), s = new VectorLayer({
|
|
1367
|
+
source: l
|
|
1368
|
+
}), i = mapInstance.value.getView();
|
|
1369
|
+
if (mapInstance.value.addLayer(s), t) {
|
|
1370
|
+
const p = new Translate({
|
|
1371
|
+
layers: [s]
|
|
1372
|
+
});
|
|
1373
|
+
p.on("translating", function(c) {
|
|
1374
|
+
var y;
|
|
1375
|
+
const f = c.features.item(0).getGeometry().getCoordinates(), g = toLonLat(f);
|
|
1376
|
+
markerPosition.value = `${g[0].toFixed(6)}, ${g[1].toFixed(6)}`, (y = marker.value) == null || y.setStyle(createIconStyle(markerPosition.value));
|
|
1377
|
+
}), mapInstance.value.addInteraction(p);
|
|
1378
|
+
}
|
|
1379
|
+
const d = new Point([n, a]);
|
|
1380
|
+
i.setCenter(transform(d.getCoordinates(), projection.data, projection.mercator)), i.setZoom(mapZoom.findShip);
|
|
1381
|
+
}, setMarkerPosition = (e) => {
|
|
1382
|
+
var a, r;
|
|
1383
|
+
if (!mapInstance.value) return;
|
|
1384
|
+
const t = mapInstance.value.getView(), o = e.split(",").map(Number);
|
|
1385
|
+
(r = (a = marker.value) == null ? void 0 : a.getGeometry()) == null || r.setCoordinates(fromLonLat([o[0], o[1]]));
|
|
1386
|
+
const n = new Point([o[0], o[1]]);
|
|
1387
|
+
t.setCenter(transform(n.getCoordinates(), projection.data, projection.mercator));
|
|
1388
|
+
};
|
|
1389
|
+
let layerState = "drawn", drawnState = "undrawn";
|
|
1390
|
+
const source = new VectorSource();
|
|
1391
|
+
let sketch, helpTooltipElement, helpTooltip, measureTooltipElement, measureTooltip;
|
|
1392
|
+
const circleStyle = {
|
|
1393
|
+
image: new CircleStyle({
|
|
1394
|
+
radius: 5,
|
|
1395
|
+
fill: new Fill({
|
|
1396
|
+
color: "rgb(51,112,255, 1)"
|
|
1397
|
+
})
|
|
1398
|
+
}),
|
|
1399
|
+
geometry: function(e) {
|
|
1400
|
+
const t = e.getGeometry().getCoordinates();
|
|
1401
|
+
return new MultiPoint(t);
|
|
1402
|
+
}
|
|
1403
|
+
}, drawVector = new VectorLayer({
|
|
1404
|
+
source,
|
|
1405
|
+
style: [
|
|
1406
|
+
{
|
|
1407
|
+
"stroke-color": "rgba(255, 255, 255, 1)",
|
|
1408
|
+
"stroke-width": 2,
|
|
1409
|
+
"fill-color": "rgba(255, 255, 255, 0.3)"
|
|
1410
|
+
},
|
|
1411
|
+
new Style(circleStyle)
|
|
1412
|
+
]
|
|
1413
|
+
});
|
|
1414
|
+
let draw;
|
|
1415
|
+
function createMeasureTooltip() {
|
|
1416
|
+
var e;
|
|
1417
|
+
measureTooltipElement != null && measureTooltipElement.parentNode && measureTooltipElement.parentNode.removeChild(measureTooltipElement), measureTooltipElement = document.createElement("div"), measureTooltipElement.className = "ol-tooltip ol-tooltip-draw-polygon", measureTooltip = new Overlay({
|
|
1418
|
+
element: measureTooltipElement,
|
|
1419
|
+
offset: [0, -15],
|
|
1420
|
+
positioning: "bottom-center",
|
|
1421
|
+
stopEvent: !1,
|
|
1422
|
+
insertFirst: !1
|
|
1423
|
+
}), (e = mapInstance.value) == null || e.addOverlay(measureTooltip);
|
|
1424
|
+
}
|
|
1425
|
+
function createHelpTooltip() {
|
|
1426
|
+
var e;
|
|
1427
|
+
helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement), helpTooltipElement = document.createElement("div"), helpTooltipElement.className = "ol-tooltip ol-help-tooltip hidden", helpTooltip = new Overlay({
|
|
1428
|
+
element: helpTooltipElement,
|
|
1429
|
+
offset: [15, 0],
|
|
1430
|
+
positioning: "center-left"
|
|
1431
|
+
}), (e = mapInstance.value) == null || e.addOverlay(helpTooltip);
|
|
1432
|
+
}
|
|
1433
|
+
let squareLimitError = !1, lineLimitError = !1;
|
|
1434
|
+
const validateSquareLimit = (e) => {
|
|
1435
|
+
let o = 1 / 0, n = -1 / 0, a = 1 / 0, r = -1 / 0;
|
|
1436
|
+
e == null || e.forEach((i) => {
|
|
1437
|
+
const d = transform(i, projection.mercator, projection.data), u = d[0], p = d[1];
|
|
1438
|
+
o = Math.min(o, p), n = Math.max(n, p), a = Math.min(a, u), r = Math.max(r, u);
|
|
1439
|
+
});
|
|
1440
|
+
const l = (n - o) * 111, s = (r - a) * 111;
|
|
1441
|
+
squareLimitError = l > 150 || s > 150;
|
|
1442
|
+
};
|
|
1443
|
+
let storeFeature;
|
|
1444
|
+
function addInteraction(e) {
|
|
1445
|
+
var o, n;
|
|
1446
|
+
mapInstance.value || init(), drawnState = "undrawn", layerState = "drawn", (o = mapInstance.value) == null || o.addLayer(drawVector), draw = new Draw({
|
|
1447
|
+
type: "Polygon",
|
|
1448
|
+
// source: drawVector.getSource(),
|
|
1449
|
+
source,
|
|
1450
|
+
trace: !0,
|
|
1451
|
+
style: [
|
|
1452
|
+
{
|
|
1453
|
+
"stroke-color": "rgba(255, 255, 255, 1)",
|
|
1454
|
+
"stroke-width": 1.5,
|
|
1455
|
+
"stroke-line-dash": [10, 10],
|
|
1456
|
+
"fill-color": "rgba(255, 255, 255, 0.25)"
|
|
1457
|
+
// "circle-radius": 6,
|
|
1458
|
+
// "circle-fill-color": "rgb(51,112,255, 1)"
|
|
1459
|
+
},
|
|
1460
|
+
new Style(circleStyle)
|
|
1461
|
+
]
|
|
1462
|
+
}), (n = mapInstance.value) == null || n.addInteraction(draw), createMeasureTooltip(), createHelpTooltip();
|
|
1463
|
+
let t;
|
|
1464
|
+
draw.on("drawstart", function(a) {
|
|
1465
|
+
var r;
|
|
1466
|
+
layerState = "drawn", sketch = a.feature, t = (r = sketch.getGeometry()) == null ? void 0 : r.on("change", function(l) {
|
|
1467
|
+
const s = l.target;
|
|
1468
|
+
let i = formatArea(s, LENGTH_UNIT.NM);
|
|
1469
|
+
const u = s.getCoordinates()[0], p = new LineString([u[u.length - 2], u[u.length - 1]]);
|
|
1470
|
+
let c = formatLength(p, LENGTH_UNIT.NM);
|
|
1471
|
+
if (lineLimitError = Number(getLength(p) / 1e3) > 150, validateSquareLimit(u), measureTooltipElement && i && (measureTooltipElement.innerHTML = `
|
|
1472
|
+
<span class="text">面积:${i}${lineLimitError || squareLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1473
|
+
`), helpTooltipElement && i) {
|
|
1474
|
+
let f = "";
|
|
1475
|
+
parseFloat(i) > 0 && (f = `
|
|
1476
|
+
<div class="text ${squareLimitError ? "error" : ""}">面积:${i}${squareLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</div>`), helpTooltipElement.innerHTML = `${f}
|
|
1477
|
+
<span class="text ${lineLimitError ? "error" : ""}">线段${u.length - 2}:${c}${lineLimitError ? '<span class="error pl-4">超出可以绘画的距离</span>' : ""}</span>
|
|
1478
|
+
<div><span class="text">单击继续,双击结束</span></div>
|
|
1479
|
+
`;
|
|
1480
|
+
}
|
|
1481
|
+
}), drawnState = "drawing";
|
|
1482
|
+
}), draw.on("drawend", function(a) {
|
|
1483
|
+
if (a.feature.getGeometry()) {
|
|
1484
|
+
storeFeature = a.feature;
|
|
1485
|
+
const r = endFn(a.feature);
|
|
1486
|
+
r != null && r.length && e && e(r);
|
|
1487
|
+
}
|
|
1488
|
+
sketch = null, measureTooltipElement = null, createMeasureTooltip(), t && unByKey(t), drawnState = "drawend";
|
|
1489
|
+
});
|
|
1490
|
+
}
|
|
1491
|
+
function removeInteraction() {
|
|
1492
|
+
var e, t, o;
|
|
1493
|
+
mapInstance.value && (document.querySelectorAll(".ol-tooltip.ol-tooltip-draw-polygon").forEach((n) => {
|
|
1494
|
+
var a;
|
|
1495
|
+
(a = n == null ? void 0 : n.parentNode) == null || a.removeChild(n);
|
|
1496
|
+
}), source.clear(), (e = mapInstance.value) == null || e.removeInteraction(draw), (t = mapInstance.value) == null || t.removeLayer(drawVector), helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement), ((o = mapInstance.value) == null ? void 0 : o.getTargetElement()).style.cursor = "", document.querySelector("#map").style.cursor = "", drawnState = "undrawn", layerState = "destroyed");
|
|
1497
|
+
}
|
|
1498
|
+
const endFn = (e) => {
|
|
1499
|
+
var t, o, n;
|
|
1500
|
+
if (e.getGeometry()) {
|
|
1501
|
+
const a = [], l = e.getGeometry().getCoordinates();
|
|
1502
|
+
(t = l[0]) == null || t.forEach((i) => {
|
|
1503
|
+
a.push(transform(i, projection.mercator, projection.data));
|
|
1504
|
+
});
|
|
1505
|
+
const s = l[0][l[0].length - 2];
|
|
1506
|
+
if (s && measureTooltip.setPosition(s), measureTooltip.setOffset([10, 0]), measureTooltipElement && (measureTooltipElement.innerHTML += '<span class="delete-icon"><i class="iconfont icon-delete" /></div>'), (o = document.querySelector(".delete-icon")) == null || o.addEventListener("click", () => {
|
|
1507
|
+
reset();
|
|
1508
|
+
}), !lineLimitError && !squareLimitError)
|
|
1509
|
+
return a;
|
|
1510
|
+
draw && ((n = mapInstance.value) == null || n.removeInteraction(draw)), helpTooltipElement != null && helpTooltipElement.parentNode && helpTooltipElement.parentNode.removeChild(helpTooltipElement);
|
|
1511
|
+
}
|
|
1512
|
+
}, initFeature = (e) => {
|
|
1513
|
+
var t, o;
|
|
1514
|
+
if (layerState = "drawn", storeFeature) {
|
|
1515
|
+
const n = storeFeature.getGeometry();
|
|
1516
|
+
if (!n) return;
|
|
1517
|
+
const a = formatArea(n, LENGTH_UNIT.NM);
|
|
1518
|
+
measureTooltipElement && (measureTooltipElement.innerHTML = `
|
|
1519
|
+
<span class="text">面积:${a}${lineLimitError || squareLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1520
|
+
`), (t = drawVector.getSource()) == null || t.addFeature(storeFeature);
|
|
1521
|
+
const r = endFn(storeFeature);
|
|
1522
|
+
r != null && r.length && e && e(r);
|
|
1523
|
+
const l = getCenter(storeFeature.getGeometry().getExtent());
|
|
1524
|
+
(o = mapInstance.value) == null || o.getView().setCenter(l);
|
|
1525
|
+
}
|
|
1526
|
+
}, pointerMoveHandler = function(e) {
|
|
1527
|
+
var o;
|
|
1528
|
+
if (e.dragging)
|
|
1529
|
+
return;
|
|
1530
|
+
let t = "点击选择起点";
|
|
1531
|
+
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");
|
|
1532
|
+
}, init = () => {
|
|
1533
|
+
mapInstance.value && (mapInstance.value.on("pointermove", pointerMoveHandler), mapInstance.value.getViewport().addEventListener("mouseout", function() {
|
|
1534
|
+
var e;
|
|
1535
|
+
(e = helpTooltipElement == null ? void 0 : helpTooltipElement.classList) == null || e.add("hidden");
|
|
1536
|
+
}), mapInstance.value.on("dblclick", function(e) {
|
|
1537
|
+
drawnState !== "undrawn" && (e.stopPropagation(), e.preventDefault());
|
|
1538
|
+
}));
|
|
1539
|
+
}, reset = () => {
|
|
1540
|
+
removeInteraction(), addInteraction(), storeFeature = null;
|
|
1541
|
+
}, drawPolygonTool = {
|
|
1542
|
+
addInteraction,
|
|
1543
|
+
removeInteraction,
|
|
1544
|
+
initFeature,
|
|
1545
|
+
reset
|
|
1227
1546
|
}, _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1228
1547
|
__name: "Map",
|
|
1229
1548
|
props: {
|
|
@@ -1233,17 +1552,17 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, a = "ship")
|
|
|
1233
1552
|
},
|
|
1234
1553
|
emits: ["zoomChanged", "extentChanged"],
|
|
1235
1554
|
setup(e, { expose: t, emit: o }) {
|
|
1236
|
-
const n = ref(null), a = ref(null), r = ref(null), l = o, s = e,
|
|
1237
|
-
let
|
|
1238
|
-
((
|
|
1239
|
-
|
|
1240
|
-
})(
|
|
1241
|
-
const
|
|
1242
|
-
var v;
|
|
1243
|
-
const
|
|
1555
|
+
const n = ref(null), a = ref(null), r = ref(null), l = o, s = e, i = ref(s.zoom || mapZoom.default), d = ref(!1), u = ref(!0), p = ref(!0);
|
|
1556
|
+
let c;
|
|
1557
|
+
((m) => {
|
|
1558
|
+
m[m.tiandituTile = new TileLayer({ source: new XYZ({ url: baseMap.tiandituTile }) })] = "tiandituTile", m[m.tiandituTileMark = new TileLayer({ source: new XYZ({ url: baseMap.tiandituTileMark }) })] = "tiandituTileMark", m[m.tiandituImgTile = new TileLayer({ source: new XYZ({ url: baseMap.tiandituImgTile }), visible: !1 })] = "tiandituImgTile", m[m.tiandituImgTileMark = new TileLayer({ source: new XYZ({ url: baseMap.tiandituImgTileMark }), visible: !1 })] = "tiandituImgTileMark", m[m.greenMark = new TileLayer({ source: new XYZ({ url: baseMap.greenTile }) })] = "greenMark";
|
|
1559
|
+
})(c || (c = {}));
|
|
1560
|
+
const f = () => {
|
|
1561
|
+
var v, h;
|
|
1562
|
+
const m = {
|
|
1244
1563
|
projection: projection.mercator,
|
|
1245
1564
|
// 地图投影坐标系
|
|
1246
|
-
zoom: s.zoom || mapZoom.default,
|
|
1565
|
+
zoom: s.zoom || (s.vehicleMode === "ship" ? mapZoom.default : mapZoom.truckDefault),
|
|
1247
1566
|
// 地图缩放级别(打开页面时默认级别)
|
|
1248
1567
|
minZoom: mapZoom.min,
|
|
1249
1568
|
// 地图缩放最小级别
|
|
@@ -1259,45 +1578,45 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, a = "ship")
|
|
|
1259
1578
|
// 对应页面里 id 为 map 的元素
|
|
1260
1579
|
layers: [
|
|
1261
1580
|
// 图层
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1581
|
+
c.tiandituTile,
|
|
1582
|
+
c.tiandituTileMark,
|
|
1583
|
+
c.tiandituImgTile,
|
|
1584
|
+
c.tiandituImgTileMark,
|
|
1585
|
+
c.greenMark
|
|
1267
1586
|
],
|
|
1268
|
-
view: new View(
|
|
1269
|
-
}), a.value
|
|
1587
|
+
view: new View(m)
|
|
1588
|
+
}), (v = a.value) == null || v.setScaleLine(), (h = mapInstance.value) == null || h.on("moveend", k), g(s.vehicleMode === "ship"), y(s.vehicleMode === "ship" ? BaseMapType.satellite : BaseMapType.vector);
|
|
1270
1589
|
};
|
|
1271
1590
|
onMounted(() => {
|
|
1272
|
-
|
|
1591
|
+
f();
|
|
1273
1592
|
});
|
|
1274
|
-
const
|
|
1593
|
+
const g = (m) => {
|
|
1275
1594
|
var v;
|
|
1276
|
-
(v = mapInstance.value) == null || v.getLayers().forEach((
|
|
1277
|
-
|
|
1595
|
+
(v = mapInstance.value) == null || v.getLayers().forEach((h) => {
|
|
1596
|
+
h.ol_uid === c.greenMark.ol_uid && (h.setVisible(m), u.value = m);
|
|
1278
1597
|
});
|
|
1279
|
-
},
|
|
1598
|
+
}, y = (m) => {
|
|
1280
1599
|
var v;
|
|
1281
|
-
console.log("mode",
|
|
1282
|
-
(
|
|
1600
|
+
console.log("mode", m), (v = mapInstance.value) == null || v.getLayers().forEach((h) => {
|
|
1601
|
+
(h.ol_uid === c.tiandituTile.ol_uid || h.ol_uid === c.tiandituTileMark.ol_uid || h.ol_uid === c.tiandituImgTile.ol_uid || h.ol_uid === c.tiandituImgTileMark.ol_uid) && h.setVisible(!1), (m === BaseMapType.vector && h.ol_uid === c.tiandituTile.ol_uid || h.ol_uid === c.tiandituTileMark.ol_uid || m === BaseMapType.satellite && h.ol_uid === c.tiandituImgTile.ol_uid || h.ol_uid === c.tiandituImgTileMark.ol_uid) && (console.log(m, h.ol_uid), h.setVisible(!0));
|
|
1283
1602
|
});
|
|
1284
|
-
},
|
|
1285
|
-
const
|
|
1286
|
-
v &&
|
|
1287
|
-
const
|
|
1288
|
-
|
|
1289
|
-
},
|
|
1290
|
-
var
|
|
1291
|
-
|
|
1292
|
-
const v = (
|
|
1293
|
-
!d.value && u.value &&
|
|
1294
|
-
},
|
|
1295
|
-
const
|
|
1296
|
-
l("extentChanged", { extent: [
|
|
1603
|
+
}, k = () => {
|
|
1604
|
+
const m = mapInstance.value.getView(), v = m.getZoom();
|
|
1605
|
+
v && L(v);
|
|
1606
|
+
const h = m.calculateExtent(mapInstance.value.getSize());
|
|
1607
|
+
h && v && E(h, v);
|
|
1608
|
+
}, L = (m) => {
|
|
1609
|
+
var I, C, V, S;
|
|
1610
|
+
i.value = m;
|
|
1611
|
+
const v = (I = mapInstance.value) == null ? void 0 : I.getLayers(), h = s.vehicleMode === "ship" ? v == null ? void 0 : v.getArray().find((w) => w.ol_uid === c.greenMark.ol_uid) : void 0;
|
|
1612
|
+
!d.value && u.value && m < mapZoom.shipGreenDotMax ? (p.value = !0, h == null || h.setVisible(!0), (C = shipsLayer.value) == null || C.setVisible(!1), (V = largeAmountShipsLayer.value) == null || V.setVisible(!1)) : (p.value = !1, h == null || h.setVisible(!1), (S = largeAmountShipsLayer.value) == null || S.setVisible(!0)), l("zoomChanged", m);
|
|
1613
|
+
}, E = (m, v) => {
|
|
1614
|
+
const h = transform([m[0], m[1]], projection.mercator, projection.data), I = transform([m[2], m[3]], projection.mercator, projection.data);
|
|
1615
|
+
l("extentChanged", { extent: [h, I], zoom: v });
|
|
1297
1616
|
};
|
|
1298
1617
|
return t({
|
|
1299
1618
|
mapInstance,
|
|
1300
|
-
initMap:
|
|
1619
|
+
initMap: f,
|
|
1301
1620
|
renderTrucksMarker,
|
|
1302
1621
|
renderShip: renderShips,
|
|
1303
1622
|
renderTrack,
|
|
@@ -1305,25 +1624,32 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, a = "ship")
|
|
|
1305
1624
|
removeTruckIcon,
|
|
1306
1625
|
clearAllTruck,
|
|
1307
1626
|
closeTrack: () => {
|
|
1308
|
-
var
|
|
1309
|
-
(
|
|
1627
|
+
var m;
|
|
1628
|
+
(m = shipTrackVectorLayer.value) == null || m.setVisible(!1);
|
|
1310
1629
|
},
|
|
1311
1630
|
closeTruckTrack: () => {
|
|
1312
|
-
var
|
|
1313
|
-
(
|
|
1631
|
+
var m;
|
|
1632
|
+
(m = shipTrackVectorLayer.value) == null || m.setVisible(!1);
|
|
1314
1633
|
},
|
|
1315
1634
|
clearSelectFeature,
|
|
1316
1635
|
findShip,
|
|
1636
|
+
focusShip: (m, v) => {
|
|
1637
|
+
var h, I;
|
|
1638
|
+
(h = shipsLayer.value) == null || h.setVisible(!1), (I = largeAmountShipsLayer.value) == null || I.setVisible(!1), findShip(m, v);
|
|
1639
|
+
},
|
|
1317
1640
|
showTracks,
|
|
1318
1641
|
removeAllTrackLayer,
|
|
1319
1642
|
switchFilterItem,
|
|
1320
1643
|
rerenderShip,
|
|
1321
|
-
switchGreenDot: () =>
|
|
1644
|
+
switchGreenDot: () => g(!1),
|
|
1322
1645
|
zoomTruckIcon,
|
|
1323
|
-
renderTruckTrack: (
|
|
1324
|
-
renderTrack(
|
|
1325
|
-
}
|
|
1326
|
-
|
|
1646
|
+
renderTruckTrack: (m, v, h) => {
|
|
1647
|
+
renderTrack(m, v, h, LENGTH_UNIT.KM, "truck");
|
|
1648
|
+
},
|
|
1649
|
+
renderMarker,
|
|
1650
|
+
setMarkerPosition,
|
|
1651
|
+
drawPolygonTool
|
|
1652
|
+
}), (m, v) => (openBlock(), createElementBlock("div", {
|
|
1327
1653
|
class: "map-page map-container",
|
|
1328
1654
|
ref_key: "pageRef",
|
|
1329
1655
|
ref: n
|
|
@@ -1333,9 +1659,9 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, a = "ship")
|
|
|
1333
1659
|
class: "map"
|
|
1334
1660
|
}, null, -1)),
|
|
1335
1661
|
createVNode(ToolPanel, {
|
|
1336
|
-
"vehicle-mode":
|
|
1337
|
-
onSwitchGreenDot:
|
|
1338
|
-
onSwitchMapTile:
|
|
1662
|
+
"vehicle-mode": m.vehicleMode,
|
|
1663
|
+
onSwitchGreenDot: g,
|
|
1664
|
+
onSwitchMapTile: y
|
|
1339
1665
|
}, null, 8, ["vehicle-mode"]),
|
|
1340
1666
|
createVNode(ScaleLine, {
|
|
1341
1667
|
ref_key: "scaleLineControl",
|
|
@@ -1349,7 +1675,7 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, a = "ship")
|
|
|
1349
1675
|
createVNode(Fullscreen, { page: n.value }, null, 8, ["page"])
|
|
1350
1676
|
], 512));
|
|
1351
1677
|
}
|
|
1352
|
-
}), Map = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
1678
|
+
}), Map = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-08679314"]]), ZhMap = withInstall(Map);
|
|
1353
1679
|
export {
|
|
1354
1680
|
ZhMap as Z
|
|
1355
1681
|
};
|