zhihao-ui 1.2.3 → 1.2.5

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.
Files changed (74) hide show
  1. package/dist/es/{BaseInfo-DqxHM6sE.js → BaseInfo-CboHDiqp.js} +1 -1
  2. package/dist/es/Button-C1Q6WvkI.js +32 -0
  3. package/dist/es/{DatePicker-CSviipkU.js → DatePicker-AcRbvS-8.js} +14 -14
  4. package/dist/es/{DetailHeader-KRh1lffS.js → DetailHeader-CoaVXtN3.js} +3 -3
  5. package/dist/es/{DetailSubTitle-DCS8YLpA.js → DetailSubTitle-Csp4LjFx.js} +2 -2
  6. package/dist/es/{Dialog-DrsOxk4u.js → Dialog-CtU-qGdR.js} +3 -3
  7. package/dist/es/DiyDataTable-DBonLs6p.js +276 -0
  8. package/dist/es/{EditInfoPair-UqygyG7w.js → EditInfoPair-DBbRqppY.js} +3 -3
  9. package/dist/es/{FileWrapper-C8FmshRX.js → FileWrapper-BwQhQopY.js} +4 -4
  10. package/dist/es/{Grid-Ds-Jy0Mn.js → Grid-B-FutGih.js} +1 -1
  11. package/dist/es/{InfoPair-BXow_dHM.js → InfoPair-WmMCXoUh.js} +3 -3
  12. package/dist/es/{Input-C1s8JqmI.js → Input-DFnH7_jo.js} +11 -11
  13. package/dist/es/{Loading-DELLXz7f.js → Loading-BW6Doqh_.js} +2 -2
  14. package/dist/es/Map-BLQnapy4.js +1183 -0
  15. package/dist/es/{MessageBox-B5ibisN4.js → MessageBox-CjuBt74R.js} +13 -13
  16. package/dist/es/{MoneyInput-Chv0AAVp.js → MoneyInput-BwkFhS2B.js} +10 -10
  17. package/dist/es/{PageHeadPanel-CdohXWA9.js → PageHeadPanel-BhR3Bq1A.js} +2 -2
  18. package/dist/es/{ToolTips-CxyQMewg.js → ToolTips-BEYXkt4n.js} +5 -5
  19. package/dist/es/index.js +29 -23
  20. package/dist/es/{utils-DBdiSe6_.js → utils-B1dH8Kx6.js} +1 -1
  21. package/dist/es/vendor-Cu-cEPs_.js +46630 -0
  22. package/dist/index.css +1 -1
  23. package/dist/types/components/Button/Button.vue.d.ts +8 -13
  24. package/dist/types/components/Button/index.d.ts +15 -24
  25. package/dist/types/components/DiyDataTable/DiyDataTable.vue.d.ts +70 -0
  26. package/dist/types/components/DiyDataTable/index.d.ts +151 -0
  27. package/dist/types/components/DiyDataTable/type.d.ts +46 -0
  28. package/dist/types/components/Map/Map.vue.d.ts +36 -0
  29. package/dist/types/components/Map/components/copyright.vue.d.ts +2 -0
  30. package/dist/types/components/Map/components/fullscreen.vue.d.ts +14 -0
  31. package/dist/types/components/Map/components/measure.vue.d.ts +15 -0
  32. package/dist/types/components/Map/components/scaleLine.vue.d.ts +4 -0
  33. package/dist/types/components/Map/components/toolPanel.vue.d.ts +21 -0
  34. package/dist/types/components/Map/components/zoomControl.vue.d.ts +10 -0
  35. package/dist/types/components/Map/config.d.ts +26 -0
  36. package/dist/types/components/Map/enum/car.d.ts +5 -0
  37. package/dist/types/components/Map/enum/device.d.ts +8 -0
  38. package/dist/types/components/Map/enum/index.d.ts +4 -0
  39. package/dist/types/components/Map/enum/openLayers.d.ts +10 -0
  40. package/dist/types/components/Map/index.d.ts +91 -0
  41. package/dist/types/components/Map/interface/common/BaseEntity.d.ts +29 -0
  42. package/dist/types/components/Map/interface/common/page.d.ts +34 -0
  43. package/dist/types/components/Map/interface/entity/dashboard.d.ts +16 -0
  44. package/dist/types/components/Map/interface/entity/map.d.ts +36 -0
  45. package/dist/types/components/Map/interface/entity/queryLicenseResponse.d.ts +197 -0
  46. package/dist/types/components/Map/interface/entity/ship.d.ts +361 -0
  47. package/dist/types/components/Map/interface/entity/shipInfoVo.d.ts +186 -0
  48. package/dist/types/components/Map/interface/entity/shipMapData.d.ts +22 -0
  49. package/dist/types/components/Map/interface/entity/shipMarker.d.ts +8 -0
  50. package/dist/types/components/Map/interface/entity/shipTrack.d.ts +60 -0
  51. package/dist/types/components/Map/interface/entity/vehicle.d.ts +174 -0
  52. package/dist/types/components/Map/interface/index.d.ts +11 -0
  53. package/dist/types/components/Map/render/canvasRender/canvasRender.d.ts +6 -0
  54. package/dist/types/components/Map/render/canvasRender/geometry.d.ts +19 -0
  55. package/dist/types/components/Map/render/canvasRender/renderShipStyle.d.ts +3 -0
  56. package/dist/types/components/Map/render/canvasRender/renderTrackStyle.d.ts +5 -0
  57. package/dist/types/components/Map/render/canvasRender/renderTruckStyle.d.ts +3 -0
  58. package/dist/types/components/Map/render/renderDashboard.d.ts +10 -0
  59. package/dist/types/components/Map/render/renderShip.d.ts +10 -0
  60. package/dist/types/components/Map/render/renderTrack.d.ts +13 -0
  61. package/dist/types/components/Map/render/renderTruck.d.ts +4 -0
  62. package/dist/types/components/Map/types.d.ts +9 -0
  63. package/dist/types/components/Map/utils/common.d.ts +24 -0
  64. package/dist/types/components/Map/utils/format.d.ts +16 -0
  65. package/dist/types/components/Map/utils/store.d.ts +18 -0
  66. package/dist/types/components/Map/utils/transform.d.ts +33 -0
  67. package/dist/types/components/MessageBox/MessageBox.vue.d.ts +12 -12
  68. package/dist/types/components/MessageBox/index.d.ts +18 -18
  69. package/dist/types/components/index.d.ts +2 -0
  70. package/dist/umd/index.css +1 -1
  71. package/dist/umd/index.umd.cjs +638 -22
  72. package/package.json +1 -1
  73. package/dist/es/Button-Q7GkKwFF.js +0 -22
  74. package/dist/es/vendor-mKFy0Hb6.js +0 -12409
@@ -0,0 +1,1183 @@
1
+ var A = Object.defineProperty;
2
+ var x = (e, t, o) => t in e ? A(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
3
+ var L = (e, t, o) => x(e, typeof t != "symbol" ? t + "" : t, o);
4
+ import { ref, defineComponent, useModel, watch, resolveComponent, openBlock, createElementBlock, createElementVNode, createVNode, withCtx, Fragment, renderList, unref, createBlock, toDisplayString, createCommentVNode, mergeModels, normalizeClass, nextTick, onMounted } from "vue";
5
+ import { m as getLength, V as VectorSource, n as VectorLayer, S as Style, C as CircleStyle, F as Fill, o as Stroke, D as Draw, O as Overlay, u as unByKey, p as ElOption, q as ScaleLine$1, T as Text, r as Feature, P as Point, s as fromLonLat, d as cloneDeep, G as GeoJSON, W as WebGLPointsLayer, h as hooks, L as LineString, t as transform, v as TileLayer, X as XYZ, M as Map$1, w as View } from "./vendor-Cu-cEPs_.js";
6
+ import { _ as _export_sfc } from "./Button-C1Q6WvkI.js";
7
+ import { w as withInstall } from "./utils-B1dH8Kx6.js";
8
+ var BaseMapType = /* @__PURE__ */ ((e) => (e[e.vector = 0] = "vector", e[e.satellite = 1] = "satellite", e))(BaseMapType || {}), CAR_COLOR = /* @__PURE__ */ ((e) => (e[e.BLUE = 1] = "BLUE", e[e.YELLOW = 2] = "YELLOW", e[e.Y_GREEN = 3] = "Y_GREEN", e))(CAR_COLOR || {}), DEVICE_TYPE = /* @__PURE__ */ ((e) => (e[e.HOST = 1] = "HOST", e[e.TALK = 2] = "TALK", e[e.STORAGE = 3] = "STORAGE", e[e.INTERNET = 4] = "INTERNET", e[e.CAMERA = 5] = "CAMERA", e[e.LOAD = 6] = "LOAD", e))(DEVICE_TYPE || {}), LENGTH_UNIT = /* @__PURE__ */ ((e) => (e[e.M = 1] = "M", e[e.KM = 2] = "KM", e[e.NM = 3] = "NM", e))(LENGTH_UNIT || {});
9
+ const LENGTH_UNIT_LABEL = {
10
+ 1: "M",
11
+ // m
12
+ 2: "KM",
13
+ // km
14
+ 3: "NM"
15
+ // nm
16
+ }, formatLength = function(e, t) {
17
+ const n = getLength(e);
18
+ let a = "";
19
+ switch (t) {
20
+ case LENGTH_UNIT.M:
21
+ a = Math.round(n * 100) / 100 + " m";
22
+ break;
23
+ case LENGTH_UNIT.KM:
24
+ a = Math.round(n / 1e3 * 100) / 100 + " km";
25
+ break;
26
+ case LENGTH_UNIT.NM:
27
+ a = (Math.round(n / 1e3 * 100) / 100 / 1.852).toFixed(2) + " nm";
28
+ break;
29
+ }
30
+ return a;
31
+ }, convertSixHundredThousandToLatLng = function(e, t) {
32
+ const o = Number(t) / 6e5;
33
+ return [Number(e) / 6e5, o];
34
+ }, mapInstance = ref(), shipsLayer = ref(), largeAmountShipsLayer = ref();
35
+ ref();
36
+ const trucksLayer = ref(), shipTrackLineFeatures = ref([]), trackLineVectorSource = ref(), shipTrackVectorLayer = ref();
37
+ ref();
38
+ ref();
39
+ const labels = ref([]), _hoisted_1$4 = {
40
+ key: 0,
41
+ class: "measure-panel"
42
+ }, _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 = /* @__PURE__ */ defineComponent({
43
+ __name: "measure",
44
+ props: {
45
+ visible: { type: Boolean },
46
+ visibleModifiers: {}
47
+ },
48
+ emits: /* @__PURE__ */ mergeModels(["close"], ["update:visible"]),
49
+ setup(e, { expose: t, emit: o }) {
50
+ const n = o, a = useModel(e, "visible"), r = ref(LENGTH_UNIT.NM), l = ref([]), s = ref(!1), c = new VectorSource();
51
+ let d, u, m, i, v;
52
+ const k = new VectorLayer({
53
+ source: c,
54
+ style: {
55
+ "fill-color": "rgba(255, 255, 255, 0.2)",
56
+ "stroke-color": "#ffcc33",
57
+ "stroke-width": 2,
58
+ "circle-radius": 7,
59
+ "circle-fill-color": "#ffcc33"
60
+ }
61
+ }), I = function(h) {
62
+ if (h.dragging)
63
+ return;
64
+ let y = "点击选择起点";
65
+ d && (y = "单击继续,双击结束"), u && (u.innerHTML = y, m.setPosition(h.coordinate), u.classList.remove("hidden"));
66
+ }, E = () => {
67
+ mapInstance.value && (mapInstance.value.on("pointermove", I), mapInstance.value.getViewport().addEventListener("mouseout", function() {
68
+ var h;
69
+ (h = u == null ? void 0 : u.classList) == null || h.add("hidden");
70
+ }), s.value = !0);
71
+ };
72
+ let w;
73
+ const _ = new Style({
74
+ fill: new Fill({
75
+ color: "rgba(255, 255, 255, 0.2)"
76
+ }),
77
+ stroke: new Stroke({
78
+ color: "rgba(255,204,51)",
79
+ lineDash: [10, 10],
80
+ width: 2
81
+ }),
82
+ image: new CircleStyle({
83
+ radius: 5,
84
+ stroke: new Stroke({
85
+ color: "rgba(0, 0, 0, 0.7)"
86
+ }),
87
+ fill: new Fill({
88
+ color: "rgba(255, 255, 255, 0.2)"
89
+ })
90
+ })
91
+ });
92
+ function p() {
93
+ var h, y;
94
+ l.value = [], document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach((M) => {
95
+ var T;
96
+ (T = M == null ? void 0 : M.parentNode) == null || T.removeChild(M);
97
+ }), c.clear(), (h = mapInstance.value) == null || h.removeInteraction(w), (y = mapInstance.value) == null || y.removeLayer(k), u != null && u.parentNode && u.parentNode.removeChild(u);
98
+ }
99
+ function g() {
100
+ var y, M;
101
+ p(), (y = mapInstance.value) == null || y.addLayer(k), w = new Draw({
102
+ source: c,
103
+ type: "LineString",
104
+ style: function() {
105
+ return _;
106
+ }
107
+ }), (M = mapInstance.value) == null || M.addInteraction(w), S(), f();
108
+ let h;
109
+ w.on("drawstart", function(T) {
110
+ var N;
111
+ d = T.feature;
112
+ let b;
113
+ h = (N = d.getGeometry()) == null ? void 0 : N.on("change", function(R) {
114
+ const F = R.target;
115
+ let C = formatLength(F, r.value);
116
+ b = F.getLastCoordinate(), i && C && (i.innerHTML = C), v.setPosition(b);
117
+ });
118
+ }), w.on("drawend", function() {
119
+ i && (i.className = "ol-tooltip ol-tooltip-static ol-tooltip-measure"), i != null && i.innerHTML && l.value.push(i == null ? void 0 : i.innerHTML), v.setOffset([0, -7]), d = null, i = null, S(), h && unByKey(h);
120
+ });
121
+ }
122
+ function f() {
123
+ var h;
124
+ u != null && u.parentNode && u.parentNode.removeChild(u), u = document.createElement("div"), u.className = "ol-tooltip hidden", m = new Overlay({
125
+ element: u,
126
+ offset: [15, 0],
127
+ positioning: "center-left"
128
+ }), (h = mapInstance.value) == null || h.addOverlay(m);
129
+ }
130
+ function S() {
131
+ var h;
132
+ i != null && i.parentNode && i.parentNode.removeChild(i), i = document.createElement("div"), i.className = "ol-tooltip ol-tooltip-measure", v = new Overlay({
133
+ element: i,
134
+ offset: [0, -15],
135
+ positioning: "bottom-center",
136
+ stopEvent: !1,
137
+ insertFirst: !1
138
+ }), (h = mapInstance.value) == null || h.addOverlay(v);
139
+ }
140
+ const V = (h) => {
141
+ var T, b;
142
+ l.value[h] && l.value.splice(h, 1);
143
+ const y = document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");
144
+ y[h] && ((b = (T = y[h]) == null ? void 0 : T.parentNode) == null || b.removeChild(y[h]));
145
+ const M = c.getFeatures();
146
+ M[h] && c.removeFeature(M[h]);
147
+ }, P = () => {
148
+ n("close");
149
+ };
150
+ return watch(() => a, () => {
151
+ a && !s.value && (E(), g());
152
+ }, { deep: !0, immediate: !0 }), t({
153
+ addInteraction: g,
154
+ removeInteraction: p
155
+ }), (h, y) => {
156
+ const M = resolveComponent("el-select");
157
+ return a.value ? (openBlock(), createElementBlock("div", _hoisted_1$4, [
158
+ createElementVNode("div", { class: "header" }, [
159
+ y[1] || (y[1] = createElementVNode("div", { class: "title" }, "测量", -1)),
160
+ createElementVNode("i", {
161
+ onClick: P,
162
+ class: "map-iconfont icon-close"
163
+ })
164
+ ]),
165
+ createElementVNode("div", _hoisted_2$2, [
166
+ y[2] || (y[2] = createElementVNode("div", { class: "tips" }, "在地图上点击多个点测量距离,距离单位", -1)),
167
+ createVNode(M, {
168
+ class: "select-length-unit",
169
+ modelValue: r.value,
170
+ "onUpdate:modelValue": y[0] || (y[0] = (T) => r.value = T)
171
+ }, {
172
+ default: withCtx(() => [
173
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(LENGTH_UNIT_LABEL), (T) => (openBlock(), createBlock(unref(ElOption), {
174
+ key: unref(LENGTH_UNIT)[T],
175
+ label: T,
176
+ value: unref(LENGTH_UNIT)[T]
177
+ }, null, 8, ["label", "value"]))), 128))
178
+ ]),
179
+ _: 1
180
+ }, 8, ["modelValue"])
181
+ ]),
182
+ createElementVNode("div", _hoisted_3$1, [
183
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(l.value, (T, b) => (openBlock(), createElementBlock("div", {
184
+ class: "measure-history-item",
185
+ key: b
186
+ }, [
187
+ createElementVNode("div", _hoisted_4, [
188
+ y[3] || (y[3] = createElementVNode("i", { class: "map-iconfont icon-a-Frame-11" }, null, -1)),
189
+ createElementVNode("span", _hoisted_5, "线段" + toDisplayString(b + 1), 1),
190
+ createElementVNode("span", _hoisted_6, toDisplayString(T), 1)
191
+ ]),
192
+ createElementVNode("div", {
193
+ class: "delete-button",
194
+ onClick: (N) => V(b)
195
+ }, y[4] || (y[4] = [
196
+ createElementVNode("i", { class: "map-iconfont icon-delete" }, null, -1)
197
+ ]), 8, _hoisted_7)
198
+ ]))), 128))
199
+ ])
200
+ ])) : createCommentVNode("", !0);
201
+ };
202
+ }
203
+ }), Measure = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-6318713d"]]), _hoisted_1$3 = { class: "tool-panel" }, _hoisted_2$1 = { class: "tool-components" }, _sfc_main$5 = /* @__PURE__ */ defineComponent({
204
+ __name: "toolPanel",
205
+ props: {
206
+ vehicleMode: {}
207
+ },
208
+ emits: ["switchGreenDot", "switchMapTile"],
209
+ setup(e, { emit: t }) {
210
+ const o = t, n = ref(!1), a = ref(null), r = ref(!0), l = () => {
211
+ r.value = !r.value, o("switchGreenDot", r.value);
212
+ }, s = ref(BaseMapType.vector), c = () => {
213
+ s.value = s.value === BaseMapType.vector ? BaseMapType.satellite : BaseMapType.vector, o("switchMapTile", s.value);
214
+ }, d = () => {
215
+ var m, i;
216
+ n.value ? (m = a.value) == null || m.removeInteraction() : (i = a.value) == null || i.addInteraction(), n.value = !n.value;
217
+ }, u = () => {
218
+ var m;
219
+ (m = a.value) == null || m.removeInteraction(), n.value = !1;
220
+ };
221
+ return (m, i) => (openBlock(), createElementBlock(Fragment, null, [
222
+ createElementVNode("div", _hoisted_1$3, [
223
+ m.vehicleMode === "ship" ? (openBlock(), createElementBlock("div", {
224
+ key: 0,
225
+ class: normalizeClass(["switch-btn", `${n.value && "active"}`]),
226
+ onClick: d
227
+ }, i[1] || (i[1] = [
228
+ createElementVNode("i", { class: "map-iconfont icon-a-Frame1" }, null, -1),
229
+ createElementVNode("div", { class: "button-text" }, "测距", -1)
230
+ ]), 2)) : createCommentVNode("", !0),
231
+ createElementVNode("div", {
232
+ class: normalizeClass(["switch-btn", { active: r.value }]),
233
+ onClick: l
234
+ }, i[2] || (i[2] = [
235
+ createElementVNode("i", { class: "map-iconfont icon-a-Frame19" }, null, -1),
236
+ createElementVNode("div", { class: "button-text" }, "绿点", -1)
237
+ ]), 2),
238
+ i[4] || (i[4] = createElementVNode("div", { class: "switch-btn" }, [
239
+ createElementVNode("i", { class: "map-iconfont icon-Frame-13" }),
240
+ createElementVNode("div", { class: "button-text" }, "图层")
241
+ ], -1)),
242
+ createElementVNode("div", {
243
+ class: normalizeClass(["switch-btn", { active: s.value === unref(BaseMapType).satellite }]),
244
+ onClick: c
245
+ }, i[3] || (i[3] = [
246
+ createElementVNode("i", { class: "map-iconfont icon-space" }, null, -1),
247
+ createElementVNode("div", { class: "button-text" }, "卫星", -1)
248
+ ]), 2)
249
+ ]),
250
+ createElementVNode("div", _hoisted_2$1, [
251
+ n.value ? (openBlock(), createBlock(Measure, {
252
+ key: 0,
253
+ ref_key: "measureRef",
254
+ ref: a,
255
+ visible: n.value,
256
+ "onUpdate:visible": i[0] || (i[0] = (v) => n.value = v),
257
+ onClose: u
258
+ }, null, 8, ["visible"])) : createCommentVNode("", !0)
259
+ ])
260
+ ], 64));
261
+ }
262
+ }), ToolPanel = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-d5e1b71d"]]), _hoisted_1$2 = { id: "scale-line-container" }, _sfc_main$4 = /* @__PURE__ */ defineComponent({
263
+ __name: "scaleLine",
264
+ setup(e, { expose: t }) {
265
+ const o = new ScaleLine$1({
266
+ units: "nautical"
267
+ });
268
+ return t({
269
+ setScaleLine: () => {
270
+ o.setTarget(document.getElementById("scale-line-container")), mapInstance.value.addControl(o);
271
+ }
272
+ }), (a, r) => (openBlock(), createElementBlock("div", _hoisted_1$2));
273
+ }
274
+ }), ScaleLine = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-e51b19b1"]]), _hoisted_1$1 = { class: "zoom" }, _sfc_main$3 = /* @__PURE__ */ defineComponent({
275
+ __name: "zoomControl",
276
+ props: {
277
+ map: {
278
+ type: Object
279
+ }
280
+ },
281
+ setup(e) {
282
+ const t = e, o = () => {
283
+ const a = t.map.getView(), r = a.getZoom();
284
+ a.setZoom(r + 1);
285
+ }, n = () => {
286
+ const a = t.map.getView(), r = a.getZoom();
287
+ a.setZoom(r - 1);
288
+ };
289
+ return (a, r) => (openBlock(), createElementBlock("div", _hoisted_1$1, [
290
+ createElementVNode("div", {
291
+ onClick: o,
292
+ class: "button big-button"
293
+ }, "+"),
294
+ createElementVNode("div", {
295
+ onClick: n,
296
+ class: "button small-button"
297
+ }, "-")
298
+ ]));
299
+ }
300
+ }), ZoomControl = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-fc659cee"]]), CDN_URL = "https://static.zhihaoscm.cn/", tiandituKey = "a6e8f78974f2581f2ca00485b40c948f", baseMap = {
301
+ // 矢量底图
302
+ 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}`,
303
+ // 矢量注记
304
+ 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}`,
305
+ // 影像底图
306
+ 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}`,
307
+ // 影像注记
308
+ 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}`,
309
+ // 绿点图
310
+ greenTile: `${CDN_URL}/map/tile/{z}/{x}/{y}.png`
311
+ }, mapZoom = {
312
+ // 地图默认层级
313
+ default: 6,
314
+ // 地图缩放最小层级
315
+ min: 3,
316
+ // 地图缩放最大层级
317
+ max: 18,
318
+ // 船舶绿点图最大显示层级
319
+ shipGreenDotMax: 11,
320
+ // 船形图标最小渲染层级
321
+ shipModelMin: 16,
322
+ // 船形图标最大渲染层级
323
+ shipModelMax: 18
324
+ }, mapDefaultCenter = [114.84, 30.52], projection = {
325
+ // 经纬度 源数据 地理坐标 WGS84
326
+ data: "EPSG:4326",
327
+ // 墨卡托投影坐标 渲染坐标
328
+ mercator: "EPSG:3857"
329
+ }, _hoisted_1 = { class: "copyright" }, _hoisted_2 = { class: "tdt-control-copyright tdt-control" }, _hoisted_3 = ["src"], _sfc_main$2 = /* @__PURE__ */ defineComponent({
330
+ __name: "copyright",
331
+ setup(e) {
332
+ return (t, o) => (openBlock(), createElementBlock("div", _hoisted_1, [
333
+ createElementVNode("div", _hoisted_2, [
334
+ createElementVNode("img", {
335
+ src: unref(CDN_URL) + "map/tdt-logo.png",
336
+ width: "53px",
337
+ height: "22px",
338
+ class: "logo",
339
+ alt: ""
340
+ }, null, 8, _hoisted_3),
341
+ o[0] || (o[0] = createElementVNode("div", { class: "copyright-text" }, "GS(2024)0568号 - 甲测资字1100471", -1))
342
+ ]),
343
+ o[1] || (o[1] = createElementVNode("div", {
344
+ id: "dataSource",
345
+ class: "tdt-control data-source"
346
+ }, "数据来源:自然资源部 & NavInfo", -1))
347
+ ]));
348
+ }
349
+ }), Copyright = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-0b80cd67"]]), _sfc_main$1 = /* @__PURE__ */ defineComponent({
350
+ __name: "fullscreen",
351
+ props: {
352
+ pageRef: {
353
+ type: Object,
354
+ default: () => ({})
355
+ }
356
+ },
357
+ setup(e) {
358
+ const t = e, o = ref(!1), n = () => {
359
+ var a;
360
+ o.value ? document.exitFullscreen() : (console.log(t.pageRef), (a = t.pageRef) == null || a.requestFullscreen()), o.value = !o.value;
361
+ };
362
+ return (a, r) => (openBlock(), createElementBlock("div", {
363
+ class: "fullscreen-btn",
364
+ onClick: n
365
+ }, [
366
+ createElementVNode("i", {
367
+ class: normalizeClass(`map-iconfont ${o.value ? "icon-quxiaoquanping" : "icon-quanping1"} `)
368
+ }, null, 2)
369
+ ]));
370
+ }
371
+ }), Fullscreen = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-adf8fd0c"]]), equatorialCircumference = 2003750834e-2;
372
+ function lonLatToMercator(e) {
373
+ const t = e[0] * equatorialCircumference / 180;
374
+ let o = Math.log(Math.tan((90 + e[1]) * Math.PI / 360)) / (Math.PI / 180);
375
+ return o = o * equatorialCircumference / 180, [t, o];
376
+ }
377
+ function getIconFont(unicode = "") {
378
+ return unicode.indexOf("&") !== -1 && (unicode = unicode.replace("&", "&")), unicode.indexOf("&amp") !== -1 && (unicode = unicode.replace("&amp", "&")), eval('("' + unicode.replace("&#x", "\\u").replace(";", "") + '")');
379
+ }
380
+ const multiplyPixelRatio = (e) => {
381
+ const t = window.devicePixelRatio || 1;
382
+ return e.map((o) => o.map((n) => n * t));
383
+ }, adjustBounds = (e, t) => t.length === 2 ? [e[0] - t[0], e[1] - t[1], e[2] + t[0], e[3] + t[1]] : [e[0] + t[0], e[1] + t[1], e[2] + t[2], e[3] + t[3]], isOverlapping = (e, t) => e[0] <= t[2] && e[2] >= t[0] && e[1] <= t[3] && e[3] >= t[1], getIconStyle = (e) => new Style({
384
+ text: new Text({
385
+ font: "Normal 14px map-iconfont",
386
+ text: getIconFont(e),
387
+ fill: new Fill({ color: "#fff" }),
388
+ offsetY: -14
389
+ }),
390
+ zIndex: 100
391
+ });
392
+ function convertToRadians(e) {
393
+ if (!e)
394
+ throw new Error("coord is required");
395
+ if (!Array.isArray(e)) {
396
+ if (e.type === "Feature" && e.geometry !== null && e.geometry.type === "Point")
397
+ return e.geometry.coordinates;
398
+ if (e.type === "Point")
399
+ return e.coordinates;
400
+ }
401
+ if (Array.isArray(e) && e.length >= 2 && !Array.isArray(e[0]) && !Array.isArray(e[1]))
402
+ return e;
403
+ throw new Error("coord must be GeoJSON Point or an Array of numbers");
404
+ }
405
+ function createFeature(e, t, o = {}) {
406
+ const n = {
407
+ type: "Feature"
408
+ };
409
+ return o.id !== void 0 && (n.id = o.id), o.bbox && (n.bbox = o.bbox), n.properties = {}, n.geometry = e, n;
410
+ }
411
+ function createPoint(e, t, o) {
412
+ return createFeature({
413
+ type: "Point",
414
+ coordinates: e
415
+ }, t, o);
416
+ }
417
+ function calculateAngle(e, t, o) {
418
+ const n = convertToRadians(e), a = convertToRadians(t), r = n[0] % 360 * (Math.PI / 180), l = a[0] % 360 * (Math.PI / 180), s = n[1] % 360 * (Math.PI / 180), c = a[1] % 360 * (Math.PI / 180), d = Math.sin(l - r) * Math.cos(c), u = Math.cos(s) * Math.sin(c) - Math.sin(s) * Math.cos(c) * Math.cos(l - r);
419
+ return 180 * Math.atan2(d, u) % (2 * Math.PI) / Math.PI;
420
+ }
421
+ const getAngle = (e, t) => {
422
+ let o = calculateAngle(createPoint(e), createPoint(t));
423
+ return o = o < 0 ? 360 + o : o, o % 360 * Math.PI / 180;
424
+ }, labelAlpha = 0.8, labelFont = "500 12px Arial", labelOutSize = 2, labelHeight = 10, fillRectRadius = (e, t, o, n, a, r, l = 4) => {
425
+ e.beginPath(), e.moveTo(t + l, o), e.arcTo(t + n, o, t + n, o + l, l), e.arcTo(t + n, o + a, t + n - l, o + a, l), e.arcTo(t, o + a, t, o + a - l, l), e.arcTo(t, o, t + l, o, l), e.closePath(), e.fillStyle = r, e.fill();
426
+ }, getPixelFromCoordinate = (e) => {
427
+ if (!e || e.length === 0)
428
+ throw new Error("Points array is empty or invalid.");
429
+ let t = 1 / 0, o = 1 / 0, n = -1 / 0, a = -1 / 0;
430
+ for (const [r, l] of e)
431
+ r < t && (t = r), l < o && (o = l), r > n && (n = r), l > a && (a = l);
432
+ return [t, o, n, a];
433
+ }, rotateShapeModel = (e, t) => {
434
+ const [o, n] = e[0], a = t * Math.PI / 180, r = Math.cos(a), l = Math.sin(a);
435
+ return e.map(([s, c]) => {
436
+ const d = s - o, u = c - n, m = d * r - u * l + o, i = d * l + u * r + n;
437
+ return [m, i];
438
+ });
439
+ }, getTopLeftPoint = (e) => [e[0], e[3]], getBottomLeftPoint = (e) => [e[2], e[3]], getBottomRightPoint = (e) => [e[2], e[1]], getTopRighttPoint = (e) => [e[0], e[1]];
440
+ function calculateBounds(e, t, o, n, a) {
441
+ let r, l, s, c, d = e[0], u = e[1];
442
+ switch (t) {
443
+ case 0:
444
+ r = d + a, l = r + o, c = u - a, s = c - n;
445
+ break;
446
+ case 1:
447
+ r = d + a, l = r + o, c = u + n / 2, s = c - n;
448
+ break;
449
+ case 2:
450
+ r = d + a, l = r + o, c = u + a + n, s = c - n;
451
+ break;
452
+ case 3:
453
+ r = d - o / 2, l = r + o, c = u + a + n, s = c - n;
454
+ break;
455
+ case 4:
456
+ l = d, r = l - o, c = u + a + n, s = c - n;
457
+ break;
458
+ case 5:
459
+ l = d - a, r = l - o, c = u + n / 2, s = c - n;
460
+ break;
461
+ case 6:
462
+ l = d, r = l - o, c = u - a, s = c - n;
463
+ break;
464
+ case 7:
465
+ r = d - o / 2, l = r + o, c = u - a, s = c - n;
466
+ }
467
+ if (!(!r || !s || !l || !c))
468
+ return [Math.min(r, l), Math.min(s, c), Math.max(r, l), Math.max(s, c) + 1];
469
+ }
470
+ function calculateAnchorPoint(e, t, o = 70, n = 20, a = 20) {
471
+ let r = [0, 0];
472
+ switch (t) {
473
+ case 0:
474
+ r[0] = e[0] + a, r[1] = e[1] - a - n / 2;
475
+ break;
476
+ case 1:
477
+ r[0] = e[0] + a, r[1] = e[1];
478
+ break;
479
+ case 2:
480
+ r[0] = e[0] + a, r[1] = e[1] + a + n / 2;
481
+ break;
482
+ case 3:
483
+ r[0] = e[0], r[1] = e[1] + a + n / 4;
484
+ break;
485
+ case 4:
486
+ r[0] = Math.max(e[0] - a, e[0] - o / 2), r[1] = e[1] + a + n / 4;
487
+ break;
488
+ case 5:
489
+ r[0] = e[0] - a, r[1] = e[1];
490
+ break;
491
+ case 6:
492
+ r[0] = Math.max(e[0] - a, e[0] - o / 2), r[1] = e[1] - a - n / 4;
493
+ break;
494
+ case 7:
495
+ r[0] = e[0], r[1] = e[1] - a - n / 4;
496
+ }
497
+ return r;
498
+ }
499
+ function drawLabelBody(e, t, o) {
500
+ if (!e) return;
501
+ const {
502
+ font: n,
503
+ labelOutSize: a = 2,
504
+ labelHeight: r,
505
+ center: l,
506
+ text: s,
507
+ lineLength: c = 20
508
+ } = o;
509
+ e.save(), n && (e.font = n);
510
+ let d = e.measureText(s).width + 2 * a;
511
+ e.restore();
512
+ let u, m = -1, i = r + 3 * a;
513
+ if (m = 0, u = calculateBounds(l, m, d, i, c), u && m > -1) {
514
+ let v = getBottomLeftPoint(u), k = getTopRighttPoint(u);
515
+ return {
516
+ center: l,
517
+ x: calculateAnchorPoint(l, m, d, i, c),
518
+ l: k,
519
+ r: v,
520
+ bounds: u,
521
+ position: m
522
+ };
523
+ }
524
+ return null;
525
+ }
526
+ const drawText = (e, t, o, n, a, r, l) => {
527
+ if (!e) return;
528
+ e.save();
529
+ let [s, c] = t;
530
+ s += labelOutSize, e.font = labelFont, e.fillStyle = n, e.fillText(o, s, c), e.restore();
531
+ }, drawPolygon = (e, t, o, n, a, r = null, l, s, c, d) => {
532
+ if (t && e) {
533
+ e.save(), e.beginPath(), l && l !== 0 && s == null && e.rotate(l), r && e.translate(r[0], r[1]), l && (s != null && s.length) && e.rotate(l), c && e.scale(c, c), e.moveTo(t[0][0], t[0][1]);
534
+ for (let u = 1; u < t.length; u++)
535
+ e.lineTo(t[u][0], t[u][1]);
536
+ a && e.closePath(), o && (e.strokeStyle = o, e.stroke()), n && a && (d && (e.globalAlpha = d), e.fillStyle = n, e.fill()), e.restore();
537
+ }
538
+ }, drawLabel = (e, t, o, n, a, r, l, s) => {
539
+ if (t && o) {
540
+ let c = { font: labelFont, labelOutSize, labelHeight, center: t, text: o }, d = drawLabelBody(e, labels.value, c);
541
+ if (d) {
542
+ const { x: u, bounds: m, l: i } = d, v = [getTopLeftPoint(m), getBottomLeftPoint(m), getBottomRightPoint(m), getTopRighttPoint(m)];
543
+ labels.value.push(d), drawPolygon(e, [t, u], n, "#000", !1, null, null, null, null, labelAlpha), drawPolygon(e, v, n, r, !0);
544
+ const [k, I] = i;
545
+ drawText(e, [k, I + labelOutSize + labelHeight + 1], o, a);
546
+ }
547
+ }
548
+ return null;
549
+ }, dotImage = new Image();
550
+ dotImage.src = `${CDN_URL}/map/truck-dot.svg`;
551
+ dotImage.crossOrigin = "anonymous";
552
+ const dotActiveImage = new Image();
553
+ dotActiveImage.src = `${CDN_URL}/map/truck-dot-active.svg`;
554
+ dotActiveImage.crossOrigin = "anonymous";
555
+ const cameraImage = new Image();
556
+ cameraImage.src = `${CDN_URL}/map/map-camera.svg`;
557
+ cameraImage.crossOrigin = "anonymous";
558
+ const loadImage = new Image();
559
+ loadImage.src = `${CDN_URL}/map/map-load.svg`;
560
+ loadImage.crossOrigin = "anonymous";
561
+ const setTruckStyle = (e, t, o, n) => new Style({
562
+ renderer: (a, r) => {
563
+ const l = r.context;
564
+ l.save();
565
+ let s = 1;
566
+ l.scale(s, s);
567
+ let [c, d] = a;
568
+ c = c / s - 20, d = d / s;
569
+ const u = c - 70, m = d - 68;
570
+ let i = 180;
571
+ const v = 56, k = "#FFFFFF";
572
+ let I = 176;
573
+ const E = 52;
574
+ let w = "#164AFF", _ = "#FFFFFF";
575
+ o === CAR_COLOR.YELLOW ? (I = 176, w = "#FFC81E", _ = "rgba(0,0,0,0.88)") : o === CAR_COLOR.Y_GREEN && (i = 200, I = 196, w = "#8FED7C", _ = "rgba(0,0,0,0.88)"), n != null && n.length && (i += n.length * 56), fillRectRadius(l, u, m, i, v, k), fillRectRadius(l, u + 2, m + 2, I, E, w), o === CAR_COLOR.Y_GREEN && fillRectRadius(l, u + 2, m + 2, 68, E, "#FFC81E"), l.save(), l.restore(), l.fillStyle = _, l.font = "bold 28px Arial", l.textAlign = "left", l.textBaseline = "middle";
576
+ const p = `${t.slice(0, 2) + " · " + t.slice(2)}`;
577
+ if (l.fillText(p, u + 12, m + 32), l.save(), l.restore(), n != null && n.length) {
578
+ const f = l.measureText(p).width + 12;
579
+ let S = 0;
580
+ n.forEach((V) => {
581
+ V === DEVICE_TYPE.CAMERA && (l.drawImage(cameraImage, c - 54 + f + S * 56, d - 64, 50, 50), ++S), V === DEVICE_TYPE.LOAD && (l.drawImage(loadImage, c - 54 + f + S * 56, d - 64, 50, 50), ++S);
582
+ });
583
+ }
584
+ const g = dotImage;
585
+ l.drawImage(g, c + i / 2 - 90, d, 50 / s, 50 / s), l.restore();
586
+ }
587
+ });
588
+ ref([]);
589
+ let truckMarkerList = [], trucksVectorSource;
590
+ const renderTrucksMarker = (e) => {
591
+ if (deleteAllTruckMarkers(), !!mapInstance.value)
592
+ return e.forEach((t) => {
593
+ const o = convertSixHundredThousandToLatLng(t.lon, t.lat), n = new Feature({
594
+ geometry: new Point(fromLonLat(o))
595
+ });
596
+ n.set("data", t), n.setStyle(
597
+ setTruckStyle(!1, t.vno, t == null ? void 0 : t.vclColor, t == null ? void 0 : t.icons)
598
+ ), truckMarkerList.push({
599
+ name: t.vno,
600
+ lonlat: o,
601
+ feature: n
602
+ });
603
+ }), trucksVectorSource = new VectorSource({
604
+ features: truckMarkerList.map((t) => t.feature)
605
+ }), trucksLayer.value = new VectorLayer({
606
+ source: trucksVectorSource
607
+ }), mapInstance.value.addLayer(trucksLayer.value), trucksLayer.value;
608
+ }, deleteAllTruckMarkers = () => {
609
+ truckMarkerList.forEach((e) => {
610
+ e.feature && (trucksVectorSource == null || trucksVectorSource.removeFeature(e.feature));
611
+ }), truckMarkerList = [];
612
+ };
613
+ class ShipMapData {
614
+ constructor(t, o, n, a, r, l, s, c, d, u, m, i, v, k, I, E, w, _, p = 1) {
615
+ L(this, "id");
616
+ // mmsi
617
+ L(this, "mmsi");
618
+ // 船舶三角形填充色
619
+ L(this, "fill");
620
+ // 船类型 "7": "货船",
621
+ L(this, "shipType");
622
+ // 船名
623
+ L(this, "name");
624
+ // 长度
625
+ L(this, "length");
626
+ // 宽度
627
+ L(this, "breadth");
628
+ // 经度
629
+ L(this, "lon");
630
+ // 纬度
631
+ L(this, "lat");
632
+ // 时间
633
+ L(this, "createdAt");
634
+ // 速度
635
+ L(this, "speed");
636
+ // 来源
637
+ L(this, "from");
638
+ // 船状态 "stop":"静止","sail":"航行","work":"作业","danger":"危险","other":"其他"
639
+ L(this, "sailStatus");
640
+ // 船艏向
641
+ L(this, "hdg");
642
+ // 航迹向
643
+ L(this, "cog");
644
+ // 设备定位类型
645
+ L(this, "posType");
646
+ L(this, "type");
647
+ // 航向角度
648
+ L(this, "angle");
649
+ L(this, "isShow");
650
+ this.id = t, this.mmsi = o, this.fill = n, this.shipType = a, this.name = r, this.length = l, this.breadth = s, this.lon = c, this.lat = d, this.createdAt = u, this.speed = m, this.from = i, this.sailStatus = v, this.hdg = k, this.cog = I, this.posType = E, this.type = w, this.angle = _, this.isShow = p;
651
+ }
652
+ }
653
+ const triangleModel = multiplyPixelRatio([
654
+ [0, -8],
655
+ [5, 8],
656
+ [-5, 8]
657
+ ]), shipShapeModel = multiplyPixelRatio([
658
+ [0, -4.545],
659
+ [-0.56, -3.909],
660
+ [-1, -2.727],
661
+ [-1, 3.636],
662
+ [-0.8, 4.545],
663
+ [0.8, 4.545],
664
+ [1, 3.636],
665
+ [1, -2.727],
666
+ [0.56, -3.909],
667
+ [0, -4.545]
668
+ ]), shipDirectPath = {
669
+ left: {
670
+ 0: [
671
+ [0, 0],
672
+ [0, -8],
673
+ [-4, -8]
674
+ ],
675
+ 1: [
676
+ [0, 0],
677
+ [0, -16],
678
+ [-6, -16]
679
+ ],
680
+ 2: [
681
+ [0, 0],
682
+ [0, -24],
683
+ [-8, -24]
684
+ ]
685
+ },
686
+ right: {
687
+ 0: [
688
+ [0, 0],
689
+ [0, -8],
690
+ [-4, -8]
691
+ ],
692
+ 1: [
693
+ [0, 0],
694
+ [0, -16],
695
+ [-6, -16]
696
+ ],
697
+ 2: [
698
+ [0, 0],
699
+ [0, -24],
700
+ [-8, -24]
701
+ ]
702
+ },
703
+ front: {
704
+ 0: [
705
+ [0, 0],
706
+ [0, -8]
707
+ ],
708
+ 1: [
709
+ [0, 0],
710
+ [0, -16]
711
+ ],
712
+ 2: [
713
+ [0, 0],
714
+ [0, -24]
715
+ ]
716
+ }
717
+ }, speedCondition = [[1, 10], [10, 20], [20, 1 / 0]], drawShipModelByZoom = { 16: [200, 30], 17: [50, 5], 18: [1, 1] }, setShipStyle = (e, t) => new Style({
718
+ renderer: (o, n) => {
719
+ const a = n.context, r = n.feature.get("data");
720
+ try {
721
+ const l = drawShipBody(a, r, o);
722
+ l && drawHeading(a, r, l), drawShipLabel(a, r, o);
723
+ } catch {
724
+ return !1;
725
+ }
726
+ }
727
+ }), drawShipBody = (e, t, o) => {
728
+ if (!mapInstance.value) return;
729
+ const n = mapInstance.value.getView().getZoom();
730
+ if (!n) return;
731
+ let a = [];
732
+ const [r, l] = drawShipModelByZoom[n] || [0, 0], [s, c] = o;
733
+ if (n <= mapZoom.shipModelMax && n > mapZoom.shipModelMin && t.length >= r && t.breadth >= l) {
734
+ const d = drawCurrentShipShapeModel(t, n);
735
+ a = rotateShapeModel(d.map((u) => {
736
+ const [m, i] = u;
737
+ return [s + m, c + i];
738
+ }), t.angle);
739
+ } else
740
+ o.length === 2 && (a = rotateShapeModel(triangleModel.map((d) => {
741
+ const [u, m] = d;
742
+ return [s + u, c + m];
743
+ }), t.angle));
744
+ if (!(a.length > 2)) return !1;
745
+ e.save(), e.beginPath(), e.moveTo(a[0][0], a[0][1]);
746
+ for (let d = 1; d < a.length; d++)
747
+ e.lineTo(a[d][0], a[d][1]);
748
+ return e.closePath(), e.strokeStyle = "#000", e.lineWidth = 1, e.stroke(), e.fillStyle = t.fill, e.fill(), e.restore(), a;
749
+ }, drawHeading = (e, t, o) => {
750
+ const [n, a] = o[0], r = getShipDirectPath(t);
751
+ if (r) {
752
+ let l = r.map(function(s) {
753
+ let [c, d] = s;
754
+ return [c + n, d + a];
755
+ });
756
+ if (e.save(), e.beginPath(), t.angle > 0) {
757
+ e.translate(n, a);
758
+ const s = t.angle * Math.PI / 180;
759
+ e.rotate(s), e.translate(-n, -a);
760
+ }
761
+ e.moveTo(n, a);
762
+ for (let s = 1; s < l.length; s++) {
763
+ let [c, d] = l[s];
764
+ e.lineTo(c, d);
765
+ }
766
+ e.strokeStyle = "#000", e.lineWidth = 1, e.stroke(), e.restore();
767
+ }
768
+ }, drawSelectBounds = (e, t) => {
769
+ let [o, n, a, r] = getPixelFromCoordinate(t);
770
+ const l = 4;
771
+ o -= l, n -= l, a += l, r += l, e.save(), e.strokeStyle = "#ff0000", e.lineWidth = 4;
772
+ const s = 8;
773
+ e.beginPath(), e.moveTo(o + s, r), e.lineTo(o, r), e.lineTo(o, r - s), e.moveTo(o, n + s), e.lineTo(o, n), e.lineTo(o + s, n), e.moveTo(a - s, n), e.lineTo(a, n), e.lineTo(a, n + s), e.moveTo(a, r - s), e.lineTo(a, r), e.lineTo(a - s, r), e.stroke(), e.restore();
774
+ }, drawShipLabel = (e, t, o) => {
775
+ const [n, a] = o, r = n - 0, l = a - 0, s = t.name;
776
+ drawLabel(e, [r, l], s, "#fff", "#000", "#fff");
777
+ }, drawCurrentShipShapeModel = (e, t) => {
778
+ let o = 0;
779
+ t === 17 ? o = 0.425 : t === 18 && (o = 0.857);
780
+ const n = e.length / 4 * o, a = e.breadth * o;
781
+ let r = cloneDeep(shipShapeModel);
782
+ return r = r.map(([l, s]) => [l * a, s * n]), r;
783
+ }, getShipDirectPath = (e) => {
784
+ let { speed: t, hdg: o, cog: n } = e, a = "", r = null;
785
+ if (t && t > 1 && (o !== null && o != 511 && n !== null ? n - o >= 3 ? a = "left" : n - o <= -3 ? a = "right" : a = "front" : a = "front", a && t))
786
+ for (let l in speedCondition) {
787
+ let s = speedCondition[l];
788
+ if (t >= s[0] && t < s[1]) {
789
+ r = shipDirectPath[a][l];
790
+ break;
791
+ }
792
+ }
793
+ return r;
794
+ };
795
+ let shipsMarkerList = [], shipsVectorSource, largeAmountShipsSource;
796
+ const renderShips = (e) => {
797
+ if (!mapInstance.value) return;
798
+ const t = mapInstance.value.getView().getZoom();
799
+ if (!(!t || t <= mapZoom.shipGreenDotMax))
800
+ return t > mapZoom.shipGreenDotMax && t < mapZoom.shipModelMin || e.length > 500 ? (deleteAllShipMarkers(), renderLargeAmountShips(e)) : (largeAmountShipsSource == null || largeAmountShipsSource.clear(), renderShipsMarker(e));
801
+ }, renderLargeAmountShips = (e) => {
802
+ if (!mapInstance.value) return;
803
+ const t = e.map((o) => ({
804
+ type: "Feature",
805
+ geometry: {
806
+ type: "Point",
807
+ coordinates: [o.lon, o.lat]
808
+ },
809
+ properties: o
810
+ }));
811
+ return largeAmountShipsSource == null || largeAmountShipsSource.clear(), largeAmountShipsSource = new VectorSource({
812
+ features: new GeoJSON().readFeatures({
813
+ type: "FeatureCollection",
814
+ features: t
815
+ }, {
816
+ featureProjection: projection.mercator
817
+ })
818
+ }), largeAmountShipsLayer.value = new WebGLPointsLayer({
819
+ source: largeAmountShipsSource,
820
+ style: {
821
+ "shape-points": 3,
822
+ "shape-radius": 9,
823
+ "shape-fill-color": "#04C900",
824
+ "shape-rotate-with-view": !1,
825
+ "shape-rotation": [
826
+ "get",
827
+ "cog",
828
+ // 获取 'cog' 属性值
829
+ 0
830
+ // 如果 'cog' 属性不存在,使用默认值 0
831
+ ]
832
+ }
833
+ }), mapInstance.value.addLayer(largeAmountShipsLayer.value), largeAmountShipsLayer.value;
834
+ }, renderShipsMarker = (e) => {
835
+ if (mapInstance.value)
836
+ return deleteAllShipMarkers(), e.forEach((t) => {
837
+ const o = [t.lon, t.lat], n = new Feature({
838
+ geometry: new Point(fromLonLat(o))
839
+ }), a = new ShipMapData(
840
+ t.id,
841
+ t.id,
842
+ // 船舶三角形填充色
843
+ t.fill || "#04C900",
844
+ "70",
845
+ t.cnname || t.name,
846
+ t.len,
847
+ t.wid,
848
+ t.lon,
849
+ t.lat,
850
+ (/* @__PURE__ */ new Date()).getTime(),
851
+ t.spd,
852
+ t.from,
853
+ t.status,
854
+ Number(t.hdg),
855
+ t.cog,
856
+ Number(t.postype),
857
+ "other",
858
+ t.cog,
859
+ 1
860
+ );
861
+ n.set("data", a), n.setStyle(
862
+ setShipStyle(!1, t.id)
863
+ ), shipsMarkerList.push({
864
+ ship: t,
865
+ lonlat: o,
866
+ feature: n
867
+ });
868
+ }), shipsVectorSource = new VectorSource({
869
+ features: shipsMarkerList.map((t) => t.feature)
870
+ }), shipsLayer.value = new VectorLayer({
871
+ source: shipsVectorSource
872
+ }), mapInstance.value.addLayer(shipsLayer.value), shipsLayer.value;
873
+ }, deleteAllShipMarkers = () => {
874
+ shipsMarkerList.forEach((e) => {
875
+ e.feature && (shipsVectorSource == null || shipsVectorSource.removeFeature(e.feature));
876
+ }), shipsMarkerList = [];
877
+ }, findShip = (e) => {
878
+ var t, o, n;
879
+ return (n = (o = (t = shipsLayer.value) == null ? void 0 : t.getSource()) == null ? void 0 : o.getFeatures()) == null ? void 0 : n.find((a) => {
880
+ var r;
881
+ return ((r = a.get("data")) == null ? void 0 : r.id) === e;
882
+ });
883
+ }, stopIcon = "&#xe6e2;", stopColor = "#E31818", slowIcon = "&#xe703;", slowColor = "#1890FF", dropletsIcon = "&#xe6d2", trackList$1 = ref([]), renderTrackLine = (e, t, o) => {
884
+ var r;
885
+ const n = e[t];
886
+ if (!n) return;
887
+ trackList$1.value = n.reverse().map((l, s) => (l.center = [l.lon, l.lat], l.centerPoint = lonLatToMercator(l.center), l.id = t, l.index = s, l.time = hooks(l.createdAt).format("YYYY-MM-DD HH:mm:ss"), l));
888
+ let a = trackList$1.value.map((l) => l.centerPoint);
889
+ if (a.length >= 2) {
890
+ let l = new LineString(a);
891
+ const s = new Feature({ geometry: l });
892
+ s.setStyle(
893
+ new Style({
894
+ stroke: new Stroke({
895
+ color: o,
896
+ width: 2
897
+ })
898
+ })
899
+ ), s.setId(t), s.set("type", "line");
900
+ const c = shipTrackLineFeatures.value.findIndex((d) => d.getId() === t);
901
+ c >= 0 ? shipTrackLineFeatures.value[c] = s : shipTrackLineFeatures.value.push(s), trackLineVectorSource.value = new VectorSource({
902
+ features: shipTrackLineFeatures.value
903
+ }), shipTrackVectorLayer.value = new VectorLayer({
904
+ source: trackLineVectorSource.value,
905
+ style: {
906
+ "fill-color": "rgba(255, 255, 255, 0.2)",
907
+ "stroke-color": "#ffcc33",
908
+ "stroke-width": 2,
909
+ "circle-radius": 7,
910
+ "circle-fill-color": "#ffcc33"
911
+ }
912
+ }), renderPoint(o), (r = mapInstance.value) == null || r.addLayer(shipTrackVectorLayer.value);
913
+ }
914
+ }, renderPoint = (e) => {
915
+ if (!mapInstance.value) return;
916
+ let t = trackList$1.value || [];
917
+ if (!(t && t.length > 2)) return [];
918
+ let o = { 16: 24, 17: 15, default: 4 }, n = [], a = t.length;
919
+ for (let s = 0; s < a; s++) {
920
+ t[s].index = s;
921
+ let c = mapInstance.value.getPixelFromCoordinate(t[s].centerPoint);
922
+ if (c) {
923
+ let d = c.concat(c);
924
+ d = adjustBounds(d, [20, 20]);
925
+ let u = mapInstance.value.getView().getZoom();
926
+ if (!u) return;
927
+ if (u > 15) {
928
+ let i = o[u] || o.default;
929
+ d = adjustBounds(d, [i, i]);
930
+ }
931
+ let m = !0;
932
+ if (t[s].state !== "0") {
933
+ for (let i = 0; i < n.length; i++)
934
+ if (isOverlapping(d, n[i].bounds)) {
935
+ m = !1;
936
+ break;
937
+ }
938
+ }
939
+ m && (t[s].bounds = d, n.push(t[s]));
940
+ }
941
+ }
942
+ const r = getIconStyle(stopIcon), l = getIconStyle(slowIcon);
943
+ n.forEach((s) => {
944
+ var u, m;
945
+ let c = new Feature({
946
+ geometry: new Point(s.centerPoint)
947
+ });
948
+ c.set("type", "track_point"), c.set("data", s), c.setStyle(
949
+ new Style({
950
+ image: new CircleStyle({
951
+ fill: new Fill({ color: e }),
952
+ stroke: new Stroke({ color: "#fff", width: 2 }),
953
+ radius: 3
954
+ })
955
+ })
956
+ ), trackLineVectorSource.value.addFeature(c);
957
+ const d = new Feature({
958
+ geometry: new Point(fromLonLat(s.center))
959
+ });
960
+ if (d.set("type", "track_label"), d.setStyle(
961
+ setTrackLabelStyle(s, e)
962
+ ), console.log("trackLabelFeature"), trackLineVectorSource.value.addFeature(d), typeof s == "object" && s.hasOwnProperty("state")) {
963
+ let i = new Feature({
964
+ geometry: new Point(s.centerPoint)
965
+ });
966
+ i.set("type", "track_icon");
967
+ let v = new Style({
968
+ text: new Text({
969
+ font: "Normal 22px iconfont",
970
+ text: getIconFont(dropletsIcon),
971
+ offsetY: -10
972
+ }),
973
+ zIndex: 99
974
+ }), k = [];
975
+ s.state === "0" ? ((u = v.getText()) == null || u.setFill(new Fill({ color: stopColor })), k.push(r)) : ((m = v.getText()) == null || m.setFill(new Fill({ color: slowColor })), k.push(l)), k.push(v), i.setStyle(k), trackLineVectorSource.value.addFeature(i);
976
+ }
977
+ }), renderArrow(n, e), renderIconPoint();
978
+ }, renderArrow = (e, t) => {
979
+ const o = e.length;
980
+ o || (e.push(trackList$1.value[0]), e.push(trackList$1.value[trackList$1.value.length - 1]));
981
+ for (let n = 0; n < o - 1; n++) {
982
+ let a, r = e[n], l = (e[n + 1].index + r.index) / 2;
983
+ if (l % 2 === 0)
984
+ a = trackList$1.value[l].centerPoint;
985
+ else {
986
+ let s = trackList$1.value[Math.floor(l)], c = trackList$1.value[Math.ceil(l)];
987
+ if (s && c) {
988
+ let [d, u] = s.centerPoint, [m, i] = c.centerPoint;
989
+ a = [(d + m) / 2, (u + i) / 2];
990
+ }
991
+ }
992
+ if (a) {
993
+ let s = new Feature({
994
+ geometry: new Point(a)
995
+ });
996
+ s.set("type", "track_arrow"), s.setStyle(
997
+ new Style({
998
+ text: new Text({
999
+ font: "700 14px iconfont",
1000
+ text: getIconFont("&#xe6bc;"),
1001
+ fill: new Fill({ color: t }),
1002
+ rotation: getAngle(
1003
+ e[n].center,
1004
+ e[n + 1].center
1005
+ )
1006
+ })
1007
+ })
1008
+ ), trackLineVectorSource.value.addFeature(s);
1009
+ }
1010
+ }
1011
+ }, renderIconPoint = () => {
1012
+ const e = "&#xe69b;", t = "#fcdc3f", o = "#ff0000";
1013
+ (trackList$1.value.length < 2 ? [trackList$1.value[0]] : [trackList$1.value[0], trackList$1.value[trackList$1.value.length - 1]]).forEach((a) => {
1014
+ let r = new Feature({
1015
+ geometry: new Point(a.centerPoint)
1016
+ });
1017
+ r.set("type", "track_begin"), r.set("data", a);
1018
+ const l = a.index === 0 && trackList$1.value.length >= 2 ? t : o;
1019
+ r.setStyle(
1020
+ new Style({
1021
+ text: new Text({
1022
+ font: "Normal 14px iconfont",
1023
+ text: getIconFont(e),
1024
+ fill: new Fill({ color: l })
1025
+ }),
1026
+ zIndex: 101
1027
+ })
1028
+ ), trackLineVectorSource.value.addFeature(r);
1029
+ });
1030
+ }, setTrackLabelStyle = (e, t) => new Style({
1031
+ renderer: (o, n) => {
1032
+ const a = n.context;
1033
+ drawLabel(a, o, e.time, t, "#000", "rgba(255,255,255,.8)");
1034
+ }
1035
+ }), showTracks = ref([]), trackList = ref([]), trackLayer = ref(null), trackId = ref(""), cursor = ref(0), renderTrack = (e, t, o, n, a = "ship") => {
1036
+ var u;
1037
+ if (removeAllTrackLayer(), (t == null ? void 0 : t.length) < 2) {
1038
+ ((u = showTracks.value) == null ? void 0 : u.findIndex((m) => m.id === e)) < 0 && showTracks.value.push({ id: e, length: "" });
1039
+ return;
1040
+ }
1041
+ let r = {};
1042
+ t.forEach((m) => {
1043
+ m.state ? m.state = Number(m.state) : delete m.state;
1044
+ }), trackId.value = e, r[e] = t, trackList.value = t;
1045
+ const l = ["#ff0000", "#00ff00", "#0079ff", "#ffa500", "#800080", "#008080", "#ffc0cb", "#800000", "#000080", "#808000"], s = r[e].map(
1046
+ (m) => transform([m.lon, m.lat], projection.data, projection.mercator)
1047
+ ), c = new LineString(s), d = formatLength(c, n) || "--";
1048
+ nextTick(() => {
1049
+ var i;
1050
+ const m = (i = showTracks.value) == null ? void 0 : i.findIndex((v) => v.id === e);
1051
+ m < 0 ? showTracks.value.push({ id: e, length: d }) : showTracks.value[m].length = d, renderTrackLine(r, e, o), ++cursor.value, cursor.value > l.length && (cursor.value = 0), resetTrackView(e);
1052
+ }).then(() => {
1053
+ });
1054
+ }, removeAllTrackLayer = () => {
1055
+ var e;
1056
+ (e = trackLayer.value) == null || e.removeAllLayer();
1057
+ }, resetTrackView = (e) => {
1058
+ var n, a;
1059
+ const t = mapInstance.value.getView(), o = (a = (n = shipTrackLineFeatures.value.find((r) => r.getId() === e)) == null ? void 0 : n.getGeometry()) == null ? void 0 : a.getExtent();
1060
+ if (o != null && o.length)
1061
+ try {
1062
+ t.fit(o);
1063
+ } catch (r) {
1064
+ console.log(r);
1065
+ }
1066
+ }, _sfc_main = /* @__PURE__ */ defineComponent({
1067
+ __name: "Map",
1068
+ props: {
1069
+ zoom: {},
1070
+ center: {},
1071
+ vehicleMode: {}
1072
+ },
1073
+ emits: ["zoomChanged", "extentChanged"],
1074
+ setup(e, { expose: t, emit: o }) {
1075
+ const n = ref(null), a = ref(null), r = ref(null), l = o, s = e, c = ref(s.zoom || mapZoom.default), d = ref(!1), u = ref(!0), m = ref(!0);
1076
+ let i;
1077
+ ((p) => {
1078
+ p[p.tiandituTile = new TileLayer({ source: new XYZ({ url: baseMap.tiandituTile }) })] = "tiandituTile", p[p.tiandituTileMark = new TileLayer({ source: new XYZ({ url: baseMap.tiandituTileMark }) })] = "tiandituTileMark", p[p.tiandituImgTile = new TileLayer({ source: new XYZ({ url: baseMap.tiandituImgTile }), visible: !1 })] = "tiandituImgTile", p[p.tiandituImgTileMark = new TileLayer({ source: new XYZ({ url: baseMap.tiandituImgTileMark }), visible: !1 })] = "tiandituImgTileMark", p[p.greenMark = new TileLayer({ source: new XYZ({ url: baseMap.greenTile }) })] = "greenMark";
1079
+ })(i || (i = {}));
1080
+ const v = () => {
1081
+ var g;
1082
+ const p = {
1083
+ projection: projection.mercator,
1084
+ // 地图投影坐标系
1085
+ zoom: s.zoom || mapZoom.default,
1086
+ // 地图缩放级别(打开页面时默认级别)
1087
+ minZoom: mapZoom.min,
1088
+ // 地图缩放最小级别
1089
+ maxZoom: mapZoom.max,
1090
+ // 地图缩放最大级别
1091
+ center: lonLatToMercator(s.center || mapDefaultCenter),
1092
+ // 深圳坐标
1093
+ constrainResolution: !0,
1094
+ multiWorld: !0
1095
+ };
1096
+ mapInstance.value = new Map$1({
1097
+ target: "map",
1098
+ // 对应页面里 id 为 map 的元素
1099
+ layers: [
1100
+ // 图层
1101
+ i.tiandituTile,
1102
+ i.tiandituTileMark,
1103
+ i.tiandituImgTile,
1104
+ i.tiandituImgTileMark,
1105
+ i.greenMark
1106
+ ],
1107
+ view: new View(p)
1108
+ }), a.value.setScaleLine(), console.log(mapInstance.value.getLayers().getArray()), (g = mapInstance.value) == null || g.on("moveend", E);
1109
+ };
1110
+ onMounted(() => {
1111
+ v();
1112
+ });
1113
+ const k = (p) => {
1114
+ var g;
1115
+ (g = mapInstance.value) == null || g.getLayers().forEach((f) => {
1116
+ f.ol_uid === i.greenMark.ol_uid && (f.setVisible(p), u.value = p);
1117
+ });
1118
+ }, I = (p) => {
1119
+ var g;
1120
+ console.log("mode", p), (g = mapInstance.value) == null || g.getLayers().forEach((f) => {
1121
+ (f.ol_uid === i.tiandituTile.ol_uid || f.ol_uid === i.tiandituTileMark.ol_uid || f.ol_uid === i.tiandituImgTile.ol_uid || f.ol_uid === i.tiandituImgTileMark.ol_uid) && f.setVisible(!1), (p === BaseMapType.vector && f.ol_uid === i.tiandituTile.ol_uid || f.ol_uid === i.tiandituTileMark.ol_uid || p === BaseMapType.satellite && f.ol_uid === i.tiandituImgTile.ol_uid || f.ol_uid === i.tiandituImgTileMark.ol_uid) && (console.log(p, f.ol_uid), f.setVisible(!0));
1122
+ });
1123
+ }, E = () => {
1124
+ const p = mapInstance.value.getView(), g = p.getZoom();
1125
+ g && w(g);
1126
+ const f = p.calculateExtent(mapInstance.value.getSize());
1127
+ f && g && _(f, g);
1128
+ }, w = (p) => {
1129
+ var S;
1130
+ c.value = p;
1131
+ const g = (S = mapInstance.value) == null ? void 0 : S.getLayers(), f = s.vehicleMode === "ship" ? g == null ? void 0 : g.getArray().find((V) => V.ol_uid === i.greenMark.ol_uid) : void 0;
1132
+ !d.value && u.value && p < mapZoom.shipGreenDotMax ? (m.value = !0, f == null || f.setVisible(!0)) : (m.value = !1, f == null || f.setVisible(!1)), l("zoomChanged", p);
1133
+ }, _ = (p, g) => {
1134
+ const f = transform([p[0], p[1]], projection.mercator, projection.data), S = transform([p[2], p[3]], projection.mercator, projection.data);
1135
+ l("extentChanged", { extent: [f, S], zoom: g });
1136
+ };
1137
+ return t({
1138
+ mapInstance,
1139
+ initMap: v,
1140
+ renderTrucksMarker,
1141
+ renderShips,
1142
+ renderTrack,
1143
+ closeTrack: () => {
1144
+ var p;
1145
+ (p = shipTrackVectorLayer.value) == null || p.setVisible(!1);
1146
+ },
1147
+ findShip
1148
+ }), (p, g) => (openBlock(), createElementBlock("div", {
1149
+ class: "map-page map-container",
1150
+ ref_key: "pageRef",
1151
+ ref: n
1152
+ }, [
1153
+ g[0] || (g[0] = createElementVNode("div", {
1154
+ id: "map",
1155
+ class: "map"
1156
+ }, null, -1)),
1157
+ createVNode(ToolPanel, {
1158
+ "vehicle-mode": p.vehicleMode,
1159
+ onSwitchGreenDot: k,
1160
+ onSwitchMapTile: I
1161
+ }, null, 8, ["vehicle-mode"]),
1162
+ createVNode(ScaleLine, {
1163
+ ref_key: "scaleLineControl",
1164
+ ref: a
1165
+ }, null, 512),
1166
+ createVNode(ZoomControl, {
1167
+ ref_key: "zoomControl",
1168
+ ref: r,
1169
+ map: unref(mapInstance)
1170
+ }, null, 8, ["map"]),
1171
+ createVNode(Copyright),
1172
+ createVNode(Fullscreen, { page: n.value }, null, 8, ["page"]),
1173
+ g[1] || (g[1] = createElementVNode("span", {
1174
+ class: "icon map-iconfont",
1175
+ style: { "user-select": "text" }
1176
+ }, " ", -1)),
1177
+ g[2] || (g[2] = createElementVNode("span", { class: "icon map-iconfont icon-arrow" }, null, -1))
1178
+ ], 512));
1179
+ }
1180
+ }), Map = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-e4db8f6e"]]), ZhMap = withInstall(Map);
1181
+ export {
1182
+ ZhMap as Z
1183
+ };