zhihao-ui 1.2.9 → 1.2.10

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.
@@ -16,7 +16,7 @@ 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, i, d, u, p, c, f, g, y, k, L, E, m, v, h, I) {
19
+ constructor(t, o, n, a, r, l, s, i, d, u, p, c, f, v, y, k, L, E, m, g, h, I) {
20
20
  T(this, "id");
21
21
  // mmsi
22
22
  T(this, "mmsi");
@@ -56,7 +56,7 @@ class ShipMapData {
56
56
  T(this, "existDevice");
57
57
  T(this, "existMobile");
58
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;
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 = v, this.cog = y, this.posType = k, this.type = L, this.angle = E, this.leftIconColor = m, this.existDevice = g, this.existMobile = h, this.existWaterGauge = I;
60
60
  }
61
61
  }
62
62
  const formatLength = function(e, t) {
@@ -135,7 +135,7 @@ const labels = ref([]), _hoisted_1$4 = {
135
135
  setup(e, { expose: t, emit: o }) {
136
136
  const n = o, a = useModel(e, "visible"), r = ref(LENGTH_UNIT.NM), l = ref([]), s = ref(!1), i = new VectorSource();
137
137
  let d, u, p, c, f;
138
- const g = new VectorLayer({
138
+ const v = new VectorLayer({
139
139
  source: i,
140
140
  style: {
141
141
  "fill-color": "rgba(255, 255, 255, 0.2)",
@@ -180,11 +180,11 @@ const labels = ref([]), _hoisted_1$4 = {
180
180
  l.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((_) => {
181
181
  var M;
182
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);
183
+ }), i.clear(), (S = mapInstance.value) == null || S.removeInteraction(L), (w = mapInstance.value) == null || w.removeLayer(v), u != null && u.parentNode && u.parentNode.removeChild(u);
184
184
  }
185
- function v() {
185
+ function g() {
186
186
  var w, _;
187
- m(), (w = mapInstance.value) == null || w.addLayer(g), L = new Draw({
187
+ m(), (w = mapInstance.value) == null || w.addLayer(v), L = new Draw({
188
188
  source: i,
189
189
  type: "LineString",
190
190
  style: function() {
@@ -234,9 +234,9 @@ const labels = ref([]), _hoisted_1$4 = {
234
234
  n("close");
235
235
  };
236
236
  return watch(() => a, () => {
237
- a && !s.value && (k(), v());
237
+ a && !s.value && (k(), g());
238
238
  }, { deep: !0, immediate: !0 }), t({
239
- addInteraction: v,
239
+ addInteraction: g,
240
240
  removeInteraction: m
241
241
  }), (S, w) => {
242
242
  const _ = resolveComponent("el-select");
@@ -613,12 +613,12 @@ function drawLabelBody(e, t, o) {
613
613
  e.save(), n && (e.font = n);
614
614
  let p = e.measureText(s).width + 2 * a;
615
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) {
616
+ let c, f = -1, v = r + 3 * a;
617
+ if (f = 0, c = calculateBounds(l, f, p, v, u), c && f > -1) {
618
618
  let y = getBottomLeftPoint(c), k = getTopRighttPoint(c);
619
619
  return {
620
620
  center: l,
621
- x: calculateAnchorPoint(l, f, p, g, u),
621
+ x: calculateAnchorPoint(l, f, p, v, u),
622
622
  l: k,
623
623
  r: y,
624
624
  bounds: c,
@@ -641,8 +641,8 @@ const drawText = (e, t) => {
641
641
  e.font = "12px map-iconfont", e.fillStyle = "#3370ff";
642
642
  let u = e.measureText(n).width + 6;
643
643
  l.forEach((p, c) => {
644
- let f = getIconFont(p), g = 20 * c;
645
- e.fillText(f, i + u + g, d);
644
+ let f = getIconFont(p), v = 20 * c;
645
+ e.fillText(f, i + u + v, d);
646
646
  });
647
647
  }
648
648
  e.font = s || labelFont, e.fillStyle = a, e.fillText(n, i, d), e.restore();
@@ -677,7 +677,7 @@ const drawText = (e, t) => {
677
677
  }, u = drawLabelBody(e, labels.value, d);
678
678
  if (u) {
679
679
  const { x: p, bounds: c, l: f } = u;
680
- let g = [getTopLeftPoint(c), getBottomLeftPoint(c), getBottomRightPoint(c), getTopRighttPoint(c)];
680
+ let v = [getTopLeftPoint(c), getBottomLeftPoint(c), getBottomRightPoint(c), getTopRighttPoint(c)];
681
681
  labels.value.push(u), drawPolygon(e, {
682
682
  points: [o, p],
683
683
  strokeColor: a,
@@ -689,9 +689,9 @@ const drawText = (e, t) => {
689
689
  scale: void 0,
690
690
  globalAlpha: labelAlpha
691
691
  }), i != null && i.length && i.forEach(() => {
692
- g[1][0] += 20, g[2][0] += 20;
692
+ v[1][0] += 20, v[2][0] += 20;
693
693
  }), drawPolygon(e, {
694
- points: g,
694
+ points: v,
695
695
  strokeColor: a,
696
696
  fillColor: l,
697
697
  shouldClosePath: !0
@@ -729,11 +729,11 @@ const setTruckStyle = (e, t, o, n) => new Style({
729
729
  i = i / s - 20, d = d / s;
730
730
  const u = i - 70, p = d - 68;
731
731
  let c = 180;
732
- const f = 56, g = "#FFFFFF";
732
+ const f = 56, v = "#FFFFFF";
733
733
  let y = 176;
734
734
  const k = 52;
735
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";
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, v), 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
737
  const m = `${t.slice(0, 2) + " · " + t.slice(2)}`;
738
738
  if (l.fillText(m, u + 12, p + 32), l.save(), l.restore(), n != null && n.length) {
739
739
  const h = l.measureText(m).width + 12;
@@ -742,8 +742,8 @@ const setTruckStyle = (e, t, o, n) => new Style({
742
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);
743
743
  });
744
744
  }
745
- const v = dotImage;
746
- l.drawImage(v, i + c / 2 - 90, d, 50 / s, 50 / s), l.restore();
745
+ const g = dotImage;
746
+ l.drawImage(g, i + c / 2 - 90, d, 50 / s, 50 / s), l.restore();
747
747
  }
748
748
  });
749
749
  ref([]);
@@ -1150,8 +1150,8 @@ const renderShips = (e) => {
1150
1150
  offsetY: -10
1151
1151
  }),
1152
1152
  zIndex: 99
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);
1153
+ }), v = [];
1154
+ s.state === "0" ? ((u = f.getText()) == null || u.setFill(new Fill({ color: stopColor })), v.push(r)) : ((p = f.getText()) == null || p.setFill(new Fill({ color: slowColor })), v.push(l)), v.push(f), c.setStyle(v), trackLineVectorSource.value.addFeature(c);
1155
1155
  }
1156
1156
  }), renderArrow(n, e), renderIconPoint();
1157
1157
  }, renderArrow = (e, t) => {
@@ -1268,17 +1268,17 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, a = "ship")
1268
1268
  // 设置不阻拦事件
1269
1269
  });
1270
1270
  if (a) {
1271
- let c = !1, f = [0, 0], g = [0, 0];
1271
+ let c = !1, f = [0, 0], v = [0, 0];
1272
1272
  r.addEventListener("mousedown", function(y) {
1273
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 = [
1274
+ c = !0, y.clientX, y.clientY, f = (k = mapInstance.value) == null ? void 0 : k.getCoordinateFromPixel([y.clientX - 200, y.clientY - 200]), v = [
1275
1275
  y.clientX - r.getBoundingClientRect().left + 160,
1276
1276
  y.clientY - r.getBoundingClientRect().top + 84
1277
1277
  ], y.preventDefault();
1278
1278
  }), document.addEventListener("mousemove", function(y) {
1279
1279
  var k;
1280
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];
1281
+ let L = (k = mapInstance.value) == null ? void 0 : k.getCoordinateFromPixel([y.clientX - v[0], y.clientY - v[1]]), E = L[0] - f[0], m = L[1] - f[1];
1282
1282
  l.setPosition([f[0] + E, f[1] + m]);
1283
1283
  }
1284
1284
  }), document.addEventListener("mouseup", function() {
@@ -1372,8 +1372,8 @@ const trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, a = "ship")
1372
1372
  });
1373
1373
  p.on("translating", function(c) {
1374
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));
1375
+ const f = c.features.item(0).getGeometry().getCoordinates(), v = toLonLat(f);
1376
+ markerPosition.value = `${v[0].toFixed(6)}, ${v[1].toFixed(6)}`, (y = marker.value) == null || y.setStyle(createIconStyle(markerPosition.value));
1377
1377
  }), mapInstance.value.addInteraction(p);
1378
1378
  }
1379
1379
  const d = new Point([n, a]);
@@ -1400,18 +1400,8 @@ const circleStyle = {
1400
1400
  const t = e.getGeometry().getCoordinates();
1401
1401
  return new MultiPoint(t);
1402
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;
1403
+ };
1404
+ let drawVector, draw;
1415
1405
  function createMeasureTooltip() {
1416
1406
  var e;
1417
1407
  measureTooltipElement != null && measureTooltipElement.parentNode && measureTooltipElement.parentNode.removeChild(measureTooltipElement), measureTooltipElement = document.createElement("div"), measureTooltipElement.className = "ol-tooltip ol-tooltip-draw-polygon", measureTooltip = new Overlay({
@@ -1443,7 +1433,7 @@ const validateSquareLimit = (e) => {
1443
1433
  let storeFeature;
1444
1434
  function addInteraction(e) {
1445
1435
  var o, n;
1446
- mapInstance.value || init(), drawnState = "undrawn", layerState = "drawn", (o = mapInstance.value) == null || o.addLayer(drawVector), draw = new Draw({
1436
+ drawVector || init(), drawnState = "undrawn", layerState = "drawn", (o = mapInstance.value) == null || o.addLayer(drawVector), draw = new Draw({
1447
1437
  type: "Polygon",
1448
1438
  // source: drawVector.getSource(),
1449
1439
  source,
@@ -1530,7 +1520,17 @@ const endFn = (e) => {
1530
1520
  let t = "点击选择起点";
1531
1521
  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
1522
  }, init = () => {
1533
- mapInstance.value && (mapInstance.value.on("pointermove", pointerMoveHandler), mapInstance.value.getViewport().addEventListener("mouseout", function() {
1523
+ mapInstance.value && (drawVector = new VectorLayer({
1524
+ source,
1525
+ style: [
1526
+ {
1527
+ "stroke-color": "rgba(255, 255, 255, 1)",
1528
+ "stroke-width": 2,
1529
+ "fill-color": "rgba(255, 255, 255, 0.3)"
1530
+ },
1531
+ new Style(circleStyle)
1532
+ ]
1533
+ }), mapInstance.value.on("pointermove", pointerMoveHandler), mapInstance.value.getViewport().addEventListener("mouseout", function() {
1534
1534
  var e;
1535
1535
  (e = helpTooltipElement == null ? void 0 : helpTooltipElement.classList) == null || e.add("hidden");
1536
1536
  }), mapInstance.value.on("dblclick", function(e) {
@@ -1558,7 +1558,7 @@ const endFn = (e) => {
1558
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
1559
  })(c || (c = {}));
1560
1560
  const f = () => {
1561
- var v, h;
1561
+ var g, h;
1562
1562
  const m = {
1563
1563
  projection: projection.mercator,
1564
1564
  // 地图投影坐标系
@@ -1585,34 +1585,34 @@ const endFn = (e) => {
1585
1585
  c.greenMark
1586
1586
  ],
1587
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);
1588
+ }), (g = a.value) == null || g.setScaleLine(), (h = mapInstance.value) == null || h.on("moveend", k), v(s.vehicleMode === "ship"), y(s.vehicleMode === "ship" ? BaseMapType.satellite : BaseMapType.vector);
1589
1589
  };
1590
1590
  onMounted(() => {
1591
1591
  f();
1592
1592
  });
1593
- const g = (m) => {
1594
- var v;
1595
- (v = mapInstance.value) == null || v.getLayers().forEach((h) => {
1593
+ const v = (m) => {
1594
+ var g;
1595
+ (g = mapInstance.value) == null || g.getLayers().forEach((h) => {
1596
1596
  h.ol_uid === c.greenMark.ol_uid && (h.setVisible(m), u.value = m);
1597
1597
  });
1598
1598
  }, y = (m) => {
1599
- var v;
1600
- console.log("mode", m), (v = mapInstance.value) == null || v.getLayers().forEach((h) => {
1599
+ var g;
1600
+ console.log("mode", m), (g = mapInstance.value) == null || g.getLayers().forEach((h) => {
1601
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));
1602
1602
  });
1603
1603
  }, k = () => {
1604
- const m = mapInstance.value.getView(), v = m.getZoom();
1605
- v && L(v);
1604
+ const m = mapInstance.value.getView(), g = m.getZoom();
1605
+ g && L(g);
1606
1606
  const h = m.calculateExtent(mapInstance.value.getSize());
1607
- h && v && E(h, v);
1607
+ h && g && E(h, g);
1608
1608
  }, L = (m) => {
1609
1609
  var I, C, V, S;
1610
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;
1611
+ const g = (I = mapInstance.value) == null ? void 0 : I.getLayers(), h = s.vehicleMode === "ship" ? g == null ? void 0 : g.getArray().find((w) => w.ol_uid === c.greenMark.ol_uid) : void 0;
1612
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) => {
1613
+ }, E = (m, g) => {
1614
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 });
1615
+ l("extentChanged", { extent: [h, I], zoom: g });
1616
1616
  };
1617
1617
  return t({
1618
1618
  mapInstance,
@@ -1633,34 +1633,34 @@ const endFn = (e) => {
1633
1633
  },
1634
1634
  clearSelectFeature,
1635
1635
  findShip,
1636
- focusShip: (m, v) => {
1636
+ focusShip: (m, g) => {
1637
1637
  var h, I;
1638
- (h = shipsLayer.value) == null || h.setVisible(!1), (I = largeAmountShipsLayer.value) == null || I.setVisible(!1), findShip(m, v);
1638
+ (h = shipsLayer.value) == null || h.setVisible(!1), (I = largeAmountShipsLayer.value) == null || I.setVisible(!1), findShip(m, g);
1639
1639
  },
1640
1640
  showTracks,
1641
1641
  removeAllTrackLayer,
1642
1642
  switchFilterItem,
1643
1643
  rerenderShip,
1644
- switchGreenDot: () => g(!1),
1644
+ switchGreenDot: () => v(!1),
1645
1645
  zoomTruckIcon,
1646
- renderTruckTrack: (m, v, h) => {
1647
- renderTrack(m, v, h, LENGTH_UNIT.KM, "truck");
1646
+ renderTruckTrack: (m, g, h) => {
1647
+ renderTrack(m, g, h, LENGTH_UNIT.KM, "truck");
1648
1648
  },
1649
1649
  renderMarker,
1650
1650
  setMarkerPosition,
1651
1651
  drawPolygonTool
1652
- }), (m, v) => (openBlock(), createElementBlock("div", {
1652
+ }), (m, g) => (openBlock(), createElementBlock("div", {
1653
1653
  class: "map-page map-container",
1654
1654
  ref_key: "pageRef",
1655
1655
  ref: n
1656
1656
  }, [
1657
- v[0] || (v[0] = createElementVNode("div", {
1657
+ g[0] || (g[0] = createElementVNode("div", {
1658
1658
  id: "map",
1659
1659
  class: "map"
1660
1660
  }, null, -1)),
1661
1661
  createVNode(ToolPanel, {
1662
1662
  "vehicle-mode": m.vehicleMode,
1663
- onSwitchGreenDot: g,
1663
+ onSwitchGreenDot: v,
1664
1664
  onSwitchMapTile: y
1665
1665
  }, null, 8, ["vehicle-mode"]),
1666
1666
  createVNode(ScaleLine, {
package/dist/es/index.js CHANGED
@@ -18,7 +18,7 @@ import { Z as I } from "./BaseInfo-Dv-eon6t.js";
18
18
  import { Z as d } from "./DetailHeader-C_mAB8-2.js";
19
19
  import { Z as P } from "./DiyDataTable-KOY6vjPs.js";
20
20
  import { D as J } from "./DiyDataTable-KOY6vjPs.js";
21
- import { Z as T } from "./Map-CMiThYaG.js";
21
+ import { Z as T } from "./Map-B8_d8utt.js";
22
22
  const b = [
23
23
  I,
24
24
  r,
@@ -655,7 +655,7 @@ void main(void) {
655
655
  }`;const $=`u_texture${g}`;let V="1.";"fill-color"in t&&(V=e.getFillColorExpression()),e.setFillColorExpression(`${V} * sampleFillPattern(${$}, ${y}, ${L}, ${k}, pxOrigin, pxPos)`)}}function parseLiteralStyle(t,e){const n=newCompilationContext(),r={...newCompilationContext(),inFragmentShader:!0,variables:n.variables},i=new ShaderBuilder,g={};if("icon-src"in t?parseIconProperties(t,i,g,n,r):"shape-points"in t?parseShapeProperties(t,i,g,n,r):"circle-radius"in t&&parseCircleProperties(t,i,g,n,r),parseStrokeProperties(t,i,g,n,r),parseFillProperties(t,i,g,n,r),t.filter){const L=expressionToGlsl(r,t.filter,BooleanType);i.setFragmentDiscardExpression(`!${L}`)}for(const L in r.variables){const $=r.variables[L],V=uniformNameForVariable($.name);let z=getGlslTypeFromType($.type);$.type===ColorType&&(z="vec4"),i.addUniform(`${z} ${V}`),g[V]=()=>{const j=e[$.name];return typeof j=="number"?j:typeof j=="boolean"?j?1:0:$.type===ColorType?asArray(j||"#eee"):typeof j=="string"?getStringNumberEquivalent(j):j}}for(const L in r.properties){const $=r.properties[L];n.properties[L]||(n.properties[L]=$);let V=getGlslTypeFromType($.type),z=`a_prop_${$.name}`;$.type===ColorType&&(V="vec4",z=`unpackColor(${z})`,i.addVertexShaderFunction(UNPACK_COLOR_FN)),i.addVarying(`v_prop_${$.name}`,V,z)}for(const L in n.properties){const $=n.properties[L];i.addAttribute(`${getGlslTypeFromType($.type)} a_prop_${$.name}`)}for(const L in n.functions)i.addVertexShaderFunction(n.functions[L]);for(const L in r.functions)i.addFragmentShaderFunction(r.functions[L]);const y={};for(const L in n.properties){const $=n.properties[L],V=z=>{const j=z.get($.name);return $.type===ColorType?packColor([...asArray(j||"#eee")]):typeof j=="string"?getStringNumberEquivalent(j):typeof j=="boolean"?j?1:0:j};y[`prop_${$.name}`]={size:getGlslSizeFromType($.type),callback:V}}function k(L,$,V,z){const j=n[L],ie=r[L];if(!j&&!ie)return;const re=getGlslTypeFromType(V),oe=getGlslSizeFromType(V);i.addAttribute(`${re} a_${$}`),ie&&i.addVarying(`v_${$}`,re,`a_${$}`),y[$]={size:oe,callback:z}}return k("geometryType",GEOMETRY_TYPE_PROPERTY_NAME,StringType,L=>getStringNumberEquivalent(computeGeometryType(L.getGeometry()))),k("featureId",FEATURE_ID_PROPERTY_NAME,StringType|NumberType,L=>{const $=L.getId()??null;return typeof $=="string"?getStringNumberEquivalent($):$}),{builder:i,attributes:y,uniforms:g}}class WebGLPointsLayer extends Layer{constructor(e){const n=Object.assign({},e);super(n),this.styleVariables_=e.variables||{},this.parseResult_=parseLiteralStyle(e.style,this.styleVariables_),this.hitDetectionDisabled_=!!e.disableHitDetection}createRenderer(){const e=Object.keys(this.parseResult_.attributes).map(n=>({name:n,...this.parseResult_.attributes[n]}));return new WebGLPointsLayerRenderer(this,{vertexShader:this.parseResult_.builder.getSymbolVertexShader(),fragmentShader:this.parseResult_.builder.getSymbolFragmentShader(),hitDetectionEnabled:!this.hitDetectionDisabled_,uniforms:this.parseResult_.uniforms,attributes:e})}updateStyleVariables(e){Object.assign(this.styleVariables_,e),this.changed()}}var CAR_COLOR=(t=>(t[t.BLUE=1]="BLUE",t[t.YELLOW=2]="YELLOW",t[t.Y_GREEN=3]="Y_GREEN",t))(CAR_COLOR||{}),DEVICE_TYPE=(t=>(t[t.HOST=1]="HOST",t[t.TALK=2]="TALK",t[t.STORAGE=3]="STORAGE",t[t.INTERNET=4]="INTERNET",t[t.CAMERA=5]="CAMERA",t[t.LOAD=6]="LOAD",t))(DEVICE_TYPE||{}),LENGTH_UNIT=(t=>(t[t.M=1]="M",t[t.KM=2]="KM",t[t.NM=3]="NM",t))(LENGTH_UNIT||{});const LENGTH_UNIT_LABEL={1:"M",2:"KM",3:"NM"};var SWITCH_BTN=(t=>(t.Camera="camera",t.Mobile="mobile",t.WaterGauge="waterGauge",t))(SWITCH_BTN||{});class ShipMapData{constructor(e,n,r,i,g,y,k,L,$,V,z,j,ie,re,oe,ue,ae,pe,he,le,de,_e){er(this,"id");er(this,"mmsi");er(this,"fill");er(this,"shipType");er(this,"name");er(this,"length");er(this,"breadth");er(this,"lon");er(this,"lat");er(this,"createdAt");er(this,"speed");er(this,"from");er(this,"sailStatus");er(this,"hdg");er(this,"cog");er(this,"posType");er(this,"type");er(this,"angle");er(this,"leftIconColor");er(this,"existDevice");er(this,"existMobile");er(this,"existWaterGauge");this.id=e,this.mmsi=n,this.fill=r,this.shipType=i,this.name=g,this.length=y,this.breadth=k,this.lon=L,this.lat=$,this.createdAt=V,this.speed=z,this.from=j,this.sailStatus=ie,this.hdg=re,this.cog=oe,this.posType=ue,this.type=ae,this.angle=pe,this.leftIconColor=he,this.existDevice=le,this.existMobile=de,this.existWaterGauge=_e}}const formatLength=function(t,e){const r=getLength(t);let i="";switch(e){case LENGTH_UNIT.M:i=Math.round(r*100)/100+" m";break;case LENGTH_UNIT.KM:i=Math.round(r/1e3*100)/100+" km";break;case LENGTH_UNIT.NM:i=(Math.round(r/1e3*100)/100/1.852).toFixed(2)+" nm";break}return i},convertSixHundredThousandToLatLng=function(t,e){const n=Number(e)/6e5;return[Number(t)/6e5,n]},formatArea=(t,e)=>{const r=getArea(t);let i;switch(e){case LENGTH_UNIT.KM:r>1e4?i=Math.round(r/1e6*100)/100+" km<sup>2</sup>":i=Math.round(r*100)/100+" m<sup>2</sup>";break;case LENGTH_UNIT.NM:const g=Math.pow(1.852,2);r>1e4?i=Math.round(r/1e6/g*100)/100+" nm<sup>2</sup>":i=Math.round(r*100)/100+" m<sup>2</sup>";break}return i},convertShipMapData=t=>{const e=n=>new ShipMapData(n.id,n.id,n.fill||"#04C900","70",n.cnname||n.name,n.len,n.wid,n.lon,n.lat,new Date().getTime(),n.spd,n.from,n.status,Number(n.hdg),n.cog,Number(n.postype),"other",n.cog,n.leftIconColor,n.existDevice,n.existMobile,n.existWaterGauge);return Array.isArray(t)?t.map(n=>e(n)):e(t)},mapInstance=vue.ref(),shipsLayer=vue.ref(),selectShipsLayer=vue.ref(),allShips=vue.ref([]),largeAmountShipsLayer=vue.ref();vue.ref();const trucksLayer=vue.ref(),shipTrackLineFeatures=vue.ref([]),trackLineVectorSource=vue.ref(),shipTrackVectorLayer=vue.ref();vue.ref(),vue.ref();const labels=vue.ref([]),_hoisted_1$4={key:0,class:"measure-panel"},_hoisted_2$2={class:"d-flex justify-content-between align-content-start w-100"},_hoisted_3$1={class:"measure-history-list"},_hoisted_4={class:"left-panel"},_hoisted_5={class:"text index"},_hoisted_6={class:"text"},_hoisted_7=["onClick"],_sfc_main$6=vue.defineComponent({__name:"measure",props:{visible:{type:Boolean},visibleModifiers:{}},emits:vue.mergeModels(["close"],["update:visible"]),setup(t,{expose:e,emit:n}){const r=n,i=vue.useModel(t,"visible"),g=vue.ref(LENGTH_UNIT.NM),y=vue.ref([]),k=vue.ref(!1),L=new VectorSource;let $,V,z,j,ie;const re=new VectorLayer({source:L,style:{"fill-color":"rgba(255, 255, 255, 0.2)","stroke-color":"#ffcc33","stroke-width":2,"circle-radius":7,"circle-fill-color":"#ffcc33"}}),oe=function(Oe){if(Oe.dragging)return;let Fe="点击选择起点";$&&(Fe="单击继续,双击结束"),V&&(V.innerHTML=Fe,z.setPosition(Oe.coordinate),V.classList.remove("hidden"))},ue=()=>{mapInstance.value&&(mapInstance.value.on("pointermove",oe),mapInstance.value.getViewport().addEventListener("mouseout",function(){var Oe;(Oe=V==null?void 0:V.classList)==null||Oe.add("hidden")}),k.value=!0)};let ae;const pe=new Style({fill:new Fill({color:"rgba(255, 255, 255, 0.2)"}),stroke:new Stroke({color:"rgba(255,204,51)",lineDash:[10,10],width:2}),image:new CircleStyle({radius:5,stroke:new Stroke({color:"rgba(0, 0, 0, 0.7)"}),fill:new Fill({color:"rgba(255, 255, 255, 0.2)"})})});function he(){var Oe,Fe;y.value=[],document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach($e=>{var Et;(Et=$e==null?void 0:$e.parentNode)==null||Et.removeChild($e)}),L.clear(),(Oe=mapInstance.value)==null||Oe.removeInteraction(ae),(Fe=mapInstance.value)==null||Fe.removeLayer(re),V!=null&&V.parentNode&&V.parentNode.removeChild(V)}function le(){var Fe,$e;he(),(Fe=mapInstance.value)==null||Fe.addLayer(re),ae=new Draw({source:L,type:"LineString",style:function(){return pe}}),($e=mapInstance.value)==null||$e.addInteraction(ae),_e(),de();let Oe;ae.on("drawstart",function(Et){var jt;$=Et.feature;let Pt;Oe=(jt=$.getGeometry())==null?void 0:jt.on("change",function(At){const Ne=At.target;let kt=formatLength(Ne,g.value);Pt=Ne.getLastCoordinate(),j&&kt&&(j.innerHTML=kt),ie.setPosition(Pt)})}),ae.on("drawend",function(){j&&(j.className="ol-tooltip ol-tooltip-static ol-tooltip-measure"),j!=null&&j.innerHTML&&y.value.push(j==null?void 0:j.innerHTML),ie.setOffset([0,-7]),$=null,j=null,_e(),Oe&&unByKey(Oe)})}function de(){var Oe;V!=null&&V.parentNode&&V.parentNode.removeChild(V),V=document.createElement("div"),V.className="ol-tooltip hidden",z=new Overlay({element:V,offset:[15,0],positioning:"center-left"}),(Oe=mapInstance.value)==null||Oe.addOverlay(z)}function _e(){var Oe;j!=null&&j.parentNode&&j.parentNode.removeChild(j),j=document.createElement("div"),j.className="ol-tooltip ol-tooltip-measure",ie=new Overlay({element:j,offset:[0,-15],positioning:"bottom-center",stopEvent:!1,insertFirst:!1}),(Oe=mapInstance.value)==null||Oe.addOverlay(ie)}const Ce=Oe=>{var Et,Pt;y.value[Oe]&&y.value.splice(Oe,1);const Fe=document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");Fe[Oe]&&((Pt=(Et=Fe[Oe])==null?void 0:Et.parentNode)==null||Pt.removeChild(Fe[Oe]));const $e=L.getFeatures();$e[Oe]&&L.removeFeature($e[Oe])},xe=()=>{r("close")};return vue.watch(()=>i,()=>{i&&!k.value&&(ue(),le())},{deep:!0,immediate:!0}),e({addInteraction:le,removeInteraction:he}),(Oe,Fe)=>{const $e=vue.resolveComponent("el-select");return i.value?(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$4,[vue.createElementVNode("div",{class:"header"},[Fe[1]||(Fe[1]=vue.createElementVNode("div",{class:"title"},"测量",-1)),vue.createElementVNode("i",{onClick:xe,class:"map-iconfont icon-close"})]),vue.createElementVNode("div",_hoisted_2$2,[Fe[2]||(Fe[2]=vue.createElementVNode("div",{class:"tips"},"在地图上点击多个点测量距离,距离单位",-1)),vue.createVNode($e,{class:"select-length-unit",modelValue:g.value,"onUpdate:modelValue":Fe[0]||(Fe[0]=Et=>g.value=Et)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(LENGTH_UNIT_LABEL),Et=>(vue.openBlock(),vue.createBlock(vue.unref(ElOption),{key:vue.unref(LENGTH_UNIT)[Et],label:Et,value:vue.unref(LENGTH_UNIT)[Et]},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),vue.createElementVNode("div",_hoisted_3$1,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(y.value,(Et,Pt)=>(vue.openBlock(),vue.createElementBlock("div",{class:"measure-history-item",key:Pt},[vue.createElementVNode("div",_hoisted_4,[Fe[3]||(Fe[3]=vue.createElementVNode("i",{class:"map-iconfont icon-a-Frame-11"},null,-1)),vue.createElementVNode("span",_hoisted_5,"线段"+vue.toDisplayString(Pt+1),1),vue.createElementVNode("span",_hoisted_6,vue.toDisplayString(Et),1)]),vue.createElementVNode("div",{class:"delete-button",onClick:jt=>Ce(Pt)},Fe[4]||(Fe[4]=[vue.createElementVNode("i",{class:"map-iconfont icon-a-delete1"},null,-1)]),8,_hoisted_7)]))),128))])])):vue.createCommentVNode("",!0)}}}),Measure=_export_sfc(_sfc_main$6,[["__scopeId","data-v-650abf6f"]]),_hoisted_1$3={class:"tool-panel"},_hoisted_2$1={class:"tool-components"},_sfc_main$5=vue.defineComponent({__name:"toolPanel",props:{vehicleMode:{}},emits:["switchGreenDot","switchMapTile"],setup(t,{emit:e}){const n=e,r=vue.ref(!1),i=vue.ref(null),g=vue.ref(!0),y=()=>{g.value=!g.value,n("switchGreenDot",g.value)},k=vue.ref(BaseMapType.vector),L=()=>{k.value=k.value===BaseMapType.vector?BaseMapType.satellite:BaseMapType.vector,n("switchMapTile",k.value)},$=()=>{var z,j;r.value?(z=i.value)==null||z.removeInteraction():(j=i.value)==null||j.addInteraction(),r.value=!r.value},V=()=>{var z;(z=i.value)==null||z.removeInteraction(),r.value=!1};return(z,j)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",_hoisted_1$3,[z.vehicleMode==="ship"?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:0},[vue.createElementVNode("div",{class:vue.normalizeClass(["switch-btn",`${r.value&&"active"}`]),onClick:$},j[1]||(j[1]=[vue.createElementVNode("i",{class:"map-iconfont icon-measure"},null,-1),vue.createElementVNode("div",{class:"button-text"},"测距",-1)]),2),vue.createElementVNode("div",{class:vue.normalizeClass(["switch-btn",{active:g.value}]),onClick:y},j[2]||(j[2]=[vue.createElementVNode("i",{class:"map-iconfont icon-ship"},null,-1),vue.createElementVNode("div",{class:"button-text"},"绿点",-1)]),2)],64)):vue.createCommentVNode("",!0),vue.createElementVNode("div",{class:vue.normalizeClass(["switch-btn",{active:k.value===vue.unref(BaseMapType).satellite}]),onClick:L},j[3]||(j[3]=[vue.createElementVNode("i",{class:"map-iconfont icon-space"},null,-1),vue.createElementVNode("div",{class:"button-text"},"卫星",-1)]),2)]),vue.createElementVNode("div",_hoisted_2$1,[r.value?(vue.openBlock(),vue.createBlock(Measure,{key:0,ref_key:"measureRef",ref:i,visible:r.value,"onUpdate:visible":j[0]||(j[0]=ie=>r.value=ie),onClose:V},null,8,["visible"])):vue.createCommentVNode("",!0)])],64))}}),ToolPanel=_export_sfc(_sfc_main$5,[["__scopeId","data-v-9c83c550"]]),UNITS_PROP="units",LEADING_DIGITS=[1,2,5],DEFAULT_DPI=25.4/.28;let ScaleLine$1=class extends Control{constructor(e){e=e||{};const n=document.createElement("div");n.style.pointerEvents="none",super({element:n,render:e.render,target:e.target}),this.on,this.once,this.un;const r=e.className!==void 0?e.className:e.bar?"ol-scale-bar":"ol-scale-line";this.innerElement_=document.createElement("div"),this.innerElement_.className=r+"-inner",this.element.className=r+" "+CLASS_UNSELECTABLE,this.element.appendChild(this.innerElement_),this.viewState_=null,this.minWidth_=e.minWidth!==void 0?e.minWidth:64,this.maxWidth_=e.maxWidth,this.renderedVisible_=!1,this.renderedWidth_=void 0,this.renderedHTML_="",this.addChangeListener(UNITS_PROP,this.handleUnitsChanged_),this.setUnits(e.units||"metric"),this.scaleBar_=e.bar||!1,this.scaleBarSteps_=e.steps||4,this.scaleBarText_=e.text||!1,this.dpi_=e.dpi||void 0}getUnits(){return this.get(UNITS_PROP)}handleUnitsChanged_(){this.updateElement_()}setUnits(e){this.set(UNITS_PROP,e)}setDpi(e){this.dpi_=e}updateElement_(){const e=this.viewState_;if(!e){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const n=e.center,r=e.projection,i=this.getUnits(),g=i=="degrees"?"degrees":"m";let y=getPointResolution(r,e.resolution,n,g);const k=this.minWidth_*(this.dpi_||DEFAULT_DPI)/DEFAULT_DPI,L=this.maxWidth_!==void 0?this.maxWidth_*(this.dpi_||DEFAULT_DPI)/DEFAULT_DPI:void 0;let $=k*y,V="";if(i=="degrees"){const he=METERS_PER_UNIT$1.degrees;$*=he,$<he/60?(V="″",y*=3600):$<he?(V="′",y*=60):V="°"}else if(i=="imperial")$<.9144?(V="in",y/=.0254):$<1609.344?(V="ft",y/=.3048):(V="mi",y/=1609.344);else if(i=="nautical")y/=1852,V="NM";else if(i=="metric")$<1e-6?(V="nm",y*=1e9):$<.001?(V="μm",y*=1e6):$<1?(V="mm",y*=1e3):$<1e3?V="m":(V="km",y/=1e3);else if(i=="us")$<.9144?(V="in",y*=39.37):$<1609.344?(V="ft",y/=.30480061):(V="mi",y/=1609.3472);else throw new Error("Invalid units");let z=3*Math.floor(Math.log(k*y)/Math.log(10)),j,ie,re,oe,ue,ae;for(;;){re=Math.floor(z/3);const he=Math.pow(10,re);if(j=LEADING_DIGITS[(z%3+3)%3]*he,ie=Math.round(j/y),isNaN(ie)){this.element.style.display="none",this.renderedVisible_=!1;return}if(L!==void 0&&ie>=L){j=oe,ie=ue,re=ae;break}else if(ie>=k)break;oe=j,ue=ie,ae=re,++z}const pe=this.scaleBar_?this.createScaleBar(ie,j,V):j.toFixed(re<0?-re:0)+" "+V;this.renderedHTML_!=pe&&(this.innerElement_.innerHTML=pe,this.renderedHTML_=pe),this.renderedWidth_!=ie&&(this.innerElement_.style.width=ie+"px",this.renderedWidth_=ie),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}createScaleBar(e,n,r){const i=this.getScaleForResolution(),g=i<1?Math.round(1/i).toLocaleString()+" : 1":"1 : "+Math.round(i).toLocaleString(),y=this.scaleBarSteps_,k=e/y,L=[this.createMarker("absolute")];for(let V=0;V<y;++V){const z=V%2===0?"ol-scale-singlebar-odd":"ol-scale-singlebar-even";L.push(`<div><div class="ol-scale-singlebar ${z}" style="width: ${k}px;"></div>`+this.createMarker("relative")+(V%2===0||y===2?this.createStepText(V,e,!1,n,r):"")+"</div>")}return L.push(this.createStepText(y,e,!0,n,r)),(this.scaleBarText_?`<div class="ol-scale-text" style="width: ${e}px;">`+g+"</div>":"")+L.join("")}createMarker(e){return`<div class="ol-scale-step-marker" style="position: ${e}; top: ${e==="absolute"?3:-10}px;"></div>`}createStepText(e,n,r,i,g){const k=(e===0?0:Math.round(i/this.scaleBarSteps_*e*100)/100)+(e===0?"":" "+g),L=e===0?-3:n/this.scaleBarSteps_*-1,$=e===0?0:n/this.scaleBarSteps_*2;return`<div class="ol-scale-step-text" style="margin-left: ${L}px;text-align: ${e===0?"left":"center"};min-width: ${$}px;left: ${r?n+"px":"unset"};">`+k+"</div>"}getScaleForResolution(){const e=getPointResolution(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center,"m"),n=this.dpi_||DEFAULT_DPI,r=1e3/25.4;return e*r*n}render(e){const n=e.frameState;n?this.viewState_=n.viewState:this.viewState_=null,this.updateElement_()}};const _hoisted_1$2={id:"scale-line-container"},_sfc_main$4=vue.defineComponent({__name:"scaleLine",setup(t,{expose:e}){const n=new ScaleLine$1({units:"nautical"});return e({setScaleLine:()=>{n.setTarget(document.getElementById("scale-line-container")),mapInstance.value.addControl(n)}}),(i,g)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$2))}}),ScaleLine=_export_sfc(_sfc_main$4,[["__scopeId","data-v-e51b19b1"]]),_hoisted_1$1={class:"zoom"},_sfc_main$3=vue.defineComponent({__name:"zoomControl",props:{map:{type:Object}},setup(t){const e=()=>{if(!mapInstance.value)return;const r=mapInstance.value.getView(),i=r.getZoom();i&&r.setZoom(i+1)},n=()=>{if(!mapInstance.value)return;const r=mapInstance.value.getView(),i=r.getZoom();i&&r.setZoom(i-1)};return(r,i)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$1,[vue.createElementVNode("div",{onClick:e,class:"button big-button"},"+"),vue.createElementVNode("div",{onClick:n,class:"button small-button"},"-")]))}}),ZoomControl=_export_sfc(_sfc_main$3,[["__scopeId","data-v-f2b62b21"]]),CDN_URL="https://static.zhihaoscm.cn/",tiandituKey="a6e8f78974f2581f2ca00485b40c948f",baseMap={tiandituTile:`http://t0.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${tiandituKey}`,tiandituTileMark:`http://t0.tianditu.gov.cn/cva_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cva&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${tiandituKey}`,tiandituImgTile:`http://t0.tianditu.gov.cn/img_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${tiandituKey}`,tiandituImgTileMark:`http://t0.tianditu.gov.cn/cia_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cia&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${tiandituKey}`,greenTile:`${CDN_URL}/map/tile/{z}/{x}/{y}.png`},mapZoom={default:6,min:3,max:18,findShip:13,shipGreenDotMax:11,truckDefault:14,shipModelMin:16,shipModelMax:18},mapDefaultCenter=[114.84,30.52],projection={data:"EPSG:4326",mercator:"EPSG:3857"},_hoisted_1={class:"copyright"},_hoisted_2={class:"tdt-control-copyright tdt-control"},_hoisted_3=["src"],_sfc_main$2=vue.defineComponent({__name:"copyright",setup(t){return(e,n)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1,[vue.createElementVNode("div",_hoisted_2,[vue.createElementVNode("img",{src:vue.unref(CDN_URL)+"map/tdt-logo.png",width:"53px",height:"22px",class:"logo",alt:""},null,8,_hoisted_3),n[0]||(n[0]=vue.createElementVNode("div",{class:"copyright-text"},"GS(2024)0568号 - 甲测资字1100471",-1))]),n[1]||(n[1]=vue.createElementVNode("div",{id:"dataSource",class:"tdt-control data-source"},"数据来源:自然资源部 & NavInfo",-1))]))}}),Copyright=_export_sfc(_sfc_main$2,[["__scopeId","data-v-9c5c2f7b"]]),_sfc_main$1=vue.defineComponent({__name:"fullscreen",props:{pageRef:{type:Object,default:()=>({})}},setup(t){const e=t,n=vue.ref(!1),r=()=>{var i;n.value?document.exitFullscreen():(console.log(e.pageRef),(i=e.pageRef)==null||i.requestFullscreen()),n.value=!n.value};return(i,g)=>(vue.openBlock(),vue.createElementBlock("div",{class:"fullscreen-btn",onClick:r},[vue.createElementVNode("i",{class:vue.normalizeClass(`map-iconfont ${n.value?"icon-quxiaoquanping":"icon-quanping"} `)},null,2)]))}}),Fullscreen=_export_sfc(_sfc_main$1,[["__scopeId","data-v-ed59d7cb"]]),TileEventType={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"},tmpTileCoord=[0,0,0],DECIMALS=5;class TileGrid{constructor(e){this.minZoom=e.minZoom!==void 0?e.minZoom:0,this.resolutions_=e.resolutions,assert(isSorted(this.resolutions_,(i,g)=>g-i),"`resolutions` must be sorted in descending order");let n;if(!e.origins){for(let i=0,g=this.resolutions_.length-1;i<g;++i)if(!n)n=this.resolutions_[i]/this.resolutions_[i+1];else if(this.resolutions_[i]/this.resolutions_[i+1]!==n){n=void 0;break}}this.zoomFactor_=n,this.maxZoom=this.resolutions_.length-1,this.origin_=e.origin!==void 0?e.origin:null,this.origins_=null,e.origins!==void 0&&(this.origins_=e.origins,assert(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const r=e.extent;r!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=getTopLeft(r)),assert(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,assert(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=e.tileSize!==void 0?e.tileSize:this.tileSizes_?null:DEFAULT_TILE_SIZE,assert(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=r!==void 0?r:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.sizes!==void 0?this.fullTileRanges_=e.sizes.map((i,g)=>{const y=new TileRange(Math.min(0,i[0]),Math.max(i[0]-1,-1),Math.min(0,i[1]),Math.max(i[1]-1,-1));if(r){const k=this.getTileRangeForExtentAndZ(r,g);y.minX=Math.max(k.minX,y.minX),y.maxX=Math.min(k.maxX,y.maxX),y.minY=Math.max(k.minY,y.minY),y.maxY=Math.min(k.maxY,y.maxY)}return y}):r&&this.calculateTileRanges_(r)}forEachTileCoord(e,n,r){const i=this.getTileRangeForExtentAndZ(e,n);for(let g=i.minX,y=i.maxX;g<=y;++g)for(let k=i.minY,L=i.maxY;k<=L;++k)r([n,g,k])}forEachTileCoordParentTileRange(e,n,r,i){let g,y,k,L=null,$=e[0]-1;for(this.zoomFactor_===2?(y=e[1],k=e[2]):L=this.getTileCoordExtent(e,i);$>=this.minZoom;){if(y!==void 0&&k!==void 0?(y=Math.floor(y/2),k=Math.floor(k/2),g=createOrUpdate(y,y,k,k,r)):g=this.getTileRangeForExtentAndZ(L,$,r),n($,g))return!0;--$}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,n,r){if(e[0]<this.maxZoom){if(this.zoomFactor_===2){const g=e[1]*2,y=e[2]*2;return createOrUpdate(g,g+1,y,y+1,n)}const i=this.getTileCoordExtent(e,r||this.tmpExtent_);return this.getTileRangeForExtentAndZ(i,e[0]+1,n)}return null}getTileRangeForTileCoordAndZ(e,n,r){if(n>this.maxZoom||n<this.minZoom)return null;const i=e[0],g=e[1],y=e[2];if(n===i)return createOrUpdate(g,y,g,y,r);if(this.zoomFactor_){const L=Math.pow(this.zoomFactor_,n-i),$=Math.floor(g*L),V=Math.floor(y*L);if(n<i)return createOrUpdate($,$,V,V,r);const z=Math.floor(L*(g+1))-1,j=Math.floor(L*(y+1))-1;return createOrUpdate($,z,V,j,r)}const k=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(k,n,r)}getTileRangeForExtentAndZ(e,n,r){this.getTileCoordForXYAndZ_(e[0],e[3],n,!1,tmpTileCoord);const i=tmpTileCoord[1],g=tmpTileCoord[2];this.getTileCoordForXYAndZ_(e[2],e[1],n,!0,tmpTileCoord);const y=tmpTileCoord[1],k=tmpTileCoord[2];return createOrUpdate(i,y,g,k,r)}getTileCoordCenter(e){const n=this.getOrigin(e[0]),r=this.getResolution(e[0]),i=toSize(this.getTileSize(e[0]),this.tmpSize_);return[n[0]+(e[1]+.5)*i[0]*r,n[1]-(e[2]+.5)*i[1]*r]}getTileCoordExtent(e,n){const r=this.getOrigin(e[0]),i=this.getResolution(e[0]),g=toSize(this.getTileSize(e[0]),this.tmpSize_),y=r[0]+e[1]*g[0]*i,k=r[1]-(e[2]+1)*g[1]*i,L=y+g[0]*i,$=k+g[1]*i;return createOrUpdate$2(y,k,L,$,n)}getTileCoordForCoordAndResolution(e,n,r){return this.getTileCoordForXYAndResolution_(e[0],e[1],n,!1,r)}getTileCoordForXYAndResolution_(e,n,r,i,g){const y=this.getZForResolution(r),k=r/this.getResolution(y),L=this.getOrigin(y),$=toSize(this.getTileSize(y),this.tmpSize_);let V=k*(e-L[0])/r/$[0],z=k*(L[1]-n)/r/$[1];return i?(V=ceil(V,DECIMALS)-1,z=ceil(z,DECIMALS)-1):(V=floor(V,DECIMALS),z=floor(z,DECIMALS)),createOrUpdate$1(y,V,z,g)}getTileCoordForXYAndZ_(e,n,r,i,g){const y=this.getOrigin(r),k=this.getResolution(r),L=toSize(this.getTileSize(r),this.tmpSize_);let $=(e-y[0])/k/L[0],V=(y[1]-n)/k/L[1];return i?($=ceil($,DECIMALS)-1,V=ceil(V,DECIMALS)-1):($=floor($,DECIMALS),V=floor(V,DECIMALS)),createOrUpdate$1(r,$,V,g)}getTileCoordForCoordAndZ(e,n,r){return this.getTileCoordForXYAndZ_(e[0],e[1],n,!1,r)}getTileCoordResolution(e){return this.resolutions_[e[0]]}getTileSize(e){return this.tileSize_?this.tileSize_:this.tileSizes_[e]}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,n){const r=linearFindNearest(this.resolutions_,e,n||0);return clamp(r,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,n){return intersectsLinearRing(n,0,n.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){const n=this.resolutions_.length,r=new Array(n);for(let i=this.minZoom;i<n;++i)r[i]=this.getTileRangeForExtentAndZ(e,i);this.fullTileRanges_=r}}function getForProjection(t){let e=t.getDefaultTileGrid();return e||(e=createForProjection(t),t.setDefaultTileGrid(e)),e}function wrapX(t,e,n){const r=e[0],i=t.getTileCoordCenter(e),g=extentFromProjection(n);if(!containsCoordinate(g,i)){const y=getWidth(g),k=Math.ceil((g[0]-i[0])/y);return i[0]+=y*k,t.getTileCoordForCoordAndZ(i,r)}return e}function createForExtent(t,e,n,r){r=r!==void 0?r:"top-left";const i=resolutionsFromExtent(t,e,n);return new TileGrid({extent:t,origin:getCorner(t,r),resolutions:i,tileSize:n})}function createXYZ(t){const e=t||{},n=e.extent||get$1("EPSG:3857").getExtent(),r={extent:n,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:resolutionsFromExtent(n,e.maxZoom,e.tileSize,e.maxResolution)};return new TileGrid(r)}function resolutionsFromExtent(t,e,n,r){e=e!==void 0?e:DEFAULT_MAX_ZOOM,n=toSize(n!==void 0?n:DEFAULT_TILE_SIZE);const i=getHeight(t),g=getWidth(t);r=r>0?r:Math.max(g/n[0],i/n[1]);const y=e+1,k=new Array(y);for(let L=0;L<y;++L)k[L]=r/Math.pow(2,L);return k}function createForProjection(t,e,n,r){const i=extentFromProjection(t);return createForExtent(i,e,n,r)}function extentFromProjection(t){t=get$1(t);let e=t.getExtent();if(!e){const n=180*METERS_PER_UNIT$1.degrees/t.getMetersPerUnit();e=createOrUpdate$2(-n,-n,n,n)}return e}class TileSource extends Source{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX,interpolate:e.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=e.tilePixelRatio!==void 0?e.tilePixelRatio:1,this.tileGrid=e.tileGrid!==void 0?e.tileGrid:null;const n=[256,256];this.tileGrid&&toSize(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),n),this.tmpSize=[0,0],this.key_=e.key||getUid(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){const n=e?this.getTileGridForProjection(e):this.tileGrid;return n?n.getResolutions():null}getTile(e,n,r,i,g){return abstract()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:getForProjection(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,n,r){const i=this.getTileGridForProjection(r),g=this.getTilePixelRatio(n),y=toSize(i.getTileSize(e),this.tmpSize);return g==1?y:scale$1(y,g,this.tmpSize)}getTileCoordForTileUrlFunction(e,n){const r=n!==void 0?n:this.getProjection(),i=n!==void 0?this.getTileGridForProjection(r):this.tileGrid||this.getTileGridForProjection(r);return this.getWrapX()&&r.isGlobal()&&(e=wrapX(i,e,r)),withinExtentAndZ(e,i)?e:null}clear(){}refresh(){this.clear(),super.refresh()}}class TileSourceEvent extends BaseEvent{constructor(e,n){super(e),this.tile=n}}const zRegEx=/\{z\}/g,xRegEx=/\{x\}/g,yRegEx=/\{y\}/g,dashYRegEx=/\{-y\}/g;function renderXYZTemplate(t,e,n,r,i){return t.replace(zRegEx,e.toString()).replace(xRegEx,n.toString()).replace(yRegEx,r.toString()).replace(dashYRegEx,function(){if(i===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(i-r).toString()})}function expandUrl(t){const e=[];let n=/\{([a-z])-([a-z])\}/.exec(t);if(n){const r=n[1].charCodeAt(0),i=n[2].charCodeAt(0);let g;for(g=r;g<=i;++g)e.push(t.replace(n[0],String.fromCharCode(g)));return e}if(n=/\{(\d+)-(\d+)\}/.exec(t),n){const r=parseInt(n[2],10);for(let i=parseInt(n[1],10);i<=r;i++)e.push(t.replace(n[0],i.toString()));return e}return e.push(t),e}function createFromTemplate(t,e){return function(n,r,i){if(!n)return;let g;const y=n[0];if(e){const k=e.getFullTileRange(y);k&&(g=k.getHeight()-1)}return renderXYZTemplate(t,y,n[1],n[2],g)}}function createFromTemplates(t,e){const n=t.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=createFromTemplate(t[i],e);return createFromTileUrlFunctions(r)}function createFromTileUrlFunctions(t){return t.length===1?t[0]:function(e,n,r){if(!e)return;const i=hash(e),g=modulo(i,t.length);return t[g](e,n,r)}}class UrlTile extends TileSource{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===UrlTile.prototype.tileUrlFunction,this.tileLoadFunction=e.tileLoadFunction,e.tileUrlFunction&&(this.tileUrlFunction=e.tileUrlFunction),this.urls=null,e.urls?this.setUrls(e.urls):e.url&&this.setUrl(e.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(e){const n=e.target,r=getUid(n),i=n.getState();let g;i==TileState.LOADING?(this.tileLoadingKeys_[r]=!0,g=TileEventType.TILELOADSTART):r in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[r],g=i==TileState.ERROR?TileEventType.TILELOADERROR:i==TileState.LOADED?TileEventType.TILELOADEND:void 0),g!=null&&this.dispatchEvent(new TileSourceEvent(g,n))}setTileLoadFunction(e){this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,n){this.tileUrlFunction=e,typeof n<"u"?this.setKey(n):this.changed()}setUrl(e){const n=expandUrl(e);this.urls=n,this.setUrls(n)}setUrls(e){this.urls=e;const n=e.join(`
656
656
  `);this.generateTileUrlFunction_?this.setTileUrlFunction(createFromTemplates(e,this.tileGrid),n):this.setKey(n)}tileUrlFunction(e,n,r){}}class TileImage extends UrlTile{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:defaultTileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate!==void 0?e.interpolate:!0,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.crossOrigin=e.crossOrigin!==void 0?e.crossOrigin:null,this.tileClass=e.tileClass!==void 0?e.tileClass:ImageTile,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!equivalent(this.getProjection(),e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=":disable-interpolation"),e}getTileGridForProjection(e){const n=this.getProjection();if(this.tileGrid&&(!n||equivalent(n,e)))return this.tileGrid;const r=getUid(e);return r in this.tileGridForProjection||(this.tileGridForProjection[r]=getForProjection(e)),this.tileGridForProjection[r]}createTile_(e,n,r,i,g,y){const k=[e,n,r],L=this.getTileCoordForTileUrlFunction(k,g),$=L?this.tileUrlFunction(L,i,g):void 0,V=new this.tileClass(k,$!==void 0?TileState.IDLE:TileState.EMPTY,$!==void 0?$:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return V.key=y,V.addEventListener(EventType.CHANGE,this.handleTileChange.bind(this)),V}getTile(e,n,r,i,g){const y=this.getProjection();if(!y||!g||equivalent(y,g))return this.getTileInternal(e,n,r,i,y||g);const k=[e,n,r],L=this.getKey(),$=this.getTileGridForProjection(y),V=this.getTileGridForProjection(g),z=this.getTileCoordForTileUrlFunction(k,g),j=new ReprojTile(y,$,g,V,k,z,this.getTilePixelRatio(i),this.getGutter(),(ie,re,oe,ue)=>this.getTileInternal(ie,re,oe,ue,y),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return j.key=L,j}getTileInternal(e,n,r,i,g){const y=this.getKey();return this.createTile_(e,n,r,i,g,y)}setRenderReprojectionEdges(e){this.renderReprojectionEdges_!=e&&(this.renderReprojectionEdges_=e,this.changed())}setTileGridForProjection(e,n){const r=get$1(e);if(r){const i=getUid(r);i in this.tileGridForProjection||(this.tileGridForProjection[i]=n)}}}function defaultTileLoadFunction(t,e){t.getImage().src=e}class XYZ extends TileImage{constructor(e){e=e||{};const n=e.projection!==void 0?e.projection:"EPSG:3857",r=e.tileGrid!==void 0?e.tileGrid:createXYZ({extent:extentFromProjection(n),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize});super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:n,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:r,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0}getGutter(){return this.gutter_}}const equatorialCircumference=2003750834e-2;function lonLatToMercator(t){const e=t[0]*equatorialCircumference/180;let n=Math.log(Math.tan((90+t[1])*Math.PI/360))/(Math.PI/180);return n=n*equatorialCircumference/180,[e,n]}function getIconFont(unicode=""){return unicode.indexOf("&amp;")!==-1&&(unicode=unicode.replace("&amp;","&")),unicode.indexOf("&amp")!==-1&&(unicode=unicode.replace("&amp","&")),eval('("'+unicode.replace("&#x","\\u").replace(";","")+'")')}const multiplyPixelRatio=t=>{const e=window.devicePixelRatio||1;return t.map(n=>n.map(r=>r*e))},adjustBounds=(t,e)=>e.length===2?[t[0]-e[0],t[1]-e[1],t[2]+e[0],t[3]+e[1]]:[t[0]+e[0],t[1]+e[1],t[2]+e[2],t[3]+e[3]],isOverlapping=(t,e)=>t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1],getIconStyle=t=>new Style({text:new Text({font:"Normal 14px map-iconfont",text:getIconFont(t),fill:new Fill({color:"#fff"}),offsetY:-14}),zIndex:100});function convertToRadians(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if(t.type==="Feature"&&t.geometry!==null&&t.geometry.type==="Point")return t.geometry.coordinates;if(t.type==="Point")return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function createFeature(t,e,n={}){const r={type:"Feature"};return n.id!==void 0&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties={},r.geometry=t,r}function createPoint(t,e,n){return createFeature({type:"Point",coordinates:t},e,n)}function calculateAngle(t,e,n){const r=convertToRadians(t),i=convertToRadians(e),g=r[0]%360*(Math.PI/180),y=i[0]%360*(Math.PI/180),k=r[1]%360*(Math.PI/180),L=i[1]%360*(Math.PI/180),$=Math.sin(y-g)*Math.cos(L),V=Math.cos(k)*Math.sin(L)-Math.sin(k)*Math.cos(L)*Math.cos(y-g);return 180*Math.atan2($,V)%(2*Math.PI)/Math.PI}const getAngle=(t,e)=>{let n=calculateAngle(createPoint(t),createPoint(e));return n=n<0?360+n:n,n%360*Math.PI/180},labelAlpha=.8,labelFont="500 12px Arial",labelOutSize=2,labelHeight=10,fillRectRadius=(t,e,n,r,i,g,y=4)=>{t.beginPath(),t.moveTo(e+y,n),t.arcTo(e+r,n,e+r,n+y,y),t.arcTo(e+r,n+i,e+r-y,n+i,y),t.arcTo(e,n+i,e,n+i-y,y),t.arcTo(e,n,e+y,n,y),t.closePath(),t.fillStyle=g,t.fill()},getPixelFromCoordinate=t=>{if(!t||t.length===0)throw new Error("Points array is empty or invalid.");let e=1/0,n=1/0,r=-1/0,i=-1/0;for(const[g,y]of t)g<e&&(e=g),y<n&&(n=y),g>r&&(r=g),y>i&&(i=y);return[e,n,r,i]},calculatePolygonCentroid=t=>{if(!Array.isArray(t)||t.length<3)throw new Error("A polygon must have at least 3 coordinates.");let e=0,n=0,r=0;const i=t.length;for(let k=0;k<i-1;k++){const[L,$]=t[k],[V,z]=t[k+1],j=L*z-V*$;r+=j,e+=(L+V)*j,n+=($+z)*j}if(r*=.5,r===0)throw new Error("多边形面积为零");const g=e/(6*r),y=n/(6*r);return[g,y]},rotateShapeModel=(t,e)=>{const[n,r]=calculatePolygonCentroid(t),i=e*Math.PI/180,g=Math.cos(i),y=Math.sin(i);return t.map(([k,L])=>{const $=k-n,V=L-r,z=$*g-V*y+n,j=$*y+V*g+r;return[z,j]})},getTopLeftPoint=t=>[t[0],t[3]],getBottomLeftPoint=t=>[t[2],t[3]],getBottomRightPoint=t=>[t[2],t[1]],getTopRighttPoint=t=>[t[0],t[1]];function calculateBounds(t,e,n,r,i){let g,y,k,L,$=t[0],V=t[1];switch(e){case 0:g=$+i,y=g+n,L=V-i,k=L-r;break;case 1:g=$+i,y=g+n,L=V+r/2,k=L-r;break;case 2:g=$+i,y=g+n,L=V+i+r,k=L-r;break;case 3:g=$-n/2,y=g+n,L=V+i+r,k=L-r;break;case 4:y=$,g=y-n,L=V+i+r,k=L-r;break;case 5:y=$-i,g=y-n,L=V+r/2,k=L-r;break;case 6:y=$,g=y-n,L=V-i,k=L-r;break;case 7:g=$-n/2,y=g+n,L=V-i,k=L-r}if(!(!g||!k||!y||!L))return[Math.min(g,y),Math.min(k,L),Math.max(g,y),Math.max(k,L)+1]}function calculateAnchorPoint(t,e,n=70,r=20,i=20){let g=[0,0];switch(e){case 0:g[0]=t[0]+i,g[1]=t[1]-i-r/2;break;case 1:g[0]=t[0]+i,g[1]=t[1];break;case 2:g[0]=t[0]+i,g[1]=t[1]+i+r/2;break;case 3:g[0]=t[0],g[1]=t[1]+i+r/4;break;case 4:g[0]=Math.max(t[0]-i,t[0]-n/2),g[1]=t[1]+i+r/4;break;case 5:g[0]=t[0]-i,g[1]=t[1];break;case 6:g[0]=Math.max(t[0]-i,t[0]-n/2),g[1]=t[1]-i-r/4;break;case 7:g[0]=t[0],g[1]=t[1]-i-r/4}return g}function drawLabelBody(t,e,n){if(!t)return;const{font:r,labelOutSize:i=2,labelHeight:g,center:y,text:k,leftIcon:L,shipColor:$,lineLength:V=20}=n;t.save(),r&&(t.font=r);let z=t.measureText(k).width+2*i;(L||$)&&(z+=g+4*i),t.restore();let j,ie=-1,re=g+3*i;if(ie=0,j=calculateBounds(y,ie,z,re,V),j&&ie>-1){let oe=getBottomLeftPoint(j),ue=getTopRighttPoint(j);return{center:y,x:calculateAnchorPoint(y,ie,z,re,V),l:ue,r:oe,bounds:j,position:ie}}return null}const drawText=(t,e)=>{if(!t)return;const{center:n,text:r,textColor:i,leftIcon:g,rightIcons:y,font:k}=e;t.save();let[L,$]=n;if(g){t.font="21px map-iconfont";let V=getIconFont(g.icon);t.fillStyle=g.color,t.fillText(V,L+labelOutSize-4,$+3),L+=22}if(y!=null&&y.length){t.font="12px map-iconfont",t.fillStyle="#3370ff";let V=t.measureText(r).width+6;y.forEach((z,j)=>{let ie=getIconFont(z),re=20*j;t.fillText(ie,L+V+re,$)})}t.font=k||labelFont,t.fillStyle=i,t.fillText(r,L,$),t.restore()},drawPolygon=(t,e)=>{let{points:n,strokeColor:r,fillColor:i,shouldClosePath:g,translation:y,rotation:k,rotationCenter:L,scale:$,globalAlpha:V}=e;if(V||(V=1),n&&t){t.save(),t.beginPath(),k&&k!==0&&L==null&&t.rotate(k),y&&t.translate(y[0],y[1]),k&&(L!=null&&L.length)&&t.rotate(k),$&&t.scale($,$),t.moveTo(n[0][0],n[0][1]);for(let z=1;z<n.length;z++)t.lineTo(n[z][0],n[z][1]);g&&t.closePath(),r&&(t.strokeStyle=r,t.stroke()),i&&g&&(V&&(t.globalAlpha=V),t.fillStyle=i,t.fill()),t.restore()}},drawLabel=(t,e)=>{const{center:n,text:r,color:i,textColor:g,bgColor:y,leftIcon:k,rightIcons:L}=e;if(n&&r){let $={font:labelFont,labelOutSize,labelHeight,center:n,text:r,leftIcon:k},V=drawLabelBody(t,labels.value,$);if(V){const{x:z,bounds:j,l:ie}=V;let re=[getTopLeftPoint(j),getBottomLeftPoint(j),getBottomRightPoint(j),getTopRighttPoint(j)];labels.value.push(V),drawPolygon(t,{points:[n,z],strokeColor:i,fillColor:"#000",shouldClosePath:!0,translation:void 0,rotation:void 0,rotationCenter:void 0,scale:void 0,globalAlpha:labelAlpha}),L!=null&&L.length&&L.forEach(()=>{re[1][0]+=20,re[2][0]+=20}),drawPolygon(t,{points:re,strokeColor:i,fillColor:y,shouldClosePath:!0});const[ae,pe]=ie,he={center:[ae,pe+labelOutSize+labelHeight+1],text:r,textColor:g,leftIcon:k,rightIcons:L};drawText(t,he)}}return null},dotImage=new Image;dotImage.src=`${CDN_URL}/map/truck-dot.svg`,dotImage.crossOrigin="anonymous";const dotActiveImage=new Image;dotActiveImage.src=`${CDN_URL}/map/truck-dot-active.svg`,dotActiveImage.crossOrigin="anonymous";const cameraImage=new Image;cameraImage.src=`${CDN_URL}/map/map-camera.svg`,cameraImage.crossOrigin="anonymous";const loadImage=new Image;loadImage.src=`${CDN_URL}/map/map-load.svg`,loadImage.crossOrigin="anonymous";const setTruckStyle=(t,e,n,r)=>new Style({renderer:(i,g)=>{const y=g.context;y.save();let k=1;y.scale(k,k);let[L,$]=i;L=L/k-20,$=$/k;const V=L-70,z=$-68;let j=180;const ie=56,re="#FFFFFF";let oe=176;const ue=52;let ae="#164AFF",pe="#FFFFFF";n===CAR_COLOR.YELLOW?(oe=176,ae="#FFC81E",pe="rgba(0,0,0,0.88)"):n===CAR_COLOR.Y_GREEN&&(j=200,oe=196,ae="#8FED7C",pe="rgba(0,0,0,0.88)"),r!=null&&r.length&&(j+=r.length*56),fillRectRadius(y,V,z,j,ie,re),fillRectRadius(y,V+2,z+2,oe,ue,ae),n===CAR_COLOR.Y_GREEN&&fillRectRadius(y,V+2,z+2,68,ue,"#FFC81E"),y.save(),y.restore(),y.fillStyle=pe,y.font="bold 28px Arial",y.textAlign="left",y.textBaseline="middle";const he=`${e.slice(0,2)+" · "+e.slice(2)}`;if(y.fillText(he,V+12,z+32),y.save(),y.restore(),r!=null&&r.length){const de=y.measureText(he).width+12;let _e=0;r.forEach(Ce=>{Ce===DEVICE_TYPE.CAMERA&&(y.drawImage(cameraImage,L-54+de+_e*56,$-64,50,50),++_e),Ce===DEVICE_TYPE.LOAD&&(y.drawImage(loadImage,L-54+de+_e*56,$-64,50,50),++_e)})}const le=dotImage;y.drawImage(le,L+j/2-90,$,50/k,50/k),y.restore()}});vue.ref([]);let truckMarkerList=[],trucksVectorSource;const renderTrucksMarker=t=>{if(deleteAllTruckMarkers(),!!mapInstance.value)return t.forEach(e=>{const n=convertSixHundredThousandToLatLng(e.lon,e.lat),r=new Feature({geometry:new Point(fromLonLat(n))});r.set("data",e),r.setStyle(setTruckStyle(!1,e.vno,e==null?void 0:e.vclColor,e==null?void 0:e.icons)),truckMarkerList.push({name:e.vno,lonlat:n,feature:r})}),trucksVectorSource=new VectorSource({features:truckMarkerList.map(e=>e.feature)}),trucksLayer.value=new VectorLayer({source:trucksVectorSource}),mapInstance.value.addLayer(trucksLayer.value),trucksLayer.value},deleteAllTruckMarkers=()=>{truckMarkerList.forEach(t=>{t.feature&&(trucksVectorSource==null||trucksVectorSource.removeFeature(t.feature))}),truckMarkerList=[]},triangleModel=multiplyPixelRatio([[0,-8],[5,8],[-5,8]]),shipShapeModel=multiplyPixelRatio([[0,-4.545],[-.56,-3.909],[-1,-2.727],[-1,3.636],[-.8,4.545],[.8,4.545],[1,3.636],[1,-2.727],[.56,-3.909],[0,-4.545]]),shipDirectPath={left:{0:[[0,0],[0,-8],[-4,-8]],1:[[0,0],[0,-16],[-6,-16]],2:[[0,0],[0,-24],[-8,-24]]},right:{0:[[0,0],[0,-8],[-4,-8]],1:[[0,0],[0,-16],[-6,-16]],2:[[0,0],[0,-24],[-8,-24]]},front:{0:[[0,0],[0,-8]],1:[[0,0],[0,-16]],2:[[0,0],[0,-24]]}},speedCondition=[[1,10],[10,20],[20,1/0]],drawShipModelByZoom={16:[200,30],17:[50,5],18:[1,1]},setShipStyle=t=>new Style({renderer:(e,n)=>{const r=n.context,i=n.feature.get("data");try{const g=drawShipBody(r,i,e);g&&(drawHeading(r,i,g),t&&drawSelectBounds(r,g)),drawShipLabel(r,i,e)}catch{return!1}}}),drawShipBody=(t,e,n)=>{if(!mapInstance.value)return;const r=mapInstance.value.getView().getZoom();if(!r)return;let i=[];const[g,y]=drawShipModelByZoom[r]||[0,0],[k,L]=n;if(r<=mapZoom.shipModelMax&&r>mapZoom.shipModelMin&&e.length>=g&&e.breadth>=y)i=rotateShapeModel(drawCurrentShipShapeModel(e,r),e.angle).map(V=>{const[z,j]=V;return[k+z,L+j]});else{const $=rotateShapeModel(triangleModel,e.angle);n.length===2&&(i=$.map(V=>{const[z,j]=V;return[k+z,L+j]}))}if(!(i.length>2))return!1;t.save(),t.beginPath(),t.moveTo(i[0][0],i[0][1]);for(let $=1;$<i.length;$++)t.lineTo(i[$][0],i[$][1]);return t.closePath(),t.strokeStyle="#000",t.lineWidth=1,t.stroke(),t.fillStyle=e.fill,t.fill(),t.restore(),i},drawHeading=(t,e,n)=>{const[r,i]=n[0],g=getShipDirectPath(e);if(g){let y=g.map(function(k){let[L,$]=k;return[L+r,$+i]});if(t.save(),t.beginPath(),e.angle>0){t.translate(r,i);const k=e.angle*Math.PI/180;t.rotate(k),t.translate(-r,-i)}t.moveTo(r,i);for(let k=1;k<y.length;k++){let[L,$]=y[k];t.lineTo(L,$)}t.strokeStyle="#000",t.lineWidth=1,t.stroke(),t.restore()}},drawSelectBounds=(t,e)=>{let[n,r,i,g]=getPixelFromCoordinate(e);const y=4;n-=y,r-=y,i+=y,g+=y,t.save(),t.strokeStyle="#ff0000",t.lineWidth=4;const k=8;t.beginPath(),t.moveTo(n+k,g),t.lineTo(n,g),t.lineTo(n,g-k),t.moveTo(n,r+k),t.lineTo(n,r),t.lineTo(n+k,r),t.moveTo(i-k,r),t.lineTo(i,r),t.lineTo(i,r+k),t.moveTo(i,g-k),t.lineTo(i,g),t.lineTo(i-k,g),t.stroke(),t.restore()},drawShipLabel=(t,e,n)=>{const[r,i]=n,g=r-0,y=i-0,k=e.name;let L;e.leftIconColor&&(L={color:e.leftIconColor,icon:"&#xe599;"});let $=getShipCustomIcon(e);drawLabel(t,{center:[g,y],text:k,color:"#fff",textColor:"#000",bgColor:"#fff",leftIcon:L,rightIcons:$})},drawCurrentShipShapeModel=(t,e)=>{let n=0;e===17?n=.425:e===18&&(n=.857);const r=t.length/4*n,i=t.breadth*n;let g=cloneDeep(shipShapeModel);return g=g.map(([y,k])=>[y*i,k*r]),g},getShipDirectPath=t=>{let{speed:e,hdg:n,cog:r}=t,i="",g=null;if(e&&e>1&&(n!==null&&n!=511&&r!==null?r-n>=3?i="left":r-n<=-3?i="right":i="front":i="front",i&&e))for(let y in speedCondition){let k=speedCondition[y];if(e>=k[0]&&e<k[1]){g=shipDirectPath[i][y];break}}return g},getShipCustomIcon=t=>{let e=[];return t.existDevice&&e.push("&#xe687;"),t.existMobile&&e.push("&#xe688;"),t.existWaterGauge&&e.push("&#xe686;"),e||[]};class FeatureFormat{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Feature,this.supportedMediaTypes=null}getReadOptions(e,n){if(n){let r=n.dataProjection?get$1(n.dataProjection):this.readProjection(e);n.extent&&r&&r.getUnits()==="tile-pixels"&&(r=get$1(r),r.setWorldExtent(n.extent)),n={dataProjection:r,featureProjection:n.featureProjection}}return this.adaptOptions(n)}adaptOptions(e){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},e)}getType(){return abstract()}readFeature(e,n){return abstract()}readFeatures(e,n){return abstract()}readGeometry(e,n){return abstract()}readProjection(e){return abstract()}writeFeature(e,n){return abstract()}writeFeatures(e,n){return abstract()}writeGeometry(e,n){return abstract()}}function transformGeometryWithOptions(t,e,n){const r=n?get$1(n.featureProjection):null,i=n?get$1(n.dataProjection):null;let g=t;if(r&&i&&!equivalent(r,i)){e&&(g=t.clone());const y=e?r:i,k=e?i:r;y.getUnits()==="tile-pixels"?g.transform(y,k):g.applyTransform(getTransform(y,k))}if(e&&n&&n.decimals!==void 0){const y=Math.pow(10,n.decimals),k=function(L){for(let $=0,V=L.length;$<V;++$)L[$]=Math.round(L[$]*y)/y;return L};g===t&&(g=t.clone()),g.applyTransform(k)}return g}const GeometryConstructor={Point,LineString,Polygon,MultiPoint,MultiLineString,MultiPolygon};function orientFlatCoordinates(t,e,n){return Array.isArray(e[0])?(linearRingssAreOriented(t,0,e,n)||(t=t.slice(),orientLinearRingsArray(t,0,e,n)),t):(linearRingsAreOriented(t,0,e,n)||(t=t.slice(),orientLinearRings(t,0,e,n)),t)}function createRenderFeature(t,e){var g;const n=t.geometry;if(!n)return[];if(Array.isArray(n))return n.map(y=>createRenderFeature({...t,geometry:y})).flat();const r=n.type==="MultiPolygon"?"Polygon":n.type;if(r==="GeometryCollection"||r==="Circle")throw new Error("Unsupported geometry type: "+r);const i=n.layout.length;return transformGeometryWithOptions(new RenderFeature(r,r==="Polygon"?orientFlatCoordinates(n.flatCoordinates,n.ends,i):n.flatCoordinates,(g=n.ends)==null?void 0:g.flat(),i,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function createGeometry(t,e){if(!t)return null;if(Array.isArray(t)){const r=t.map(i=>createGeometry(i,e));return new GeometryCollection(r)}const n=GeometryConstructor[t.type];return transformGeometryWithOptions(new n(t.flatCoordinates,t.layout,t.ends),!1,e)}class JSONFeature extends FeatureFormat{constructor(){super()}getType(){return"json"}readFeature(e,n){return this.readFeatureFromObject(getObject(e),this.getReadOptions(e,n))}readFeatures(e,n){return this.readFeaturesFromObject(getObject(e),this.getReadOptions(e,n))}readFeatureFromObject(e,n){return abstract()}readFeaturesFromObject(e,n){return abstract()}readGeometry(e,n){return this.readGeometryFromObject(getObject(e),this.getReadOptions(e,n))}readGeometryFromObject(e,n){return abstract()}readProjection(e){return this.readProjectionFromObject(getObject(e))}readProjectionFromObject(e){return abstract()}writeFeature(e,n){return JSON.stringify(this.writeFeatureObject(e,n))}writeFeatureObject(e,n){return abstract()}writeFeatures(e,n){return JSON.stringify(this.writeFeaturesObject(e,n))}writeFeaturesObject(e,n){return abstract()}writeGeometry(e,n){return JSON.stringify(this.writeGeometryObject(e,n))}writeGeometryObject(e,n){return abstract()}}function getObject(t){if(typeof t=="string"){const e=JSON.parse(t);return e||null}return t!==null?t:null}class GeoJSON extends JSONFeature{constructor(e){e=e||{},super(),this.dataProjection=get$1(e.dataProjection?e.dataProjection:"EPSG:4326"),e.featureProjection&&(this.defaultFeatureProjection=get$1(e.featureProjection)),e.featureClass&&(this.featureClass=e.featureClass),this.geometryName_=e.geometryName,this.extractGeometryName_=e.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(e,n){let r=null;e.type==="Feature"?r=e:r={type:"Feature",geometry:e,properties:null};const i=readGeometryInternal(r.geometry);if(this.featureClass===RenderFeature)return createRenderFeature({geometry:i,id:r.id,properties:r.properties},n);const g=new Feature;return this.geometryName_?g.setGeometryName(this.geometryName_):this.extractGeometryName_&&r.geometry_name&&g.setGeometryName(r.geometry_name),g.setGeometry(createGeometry(i,n)),"id"in r&&g.setId(r.id),r.properties&&g.setProperties(r.properties,!0),g}readFeaturesFromObject(e,n){const r=e;let i=null;if(r.type==="FeatureCollection"){const g=e;i=[];const y=g.features;for(let k=0,L=y.length;k<L;++k){const $=this.readFeatureFromObject(y[k],n);$&&i.push($)}}else i=[this.readFeatureFromObject(e,n)];return i.flat()}readGeometryFromObject(e,n){return readGeometry(e,n)}readProjectionFromObject(e){const n=e.crs;let r;if(n)if(n.type=="name")r=get$1(n.properties.name);else if(n.type==="EPSG")r=get$1("EPSG:"+n.properties.code);else throw new Error("Unknown SRS type");else r=this.dataProjection;return r}writeFeatureObject(e,n){n=this.adaptOptions(n);const r={type:"Feature",geometry:null,properties:null},i=e.getId();if(i!==void 0&&(r.id=i),!e.hasProperties())return r;const g=e.getProperties(),y=e.getGeometry();return y&&(r.geometry=writeGeometry(y,n),delete g[e.getGeometryName()]),isEmpty$1(g)||(r.properties=g),r}writeFeaturesObject(e,n){n=this.adaptOptions(n);const r=[];for(let i=0,g=e.length;i<g;++i)r.push(this.writeFeatureObject(e[i],n));return{type:"FeatureCollection",features:r}}writeGeometryObject(e,n){return writeGeometry(e,this.adaptOptions(n))}}function readGeometryInternal(t,e){if(!t)return null;let n;switch(t.type){case"Point":{n=readPointGeometry(t);break}case"LineString":{n=readLineStringGeometry(t);break}case"Polygon":{n=readPolygonGeometry(t);break}case"MultiPoint":{n=readMultiPointGeometry(t);break}case"MultiLineString":{n=readMultiLineStringGeometry(t);break}case"MultiPolygon":{n=readMultiPolygonGeometry(t);break}case"GeometryCollection":{n=readGeometryCollectionGeometry(t);break}default:throw new Error("Unsupported GeoJSON type: "+t.type)}return n}function readGeometry(t,e){const n=readGeometryInternal(t);return createGeometry(n,e)}function readGeometryCollectionGeometry(t,e){return t.geometries.map(function(r){return readGeometryInternal(r)})}function readPointGeometry(t){const e=t.coordinates;return{type:"Point",flatCoordinates:e,layout:getLayoutForStride(e.length)}}function readLineStringGeometry(t){var r;const e=t.coordinates,n=e.flat();return{type:"LineString",flatCoordinates:n,ends:[n.length],layout:getLayoutForStride(((r=e[0])==null?void 0:r.length)||2)}}function readMultiLineStringGeometry(t){var g,y;const e=t.coordinates,n=((y=(g=e[0])==null?void 0:g[0])==null?void 0:y.length)||2,r=[],i=deflateCoordinatesArray(r,0,e,n);return{type:"MultiLineString",flatCoordinates:r,ends:i,layout:getLayoutForStride(n)}}function readMultiPointGeometry(t){var n;const e=t.coordinates;return{type:"MultiPoint",flatCoordinates:e.flat(),layout:getLayoutForStride(((n=e[0])==null?void 0:n.length)||2)}}function readMultiPolygonGeometry(t){var g,y;const e=t.coordinates,n=[],r=((y=(g=e[0])==null?void 0:g[0])==null?void 0:y[0].length)||2,i=deflateMultiCoordinatesArray(n,0,e,r);return{type:"MultiPolygon",flatCoordinates:n,ends:i,layout:getLayoutForStride(r)}}function readPolygonGeometry(t){var g,y;const e=t.coordinates,n=[],r=(y=(g=e[0])==null?void 0:g[0])==null?void 0:y.length,i=deflateCoordinatesArray(n,0,e,r);return{type:"Polygon",flatCoordinates:n,ends:i,layout:getLayoutForStride(r)}}function writeGeometry(t,e){t=transformGeometryWithOptions(t,!0,e);const n=t.getType();let r;switch(n){case"Point":{r=writePointGeometry(t);break}case"LineString":{r=writeLineStringGeometry(t);break}case"Polygon":{r=writePolygonGeometry(t,e);break}case"MultiPoint":{r=writeMultiPointGeometry(t);break}case"MultiLineString":{r=writeMultiLineStringGeometry(t);break}case"MultiPolygon":{r=writeMultiPolygonGeometry(t,e);break}case"GeometryCollection":{r=writeGeometryCollectionGeometry(t,e);break}case"Circle":{r={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+n)}return r}function writeGeometryCollectionGeometry(t,e){return e=Object.assign({},e),delete e.featureProjection,{type:"GeometryCollection",geometries:t.getGeometriesArray().map(function(r){return writeGeometry(r,e)})}}function writeLineStringGeometry(t,e){return{type:"LineString",coordinates:t.getCoordinates()}}function writeMultiLineStringGeometry(t,e){return{type:"MultiLineString",coordinates:t.getCoordinates()}}function writeMultiPointGeometry(t,e){return{type:"MultiPoint",coordinates:t.getCoordinates()}}function writeMultiPolygonGeometry(t,e){let n;return e&&(n=e.rightHanded),{type:"MultiPolygon",coordinates:t.getCoordinates(n)}}function writePointGeometry(t,e){return{type:"Point",coordinates:t.getCoordinates()}}function writePolygonGeometry(t,e){let n;return e&&(n=e.rightHanded),{type:"Polygon",coordinates:t.getCoordinates(n)}}let shipsMarkerList=[],shipsVectorSource,largeAmountShipsSource;const selectedShipData=vue.ref(null);let selectShipsVectorSource;const renderShips=t=>{if(!mapInstance.value)return;const e=mapInstance.value.getView().getZoom();if(selectedShipData.value&&vue.nextTick(()=>{selectSingleShipMarker(selectedShipData.value)}).then(n=>{}),!(!e||e<mapZoom.shipGreenDotMax))return allShips.value=t,e>mapZoom.shipGreenDotMax&&e<mapZoom.shipModelMin||t.length>500?(deleteAllShipMarkers(),renderLargeAmountShips(t)):(largeAmountShipsSource==null||largeAmountShipsSource.clear(),renderShipsMarker(t))},renderLargeAmountShips=t=>{if(!mapInstance.value)return;const e=t.map(n=>({type:"Feature",geometry:{type:"Point",coordinates:[n.lon,n.lat]},properties:n}));return largeAmountShipsSource==null||largeAmountShipsSource.clear(),largeAmountShipsSource=new VectorSource({features:new GeoJSON().readFeatures({type:"FeatureCollection",features:e},{featureProjection:projection.mercator})}),largeAmountShipsLayer.value=new WebGLPointsLayer({source:largeAmountShipsSource,style:{"shape-points":3,"shape-radius":9,"shape-fill-color":"#04C900","shape-rotate-with-view":!1,"shape-rotation":["get","cog",0],"shape-scale":[.8,1.2]}}),mapInstance.value.addLayer(largeAmountShipsLayer.value),largeAmountShipsLayer.value},renderShipsMarker=t=>{if(!mapInstance.value)return;deleteAllShipMarkers();let e=convertShipMapData(t);if(e=customFilterShips(e),!!(e!=null&&e.length))return e.forEach(n=>{const r=[n.lon,n.lat],i=new Feature({geometry:new Point(fromLonLat(r))});i.set("data",n),i.setStyle(setShipStyle(!1,n.id)),shipsMarkerList.push({ship:n,lonlat:r,feature:i})}),shipsVectorSource=new VectorSource({features:shipsMarkerList.map(n=>n.feature)}),shipsLayer.value=new VectorLayer({source:shipsVectorSource}),mapInstance.value.addLayer(shipsLayer.value),shipsLayer.value},customFilterShips=t=>{let e=cloneDeep(t);return e=e.filter(n=>{var i,g,y;let r=getFilterItem(n).every(({btnShow:k,value:L})=>k?!!L:!0);return switchBtnShow.value.camera||switchBtnShow.value.mobile||switchBtnShow.value.waterGauge?((i=selectedShipData.value)==null?void 0:i.id)===n.id&&clearSelectFeature():(g=selectedShipData.value)!=null&&g.id&&findShip((y=selectedShipData.value)==null?void 0:y.id,selectedShipData.value,!1),r}),e},getFilterItem=t=>[{btnShow:switchBtnShow.value.camera,value:t==null?void 0:t.existDevice},{btnShow:switchBtnShow.value.mobile,value:t==null?void 0:t.existMobile},{btnShow:switchBtnShow.value.waterGauge,value:t==null?void 0:t.existWaterGauge}],deleteAllShipMarkers=()=>{shipsMarkerList.forEach(t=>{t.feature&&(shipsVectorSource==null||shipsVectorSource.removeFeature(t.feature))}),shipsMarkerList=[]},selectSingleShipMarker=t=>{if(!mapInstance.value)return;const e=convertShipMapData(t),n=[e.lon,e.lat],r=new Feature({geometry:new Point(fromLonLat(n))});return r.set("data",e),r.setStyle(setShipStyle(!0,e.id)),shipsMarkerList.push({ship:e,lonlat:n,feature:r}),selectShipsVectorSource==null||selectShipsVectorSource.clear(),selectShipsVectorSource=new VectorSource({features:[r]}),selectShipsLayer.value=new VectorLayer({source:selectShipsVectorSource}),mapInstance.value.addLayer(selectShipsLayer.value),selectShipsLayer.value.setVisible(!0),selectShipsLayer.value},findShip=(t,e,n=!0)=>{var i,g,y,k,L;if(!t||!mapInstance.value)return;const r=(y=(g=(i=shipsLayer.value)==null?void 0:i.getSource())==null?void 0:g.getFeatures())==null?void 0:y.find($=>{var V;return((V=$.get("data"))==null?void 0:V.id)===t});if(r)selectedShipData.value=r;else if(e)selectedShipData.value=e;else{console.error("找不到船舶");return}if(selectSingleShipMarker(e),n&&((k=selectedShipData.value)!=null&&k.lon)&&((L=selectedShipData.value)!=null&&L.lat)){const $=mapInstance.value.getView(),V=new Point([selectedShipData.value.lon,selectedShipData.value.lat]);$.setCenter(transform(V.getCoordinates(),projection.data,projection.mercator));const z=$.getZoom(),j=z<mapZoom.findShip?mapZoom.findShip:z;$.setZoom(j)}return r},clearSelectFeature=()=>{selectedShipData.value=null,mapInstance.value&&(selectShipsVectorSource==null||selectShipsVectorSource.clear(),selectShipsLayer.value=new VectorLayer({source:selectShipsVectorSource}),mapInstance.value.addLayer(selectShipsLayer.value),selectShipsLayer.value.setVisible(!1))},hiddenAllShips=()=>{var t,e;(t=shipsLayer.value)==null||t.setVisible(!1),(e=largeAmountShipsLayer.value)==null||e.setVisible(!1)},switchBtnShow=vue.ref({[SWITCH_BTN.Camera]:!1,[SWITCH_BTN.Mobile]:!1,[SWITCH_BTN.WaterGauge]:!1}),switchFilterItem=(t,e)=>{switchBtnShow.value[t]=e,renderShips(allShips.value)},rerenderShip=()=>{renderShips(allShips.value)},stopIcon="&#xe6e2;",stopColor="#E31818",slowIcon="&#xe703;",slowColor="#1890FF",dropletsIcon="&#xe6d2",trackList$1=vue.ref([]),renderTrackLine=(t,e,n)=>{var g,y;const r=t[e];if(!r)return;(g=trackLineVectorSource.value)==null||g.clear(),trackList$1.value=[],trackList$1.value=r.reverse().map((k,L)=>(k.center=[k.lon,k.lat],k.centerPoint=lonLatToMercator(k.center),k.id=e,k.index=L,k.time=hooks(k.createdAt).format("YYYY-MM-DD HH:mm:ss"),k));let i=trackList$1.value.map(k=>k.centerPoint);if(i.length>=2){let k=new LineString(i);const L=new Feature({geometry:k});L.setStyle(new Style({stroke:new Stroke({color:n,width:2})})),L.setId(e),L.set("type","line");const $=shipTrackLineFeatures.value.findIndex(V=>V.getId()===e);$>=0?shipTrackLineFeatures.value[$]=L:shipTrackLineFeatures.value.push(L),trackLineVectorSource.value=new VectorSource({features:shipTrackLineFeatures.value}),shipTrackVectorLayer.value=new VectorLayer({source:trackLineVectorSource.value}),setTimeout(()=>{renderPoint(n)},500),(y=mapInstance.value)==null||y.addLayer(shipTrackVectorLayer.value)}},renderPoint=t=>{if(!mapInstance.value)return;let e=trackList$1.value||[];if(!(e&&e.length>2))return[];let n={16:24,17:15,default:4},r=[],i=e.length;for(let k=0;k<i;k++){e[k].index=k;let L=mapInstance.value.getPixelFromCoordinate(e[k].centerPoint);if(L){let $=L.concat(L);$=adjustBounds($,[20,20]);let V=mapInstance.value.getView().getZoom();if(!V)return;if(V>15){let j=n[V]||n.default;$=adjustBounds($,[j,j])}let z=!0;if(e[k].state!=="0"){for(let j=0;j<r.length;j++)if(isOverlapping($,r[j].bounds)){z=!1;break}}z&&(e[k].bounds=$,r.push(e[k]))}}const g=getIconStyle(stopIcon),y=getIconStyle(slowIcon);r.forEach(k=>{var V,z;let L=new Feature({geometry:new Point(k.centerPoint)});L.set("type","track_point"),L.set("data",k),L.setStyle(new Style({image:new CircleStyle({fill:new Fill({color:t}),stroke:new Stroke({color:"#fff",width:2}),radius:3})})),trackLineVectorSource.value.addFeature(L);const $=new Feature({geometry:new Point(fromLonLat(k.center))});if($.set("type","track_label"),$.setStyle(setTrackLabelStyle(k,t)),console.log("trackLabelFeature"),trackLineVectorSource.value.addFeature($),typeof k=="object"&&k.hasOwnProperty("state")){let j=new Feature({geometry:new Point(k.centerPoint)});j.set("type","track_icon");let ie=new Style({text:new Text({font:"Normal 22px map-iconfont",text:getIconFont(dropletsIcon),offsetY:-10}),zIndex:99}),re=[];k.state==="0"?((V=ie.getText())==null||V.setFill(new Fill({color:stopColor})),re.push(g)):((z=ie.getText())==null||z.setFill(new Fill({color:slowColor})),re.push(y)),re.push(ie),j.setStyle(re),trackLineVectorSource.value.addFeature(j)}}),renderArrow(r,t),renderIconPoint()},renderArrow=(t,e)=>{const n=t.length;n||(t.push(trackList$1.value[0]),t.push(trackList$1.value[trackList$1.value.length-1]));for(let r=0;r<n-1;r++){let i,g=t[r],y=(t[r+1].index+g.index)/2;if(y%2===0)i=trackList$1.value[y].centerPoint;else{let k=trackList$1.value[Math.floor(y)],L=trackList$1.value[Math.ceil(y)];if(k&&L){let[$,V]=k.centerPoint,[z,j]=L.centerPoint;i=[($+z)/2,(V+j)/2]}}if(i){let k=new Feature({geometry:new Point(i)});k.set("type","track_arrow"),k.setStyle(new Style({text:new Text({font:"700 14px map-iconfont",text:getIconFont("&#xe6bc;"),fill:new Fill({color:e}),rotation:getAngle(t[r].center,t[r+1].center)})})),trackLineVectorSource.value.addFeature(k)}}},renderIconPoint=()=>{const t="&#xe69b;",e="#fcdc3f",n="#ff0000";(trackList$1.value.length<2?[trackList$1.value[0]]:[trackList$1.value[0],trackList$1.value[trackList$1.value.length-1]]).forEach(i=>{let g=new Feature({geometry:new Point(i.centerPoint)});g.set("type","track_begin"),g.set("data",i);const y=i.index===0&&trackList$1.value.length>=2?e:n;g.setStyle(new Style({text:new Text({font:"Normal 14px map-iconfont",text:getIconFont(t),fill:new Fill({color:y})}),zIndex:101})),trackLineVectorSource.value.addFeature(g)})},setTrackLabelStyle=(t,e)=>new Style({renderer:(n,r)=>{const i=r.context,k={center:n,text:t.time,color:e,textColor:"#000",bgColor:"rgba(255,255,255,.8)"};drawLabel(i,k)}}),showTracks=vue.ref([]),trackList=vue.ref([]);vue.ref(null);const trackId=vue.ref(""),cursor=vue.ref(0),renderTrack=(t,e,n,r,i="ship")=>{var V;if(vue.nextTick(()=>{hiddenAllShips()}).then(z=>{}),(e==null?void 0:e.length)<2){((V=showTracks.value)==null?void 0:V.findIndex(z=>z.id===t))<0&&showTracks.value.push({id:t,length:""});return}let g={};e.forEach(z=>{z.state?z.state=Number(z.state):delete z.state}),trackId.value=t,g[t]=e,trackList.value=e;const y=["#ff0000","#00ff00","#0079ff","#ffa500","#800080","#008080","#ffc0cb","#800000","#000080","#808000"],k=g[t].map(z=>transform([z.lon,z.lat],projection.data,projection.mercator)),L=new LineString(k),$=formatLength(L,r)||"--";vue.nextTick(()=>{var j;const z=(j=showTracks.value)==null?void 0:j.findIndex(ie=>ie.id===t);z<0?showTracks.value.push({id:t,length:$}):showTracks.value[z].length=$,renderTrackLine(g,t,n),++cursor.value,cursor.value>y.length&&(cursor.value=0),resetTrackView(t)}).then(()=>{})},removeAllTrackLayer=()=>{var t;showTracks.value=[],(t=trackLineVectorSource.value)==null||t.clear()},resetTrackView=t=>{var r,i;const e=mapInstance.value.getView(),n=(i=(r=shipTrackLineFeatures.value.find(g=>g.getId()===t))==null?void 0:r.getGeometry())==null?void 0:i.getExtent();if(n!=null&&n.length)try{e.fit(n)}catch(g){console.log(g)}},drawCustomContent=(t,e,n,r="top-left",i=!1)=>{var V,z;if(!e||!mapInstance.value)return;document.querySelectorAll(".truck-custom-content").forEach(j=>j.parentNode.removeChild(j));const g=document.createElement("div");g.innerHTML=n;const y=new Overlay({element:g,position:e,positioning:r,stopEvent:i});if(i){let j=!1,ie=[0,0],re=[0,0];g.addEventListener("mousedown",function(oe){var ue;j=!0,oe.clientX,oe.clientY,ie=(ue=mapInstance.value)==null?void 0:ue.getCoordinateFromPixel([oe.clientX-200,oe.clientY-200]),re=[oe.clientX-g.getBoundingClientRect().left+160,oe.clientY-g.getBoundingClientRect().top+84],oe.preventDefault()}),document.addEventListener("mousemove",function(oe){var ue;if(j){let ae=(ue=mapInstance.value)==null?void 0:ue.getCoordinateFromPixel([oe.clientX-re[0],oe.clientY-re[1]]),pe=ae[0]-ie[0],he=ae[1]-ie[1];y.setPosition([ie[0]+pe,ie[1]+he])}}),document.addEventListener("mouseup",function(){j=!1})}(V=mapInstance.value)==null||V.addOverlay(y);const k=g.querySelector(".close-button");k&&k.addEventListener("click",()=>{var j,ie;(j=mapInstance.value)==null||j.removeOverlay(y),(ie=g.parentNode)==null||ie.removeChild(g)});let L=JSON.parse(JSON.stringify(e));const $=(z=mapInstance.value)==null?void 0:z.getCoordinateFromPixel(L);return y.setPosition($),y},vehicle=vue.ref(null),focusShipData=vue.ref(),currentTruckOverlay=vue.ref(null),findTruck=async t=>{if(!mapInstance.value)return;focusShipData.value=t;const e=convertSixHundredThousandToLatLng(t.lon,t.lat),n=mapInstance.value.getPixelFromCoordinate(transform(e,projection.data,projection.mercator));currentTruckOverlay.value=drawTruckIcon(t.vno,n,t==null?void 0:t.drc);const r=mapInstance.value.getView(),i=new Point(e);r.setCenter(transform(i.getCoordinates(),projection.data,projection.mercator))},clearAllTruck=()=>{vehicle.value.clearAllShip()},drawTruckIcon=(t,e,n)=>{const r=`<div id="${t}" class="ol-custom-content truck-custom-content" style="width: 80px; height: 80px; transform: rotate(${n}deg);">
657
657
  <img src="${CDN_URL}map/car-icon.gif" width="100%" height="100%" />
658
- </div>`;return drawCustomContent(t,e,r,"center-center")},removeTruckIcon=()=>{var e;const t=(e=currentTruckOverlay.value)==null?void 0:e.getElement();t&&(t.innerHTML="")},zoomTruckIcon=()=>{var g;if(!mapInstance.value)return;const t=mapInstance.value.getView().getZoom(),e=120,n=60;function r(y){return y<14?n:y>=14&&y<=18?Math.round((y-14)*(e-n)/4+n):e}const i=r(t);(g=document.querySelectorAll(".truck-custom-content"))==null||g.forEach(y=>{y.style.width=`${i}px`,y.style.height=`${i}px`})},markerPosition=vue.ref(""),marker=vue.ref(),createIconStyle=t=>new Style({image:new Icon({src:CDN_URL+"map/poi-marker-default.png",anchor:[.5,1]}),text:new Text({text:t,offsetY:-90,font:"12px",fill:new Fill({color:"#000"}),stroke:new Stroke({color:"#fff",width:2}),backgroundFill:new Fill({color:"#fff"}),backgroundStroke:new Stroke({color:"#000",width:1}),padding:[2,2,2,2]})}),renderMarker=(t,e=!0,n=!0)=>{var V;if(!mapInstance.value||!t||t.split(",").length!==2)return;const[r,i]=t.split(",").map(Number);marker.value=new Feature({geometry:new Point(fromLonLat([r,i]))});const g=n?`${r}, ${i}`:"";(V=marker.value)==null||V.setStyle(createIconStyle(g));const y=new VectorSource({features:[marker.value]}),k=new VectorLayer({source:y}),L=mapInstance.value.getView();if(mapInstance.value.addLayer(k),e){const z=new Translate({layers:[k]});z.on("translating",function(j){var oe;const ie=j.features.item(0).getGeometry().getCoordinates(),re=toLonLat(ie);markerPosition.value=`${re[0].toFixed(6)}, ${re[1].toFixed(6)}`,(oe=marker.value)==null||oe.setStyle(createIconStyle(markerPosition.value))}),mapInstance.value.addInteraction(z)}const $=new Point([r,i]);L.setCenter(transform($.getCoordinates(),projection.data,projection.mercator)),L.setZoom(mapZoom.findShip)},setMarkerPosition=t=>{var i,g;if(!mapInstance.value)return;const e=mapInstance.value.getView(),n=t.split(",").map(Number);(g=(i=marker.value)==null?void 0:i.getGeometry())==null||g.setCoordinates(fromLonLat([n[0],n[1]]));const r=new Point([n[0],n[1]]);e.setCenter(transform(r.getCoordinates(),projection.data,projection.mercator))};let layerState="drawn",drawnState="undrawn";const source=new VectorSource;let sketch,helpTooltipElement,helpTooltip,measureTooltipElement,measureTooltip;const circleStyle={image:new CircleStyle({radius:5,fill:new Fill({color:"rgb(51,112,255, 1)"})}),geometry:function(t){const e=t.getGeometry().getCoordinates();return new MultiPoint(e)}},drawVector=new VectorLayer({source,style:[{"stroke-color":"rgba(255, 255, 255, 1)","stroke-width":2,"fill-color":"rgba(255, 255, 255, 0.3)"},new Style(circleStyle)]});let draw;function createMeasureTooltip(){var t;measureTooltipElement!=null&&measureTooltipElement.parentNode&&measureTooltipElement.parentNode.removeChild(measureTooltipElement),measureTooltipElement=document.createElement("div"),measureTooltipElement.className="ol-tooltip ol-tooltip-draw-polygon",measureTooltip=new Overlay({element:measureTooltipElement,offset:[0,-15],positioning:"bottom-center",stopEvent:!1,insertFirst:!1}),(t=mapInstance.value)==null||t.addOverlay(measureTooltip)}function createHelpTooltip(){var t;helpTooltipElement!=null&&helpTooltipElement.parentNode&&helpTooltipElement.parentNode.removeChild(helpTooltipElement),helpTooltipElement=document.createElement("div"),helpTooltipElement.className="ol-tooltip ol-help-tooltip hidden",helpTooltip=new Overlay({element:helpTooltipElement,offset:[15,0],positioning:"center-left"}),(t=mapInstance.value)==null||t.addOverlay(helpTooltip)}let squareLimitError=!1,lineLimitError=!1;const validateSquareLimit=t=>{let n=1/0,r=-1/0,i=1/0,g=-1/0;t==null||t.forEach(L=>{const $=transform(L,projection.mercator,projection.data),V=$[0],z=$[1];n=Math.min(n,z),r=Math.max(r,z),i=Math.min(i,V),g=Math.max(g,V)});const y=(r-n)*111,k=(g-i)*111;squareLimitError=y>150||k>150};let storeFeature;function addInteraction(t){var n,r;mapInstance.value||init(),drawnState="undrawn",layerState="drawn",(n=mapInstance.value)==null||n.addLayer(drawVector),draw=new Draw({type:"Polygon",source,trace:!0,style:[{"stroke-color":"rgba(255, 255, 255, 1)","stroke-width":1.5,"stroke-line-dash":[10,10],"fill-color":"rgba(255, 255, 255, 0.25)"},new Style(circleStyle)]}),(r=mapInstance.value)==null||r.addInteraction(draw),createMeasureTooltip(),createHelpTooltip();let e;draw.on("drawstart",function(i){var g;layerState="drawn",sketch=i.feature,e=(g=sketch.getGeometry())==null?void 0:g.on("change",function(y){const k=y.target;let L=formatArea(k,LENGTH_UNIT.NM);const V=k.getCoordinates()[0],z=new LineString([V[V.length-2],V[V.length-1]]);let j=formatLength(z,LENGTH_UNIT.NM);if(lineLimitError=Number(getLength(z)/1e3)>150,validateSquareLimit(V),measureTooltipElement&&L&&(measureTooltipElement.innerHTML=`
658
+ </div>`;return drawCustomContent(t,e,r,"center-center")},removeTruckIcon=()=>{var e;const t=(e=currentTruckOverlay.value)==null?void 0:e.getElement();t&&(t.innerHTML="")},zoomTruckIcon=()=>{var g;if(!mapInstance.value)return;const t=mapInstance.value.getView().getZoom(),e=120,n=60;function r(y){return y<14?n:y>=14&&y<=18?Math.round((y-14)*(e-n)/4+n):e}const i=r(t);(g=document.querySelectorAll(".truck-custom-content"))==null||g.forEach(y=>{y.style.width=`${i}px`,y.style.height=`${i}px`})},markerPosition=vue.ref(""),marker=vue.ref(),createIconStyle=t=>new Style({image:new Icon({src:CDN_URL+"map/poi-marker-default.png",anchor:[.5,1]}),text:new Text({text:t,offsetY:-90,font:"12px",fill:new Fill({color:"#000"}),stroke:new Stroke({color:"#fff",width:2}),backgroundFill:new Fill({color:"#fff"}),backgroundStroke:new Stroke({color:"#000",width:1}),padding:[2,2,2,2]})}),renderMarker=(t,e=!0,n=!0)=>{var V;if(!mapInstance.value||!t||t.split(",").length!==2)return;const[r,i]=t.split(",").map(Number);marker.value=new Feature({geometry:new Point(fromLonLat([r,i]))});const g=n?`${r}, ${i}`:"";(V=marker.value)==null||V.setStyle(createIconStyle(g));const y=new VectorSource({features:[marker.value]}),k=new VectorLayer({source:y}),L=mapInstance.value.getView();if(mapInstance.value.addLayer(k),e){const z=new Translate({layers:[k]});z.on("translating",function(j){var oe;const ie=j.features.item(0).getGeometry().getCoordinates(),re=toLonLat(ie);markerPosition.value=`${re[0].toFixed(6)}, ${re[1].toFixed(6)}`,(oe=marker.value)==null||oe.setStyle(createIconStyle(markerPosition.value))}),mapInstance.value.addInteraction(z)}const $=new Point([r,i]);L.setCenter(transform($.getCoordinates(),projection.data,projection.mercator)),L.setZoom(mapZoom.findShip)},setMarkerPosition=t=>{var i,g;if(!mapInstance.value)return;const e=mapInstance.value.getView(),n=t.split(",").map(Number);(g=(i=marker.value)==null?void 0:i.getGeometry())==null||g.setCoordinates(fromLonLat([n[0],n[1]]));const r=new Point([n[0],n[1]]);e.setCenter(transform(r.getCoordinates(),projection.data,projection.mercator))};let layerState="drawn",drawnState="undrawn";const source=new VectorSource;let sketch,helpTooltipElement,helpTooltip,measureTooltipElement,measureTooltip;const circleStyle={image:new CircleStyle({radius:5,fill:new Fill({color:"rgb(51,112,255, 1)"})}),geometry:function(t){const e=t.getGeometry().getCoordinates();return new MultiPoint(e)}};let drawVector,draw;function createMeasureTooltip(){var t;measureTooltipElement!=null&&measureTooltipElement.parentNode&&measureTooltipElement.parentNode.removeChild(measureTooltipElement),measureTooltipElement=document.createElement("div"),measureTooltipElement.className="ol-tooltip ol-tooltip-draw-polygon",measureTooltip=new Overlay({element:measureTooltipElement,offset:[0,-15],positioning:"bottom-center",stopEvent:!1,insertFirst:!1}),(t=mapInstance.value)==null||t.addOverlay(measureTooltip)}function createHelpTooltip(){var t;helpTooltipElement!=null&&helpTooltipElement.parentNode&&helpTooltipElement.parentNode.removeChild(helpTooltipElement),helpTooltipElement=document.createElement("div"),helpTooltipElement.className="ol-tooltip ol-help-tooltip hidden",helpTooltip=new Overlay({element:helpTooltipElement,offset:[15,0],positioning:"center-left"}),(t=mapInstance.value)==null||t.addOverlay(helpTooltip)}let squareLimitError=!1,lineLimitError=!1;const validateSquareLimit=t=>{let n=1/0,r=-1/0,i=1/0,g=-1/0;t==null||t.forEach(L=>{const $=transform(L,projection.mercator,projection.data),V=$[0],z=$[1];n=Math.min(n,z),r=Math.max(r,z),i=Math.min(i,V),g=Math.max(g,V)});const y=(r-n)*111,k=(g-i)*111;squareLimitError=y>150||k>150};let storeFeature;function addInteraction(t){var n,r;drawVector||init(),drawnState="undrawn",layerState="drawn",(n=mapInstance.value)==null||n.addLayer(drawVector),draw=new Draw({type:"Polygon",source,trace:!0,style:[{"stroke-color":"rgba(255, 255, 255, 1)","stroke-width":1.5,"stroke-line-dash":[10,10],"fill-color":"rgba(255, 255, 255, 0.25)"},new Style(circleStyle)]}),(r=mapInstance.value)==null||r.addInteraction(draw),createMeasureTooltip(),createHelpTooltip();let e;draw.on("drawstart",function(i){var g;layerState="drawn",sketch=i.feature,e=(g=sketch.getGeometry())==null?void 0:g.on("change",function(y){const k=y.target;let L=formatArea(k,LENGTH_UNIT.NM);const V=k.getCoordinates()[0],z=new LineString([V[V.length-2],V[V.length-1]]);let j=formatLength(z,LENGTH_UNIT.NM);if(lineLimitError=Number(getLength(z)/1e3)>150,validateSquareLimit(V),measureTooltipElement&&L&&(measureTooltipElement.innerHTML=`
659
659
  <span class="text">面积:${L}${lineLimitError||squareLimitError?'<span class="error pl-12">超出可以绘画的距离</span>':""}</span>
660
660
  `),helpTooltipElement&&L){let ie="";parseFloat(L)>0&&(ie=`
661
661
  <div class="text ${squareLimitError?"error":""}">面积:${L}${squareLimitError?'<span class="error pl-12">超出可以绘画的距离</span>':""}</div>`),helpTooltipElement.innerHTML=`${ie}
@@ -663,4 +663,4 @@ void main(void) {
663
663
  <div><span class="text">单击继续,双击结束</span></div>
664
664
  `}}),drawnState="drawing"}),draw.on("drawend",function(i){if(i.feature.getGeometry()){storeFeature=i.feature;const g=endFn(i.feature);g!=null&&g.length&&t&&t(g)}sketch=null,measureTooltipElement=null,createMeasureTooltip(),e&&unByKey(e),drawnState="drawend"})}function removeInteraction(){var t,e,n;mapInstance.value&&(document.querySelectorAll(".ol-tooltip.ol-tooltip-draw-polygon").forEach(r=>{var i;(i=r==null?void 0:r.parentNode)==null||i.removeChild(r)}),source.clear(),(t=mapInstance.value)==null||t.removeInteraction(draw),(e=mapInstance.value)==null||e.removeLayer(drawVector),helpTooltipElement!=null&&helpTooltipElement.parentNode&&helpTooltipElement.parentNode.removeChild(helpTooltipElement),((n=mapInstance.value)==null?void 0:n.getTargetElement()).style.cursor="",document.querySelector("#map").style.cursor="",drawnState="undrawn",layerState="destroyed")}const endFn=t=>{var e,n,r;if(t.getGeometry()){const i=[],y=t.getGeometry().getCoordinates();(e=y[0])==null||e.forEach(L=>{i.push(transform(L,projection.mercator,projection.data))});const k=y[0][y[0].length-2];if(k&&measureTooltip.setPosition(k),measureTooltip.setOffset([10,0]),measureTooltipElement&&(measureTooltipElement.innerHTML+='<span class="delete-icon"><i class="iconfont icon-delete" /></div>'),(n=document.querySelector(".delete-icon"))==null||n.addEventListener("click",()=>{reset()}),!lineLimitError&&!squareLimitError)return i;draw&&((r=mapInstance.value)==null||r.removeInteraction(draw)),helpTooltipElement!=null&&helpTooltipElement.parentNode&&helpTooltipElement.parentNode.removeChild(helpTooltipElement)}},initFeature=t=>{var e,n;if(layerState="drawn",storeFeature){const r=storeFeature.getGeometry();if(!r)return;const i=formatArea(r,LENGTH_UNIT.NM);measureTooltipElement&&(measureTooltipElement.innerHTML=`
665
665
  <span class="text">面积:${i}${lineLimitError||squareLimitError?'<span class="error pl-12">超出可以绘画的距离</span>':""}</span>
666
- `),(e=drawVector.getSource())==null||e.addFeature(storeFeature);const g=endFn(storeFeature);g!=null&&g.length&&t&&t(g);const y=getCenter(storeFeature.getGeometry().getExtent());(n=mapInstance.value)==null||n.getView().setCenter(y)}},pointerMoveHandler=function(t){var n;if(t.dragging)return;let e="点击选择起点";sketch&&(e="单击继续,双击结束"),helpTooltipElement&&(helpTooltipElement.innerHTML=e,helpTooltip.setPosition(t.coordinate),helpTooltipElement.classList.remove("hidden")),layerState==="drawn"&&(((n=mapInstance.value)==null?void 0:n.getTargetElement()).style.cursor="crosshair")},init=()=>{mapInstance.value&&(mapInstance.value.on("pointermove",pointerMoveHandler),mapInstance.value.getViewport().addEventListener("mouseout",function(){var t;(t=helpTooltipElement==null?void 0:helpTooltipElement.classList)==null||t.add("hidden")}),mapInstance.value.on("dblclick",function(t){drawnState!=="undrawn"&&(t.stopPropagation(),t.preventDefault())}))},reset=()=>{removeInteraction(),addInteraction(),storeFeature=null},drawPolygonTool={addInteraction,removeInteraction,initFeature,reset},_sfc_main=vue.defineComponent({__name:"Map",props:{zoom:{},center:{},vehicleMode:{}},emits:["zoomChanged","extentChanged"],setup(t,{expose:e,emit:n}){const r=vue.ref(null),i=vue.ref(null),g=vue.ref(null),y=n,k=t,L=vue.ref(k.zoom||mapZoom.default),$=vue.ref(!1),V=vue.ref(!0),z=vue.ref(!0);let j;(he=>{he[he.tiandituTile=new TileLayer({source:new XYZ({url:baseMap.tiandituTile})})]="tiandituTile",he[he.tiandituTileMark=new TileLayer({source:new XYZ({url:baseMap.tiandituTileMark})})]="tiandituTileMark",he[he.tiandituImgTile=new TileLayer({source:new XYZ({url:baseMap.tiandituImgTile}),visible:!1})]="tiandituImgTile",he[he.tiandituImgTileMark=new TileLayer({source:new XYZ({url:baseMap.tiandituImgTileMark}),visible:!1})]="tiandituImgTileMark",he[he.greenMark=new TileLayer({source:new XYZ({url:baseMap.greenTile})})]="greenMark"})(j||(j={}));const ie=()=>{var le,de;const he={projection:projection.mercator,zoom:k.zoom||(k.vehicleMode==="ship"?mapZoom.default:mapZoom.truckDefault),minZoom:mapZoom.min,maxZoom:mapZoom.max,center:lonLatToMercator(k.center||mapDefaultCenter),constrainResolution:!0,multiWorld:!0};mapInstance.value=new Map$2({target:"map",layers:[j.tiandituTile,j.tiandituTileMark,j.tiandituImgTile,j.tiandituImgTileMark,j.greenMark],view:new View(he)}),(le=i.value)==null||le.setScaleLine(),(de=mapInstance.value)==null||de.on("moveend",ue),re(k.vehicleMode==="ship"),oe(k.vehicleMode==="ship"?BaseMapType.satellite:BaseMapType.vector)};vue.onMounted(()=>{ie()});const re=he=>{var le;(le=mapInstance.value)==null||le.getLayers().forEach(de=>{de.ol_uid===j.greenMark.ol_uid&&(de.setVisible(he),V.value=he)})},oe=he=>{var le;console.log("mode",he),(le=mapInstance.value)==null||le.getLayers().forEach(de=>{(de.ol_uid===j.tiandituTile.ol_uid||de.ol_uid===j.tiandituTileMark.ol_uid||de.ol_uid===j.tiandituImgTile.ol_uid||de.ol_uid===j.tiandituImgTileMark.ol_uid)&&de.setVisible(!1),(he===BaseMapType.vector&&de.ol_uid===j.tiandituTile.ol_uid||de.ol_uid===j.tiandituTileMark.ol_uid||he===BaseMapType.satellite&&de.ol_uid===j.tiandituImgTile.ol_uid||de.ol_uid===j.tiandituImgTileMark.ol_uid)&&(console.log(he,de.ol_uid),de.setVisible(!0))})},ue=()=>{const he=mapInstance.value.getView(),le=he.getZoom();le&&ae(le);const de=he.calculateExtent(mapInstance.value.getSize());de&&le&&pe(de,le)},ae=he=>{var _e,Ce,xe,Oe;L.value=he;const le=(_e=mapInstance.value)==null?void 0:_e.getLayers(),de=k.vehicleMode==="ship"?le==null?void 0:le.getArray().find(Fe=>Fe.ol_uid===j.greenMark.ol_uid):void 0;!$.value&&V.value&&he<mapZoom.shipGreenDotMax?(z.value=!0,de==null||de.setVisible(!0),(Ce=shipsLayer.value)==null||Ce.setVisible(!1),(xe=largeAmountShipsLayer.value)==null||xe.setVisible(!1)):(z.value=!1,de==null||de.setVisible(!1),(Oe=largeAmountShipsLayer.value)==null||Oe.setVisible(!0)),y("zoomChanged",he)},pe=(he,le)=>{const de=transform([he[0],he[1]],projection.mercator,projection.data),_e=transform([he[2],he[3]],projection.mercator,projection.data);y("extentChanged",{extent:[de,_e],zoom:le})};return e({mapInstance,initMap:ie,renderTrucksMarker,renderShip:renderShips,renderTrack,findTruck,removeTruckIcon,clearAllTruck,closeTrack:()=>{var he;(he=shipTrackVectorLayer.value)==null||he.setVisible(!1)},closeTruckTrack:()=>{var he;(he=shipTrackVectorLayer.value)==null||he.setVisible(!1)},clearSelectFeature,findShip,focusShip:(he,le)=>{var de,_e;(de=shipsLayer.value)==null||de.setVisible(!1),(_e=largeAmountShipsLayer.value)==null||_e.setVisible(!1),findShip(he,le)},showTracks,removeAllTrackLayer,switchFilterItem,rerenderShip,switchGreenDot:()=>re(!1),zoomTruckIcon,renderTruckTrack:(he,le,de)=>{renderTrack(he,le,de,LENGTH_UNIT.KM,"truck")},renderMarker,setMarkerPosition,drawPolygonTool}),(he,le)=>(vue.openBlock(),vue.createElementBlock("div",{class:"map-page map-container",ref_key:"pageRef",ref:r},[le[0]||(le[0]=vue.createElementVNode("div",{id:"map",class:"map"},null,-1)),vue.createVNode(ToolPanel,{"vehicle-mode":he.vehicleMode,onSwitchGreenDot:re,onSwitchMapTile:oe},null,8,["vehicle-mode"]),vue.createVNode(ScaleLine,{ref_key:"scaleLineControl",ref:i},null,512),vue.createVNode(ZoomControl,{ref_key:"zoomControl",ref:g},null,512),vue.createVNode(Copyright),vue.createVNode(Fullscreen,{page:r.value},null,8,["page"])],512))}}),Map$1=_export_sfc(_sfc_main,[["__scopeId","data-v-08679314"]]),ZhMap=withInstall$1(Map$1),components=[ZhBaseInfo,ZhButton,ZhDatePicker,ZhDetailHeader,ZhDetailSubTitle,ZhDialog,ZhDiyDataTable,ZhEditInfoPair,ZhFileWrapper,ZhGrid,ZhInfoPair,ZhInput,ZhInputNumber,ZhLoading,ZhMessageBox,ZhMoneyInput,ZhPageHeadPanel,ZhToolTips,ZhMap],installer=makeInstaller(components);exports.DIY_DATA_TYPE=DIY_DATA_TYPE,exports.ZhBaseInfo=ZhBaseInfo,exports.ZhButton=ZhButton,exports.ZhButtonGroup=ZhButtonGroup,exports.ZhDatePicker=ZhDatePicker,exports.ZhDetailHeader=ZhDetailHeader,exports.ZhDetailSubTitle=ZhDetailSubTitle,exports.ZhDialog=ZhDialog,exports.ZhDiyDataTable=ZhDiyDataTable,exports.ZhEditInfoPair=ZhEditInfoPair,exports.ZhFileWrapper=ZhFileWrapper,exports.ZhGrid=ZhGrid,exports.ZhInfoPair=ZhInfoPair,exports.ZhInput=ZhInput,exports.ZhInputNumber=ZhInputNumber,exports.ZhLoading=ZhLoading,exports.ZhMap=ZhMap,exports.ZhMessageBox=ZhMessageBox,exports.ZhMoneyInput=ZhMoneyInput,exports.ZhPageHeadPanel=ZhPageHeadPanel,exports.ZhToolTips=ZhToolTips,exports.default=installer,Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
666
+ `),(e=drawVector.getSource())==null||e.addFeature(storeFeature);const g=endFn(storeFeature);g!=null&&g.length&&t&&t(g);const y=getCenter(storeFeature.getGeometry().getExtent());(n=mapInstance.value)==null||n.getView().setCenter(y)}},pointerMoveHandler=function(t){var n;if(t.dragging)return;let e="点击选择起点";sketch&&(e="单击继续,双击结束"),helpTooltipElement&&(helpTooltipElement.innerHTML=e,helpTooltip.setPosition(t.coordinate),helpTooltipElement.classList.remove("hidden")),layerState==="drawn"&&(((n=mapInstance.value)==null?void 0:n.getTargetElement()).style.cursor="crosshair")},init=()=>{mapInstance.value&&(drawVector=new VectorLayer({source,style:[{"stroke-color":"rgba(255, 255, 255, 1)","stroke-width":2,"fill-color":"rgba(255, 255, 255, 0.3)"},new Style(circleStyle)]}),mapInstance.value.on("pointermove",pointerMoveHandler),mapInstance.value.getViewport().addEventListener("mouseout",function(){var t;(t=helpTooltipElement==null?void 0:helpTooltipElement.classList)==null||t.add("hidden")}),mapInstance.value.on("dblclick",function(t){drawnState!=="undrawn"&&(t.stopPropagation(),t.preventDefault())}))},reset=()=>{removeInteraction(),addInteraction(),storeFeature=null},drawPolygonTool={addInteraction,removeInteraction,initFeature,reset},_sfc_main=vue.defineComponent({__name:"Map",props:{zoom:{},center:{},vehicleMode:{}},emits:["zoomChanged","extentChanged"],setup(t,{expose:e,emit:n}){const r=vue.ref(null),i=vue.ref(null),g=vue.ref(null),y=n,k=t,L=vue.ref(k.zoom||mapZoom.default),$=vue.ref(!1),V=vue.ref(!0),z=vue.ref(!0);let j;(he=>{he[he.tiandituTile=new TileLayer({source:new XYZ({url:baseMap.tiandituTile})})]="tiandituTile",he[he.tiandituTileMark=new TileLayer({source:new XYZ({url:baseMap.tiandituTileMark})})]="tiandituTileMark",he[he.tiandituImgTile=new TileLayer({source:new XYZ({url:baseMap.tiandituImgTile}),visible:!1})]="tiandituImgTile",he[he.tiandituImgTileMark=new TileLayer({source:new XYZ({url:baseMap.tiandituImgTileMark}),visible:!1})]="tiandituImgTileMark",he[he.greenMark=new TileLayer({source:new XYZ({url:baseMap.greenTile})})]="greenMark"})(j||(j={}));const ie=()=>{var le,de;const he={projection:projection.mercator,zoom:k.zoom||(k.vehicleMode==="ship"?mapZoom.default:mapZoom.truckDefault),minZoom:mapZoom.min,maxZoom:mapZoom.max,center:lonLatToMercator(k.center||mapDefaultCenter),constrainResolution:!0,multiWorld:!0};mapInstance.value=new Map$2({target:"map",layers:[j.tiandituTile,j.tiandituTileMark,j.tiandituImgTile,j.tiandituImgTileMark,j.greenMark],view:new View(he)}),(le=i.value)==null||le.setScaleLine(),(de=mapInstance.value)==null||de.on("moveend",ue),re(k.vehicleMode==="ship"),oe(k.vehicleMode==="ship"?BaseMapType.satellite:BaseMapType.vector)};vue.onMounted(()=>{ie()});const re=he=>{var le;(le=mapInstance.value)==null||le.getLayers().forEach(de=>{de.ol_uid===j.greenMark.ol_uid&&(de.setVisible(he),V.value=he)})},oe=he=>{var le;console.log("mode",he),(le=mapInstance.value)==null||le.getLayers().forEach(de=>{(de.ol_uid===j.tiandituTile.ol_uid||de.ol_uid===j.tiandituTileMark.ol_uid||de.ol_uid===j.tiandituImgTile.ol_uid||de.ol_uid===j.tiandituImgTileMark.ol_uid)&&de.setVisible(!1),(he===BaseMapType.vector&&de.ol_uid===j.tiandituTile.ol_uid||de.ol_uid===j.tiandituTileMark.ol_uid||he===BaseMapType.satellite&&de.ol_uid===j.tiandituImgTile.ol_uid||de.ol_uid===j.tiandituImgTileMark.ol_uid)&&(console.log(he,de.ol_uid),de.setVisible(!0))})},ue=()=>{const he=mapInstance.value.getView(),le=he.getZoom();le&&ae(le);const de=he.calculateExtent(mapInstance.value.getSize());de&&le&&pe(de,le)},ae=he=>{var _e,Ce,xe,Oe;L.value=he;const le=(_e=mapInstance.value)==null?void 0:_e.getLayers(),de=k.vehicleMode==="ship"?le==null?void 0:le.getArray().find(Fe=>Fe.ol_uid===j.greenMark.ol_uid):void 0;!$.value&&V.value&&he<mapZoom.shipGreenDotMax?(z.value=!0,de==null||de.setVisible(!0),(Ce=shipsLayer.value)==null||Ce.setVisible(!1),(xe=largeAmountShipsLayer.value)==null||xe.setVisible(!1)):(z.value=!1,de==null||de.setVisible(!1),(Oe=largeAmountShipsLayer.value)==null||Oe.setVisible(!0)),y("zoomChanged",he)},pe=(he,le)=>{const de=transform([he[0],he[1]],projection.mercator,projection.data),_e=transform([he[2],he[3]],projection.mercator,projection.data);y("extentChanged",{extent:[de,_e],zoom:le})};return e({mapInstance,initMap:ie,renderTrucksMarker,renderShip:renderShips,renderTrack,findTruck,removeTruckIcon,clearAllTruck,closeTrack:()=>{var he;(he=shipTrackVectorLayer.value)==null||he.setVisible(!1)},closeTruckTrack:()=>{var he;(he=shipTrackVectorLayer.value)==null||he.setVisible(!1)},clearSelectFeature,findShip,focusShip:(he,le)=>{var de,_e;(de=shipsLayer.value)==null||de.setVisible(!1),(_e=largeAmountShipsLayer.value)==null||_e.setVisible(!1),findShip(he,le)},showTracks,removeAllTrackLayer,switchFilterItem,rerenderShip,switchGreenDot:()=>re(!1),zoomTruckIcon,renderTruckTrack:(he,le,de)=>{renderTrack(he,le,de,LENGTH_UNIT.KM,"truck")},renderMarker,setMarkerPosition,drawPolygonTool}),(he,le)=>(vue.openBlock(),vue.createElementBlock("div",{class:"map-page map-container",ref_key:"pageRef",ref:r},[le[0]||(le[0]=vue.createElementVNode("div",{id:"map",class:"map"},null,-1)),vue.createVNode(ToolPanel,{"vehicle-mode":he.vehicleMode,onSwitchGreenDot:re,onSwitchMapTile:oe},null,8,["vehicle-mode"]),vue.createVNode(ScaleLine,{ref_key:"scaleLineControl",ref:i},null,512),vue.createVNode(ZoomControl,{ref_key:"zoomControl",ref:g},null,512),vue.createVNode(Copyright),vue.createVNode(Fullscreen,{page:r.value},null,8,["page"])],512))}}),Map$1=_export_sfc(_sfc_main,[["__scopeId","data-v-08679314"]]),ZhMap=withInstall$1(Map$1),components=[ZhBaseInfo,ZhButton,ZhDatePicker,ZhDetailHeader,ZhDetailSubTitle,ZhDialog,ZhDiyDataTable,ZhEditInfoPair,ZhFileWrapper,ZhGrid,ZhInfoPair,ZhInput,ZhInputNumber,ZhLoading,ZhMessageBox,ZhMoneyInput,ZhPageHeadPanel,ZhToolTips,ZhMap],installer=makeInstaller(components);exports.DIY_DATA_TYPE=DIY_DATA_TYPE,exports.ZhBaseInfo=ZhBaseInfo,exports.ZhButton=ZhButton,exports.ZhButtonGroup=ZhButtonGroup,exports.ZhDatePicker=ZhDatePicker,exports.ZhDetailHeader=ZhDetailHeader,exports.ZhDetailSubTitle=ZhDetailSubTitle,exports.ZhDialog=ZhDialog,exports.ZhDiyDataTable=ZhDiyDataTable,exports.ZhEditInfoPair=ZhEditInfoPair,exports.ZhFileWrapper=ZhFileWrapper,exports.ZhGrid=ZhGrid,exports.ZhInfoPair=ZhInfoPair,exports.ZhInput=ZhInput,exports.ZhInputNumber=ZhInputNumber,exports.ZhLoading=ZhLoading,exports.ZhMap=ZhMap,exports.ZhMessageBox=ZhMessageBox,exports.ZhMoneyInput=ZhMoneyInput,exports.ZhPageHeadPanel=ZhPageHeadPanel,exports.ZhToolTips=ZhToolTips,exports.default=installer,Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zhihao-ui",
3
- "version": "1.2.9",
3
+ "version": "1.2.10",
4
4
  "description": "components",
5
5
  "type": "module",
6
6
  "main": "./dist/umd/index.umd.cjs",