zhihao-ui 1.3.7 → 1.3.9
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-d20K-h9a.js → Map-CCtm5zBi.js} +137 -73
- package/dist/es/index.js +1 -1
- package/dist/index.css +1 -1
- package/dist/types/components/Map/Map.vue.d.ts +5 -15
- package/dist/types/components/Map/function/position.d.ts +14 -0
- package/dist/types/components/Map/index.d.ts +15 -45
- package/dist/types/components/Map/interface/index.d.ts +1 -0
- package/dist/types/components/Map/interface/position.d.ts +7 -0
- package/dist/types/components/Map/interface/wharfEntity.d.ts +0 -2
- package/dist/types/components/Map/utils/util.d.ts +42 -0
- package/dist/umd/index.css +1 -1
- package/dist/umd/index.umd.cjs +15 -15
- package/package.json +1 -1
- package/dist/types/components/Map/function/label.d.ts +0 -9
- package/dist/types/components/Map/function/location.d.ts +0 -7
- package/dist/types/components/Map/function/ship.d.ts +0 -34
- package/dist/types/components/Map/function/shipLabel.d.ts +0 -25
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { ref, computed, watch, onMounted, onBeforeUnmount, h, nextTick, createVNode, render as render$1, defineComponent, openBlock, createElementBlock, inject, createElementVNode, Fragment } from "vue";
|
|
1
2
|
import { h as hooks, p as fromLonLat, t as transformExtent, T as Text, F as Fill, S as Style, q as getLength, O as Overlay, P as Polyline, L as LineString, r as Feature, s as Point, V as VectorLayer, u as VectorSource, i as cloneDeep, v as buffer, w as Stroke, C as CircleStyle, x as transform, y as getVectorContext, z as debounce, R as RBush$1, I as Icon, D as DoubleClickZoom, A as Draw, B as unByKey, G as getUid, M as Map$2, H as TileLayer, X as XYZ, J as View, K as defaults, N as toLonLat, Q as ScaleLine$1, U as getArea, W as getCenter$1, Y as MultiPoint } from "./vendor-Cc_TVxUO.js";
|
|
2
|
-
import { ref, computed, watch, onMounted, onBeforeUnmount, h, nextTick, createVNode, render, defineComponent, openBlock, createElementBlock, inject, createElementVNode, Fragment } from "vue";
|
|
3
3
|
import { _ as _export_sfc } from "./Button-NgQ5sHIG.js";
|
|
4
4
|
import { w as withInstall } from "./utils-DSw1USoH.js";
|
|
5
5
|
const TIAN_DI_TU_KEY = "a6e8f78974f2581f2ca00485b40c948f", MAP_ZOOM = {
|
|
@@ -93,7 +93,7 @@ const popupEle = document.createElement("div"), popupOverlay = new Overlay({
|
|
|
93
93
|
stopEvent: !1,
|
|
94
94
|
className: "track-label-popup"
|
|
95
95
|
});
|
|
96
|
-
let polyline, linePath, startMarker, position, geoMarker, trackAnimating = !1, lastTime = Date.now(), vectorLayer$
|
|
96
|
+
let polyline, linePath, startMarker, position$1, geoMarker, trackAnimating = !1, lastTime = Date.now(), vectorLayer$4, distance = 0, routeFeature = null, thresholdNum = 20;
|
|
97
97
|
const MAX_CACHED_LAYERS = 5, usedIds = [], manageLayerCache = (e) => {
|
|
98
98
|
var n;
|
|
99
99
|
const t = getInstall();
|
|
@@ -475,15 +475,15 @@ const createPointFeatureWithStyle = (e) => {
|
|
|
475
475
|
mercatorToLonLat(s, "array"),
|
|
476
476
|
mercatorToLonLat(c, "array")
|
|
477
477
|
) * Math.PI / 180;
|
|
478
|
-
(m = geoMarkerStyle.getText()) == null || m.setRotation(p), position.setCoordinates(a);
|
|
478
|
+
(m = geoMarkerStyle.getText()) == null || m.setRotation(p), position$1.setCoordinates(a);
|
|
479
479
|
const i = getVectorContext(e);
|
|
480
|
-
i.setStyle(geoMarkerStyle), i.drawGeometry(position), n == null || n.render();
|
|
480
|
+
i.setStyle(geoMarkerStyle), i.drawGeometry(position$1), n == null || n.render();
|
|
481
481
|
}, startAnimation = () => {
|
|
482
482
|
var e;
|
|
483
|
-
trackAnimating = !0, lastTime = Date.now(), distance = 0, position = ((e = startMarker.getGeometry()) == null ? void 0 : e.clone()) || new Point([0, 0]), moveFeatureHandler && (vectorLayer$
|
|
483
|
+
trackAnimating = !0, lastTime = Date.now(), distance = 0, position$1 = ((e = startMarker.getGeometry()) == null ? void 0 : e.clone()) || new Point([0, 0]), moveFeatureHandler && (vectorLayer$4 == null || vectorLayer$4.on("postrender", moveFeatureHandler)), geoMarker == null || geoMarker.setGeometry(void 0);
|
|
484
484
|
}, stopAnimation = () => {
|
|
485
485
|
const e = getInstall();
|
|
486
|
-
trackAnimating && (trackAnimating = !1, geoMarker == null || geoMarker.setGeometry(void 0), moveFeatureHandler && vectorLayer$
|
|
486
|
+
trackAnimating && (trackAnimating = !1, geoMarker == null || geoMarker.setGeometry(void 0), moveFeatureHandler && vectorLayer$4 && vectorLayer$4.un("postrender", moveFeatureHandler), vectorLayer$4 && (e == null || e.removeLayer(vectorLayer$4)), vectorLayer$4 = null, geoMarker = null);
|
|
487
487
|
}, playAnimation = (e, t) => {
|
|
488
488
|
trackAnimating && stopAnimation(), polyline = new Polyline({
|
|
489
489
|
factor: 1e6
|
|
@@ -497,17 +497,17 @@ const createPointFeatureWithStyle = (e) => {
|
|
|
497
497
|
geometry: new Point(linePath.getFirstCoordinate())
|
|
498
498
|
});
|
|
499
499
|
const n = startMarker.getGeometry();
|
|
500
|
-
position = n ? n.clone() : new Point([0, 0]), geoMarker = new Feature({
|
|
500
|
+
position$1 = n ? n.clone() : new Point([0, 0]), geoMarker = new Feature({
|
|
501
501
|
type: "geoMarker",
|
|
502
502
|
style: geoMarkerStyle,
|
|
503
|
-
geometry: position
|
|
504
|
-
}), vectorLayer$
|
|
503
|
+
geometry: position$1
|
|
504
|
+
}), vectorLayer$4 = new VectorLayer({
|
|
505
505
|
source: new VectorSource({
|
|
506
506
|
features: [geoMarker]
|
|
507
507
|
})
|
|
508
508
|
});
|
|
509
509
|
const o = getInstall();
|
|
510
|
-
o == null || o.addLayer(vectorLayer$
|
|
510
|
+
o == null || o.addLayer(vectorLayer$4), moveFeatureHandler = (r) => moveFeature(r, t), startAnimation();
|
|
511
511
|
}, getRotation = (e, t, n) => {
|
|
512
512
|
function o(i) {
|
|
513
513
|
return 180 * (i % (2 * Math.PI)) / Math.PI;
|
|
@@ -531,10 +531,10 @@ const createPointFeatureWithStyle = (e) => {
|
|
|
531
531
|
}
|
|
532
532
|
function a(i, u, m = {}) {
|
|
533
533
|
if (m.final)
|
|
534
|
-
return function(
|
|
535
|
-
return (a(
|
|
534
|
+
return function(S, k) {
|
|
535
|
+
return (a(k, S) + 180) % 360;
|
|
536
536
|
}(i, u);
|
|
537
|
-
const g = l(i), f = l(u), y = r(g[0]), v = r(f[0]),
|
|
537
|
+
const g = l(i), f = l(u), y = r(g[0]), v = r(f[0]), T = r(g[1]), L = r(f[1]), w = Math.sin(v - y) * Math.cos(L), E = Math.cos(T) * Math.sin(L) - Math.sin(T) * Math.cos(L) * Math.cos(v - y);
|
|
538
538
|
return o(Math.atan2(w, E));
|
|
539
539
|
}
|
|
540
540
|
function s(i) {
|
|
@@ -853,7 +853,7 @@ const getShipDirectPath = (e) => {
|
|
|
853
853
|
});
|
|
854
854
|
}
|
|
855
855
|
});
|
|
856
|
-
return render(d, t), t;
|
|
856
|
+
return render$1(d, t), t;
|
|
857
857
|
};
|
|
858
858
|
let selectedShipFeature = null, selectedShip = null;
|
|
859
859
|
const shipsSource = new VectorSource(), shipsLayer = new VectorLayer({
|
|
@@ -988,28 +988,28 @@ const renderShipList = (e) => {
|
|
|
988
988
|
console.log(e);
|
|
989
989
|
}
|
|
990
990
|
}, PORT_LAYER_CLASS_NAME = "zh-map-port-layer";
|
|
991
|
-
let vectorLayer$
|
|
991
|
+
let vectorLayer$3, vectorSource$3;
|
|
992
992
|
const renderPortList = (e) => {
|
|
993
993
|
var t;
|
|
994
994
|
if (!(!e || e.length === 0)) {
|
|
995
|
-
if (vectorSource$
|
|
995
|
+
if (vectorSource$3 || (vectorSource$3 = new VectorSource()), vectorSource$3.clear(), selectedPortData) {
|
|
996
996
|
const n = e.find((o) => o.id === selectedPortData.id);
|
|
997
997
|
n ? selectedPortData = n : e.push(selectedPortData);
|
|
998
998
|
}
|
|
999
999
|
e.forEach((n) => {
|
|
1000
|
-
renderPortPoint(n);
|
|
1001
|
-
}), vectorLayer$
|
|
1000
|
+
renderPortPoint$1(n);
|
|
1001
|
+
}), vectorLayer$3 || (vectorLayer$3 = new VectorLayer({
|
|
1002
1002
|
className: PORT_LAYER_CLASS_NAME,
|
|
1003
|
-
source: vectorSource$
|
|
1003
|
+
source: vectorSource$3,
|
|
1004
1004
|
zIndex: 100
|
|
1005
|
-
}), (t = getInstall()) == null || t.addLayer(vectorLayer$
|
|
1005
|
+
}), (t = getInstall()) == null || t.addLayer(vectorLayer$3));
|
|
1006
1006
|
}
|
|
1007
|
-
}, renderPortPoint = (e) => {
|
|
1007
|
+
}, renderPortPoint$1 = (e) => {
|
|
1008
1008
|
const t = getZoom(), [n, o] = e.latLon.split(","), r = new Feature({
|
|
1009
1009
|
geometry: new Point(fromLonLat([Number(n), Number(o)]))
|
|
1010
1010
|
});
|
|
1011
|
-
r.setStyle(setPortStyle(e, t, e.id === (selectedPortData == null ? void 0 : selectedPortData.id))), r.set("portData", e), vectorSource$
|
|
1012
|
-
}, setPortStyle = (e, t, n) => {
|
|
1011
|
+
r.setStyle(setPortStyle$1(e, t, e.id === (selectedPortData == null ? void 0 : selectedPortData.id))), r.set("portData", e), vectorSource$3.addFeature(r);
|
|
1012
|
+
}, setPortStyle$1 = (e, t, n) => {
|
|
1013
1013
|
const o = (l) => `<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1014
1014
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M22.6563 44.9304C22.5453 44.8844 22.4445 44.817 22.3595 44.7321C22.3595 44.7321 9.36986 31.7424 9.32952 31.6913C7.09059 29.0791 5.64794 25.8802 5.17255 22.4736C4.69716 19.0671 5.20896 15.5957 6.64728 12.471C8.08561 9.34625 10.3902 6.69909 13.2878 4.84325C16.1855 2.98741 19.5548 2.00068 22.9965 2C26.4381 1.99932 29.8078 2.98473 32.7062 4.83943C35.6046 6.69414 37.9102 9.34039 39.3498 12.4646C40.7893 15.5888 41.3025 19.0599 40.8284 22.4666C40.3544 25.8734 38.913 29.0729 36.6751 31.686C36.6401 31.737 23.6531 44.7321 23.6531 44.7321C23.5682 44.817 23.4674 44.8844 23.3564 44.9304C23.2454 44.9763 23.1265 45 23.0063 45C22.8862 45 22.7673 44.9763 22.6563 44.9304Z" fill="${l}"/>
|
|
1015
1015
|
<g clip-path="url(#clip0_10059_122082)">
|
|
@@ -1040,31 +1040,31 @@ const renderPortList = (e) => {
|
|
|
1040
1040
|
})
|
|
1041
1041
|
});
|
|
1042
1042
|
}, clearPortList = () => {
|
|
1043
|
-
if (selectedPortFeature) {
|
|
1043
|
+
if (selectedPortFeature$1) {
|
|
1044
1044
|
console.log("清除非选中的港口");
|
|
1045
|
-
const e = selectedPortFeature.get("portData").id;
|
|
1046
|
-
vectorSource$
|
|
1047
|
-
t.get("portData").id !== e && vectorSource$
|
|
1045
|
+
const e = selectedPortFeature$1.get("portData").id;
|
|
1046
|
+
vectorSource$3.getFeatures().forEach((t) => {
|
|
1047
|
+
t.get("portData").id !== e && vectorSource$3.removeFeature(t);
|
|
1048
1048
|
});
|
|
1049
1049
|
} else
|
|
1050
|
-
console.log("清除所有港口"), vectorSource$
|
|
1051
|
-
}, clearSelectedPort = () => {
|
|
1052
|
-
const e = selectedPortFeature.get("portData"), t = getZoom();
|
|
1053
|
-
vectorSource$
|
|
1054
|
-
o.get("portData").id === e.id && (o == null || o.setStyle(setPortStyle(e, t, !1)));
|
|
1055
|
-
}), selectedPortData = null, selectedPortFeature = null;
|
|
1050
|
+
console.log("清除所有港口"), vectorSource$3.clear();
|
|
1051
|
+
}, clearSelectedPort$1 = () => {
|
|
1052
|
+
const e = selectedPortFeature$1.get("portData"), t = getZoom();
|
|
1053
|
+
vectorSource$3.getFeatures().forEach((o) => {
|
|
1054
|
+
o.get("portData").id === e.id && (o == null || o.setStyle(setPortStyle$1(e, t, !1)));
|
|
1055
|
+
}), selectedPortData = null, selectedPortFeature$1 = null;
|
|
1056
1056
|
};
|
|
1057
|
-
let selectedPortFeature = null, selectedPortData = null;
|
|
1057
|
+
let selectedPortFeature$1 = null, selectedPortData = null;
|
|
1058
1058
|
const selectedPort = (e) => {
|
|
1059
|
-
e ? (clearPrevSelectedPort(), addSelectedPortStyle(e)) : clearSelectedPort();
|
|
1060
|
-
}, clearPrevSelectedPort = () => {
|
|
1061
|
-
if (selectedPortFeature) {
|
|
1062
|
-
const e = selectedPortFeature.get("portData"), t = getZoom();
|
|
1063
|
-
selectedPortFeature.setStyle(setPortStyle(e, t, !1));
|
|
1059
|
+
e ? (clearPrevSelectedPort$1(), addSelectedPortStyle$1(e)) : clearSelectedPort$1();
|
|
1060
|
+
}, clearPrevSelectedPort$1 = () => {
|
|
1061
|
+
if (selectedPortFeature$1) {
|
|
1062
|
+
const e = selectedPortFeature$1.get("portData"), t = getZoom();
|
|
1063
|
+
selectedPortFeature$1.setStyle(setPortStyle$1(e, t, !1));
|
|
1064
1064
|
}
|
|
1065
|
-
}, addSelectedPortStyle = (e) => {
|
|
1066
|
-
const t = vectorSource$
|
|
1067
|
-
selectedPortData = e, selectedPortFeature = t.find((n) => n.get("portData").id === e.id);
|
|
1065
|
+
}, addSelectedPortStyle$1 = (e) => {
|
|
1066
|
+
const t = vectorSource$3.getFeatures();
|
|
1067
|
+
selectedPortData = e, selectedPortFeature$1 = t.find((n) => n.get("portData").id === e.id);
|
|
1068
1068
|
}, handlePortHover = (e) => {
|
|
1069
1069
|
const t = getInstall(), n = t.forEachFeatureAtPixel(e, (o) => o);
|
|
1070
1070
|
n && n.get("portData") && (t.getTargetElement().style.cursor = "pointer");
|
|
@@ -1089,10 +1089,10 @@ const state = ref(!1), open$1 = () => {
|
|
|
1089
1089
|
helpTooltipElement$1 && helpTooltipElement$1.classList.add("hidden");
|
|
1090
1090
|
}), addInteraction(), state.value = !0;
|
|
1091
1091
|
};
|
|
1092
|
-
let vectorSource$
|
|
1092
|
+
let vectorSource$2, vectorLayer$2;
|
|
1093
1093
|
const initMapLayer = () => {
|
|
1094
|
-
vectorSource$
|
|
1095
|
-
source: vectorSource$
|
|
1094
|
+
vectorSource$2 = new VectorSource(), vectorLayer$2 = new VectorLayer({
|
|
1095
|
+
source: vectorSource$2,
|
|
1096
1096
|
zIndex: 1e3,
|
|
1097
1097
|
style: {
|
|
1098
1098
|
"fill-color": "rgba(255, 255, 255, 0.2)",
|
|
@@ -1101,7 +1101,7 @@ const initMapLayer = () => {
|
|
|
1101
1101
|
"circle-radius": 7,
|
|
1102
1102
|
"circle-fill-color": "#ffcc33"
|
|
1103
1103
|
}
|
|
1104
|
-
}), getInstall().addLayer(vectorLayer$
|
|
1104
|
+
}), getInstall().addLayer(vectorLayer$2);
|
|
1105
1105
|
};
|
|
1106
1106
|
let sketch$1, helpTooltip;
|
|
1107
1107
|
const pointerMoveHandler$1 = (e) => {
|
|
@@ -1115,7 +1115,7 @@ const pointerMoveHandler$1 = (e) => {
|
|
|
1115
1115
|
let draw$1;
|
|
1116
1116
|
const addInteraction = () => {
|
|
1117
1117
|
draw$1 = new Draw({
|
|
1118
|
-
source: vectorSource$
|
|
1118
|
+
source: vectorSource$2,
|
|
1119
1119
|
type: "LineString",
|
|
1120
1120
|
style: new Style({
|
|
1121
1121
|
fill: new Fill({
|
|
@@ -1182,8 +1182,8 @@ const createMeasureTooltip$1 = () => {
|
|
|
1182
1182
|
var r, l;
|
|
1183
1183
|
const n = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1184
1184
|
n[t] && ((l = (r = n[t]) == null ? void 0 : r.parentNode) == null || l.removeChild(n[t]));
|
|
1185
|
-
const o = vectorSource$
|
|
1186
|
-
o[t] && vectorSource$
|
|
1185
|
+
const o = vectorSource$2.getFeatures();
|
|
1186
|
+
o[t] && vectorSource$2.removeFeature(o[t]);
|
|
1187
1187
|
}), removeInteraction(), enableDoubleClickZoom(), state.value = !1;
|
|
1188
1188
|
}, deleteLine = (e) => {
|
|
1189
1189
|
var n, o, r, l;
|
|
@@ -1192,8 +1192,8 @@ const createMeasureTooltip$1 = () => {
|
|
|
1192
1192
|
measureHistory.value.splice(t, 1);
|
|
1193
1193
|
const a = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
|
|
1194
1194
|
a[t] && ((o = (n = a[t]) == null ? void 0 : n.parentNode) == null || o.removeChild(a[t]));
|
|
1195
|
-
const s = vectorSource$
|
|
1196
|
-
s[t] && vectorSource$
|
|
1195
|
+
const s = vectorSource$2.getFeatures();
|
|
1196
|
+
s[t] && vectorSource$2.removeFeature(s[t]);
|
|
1197
1197
|
}
|
|
1198
1198
|
(r = getProps()) != null && r.lineDrawEnd && ((l = getProps()) == null || l.lineDrawEnd(measureHistory.value));
|
|
1199
1199
|
}, computedDistance = (e, t) => {
|
|
@@ -1215,13 +1215,13 @@ const createMeasureTooltip$1 = () => {
|
|
|
1215
1215
|
measureHistory.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((t) => {
|
|
1216
1216
|
var n;
|
|
1217
1217
|
(n = t == null ? void 0 : t.parentNode) == null || n.removeChild(t);
|
|
1218
|
-
}), vectorSource$
|
|
1218
|
+
}), vectorSource$2.clear();
|
|
1219
1219
|
const e = getInstall();
|
|
1220
1220
|
if (draw$1) {
|
|
1221
1221
|
const t = e.getInteractions().getArray().find((n) => getUid(n) === getUid(draw$1));
|
|
1222
1222
|
t && e.removeInteraction(t);
|
|
1223
1223
|
}
|
|
1224
|
-
e.removeLayer(vectorLayer$
|
|
1224
|
+
e.removeLayer(vectorLayer$2), helpTooltipElement$1 != null && helpTooltipElement$1.parentNode && helpTooltipElement$1.parentNode.removeChild(helpTooltipElement$1), measureTooltipElement$1 != null && measureTooltipElement$1.parentNode && measureTooltipElement$1.parentNode.removeChild(measureTooltipElement$1);
|
|
1225
1225
|
}, getState = () => state.value, drawLine = {
|
|
1226
1226
|
open: open$1,
|
|
1227
1227
|
close: close$1,
|
|
@@ -1402,9 +1402,9 @@ const open = () => {
|
|
|
1402
1402
|
}, init = () => {
|
|
1403
1403
|
initLayer(), createMeasureTooltip(), createHelpTooltip(), initDraw();
|
|
1404
1404
|
};
|
|
1405
|
-
let vectorLayer = null, vectorSource = null;
|
|
1405
|
+
let vectorLayer$1 = null, vectorSource$1 = null;
|
|
1406
1406
|
const initLayer = () => {
|
|
1407
|
-
if (vectorLayer || vectorSource) return;
|
|
1407
|
+
if (vectorLayer$1 || vectorSource$1) return;
|
|
1408
1408
|
const e = new VectorSource(), t = new VectorLayer({
|
|
1409
1409
|
source: e,
|
|
1410
1410
|
style: new Style({
|
|
@@ -1414,7 +1414,7 @@ const initLayer = () => {
|
|
|
1414
1414
|
})
|
|
1415
1415
|
})
|
|
1416
1416
|
});
|
|
1417
|
-
vectorLayer = t, vectorSource = e;
|
|
1417
|
+
vectorLayer$1 = t, vectorSource$1 = e;
|
|
1418
1418
|
const n = getInstall();
|
|
1419
1419
|
n.on("pointermove", pointerMoveHandler), n.addLayer(t), n.on(["dblclick"], function(o) {
|
|
1420
1420
|
draw && (o.stopPropagation(), o.preventDefault());
|
|
@@ -1437,8 +1437,8 @@ const initDraw = () => {
|
|
|
1437
1437
|
<span class="text">面积:${n}${lineLimitError ? '<span class="error pl-12">超出可以绘画的距离</span>' : ""}</span>
|
|
1438
1438
|
`), measureTooltipElement && (measureTooltipElement.innerHTML += '<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');
|
|
1439
1439
|
const o = t.getCoordinates(), r = o[0][o[0].length - 2];
|
|
1440
|
-
if (measureTooltip.setPosition(r), vectorLayer) {
|
|
1441
|
-
const a = vectorLayer.getSource();
|
|
1440
|
+
if (measureTooltip.setPosition(r), vectorLayer$1) {
|
|
1441
|
+
const a = vectorLayer$1.getSource();
|
|
1442
1442
|
a && storeFeature && (a.clear(), a.addFeature(storeFeature));
|
|
1443
1443
|
}
|
|
1444
1444
|
setTimeout(() => {
|
|
@@ -1454,7 +1454,7 @@ const initDraw = () => {
|
|
|
1454
1454
|
}
|
|
1455
1455
|
draw = new Draw({
|
|
1456
1456
|
type: "Polygon",
|
|
1457
|
-
source: vectorSource,
|
|
1457
|
+
source: vectorSource$1,
|
|
1458
1458
|
trace: !0,
|
|
1459
1459
|
style: [new Style({
|
|
1460
1460
|
stroke: new Stroke({
|
|
@@ -1548,10 +1548,10 @@ const createHelpTooltip = () => {
|
|
|
1548
1548
|
positioning: "center-left"
|
|
1549
1549
|
}), getInstall().addOverlay(tipOverlay);
|
|
1550
1550
|
}, reset = () => {
|
|
1551
|
-
vectorSource == null || vectorSource.clear(), storeFeature = null, createMeasureTooltip(), createHelpTooltip(), initDraw();
|
|
1551
|
+
vectorSource$1 == null || vectorSource$1.clear(), storeFeature = null, createMeasureTooltip(), createHelpTooltip(), initDraw();
|
|
1552
1552
|
}, close = () => {
|
|
1553
1553
|
const e = getInstall();
|
|
1554
|
-
vectorSource == null || vectorSource.clear(), vectorSource = null, vectorLayer && (e.removeLayer(vectorLayer), vectorLayer = null), sketch = null, draw && (draw = null, e.getInteractions().forEach((t) => {
|
|
1554
|
+
vectorSource$1 == null || vectorSource$1.clear(), vectorSource$1 = null, vectorLayer$1 && (e.removeLayer(vectorLayer$1), vectorLayer$1 = null), sketch = null, draw && (draw = null, e.getInteractions().forEach((t) => {
|
|
1555
1555
|
t instanceof Draw && e.removeInteraction(t);
|
|
1556
1556
|
})), helpTooltipElement != null && helpTooltipElement.parentElement && helpTooltipElement.parentElement.removeChild(helpTooltipElement), measureTooltipElement != null && measureTooltipElement.parentElement && measureTooltipElement.parentElement.removeChild(measureTooltipElement), tipOverlay && e.removeOverlay(tipOverlay), measureTooltip && e.removeOverlay(measureTooltip);
|
|
1557
1557
|
}, drawPolygon = {
|
|
@@ -1590,6 +1590,74 @@ const locationTruck = async (e) => {
|
|
|
1590
1590
|
setTrackViewCenter(e);
|
|
1591
1591
|
}, playTrack = (e, t) => {
|
|
1592
1592
|
playShipTrack(e, t);
|
|
1593
|
+
}, LOCATION_LAYER_CLASS_NAME = "zh-map-location-layer";
|
|
1594
|
+
let vectorLayer, vectorSource, selectedPortFeature = null, selectedloactionData = null;
|
|
1595
|
+
const render = (e) => {
|
|
1596
|
+
var t;
|
|
1597
|
+
if (!(!e || e.length === 0)) {
|
|
1598
|
+
if (vectorSource || (vectorSource = new VectorSource()), vectorSource.clear(), selectedloactionData) {
|
|
1599
|
+
const n = e.find((o) => o.id === selectedloactionData.id);
|
|
1600
|
+
n ? selectedloactionData = n : e.push(selectedloactionData);
|
|
1601
|
+
}
|
|
1602
|
+
e.forEach((n) => {
|
|
1603
|
+
renderPortPoint(n);
|
|
1604
|
+
}), vectorLayer || (vectorLayer = new VectorLayer({
|
|
1605
|
+
className: LOCATION_LAYER_CLASS_NAME,
|
|
1606
|
+
source: vectorSource,
|
|
1607
|
+
zIndex: 100
|
|
1608
|
+
}), (t = getInstall()) == null || t.addLayer(vectorLayer));
|
|
1609
|
+
}
|
|
1610
|
+
}, renderPortPoint = (e) => {
|
|
1611
|
+
const t = getZoom(), [n, o] = e.latLon.split(","), r = new Feature({
|
|
1612
|
+
geometry: new Point(fromLonLat([Number(n), Number(o)]))
|
|
1613
|
+
});
|
|
1614
|
+
r.setStyle(setPortStyle(e, t, e.id === (selectedloactionData == null ? void 0 : selectedloactionData.id))), r.set("loactionData", e), vectorSource.addFeature(r);
|
|
1615
|
+
}, setPortStyle = (e, t, n) => {
|
|
1616
|
+
const o = {
|
|
1617
|
+
image: new Icon({
|
|
1618
|
+
src: n && e.selectedPath || e.defaultPath,
|
|
1619
|
+
scale: 0.5 * t / 10
|
|
1620
|
+
})
|
|
1621
|
+
};
|
|
1622
|
+
return e.name && (o.text = new Text({
|
|
1623
|
+
text: e.name,
|
|
1624
|
+
font: "12px sans-serif",
|
|
1625
|
+
fill: new Fill({
|
|
1626
|
+
color: "#000000"
|
|
1627
|
+
}),
|
|
1628
|
+
backgroundFill: new Fill({
|
|
1629
|
+
color: "#FFFFFF"
|
|
1630
|
+
}),
|
|
1631
|
+
offsetY: 30
|
|
1632
|
+
})), new Style(o);
|
|
1633
|
+
}, clearList = () => {
|
|
1634
|
+
if (selectedPortFeature) {
|
|
1635
|
+
const e = selectedPortFeature.get("loactionData").id;
|
|
1636
|
+
vectorSource.getFeatures().forEach((t) => {
|
|
1637
|
+
t.get("loactionData").id !== e && vectorSource.removeFeature(t);
|
|
1638
|
+
});
|
|
1639
|
+
} else
|
|
1640
|
+
vectorSource.clear();
|
|
1641
|
+
}, clearSelected = () => {
|
|
1642
|
+
const e = selectedPortFeature.get("loactionData"), t = getZoom();
|
|
1643
|
+
vectorSource.getFeatures().forEach((o) => {
|
|
1644
|
+
o.get("loactionData").id === e.id && (o == null || o.setStyle(setPortStyle(e, t, !1)));
|
|
1645
|
+
}), selectedloactionData = null, selectedPortFeature = null;
|
|
1646
|
+
}, selectedLocation = (e) => {
|
|
1647
|
+
e ? (clearPrevSelectedPort(), addSelectedPortStyle(e)) : clearSelectedPort();
|
|
1648
|
+
}, clearPrevSelectedPort = () => {
|
|
1649
|
+
if (selectedPortFeature) {
|
|
1650
|
+
const e = selectedPortFeature.get("loactionData"), t = getZoom();
|
|
1651
|
+
selectedPortFeature.setStyle(setPortStyle(e, t, !1));
|
|
1652
|
+
}
|
|
1653
|
+
}, addSelectedPortStyle = (e) => {
|
|
1654
|
+
const t = vectorSource.getFeatures();
|
|
1655
|
+
selectedloactionData = e, selectedPortFeature = t.find((n) => n.get("loactionData").id === e.id);
|
|
1656
|
+
}, position = {
|
|
1657
|
+
render,
|
|
1658
|
+
selected: selectedLocation,
|
|
1659
|
+
clearSelected,
|
|
1660
|
+
clear: clearList
|
|
1593
1661
|
}, _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1594
1662
|
__name: "Map",
|
|
1595
1663
|
props: {
|
|
@@ -1611,15 +1679,10 @@ const locationTruck = async (e) => {
|
|
|
1611
1679
|
},
|
|
1612
1680
|
setup(e, { expose: t }) {
|
|
1613
1681
|
const n = ref(), o = ref(), r = e;
|
|
1614
|
-
console.log(r), onMounted(() => {
|
|
1682
|
+
return console.log(r), onMounted(() => {
|
|
1615
1683
|
var a;
|
|
1616
1684
|
initMap(r), setProps(r), setShowLayerType(r.layerType), setGreenTileVisible(r.showGreenLayer), (a = o.value) == null || a.setScaleLine(r.scaleLineUnit);
|
|
1617
|
-
})
|
|
1618
|
-
const l = () => {
|
|
1619
|
-
const a = getView().calculateExtent(getSize()), s = transform([a[0], a[1]], projection.mercator, projection.data), c = transform([a[2], a[3]], projection.mercator, projection.data);
|
|
1620
|
-
return [s[0], s[1], c[0], c[1]];
|
|
1621
|
-
};
|
|
1622
|
-
return t({
|
|
1685
|
+
}), t({
|
|
1623
1686
|
getInstall,
|
|
1624
1687
|
getZoom,
|
|
1625
1688
|
setZoom,
|
|
@@ -1652,9 +1715,7 @@ const locationTruck = async (e) => {
|
|
|
1652
1715
|
clear: clearPortList,
|
|
1653
1716
|
selected: selectedPort
|
|
1654
1717
|
},
|
|
1655
|
-
|
|
1656
|
-
...location
|
|
1657
|
-
},
|
|
1718
|
+
position,
|
|
1658
1719
|
drawLine,
|
|
1659
1720
|
// 绘制矩形
|
|
1660
1721
|
drawPolygon,
|
|
@@ -1667,7 +1728,10 @@ const locationTruck = async (e) => {
|
|
|
1667
1728
|
playTrack
|
|
1668
1729
|
},
|
|
1669
1730
|
utils: {
|
|
1670
|
-
getCalculateExtent:
|
|
1731
|
+
getCalculateExtent: () => {
|
|
1732
|
+
const a = getView().calculateExtent(getSize()), s = transform([a[0], a[1]], projection.mercator, projection.data), c = transform([a[2], a[3]], projection.mercator, projection.data);
|
|
1733
|
+
return [s[0], s[1], c[0], c[1]];
|
|
1734
|
+
},
|
|
1671
1735
|
convertSixHundredThousandToLatLng,
|
|
1672
1736
|
calculateCirclePoints
|
|
1673
1737
|
}
|
|
@@ -1685,7 +1749,7 @@ const locationTruck = async (e) => {
|
|
|
1685
1749
|
createVNode(ZoomControl, { ref: "zoomControlRef" }, null, 512)
|
|
1686
1750
|
], 64));
|
|
1687
1751
|
}
|
|
1688
|
-
}), Map$1 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
1752
|
+
}), Map$1 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-da85b816"]]), ZhMap = withInstall(Map$1);
|
|
1689
1753
|
export {
|
|
1690
1754
|
ZhMap as Z
|
|
1691
1755
|
};
|
package/dist/es/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import { Z as B } from "./BaseInfo-DFEg4oWo.js";
|
|
|
17
17
|
import { Z as g } from "./DetailHeader-DDDbFDig.js";
|
|
18
18
|
import { Z as x } from "./DiyDataTable-DlgBshaZ.js";
|
|
19
19
|
import { D as V } from "./DiyDataTable-DlgBshaZ.js";
|
|
20
|
-
import { Z as G } from "./Map-
|
|
20
|
+
import { Z as G } from "./Map-CCtm5zBi.js";
|
|
21
21
|
import { Z as M } from "./Table-iJRuASc3.js";
|
|
22
22
|
import { Z as $ } from "./BaseItem-BvdMV2Gu.js";
|
|
23
23
|
const A = [
|