zhihao-ui 1.3.12 → 1.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/{Map-BotrSWAZ.js → Map-BJQ9eIcs.js} +103 -99
- package/dist/es/index.js +1 -1
- package/dist/index.css +1 -1
- package/dist/umd/index.css +1 -1
- package/dist/umd/index.umd.cjs +1 -1
- package/package.json +1 -1
|
@@ -10,8 +10,8 @@ const _hoisted_1$2 = { id: "scale-line-container" }, _sfc_main$2 = /* @__PURE__
|
|
|
10
10
|
a || (a = "metric");
|
|
11
11
|
const o = new ScaleLine$1({
|
|
12
12
|
units: a
|
|
13
|
-
}),
|
|
14
|
-
|
|
13
|
+
}), y = document.getElementById("scale-line-container");
|
|
14
|
+
y && (o.setTarget(y), s.addControl(o));
|
|
15
15
|
}
|
|
16
16
|
}), (s, a) => (openBlock(), createElementBlock("div", _hoisted_1$2));
|
|
17
17
|
}
|
|
@@ -28,13 +28,13 @@ const _hoisted_1$2 = { id: "scale-line-container" }, _sfc_main$2 = /* @__PURE__
|
|
|
28
28
|
console.log("props", n);
|
|
29
29
|
const l = () => {
|
|
30
30
|
console.log("props");
|
|
31
|
-
const { setZoom: a, getZoom: o, getInstall:
|
|
32
|
-
if (!
|
|
31
|
+
const { setZoom: a, getZoom: o, getInstall: y } = n.mapInstance.methods;
|
|
32
|
+
if (!y()) return;
|
|
33
33
|
const t = o();
|
|
34
34
|
t && a(t + 1);
|
|
35
35
|
}, s = () => {
|
|
36
|
-
const { setZoom: a, getZoom: o, getInstall:
|
|
37
|
-
if (!
|
|
36
|
+
const { setZoom: a, getZoom: o, getInstall: y } = n.mapInstance.methods;
|
|
37
|
+
if (!y()) return;
|
|
38
38
|
const t = o();
|
|
39
39
|
t && a(t - 1);
|
|
40
40
|
};
|
|
@@ -81,7 +81,7 @@ function useMapInitializer() {
|
|
|
81
81
|
}, o = (m, F) => {
|
|
82
82
|
var V;
|
|
83
83
|
(V = l()) == null || V.setCenter(fromLonLat([m, F]));
|
|
84
|
-
},
|
|
84
|
+
}, y = () => {
|
|
85
85
|
var F;
|
|
86
86
|
const m = (F = l()) == null ? void 0 : F.getCenter();
|
|
87
87
|
return toLonLat(m);
|
|
@@ -89,7 +89,7 @@ function useMapInitializer() {
|
|
|
89
89
|
var m;
|
|
90
90
|
return (m = n()) == null ? void 0 : m.getSize();
|
|
91
91
|
}, t = new Map$2(), r = (m, F) => {
|
|
92
|
-
|
|
92
|
+
f(F);
|
|
93
93
|
const V = {
|
|
94
94
|
zoom: F.zoom,
|
|
95
95
|
center: fromLonLat(F.center),
|
|
@@ -112,7 +112,7 @@ function useMapInitializer() {
|
|
|
112
112
|
view: new View(V)
|
|
113
113
|
});
|
|
114
114
|
e.value = v;
|
|
115
|
-
},
|
|
115
|
+
}, f = (m) => {
|
|
116
116
|
t.set("vectorTile", new TileLayer({
|
|
117
117
|
source: new XYZ({ url: BASE_MAP_LINK.vectorTile }),
|
|
118
118
|
visible: m.layerType === "vector",
|
|
@@ -150,10 +150,10 @@ function useMapInitializer() {
|
|
|
150
150
|
getZoom: s,
|
|
151
151
|
setZoom: a,
|
|
152
152
|
setCenter: o,
|
|
153
|
-
getCenter:
|
|
153
|
+
getCenter: y,
|
|
154
154
|
getSize: E,
|
|
155
155
|
initMap: r,
|
|
156
|
-
setBaseLayerMap:
|
|
156
|
+
setBaseLayerMap: f
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
159
|
const convertSixHundredThousandToLatLng = function(e, n) {
|
|
@@ -217,13 +217,13 @@ const getIconStyle = (e) => {
|
|
|
217
217
|
return s !== 0 && (o = `${String(s).padStart(2, "0")}时${o}`), l !== 0 && (o = `${String(l).padStart(2, "0")}天${o}`), o;
|
|
218
218
|
}, useCarTrackManager = (e, n) => {
|
|
219
219
|
let l = null;
|
|
220
|
-
const s = async (
|
|
221
|
-
if (!e || (console.log("vehicleInfo",
|
|
222
|
-
const m = Math.abs(Number(
|
|
223
|
-
a(
|
|
220
|
+
const s = async (f) => {
|
|
221
|
+
if (!e || (console.log("vehicleInfo", f), !(f != null && f.lon && (f != null && f.lat)))) return;
|
|
222
|
+
const m = Math.abs(Number(f.lon)) > 180 ? convertSixHundredThousandToLatLng(f.lon, f.lat) : [f.lon, f.lat];
|
|
223
|
+
a(f, fromLonLat(m));
|
|
224
224
|
const F = e == null ? void 0 : e.getView(), V = new Point(m);
|
|
225
225
|
F.setCenter(transform(V.getCoordinates(), projection.data, projection.mercator));
|
|
226
|
-
}, a = (
|
|
226
|
+
}, a = (f, m) => {
|
|
227
227
|
const F = `${CDN_URL}map/car-icon.gif`;
|
|
228
228
|
l || (l = new Overlay({
|
|
229
229
|
element: document.createElement("div"),
|
|
@@ -233,26 +233,26 @@ const getIconStyle = (e) => {
|
|
|
233
233
|
}), e.addOverlay(l));
|
|
234
234
|
const V = l.getElement();
|
|
235
235
|
V.style.backgroundImage = `url(${F})`, V.style.width = "80px", V.style.height = "80px";
|
|
236
|
-
const v = (
|
|
236
|
+
const v = (f == null ? void 0 : f.drc) || "";
|
|
237
237
|
V.style.transform = `rotate(${v}deg)`, V.style.backgroundSize = "cover", l == null || l.setPosition(m);
|
|
238
238
|
};
|
|
239
239
|
return {
|
|
240
240
|
location: s,
|
|
241
241
|
remove: () => {
|
|
242
|
-
const
|
|
243
|
-
|
|
242
|
+
const f = l == null ? void 0 : l.getElement();
|
|
243
|
+
f && (f.innerHTML = "");
|
|
244
244
|
},
|
|
245
|
-
renderTrack: (
|
|
246
|
-
n.render(
|
|
245
|
+
renderTrack: (f, m, F) => {
|
|
246
|
+
n.render(f, m, F, "truck", 1e3);
|
|
247
247
|
},
|
|
248
|
-
setCenter: (
|
|
249
|
-
n.setCenter(
|
|
248
|
+
setCenter: (f) => {
|
|
249
|
+
n.setCenter(f);
|
|
250
250
|
},
|
|
251
251
|
closeTrack: () => {
|
|
252
252
|
n.close();
|
|
253
253
|
},
|
|
254
|
-
playTrack: (
|
|
255
|
-
n.play(
|
|
254
|
+
playTrack: (f, m) => {
|
|
255
|
+
n.play(f, m);
|
|
256
256
|
}
|
|
257
257
|
};
|
|
258
258
|
};
|
|
@@ -262,13 +262,13 @@ const useTrackManager = (e) => {
|
|
|
262
262
|
let s = null;
|
|
263
263
|
const a = "--";
|
|
264
264
|
let o = null;
|
|
265
|
-
const
|
|
266
|
-
element:
|
|
265
|
+
const y = document.createElement("div"), E = new Overlay({
|
|
266
|
+
element: y,
|
|
267
267
|
positioning: "top-left",
|
|
268
268
|
stopEvent: !1,
|
|
269
269
|
className: "track-label-popup"
|
|
270
270
|
});
|
|
271
|
-
let t, r,
|
|
271
|
+
let t, r, f, m, F, V = !1, v = Date.now(), g, T = 0, p = null, C = 20, Z = !1;
|
|
272
272
|
const Y = 5, X = [], H = (i) => {
|
|
273
273
|
var c;
|
|
274
274
|
for (X.unshift(i); X.length > Y; ) {
|
|
@@ -347,7 +347,7 @@ const useTrackManager = (e) => {
|
|
|
347
347
|
if (i && w && c === "hover") {
|
|
348
348
|
e.getTargetElement().style.cursor = w ? "pointer" : "";
|
|
349
349
|
const M = i.get("data"), b = Q(M), _ = d == null ? void 0 : d.coordinate;
|
|
350
|
-
_ && (
|
|
350
|
+
_ && (y.querySelector(".popup-content"), y.innerHTML = b, E == null || E.setPosition(_));
|
|
351
351
|
} else
|
|
352
352
|
E && E.setPosition(void 0);
|
|
353
353
|
}, Q = (i) => {
|
|
@@ -656,7 +656,7 @@ const useTrackManager = (e) => {
|
|
|
656
656
|
q.setStyle(te), q.drawGeometry(m), e == null || e.render();
|
|
657
657
|
}, be = () => {
|
|
658
658
|
var i;
|
|
659
|
-
V = !0, v = Date.now(), T = 0, m = ((i =
|
|
659
|
+
V = !0, v = Date.now(), T = 0, m = ((i = f.getGeometry()) == null ? void 0 : i.clone()) || new Point([0, 0]), o && (g == null || g.on("postrender", o)), F == null || F.setGeometry(void 0);
|
|
660
660
|
}, U = () => {
|
|
661
661
|
V && (V = !1, F == null || F.setGeometry(void 0), o && g && g.un("postrender", o), g && (e == null || e.removeLayer(g)), g = null, F = null);
|
|
662
662
|
}, ke = (i, c) => {
|
|
@@ -667,11 +667,11 @@ const useTrackManager = (e) => {
|
|
|
667
667
|
}).readGeometry(t, {
|
|
668
668
|
dataProjection: projection.data,
|
|
669
669
|
featureProjection: projection.mercator
|
|
670
|
-
}),
|
|
670
|
+
}), f = new Feature({
|
|
671
671
|
type: "icon",
|
|
672
672
|
geometry: new Point(r.getFirstCoordinate())
|
|
673
673
|
});
|
|
674
|
-
const d =
|
|
674
|
+
const d = f.getGeometry();
|
|
675
675
|
m = d ? d.clone() : new Point([0, 0]), F = new Feature({
|
|
676
676
|
type: "geoMarker",
|
|
677
677
|
style: te,
|
|
@@ -874,12 +874,12 @@ const getShipDirectPath = (e) => {
|
|
|
874
874
|
return n <= MAP_ZOOM.shipModelMax && n >= MAP_ZOOM.shipTriggleMin ? "ship" : "triangle";
|
|
875
875
|
}, getShipScale = (e, n, l) => {
|
|
876
876
|
if (l === "ship") {
|
|
877
|
-
const { len: s, wid: a } = n, o = 97,
|
|
878
|
-
return Math.max(r,
|
|
877
|
+
const { len: s, wid: a } = n, o = 97, y = 20, t = 1 / (e == null ? void 0 : e.getView().getResolution()), r = s * t / o, f = a * t / y;
|
|
878
|
+
return Math.max(r, f);
|
|
879
879
|
}
|
|
880
880
|
return MAP_ZOOM.scaleNum;
|
|
881
881
|
}, initShipStyle = (e, n, l) => {
|
|
882
|
-
const { color: s, direct: a, isHighlight: o, shipData:
|
|
882
|
+
const { color: s, direct: a, isHighlight: o, shipData: y } = e.getProperties(), E = ((y == null ? void 0 : y.cog) - 90 + 360) % 360;
|
|
883
883
|
return new Style({
|
|
884
884
|
image: new Icon({
|
|
885
885
|
src: t(),
|
|
@@ -920,7 +920,7 @@ const getShipDirectPath = (e) => {
|
|
|
920
920
|
}
|
|
921
921
|
}
|
|
922
922
|
}, selectedShipStyle = (e, n) => {
|
|
923
|
-
const l = selectedShipElement(e, n), s = n.id, { lon: a, lat: o } = n,
|
|
923
|
+
const l = selectedShipElement(e, n), s = n.id, { lon: a, lat: o } = n, y = new Overlay({
|
|
924
924
|
element: l,
|
|
925
925
|
position: fromLonLat([a, o]),
|
|
926
926
|
id: "selected-" + s,
|
|
@@ -928,26 +928,26 @@ const getShipDirectPath = (e) => {
|
|
|
928
928
|
offset: [0, 5],
|
|
929
929
|
className: "ship-selected-overlay"
|
|
930
930
|
});
|
|
931
|
-
return
|
|
931
|
+
return y.set("class", "ship-overlay-selected"), y;
|
|
932
932
|
}, selectedShipElement = (e, n) => {
|
|
933
933
|
const l = getShipType(e), s = getShipScale(e, n, l), a = l === "ship" ? 109 : 49, o = `
|
|
934
934
|
<svg style="transform:scale(${s});" xmlns="http://www.w3.org/2000/svg" width="${a}" height="${a}" viewBox="0 0 49 49" fill="none">
|
|
935
935
|
<path d="M1.99982 46.9998L1.99982 1.99982L46.9998 1.99982L46.9998 46.9998L1.99982 46.9998Z" fill="#FF2424" fill-opacity="0.2"/>
|
|
936
936
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M19.9998 0.5V3.5L3.49976 3.5V20H0.499756V0.500002L19.9998 0.5ZM45.4998 3.5H28.9998V0.5H48.4998V20H45.4998V3.5ZM48.4998 29L48.4998 48.5H28.9998V45.5H45.4998L45.4998 29H48.4998ZM3.49976 45.5L3.49976 29H0.499756L0.499758 48.5L19.9998 48.5V45.5L3.49976 45.5Z" fill="#FF2424"/>
|
|
937
937
|
</svg>
|
|
938
|
-
`,
|
|
939
|
-
return
|
|
938
|
+
`, y = document.createElement("div");
|
|
939
|
+
return y.className = "ship-overlay-selected", y.innerHTML = o, y;
|
|
940
940
|
}, createLabelStyle = (e, n) => {
|
|
941
|
-
const { shipData: l, blinking: s } = n.getProperties(), { lon: a, lat: o } = l,
|
|
942
|
-
a && o && addOverlay(e, fromLonLat([a, o]),
|
|
941
|
+
const { shipData: l, blinking: s } = n.getProperties(), { lon: a, lat: o } = l, y = createLabelElement(n);
|
|
942
|
+
a && o && addOverlay(e, fromLonLat([a, o]), y, { ...l, blinking: s });
|
|
943
943
|
}, createLabelElement = (e) => {
|
|
944
944
|
const n = document.createElement("div");
|
|
945
945
|
n.className = "ship-overlay-box", n.style.position = "relative";
|
|
946
|
-
const l = e.getProperties(), { shipData: s, blinking: a, blinkingColor: o, name:
|
|
946
|
+
const l = e.getProperties(), { shipData: s, blinking: a, blinkingColor: o, name: y } = l, { lon: E, lat: t } = s, r = createVNode({
|
|
947
947
|
setup() {
|
|
948
948
|
return useShipOverlay({
|
|
949
949
|
selected: a,
|
|
950
|
-
name:
|
|
950
|
+
name: y,
|
|
951
951
|
color: o,
|
|
952
952
|
existDevice: s == null ? void 0 : s.existDevice,
|
|
953
953
|
existMobile: s == null ? void 0 : s.existMobile,
|
|
@@ -960,7 +960,7 @@ const getShipDirectPath = (e) => {
|
|
|
960
960
|
const n = [];
|
|
961
961
|
return e.existDevice && n.push(""), e.existMobile && n.push(""), e.existWaterGauge && n.push(""), n;
|
|
962
962
|
}, createLabelFeatureStyle = (e) => {
|
|
963
|
-
const { name: n, rightIcons: l } = e.getProperties(), s = `${n} ${l.map((
|
|
963
|
+
const { name: n, rightIcons: l } = e.getProperties(), s = `${n} ${l.map((f) => getIconFont(f)).join(" ")} `, a = [20, -20], y = -Math.atan2(-a[1], a[0]), E = Math.sqrt(a[0] ** 2 + a[1] ** 2), t = `<svg viewBox="0 0 ${E + 10} 20" width="${E + 10}" height="20" xmlns="http://www.w3.org/2000/svg" >
|
|
964
964
|
<line x1="0" y1="0" x2="${10 + E}" y2="10" stroke="white" stroke-width="1"></line>
|
|
965
965
|
</svg>`;
|
|
966
966
|
return [new Style({
|
|
@@ -978,7 +978,7 @@ const getShipDirectPath = (e) => {
|
|
|
978
978
|
src: `data:image/svg+xml;utf8,${encodeURIComponent(t)}`,
|
|
979
979
|
displacement: [16, -10],
|
|
980
980
|
anchor: [0.5, 0.5],
|
|
981
|
-
rotation:
|
|
981
|
+
rotation: y,
|
|
982
982
|
rotateWithView: !1
|
|
983
983
|
})
|
|
984
984
|
})];
|
|
@@ -989,7 +989,7 @@ const getShipDirectPath = (e) => {
|
|
|
989
989
|
className: "zh-map--ship-layer",
|
|
990
990
|
renderBuffer: 300,
|
|
991
991
|
zIndex: 101
|
|
992
|
-
}), o = new VectorSource(),
|
|
992
|
+
}), o = new VectorSource(), y = new VectorLayer({
|
|
993
993
|
source: o,
|
|
994
994
|
className: "zh-map--ship-label-layer",
|
|
995
995
|
zIndex: 102,
|
|
@@ -997,9 +997,9 @@ const getShipDirectPath = (e) => {
|
|
|
997
997
|
updateWhileAnimating: !1,
|
|
998
998
|
declutter: !0
|
|
999
999
|
});
|
|
1000
|
-
e == null || e.addLayer(a), e == null || e.addLayer(
|
|
1000
|
+
e == null || e.addLayer(a), e == null || e.addLayer(y);
|
|
1001
1001
|
let E = "", t = {}, r = {};
|
|
1002
|
-
const
|
|
1002
|
+
const f = (u) => {
|
|
1003
1003
|
if (!u || !e) return;
|
|
1004
1004
|
const L = (l == null ? void 0 : l.id) || (n == null ? void 0 : n.get("id"));
|
|
1005
1005
|
if (l) {
|
|
@@ -1134,7 +1134,7 @@ const getShipDirectPath = (e) => {
|
|
|
1134
1134
|
});
|
|
1135
1135
|
};
|
|
1136
1136
|
return {
|
|
1137
|
-
render:
|
|
1137
|
+
render: f,
|
|
1138
1138
|
selected: p,
|
|
1139
1139
|
filter: T,
|
|
1140
1140
|
blinking: g,
|
|
@@ -1145,8 +1145,8 @@ const getShipDirectPath = (e) => {
|
|
|
1145
1145
|
const n = () => e == null ? void 0 : e.getLayers(), l = ref("vector"), s = () => l.value, a = (t) => {
|
|
1146
1146
|
l.value = t;
|
|
1147
1147
|
const r = n();
|
|
1148
|
-
r && (r == null || r.getArray().forEach((
|
|
1149
|
-
(
|
|
1148
|
+
r && (r == null || r.getArray().forEach((f) => {
|
|
1149
|
+
(f.className_ === "vector" || f.className_ === "satellite") && f.setVisible(f.className_ === t);
|
|
1150
1150
|
}));
|
|
1151
1151
|
}, o = ref(!1);
|
|
1152
1152
|
return {
|
|
@@ -1166,8 +1166,8 @@ const getShipDirectPath = (e) => {
|
|
|
1166
1166
|
r.push(m);
|
|
1167
1167
|
}
|
|
1168
1168
|
} else {
|
|
1169
|
-
const r = n(),
|
|
1170
|
-
|
|
1169
|
+
const r = n(), f = r.getArray().find((m) => m.className_ === "greenTile");
|
|
1170
|
+
f && r.remove(f);
|
|
1171
1171
|
}
|
|
1172
1172
|
o.value = t;
|
|
1173
1173
|
}
|
|
@@ -1186,7 +1186,7 @@ const getShipDirectPath = (e) => {
|
|
|
1186
1186
|
}, usePositionManager = (e) => {
|
|
1187
1187
|
const n = "zh-map-location-layer";
|
|
1188
1188
|
let l, s, a = null, o = null;
|
|
1189
|
-
const
|
|
1189
|
+
const y = (v) => {
|
|
1190
1190
|
if (!(!v || v.length === 0)) {
|
|
1191
1191
|
if (s || (s = new VectorSource()), s.clear(), o) {
|
|
1192
1192
|
const g = v.find((T) => T.id === o.id);
|
|
@@ -1231,7 +1231,7 @@ const getShipDirectPath = (e) => {
|
|
|
1231
1231
|
});
|
|
1232
1232
|
} else
|
|
1233
1233
|
s.clear();
|
|
1234
|
-
},
|
|
1234
|
+
}, f = () => {
|
|
1235
1235
|
const v = a.get("loactionData"), g = getZoom();
|
|
1236
1236
|
s.getFeatures().forEach((p) => {
|
|
1237
1237
|
p.get("loactionData").id === v.id && (p == null || p.setStyle(t(v, g, !1)));
|
|
@@ -1248,9 +1248,9 @@ const getShipDirectPath = (e) => {
|
|
|
1248
1248
|
o = v, a = g.find((T) => T.get("loactionData").id === v.id);
|
|
1249
1249
|
};
|
|
1250
1250
|
return {
|
|
1251
|
-
render:
|
|
1251
|
+
render: y,
|
|
1252
1252
|
selected: m,
|
|
1253
|
-
clearSelected:
|
|
1253
|
+
clearSelected: f,
|
|
1254
1254
|
clear: r
|
|
1255
1255
|
};
|
|
1256
1256
|
}, disableDoubleClickZoom = () => {
|
|
@@ -1266,13 +1266,13 @@ const getShipDirectPath = (e) => {
|
|
|
1266
1266
|
s.value = P;
|
|
1267
1267
|
};
|
|
1268
1268
|
let o;
|
|
1269
|
-
const
|
|
1270
|
-
|
|
1269
|
+
const y = ref(!1), E = () => {
|
|
1270
|
+
f(), disableDoubleClickZoom(), v("pointer"), e.on("pointermove", V), e.getViewport().addEventListener("mouseout", () => {
|
|
1271
1271
|
o && o.classList.add("hidden");
|
|
1272
|
-
}), T(),
|
|
1272
|
+
}), T(), y.value = !0;
|
|
1273
1273
|
};
|
|
1274
1274
|
let t, r;
|
|
1275
|
-
const
|
|
1275
|
+
const f = () => {
|
|
1276
1276
|
t = new VectorSource(), r = new VectorLayer({
|
|
1277
1277
|
source: t,
|
|
1278
1278
|
zIndex: 1e3,
|
|
@@ -1367,7 +1367,7 @@ const getShipDirectPath = (e) => {
|
|
|
1367
1367
|
N[x] && (($ = (z = N[x]) == null ? void 0 : z.parentNode) == null || $.removeChild(N[x]));
|
|
1368
1368
|
const D = t.getFeatures();
|
|
1369
1369
|
D[x] && t.removeFeature(D[x]);
|
|
1370
|
-
}), L(), enableDoubleClickZoom(),
|
|
1370
|
+
}), L(), enableDoubleClickZoom(), y.value = !1;
|
|
1371
1371
|
}, u = (P) => {
|
|
1372
1372
|
var N, D, z, $;
|
|
1373
1373
|
const x = l.value.findIndex((R) => R.id === P);
|
|
@@ -1394,7 +1394,7 @@ const getShipDirectPath = (e) => {
|
|
|
1394
1394
|
close: H,
|
|
1395
1395
|
deleteLine: u,
|
|
1396
1396
|
setUnit: a,
|
|
1397
|
-
getState: () =>
|
|
1397
|
+
getState: () => y.value
|
|
1398
1398
|
};
|
|
1399
1399
|
}, computedDistance = (e, n) => {
|
|
1400
1400
|
const s = getLength(e);
|
|
@@ -1418,9 +1418,9 @@ const getShipDirectPath = (e) => {
|
|
|
1418
1418
|
}, a = () => {
|
|
1419
1419
|
E(), T(), Z(), F();
|
|
1420
1420
|
};
|
|
1421
|
-
let o = null,
|
|
1421
|
+
let o = null, y = null;
|
|
1422
1422
|
const E = () => {
|
|
1423
|
-
if (o ||
|
|
1423
|
+
if (o || y) return;
|
|
1424
1424
|
const H = new VectorSource(), u = new VectorLayer({
|
|
1425
1425
|
source: H,
|
|
1426
1426
|
style: new Style({
|
|
@@ -1430,8 +1430,8 @@ const getShipDirectPath = (e) => {
|
|
|
1430
1430
|
})
|
|
1431
1431
|
})
|
|
1432
1432
|
});
|
|
1433
|
-
o = u,
|
|
1434
|
-
|
|
1433
|
+
o = u, y = H, e.on("pointermove", r), e.addLayer(u), e.on(["dblclick"], function(L) {
|
|
1434
|
+
f && (L.stopPropagation(), L.preventDefault());
|
|
1435
1435
|
});
|
|
1436
1436
|
};
|
|
1437
1437
|
let t;
|
|
@@ -1440,7 +1440,7 @@ const getShipDirectPath = (e) => {
|
|
|
1440
1440
|
const u = t ? "单击继续,双击结束" : "点击选择起点";
|
|
1441
1441
|
p && (p.innerHTML = u, C.setPosition(H.coordinate));
|
|
1442
1442
|
};
|
|
1443
|
-
let
|
|
1443
|
+
let f, m = !1;
|
|
1444
1444
|
const F = () => {
|
|
1445
1445
|
if (l) {
|
|
1446
1446
|
p != null && p.parentNode && p.parentNode.removeChild(p);
|
|
@@ -1466,9 +1466,9 @@ const getShipDirectPath = (e) => {
|
|
|
1466
1466
|
e == null || e.getView().setCenter(x);
|
|
1467
1467
|
return;
|
|
1468
1468
|
}
|
|
1469
|
-
|
|
1469
|
+
f = new Draw({
|
|
1470
1470
|
type: "Polygon",
|
|
1471
|
-
source:
|
|
1471
|
+
source: y,
|
|
1472
1472
|
trace: !0,
|
|
1473
1473
|
style: [new Style({
|
|
1474
1474
|
stroke: new Stroke({
|
|
@@ -1491,9 +1491,9 @@ const getShipDirectPath = (e) => {
|
|
|
1491
1491
|
return new MultiPoint(L);
|
|
1492
1492
|
}
|
|
1493
1493
|
})]
|
|
1494
|
-
}), e == null || e.addInteraction(
|
|
1494
|
+
}), e == null || e.addInteraction(f);
|
|
1495
1495
|
let H;
|
|
1496
|
-
|
|
1496
|
+
f.on("drawstart", (u) => {
|
|
1497
1497
|
var L;
|
|
1498
1498
|
t = u.feature, H = (L = t.getGeometry()) == null ? void 0 : L.on("change", (S) => {
|
|
1499
1499
|
const P = S.target, x = V(P, "nm"), D = P.getCoordinates()[0], z = new LineString([D[D.length - 2], D[D.length - 1]]), $ = computedDistance(z, "nm");
|
|
@@ -1518,7 +1518,7 @@ const getShipDirectPath = (e) => {
|
|
|
1518
1518
|
</div>
|
|
1519
1519
|
`);
|
|
1520
1520
|
});
|
|
1521
|
-
}),
|
|
1521
|
+
}), f.on("drawend", (u) => {
|
|
1522
1522
|
var x, N, D, z;
|
|
1523
1523
|
if (!u.feature.getGeometry()) return;
|
|
1524
1524
|
l = u.feature, v && (v.innerHTML += '<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'), g.setOffset([10, 0]);
|
|
@@ -1527,7 +1527,7 @@ const getShipDirectPath = (e) => {
|
|
|
1527
1527
|
const $ = S[0].map((R) => transform(R, projection.mercator, projection.data));
|
|
1528
1528
|
(D = (N = n.getProps()) == null ? void 0 : N.areaDrawEnd) == null || D.call(N, $);
|
|
1529
1529
|
}
|
|
1530
|
-
|
|
1530
|
+
f && (f.setActive(!1), e == null || e.removeInteraction(f), (e == null ? void 0 : e.getInteractions()).forEach((R) => {
|
|
1531
1531
|
R instanceof Draw && (R.setActive(!1), e == null || e.removeInteraction(R));
|
|
1532
1532
|
})), H && unByKey(H), (z = document.querySelector(".delete-icon")) == null || z.addEventListener("click", () => {
|
|
1533
1533
|
var $, R;
|
|
@@ -1561,12 +1561,12 @@ const getShipDirectPath = (e) => {
|
|
|
1561
1561
|
positioning: "center-left"
|
|
1562
1562
|
}), e == null || e.addOverlay(C);
|
|
1563
1563
|
}, Y = () => {
|
|
1564
|
-
|
|
1564
|
+
y == null || y.clear(), l = null, T(), Z(), F();
|
|
1565
1565
|
};
|
|
1566
1566
|
return {
|
|
1567
1567
|
open: s,
|
|
1568
1568
|
close: () => {
|
|
1569
|
-
|
|
1569
|
+
y == null || y.clear(), y = null, o && (e.removeLayer(o), o = null), t = null, f && (f = null, e.getInteractions().forEach((H) => {
|
|
1570
1570
|
H instanceof Draw && e.removeInteraction(H);
|
|
1571
1571
|
})), p != null && p.parentElement && p.parentElement.removeChild(p), v != null && v.parentElement && v.parentElement.removeChild(v), C && e.removeOverlay(C), g && e.removeOverlay(g);
|
|
1572
1572
|
},
|
|
@@ -1575,7 +1575,7 @@ const getShipDirectPath = (e) => {
|
|
|
1575
1575
|
}, PORT_LAYER_CLASS_NAME = "zh-map-port-layer", usePortManager = (e) => {
|
|
1576
1576
|
const n = e.getInstall();
|
|
1577
1577
|
let l, s, a = null, o = null;
|
|
1578
|
-
const
|
|
1578
|
+
const y = (g) => {
|
|
1579
1579
|
if (!(!g || g.length === 0)) {
|
|
1580
1580
|
if (s || (s = new VectorSource()), s.clear(), o) {
|
|
1581
1581
|
const T = g.find((p) => p.id === o.id);
|
|
@@ -1633,13 +1633,13 @@ const getShipDirectPath = (e) => {
|
|
|
1633
1633
|
});
|
|
1634
1634
|
} else
|
|
1635
1635
|
console.log("清除所有港口"), s.clear();
|
|
1636
|
-
},
|
|
1636
|
+
}, f = () => {
|
|
1637
1637
|
const g = a == null ? void 0 : a.get("portData"), T = e.getZoom();
|
|
1638
1638
|
g && s.getFeatures().forEach((C) => {
|
|
1639
1639
|
C.get("portData").id === g.id && (C == null || C.setStyle(t(g, T, !1)));
|
|
1640
1640
|
}), o = null, a = null;
|
|
1641
1641
|
}, m = (g) => {
|
|
1642
|
-
g ? (F(), V(g)) :
|
|
1642
|
+
g ? (F(), V(g)) : f();
|
|
1643
1643
|
}, F = () => {
|
|
1644
1644
|
if (a) {
|
|
1645
1645
|
const g = a == null ? void 0 : a.get("portData"), T = e.getZoom();
|
|
@@ -1650,7 +1650,7 @@ const getShipDirectPath = (e) => {
|
|
|
1650
1650
|
o = g, a = T.find((p) => p.get("portData").id === g.id);
|
|
1651
1651
|
};
|
|
1652
1652
|
return {
|
|
1653
|
-
render:
|
|
1653
|
+
render: y,
|
|
1654
1654
|
clear: r,
|
|
1655
1655
|
selected: m,
|
|
1656
1656
|
handlePortHover: (g) => {
|
|
@@ -1659,20 +1659,20 @@ const getShipDirectPath = (e) => {
|
|
|
1659
1659
|
}
|
|
1660
1660
|
};
|
|
1661
1661
|
}, useEventManager = (e, n, l, s, a, o) => {
|
|
1662
|
-
const
|
|
1663
|
-
|
|
1662
|
+
const y = e.getInstall();
|
|
1663
|
+
y.on("moveend", () => {
|
|
1664
1664
|
var t, r;
|
|
1665
1665
|
const E = e.getZoom();
|
|
1666
1666
|
(r = (t = n.getProps()).mapMoveEnd) == null || r.call(t, E), l.reRenderTrackLine();
|
|
1667
|
-
}),
|
|
1668
|
-
const t =
|
|
1667
|
+
}), y.on("pointermove", (E) => {
|
|
1668
|
+
const t = y.getEventPixel(E.originalEvent), r = y.forEachFeatureAtPixel(t, (f) => f);
|
|
1669
1669
|
s.handleShipMapEvent(r, "hover"), l.handleTrackMapEvent(r, "hover", E), r && a.handlePortHover(r);
|
|
1670
|
-
}),
|
|
1670
|
+
}), y.on("movestart", () => {
|
|
1671
1671
|
console.log("movestart-----------------------");
|
|
1672
|
-
}),
|
|
1673
|
-
var
|
|
1672
|
+
}), y.on("click", debounce((E) => {
|
|
1673
|
+
var f, m, F;
|
|
1674
1674
|
if (console.log("1", o.getState()), o.getState()) return;
|
|
1675
|
-
const t =
|
|
1675
|
+
const t = y.getEventPixel(E.originalEvent), r = y.forEachFeatureAtPixel(
|
|
1676
1676
|
t,
|
|
1677
1677
|
(V) => {
|
|
1678
1678
|
if (V != null && V.get("shipData") || V != null && V.get("portData"))
|
|
@@ -1681,7 +1681,7 @@ const getShipDirectPath = (e) => {
|
|
|
1681
1681
|
);
|
|
1682
1682
|
if (console.log("2", r), !!r) {
|
|
1683
1683
|
if (E.preventDefault(), E.stopPropagation(), r.get("shipData"))
|
|
1684
|
-
s.handleShipMapEvent(r, "click", (
|
|
1684
|
+
s.handleShipMapEvent(r, "click", (f = n.getProps()) == null ? void 0 : f.selectShip);
|
|
1685
1685
|
else if (r.get("portData")) {
|
|
1686
1686
|
const V = r.get("portData");
|
|
1687
1687
|
a.selected(V), (F = (m = n.getProps()) == null ? void 0 : m.selectPort) == null || F.call(m, V);
|
|
@@ -1694,26 +1694,26 @@ const getShipDirectPath = (e) => {
|
|
|
1694
1694
|
createInstance: (s, a) => {
|
|
1695
1695
|
const o = useMapInitializer();
|
|
1696
1696
|
o.initMap(s, a);
|
|
1697
|
-
const
|
|
1697
|
+
const y = o.getInstall(), E = useLayerManager(y), t = usePropsManager();
|
|
1698
1698
|
t.setProps(a), E.setShowLayerType(a.layerType), E.setGreenTileVisible(a.showGreenLayer);
|
|
1699
|
-
const r = useTrackManager(
|
|
1699
|
+
const r = useTrackManager(y), f = useCarTrackManager(y, r), m = useShipManager(y), F = usePositionManager(y), V = useDrawLineManager(y, t), v = useDrawPolygonManager(y, t), g = usePortManager(o);
|
|
1700
1700
|
useEventManager(o, t, r, m, g, V);
|
|
1701
1701
|
const T = () => {
|
|
1702
|
-
const C =
|
|
1702
|
+
const C = y.getView().calculateExtent(o.getSize()), Z = transform([C[0], C[1]], projection.mercator, projection.data), Y = transform([C[2], C[3]], projection.mercator, projection.data);
|
|
1703
1703
|
return [Z[0], Z[1], Y[0], Y[1]];
|
|
1704
1704
|
}, p = {
|
|
1705
1705
|
id: Symbol("map-instance"),
|
|
1706
1706
|
innerMap: null,
|
|
1707
1707
|
map: o.getInstall(),
|
|
1708
1708
|
destroy: () => {
|
|
1709
|
-
e.splice(e.indexOf(p), 1)
|
|
1709
|
+
e.splice(e.indexOf(p), 1);
|
|
1710
1710
|
},
|
|
1711
1711
|
methods: {
|
|
1712
1712
|
...o,
|
|
1713
1713
|
layer: E,
|
|
1714
1714
|
ship: m,
|
|
1715
1715
|
track: r,
|
|
1716
|
-
carTrack:
|
|
1716
|
+
carTrack: f,
|
|
1717
1717
|
port: {
|
|
1718
1718
|
render: g.render,
|
|
1719
1719
|
clear: g.clear,
|
|
@@ -1761,13 +1761,13 @@ const getShipDirectPath = (e) => {
|
|
|
1761
1761
|
} }
|
|
1762
1762
|
},
|
|
1763
1763
|
setup(e, { expose: n }) {
|
|
1764
|
-
const l = ref(), s = ref(), a = useMapController(), o = ref(),
|
|
1764
|
+
const l = ref(), s = ref(), a = useMapController(), o = ref(), y = e, E = ref({
|
|
1765
1765
|
getInstall() {
|
|
1766
1766
|
}
|
|
1767
1767
|
});
|
|
1768
1768
|
return onMounted(() => {
|
|
1769
1769
|
var t;
|
|
1770
|
-
o.value = a.createInstance(l.value,
|
|
1770
|
+
o.value = a.createInstance(l.value, y), console.log(" instance.value?.methods", o.value.map), E.value = o.value.methods, (t = s.value) == null || t.setScaleLine(o.value.map, y.scaleLineUnit);
|
|
1771
1771
|
}), onUnmounted(() => {
|
|
1772
1772
|
var t, r;
|
|
1773
1773
|
a.destroyInstance((t = o == null ? void 0 : o.value) == null ? void 0 : t.id), (r = o.value) == null || r.destroy();
|
|
@@ -1789,13 +1789,17 @@ const getShipDirectPath = (e) => {
|
|
|
1789
1789
|
return (t = o.value) == null ? void 0 : t.methods.getView();
|
|
1790
1790
|
},
|
|
1791
1791
|
setCenter: (t, r) => {
|
|
1792
|
-
var
|
|
1793
|
-
return (
|
|
1792
|
+
var f;
|
|
1793
|
+
return (f = o.value) == null ? void 0 : f.methods.setCenter(t, r);
|
|
1794
1794
|
},
|
|
1795
1795
|
getSize: () => {
|
|
1796
1796
|
var t;
|
|
1797
1797
|
return (t = o.value) == null ? void 0 : t.methods.getSize();
|
|
1798
1798
|
},
|
|
1799
|
+
setCenter: (t, r) => {
|
|
1800
|
+
var f;
|
|
1801
|
+
return (f = o.value) == null ? void 0 : f.methods.setCenter(t, r);
|
|
1802
|
+
},
|
|
1799
1803
|
layer: {
|
|
1800
1804
|
setGreenTileVisible: (t) => {
|
|
1801
1805
|
var r;
|
|
@@ -1988,7 +1992,7 @@ const getShipDirectPath = (e) => {
|
|
|
1988
1992
|
}, null, 8, ["map-instance"])
|
|
1989
1993
|
]));
|
|
1990
1994
|
}
|
|
1991
|
-
}), Map$1 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
1995
|
+
}), Map$1 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-2f5fd149"]]), ZhMap = withInstall(Map$1);
|
|
1992
1996
|
export {
|
|
1993
1997
|
ZhMap as Z
|
|
1994
1998
|
};
|
package/dist/es/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import { Z as B } from "./BaseInfo-BhnEjLKF.js";
|
|
|
17
17
|
import { Z as g } from "./DetailHeader-DaabNj_4.js";
|
|
18
18
|
import { Z as x } from "./DiyDataTable-D-UZVciZ.js";
|
|
19
19
|
import { D as V } from "./DiyDataTable-D-UZVciZ.js";
|
|
20
|
-
import { Z as G } from "./Map-
|
|
20
|
+
import { Z as G } from "./Map-BJQ9eIcs.js";
|
|
21
21
|
import { Z as M } from "./Table-B_3YA1mb.js";
|
|
22
22
|
import { Z as $ } from "./BaseItem-C4NJy1i4.js";
|
|
23
23
|
const A = [
|