gisviewer-vue3-arcgis 1.0.269 → 1.0.270

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.
@@ -193,6 +193,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
193
193
  status: number;
194
194
  message: string;
195
195
  };
196
+ changeSignalCrossShowName: (nameType: string) => void | {
197
+ status: number;
198
+ message: string;
199
+ };
196
200
  addGreenWaveBand: (params: IEditSignalControlAreaParams) => void;
197
201
  stopAddGreenWaveBand: () => {
198
202
  status: number;
@@ -1,23 +1,23 @@
1
- import { defineComponent as St, ref as x, reactive as Ct, onMounted as yt, getCurrentInstance as ht, onUnmounted as vt, computed as bt, openBlock as I, createElementBlock as G, createElementVNode as w, withDirectives as Ot, vShow as At, Fragment as kt, renderList as Dt, createBlock as Lt } from "vue";
2
- import H, { registerStore as Tt } from "./stores/index.mjs";
1
+ import { defineComponent as Ct, ref as x, reactive as yt, onMounted as ht, getCurrentInstance as vt, onUnmounted as bt, computed as Ot, openBlock as I, createElementBlock as G, createElementVNode as w, withDirectives as At, vShow as kt, Fragment as Dt, renderList as Lt, createBlock as Tt } from "vue";
2
+ import H, { registerStore as It } from "./stores/index.mjs";
3
3
  import "./style/index.css";
4
- import It from "./utils/dbscan-cluster/index.mjs";
5
- import Bt from "./utils/detect-gpu.mjs";
6
- import Mt from "./utils/edpass-device-controller.mjs";
7
- import E from "./utils/green-wave-band-controller/index.mjs";
8
- import Pt from "./utils/holo-flow/index.mjs";
9
- import Vt from "./utils/holo-flow/signal-countdown-panel.vue.mjs";
10
- import zt from "./utils/map-initializer.mjs";
11
- import N from "./utils/open-drive-renderer/index.mjs";
4
+ import Bt from "./utils/dbscan-cluster/index.mjs";
5
+ import Mt from "./utils/detect-gpu.mjs";
6
+ import Pt from "./utils/edpass-device-controller.mjs";
7
+ import N from "./utils/green-wave-band-controller/index.mjs";
8
+ import Vt from "./utils/holo-flow/index.mjs";
9
+ import zt from "./utils/holo-flow/signal-countdown-panel.vue.mjs";
10
+ import _t from "./utils/map-initializer.mjs";
11
+ import E from "./utils/open-drive-renderer/index.mjs";
12
12
  import W from "./utils/overlay.mjs";
13
- import _t from "./utils/police-jurisdiction.mjs";
14
- import xt from "./utils/queue-length.mjs";
13
+ import xt from "./utils/police-jurisdiction.mjs";
14
+ import Gt from "./utils/queue-length.mjs";
15
15
  import Z from "./utils/road-config-tool/index.mjs";
16
- import Gt from "./utils/signal-control-area/edit-area.mjs";
16
+ import Ht from "./utils/signal-control-area/edit-area.mjs";
17
17
  import B from "./utils/signal-control-area/signal-area-controller.mjs";
18
- import Ht from "./utils/signal-control-area/signal-cross-controller.mjs";
18
+ import Nt from "./utils/signal-control-area/signal-cross-controller.mjs";
19
19
  import Et from "./utils/traffic-flow.mjs";
20
- const Nt = { class: "gis-viewer" }, Wt = { style: { position: "absolute", bottom: "80px", left: "10px", "z-index": "9999" } }, cn = /* @__PURE__ */ St({
20
+ const Wt = { class: "gis-viewer" }, Zt = { style: { position: "absolute", bottom: "80px", left: "10px", "z-index": "9999" } }, ln = /* @__PURE__ */ Ct({
21
21
  __name: "gis-map",
22
22
  props: {
23
23
  config: {},
@@ -26,10 +26,10 @@ const Nt = { class: "gis-viewer" }, Wt = { style: { position: "absolute", bottom
26
26
  emits: ["mapLoaded", "markerClick", "mapClick", "update:zoom"],
27
27
  setup(Q, { expose: j, emit: J }) {
28
28
  const b = x(null);
29
- let n, p, c, o, r, s, d, t, l, a, S, g, C, O, f;
29
+ let n, p, c, o, r, s, f, t, l, a, d, g, C, O, S;
30
30
  const A = x(!1);
31
- Tt();
32
- const M = H.useAppDataStore, P = Ct([]), V = (e) => Math.log2(591657527591555e-6 / e);
31
+ It();
32
+ const M = H.useAppDataStore, P = yt([]), V = (e) => Math.log2(591657527591555e-6 / e);
33
33
  let y = null, z = null;
34
34
  const k = (e) => {
35
35
  if (!Number.isFinite(e))
@@ -37,14 +37,14 @@ const Nt = { class: "gis-viewer" }, Wt = { style: { position: "absolute", bottom
37
37
  const u = Math.round(e);
38
38
  u !== z && (z = u, h("update:zoom", u));
39
39
  };
40
- Bt(), yt(async () => {
40
+ Mt(), ht(async () => {
41
41
  if (!b.value)
42
42
  return;
43
43
  document.addEventListener("keydown", (m) => {
44
44
  m.ctrlKey && m.key === "i" && (A.value = !A.value);
45
45
  });
46
- const e = ht(), { $gisviewerAssetsRoot: u } = e.appContext.config.globalProperties, i = await (await fetch(_.config)).json();
47
- i.assetsRoot = _.assetsRoot || u, M.mapConfig = i, p = new zt(), M.mapInitializer = p, n = await p.initialize({
46
+ const e = vt(), { $gisviewerAssetsRoot: u } = e.appContext.config.globalProperties, i = await (await fetch(_.config)).json();
47
+ i.assetsRoot = _.assetsRoot || u, M.mapConfig = i, p = new _t(), M.mapInitializer = p, n = await p.initialize({
48
48
  container: b.value,
49
49
  mapConfig: i,
50
50
  markerClickCallback: (m, L, T, wt) => {
@@ -56,16 +56,16 @@ const Nt = { class: "gis-viewer" }, Wt = { style: { position: "absolute", bottom
56
56
  });
57
57
  const v = n.zoom ?? (n.scale ? V(n.scale) : void 0);
58
58
  typeof v == "number" && k(v);
59
- const ft = n.zoom !== void 0 ? n.watch("zoom", (m) => {
59
+ const St = n.zoom !== void 0 ? n.watch("zoom", (m) => {
60
60
  k(m);
61
61
  }) : n.watch("scale", (m) => {
62
62
  typeof m == "number" && m > 0 && k(V(m));
63
63
  });
64
- y = () => ft.remove(), r = new Pt(n, P), await r.init(), h("mapLoaded");
65
- }), vt(() => {
64
+ y = () => St.remove(), r = new Vt(n, P), await r.init(), h("mapLoaded");
65
+ }), bt(() => {
66
66
  a == null || a.clearSignalControlArea(), t == null || t.clearOpenDrive(), r.clearHoloTrace(), r.clearHoloSignal(), o == null || o.disconnectTrafficFlow(), y == null || y(), y = null;
67
67
  });
68
- const U = bt(() => n), $ = () => {
68
+ const U = Ot(() => n), $ = () => {
69
69
  const e = H.useAppDataStore;
70
70
  e.saveTrackLog = !0;
71
71
  }, q = () => {
@@ -93,9 +93,9 @@ const Nt = { class: "gis-viewer" }, Wt = { style: { position: "absolute", bottom
93
93
  r.setInterpolate(e);
94
94
  }, fe = async (e) => {
95
95
  await r.handleSignalData(e);
96
- }, we = async (e) => {
96
+ }, Se = async (e) => {
97
97
  await r.initializeLampGroup(e);
98
- }, Se = (e) => {
98
+ }, we = (e) => {
99
99
  r.handleUniSignalData(e);
100
100
  }, Ce = () => {
101
101
  r.clearHoloSignal();
@@ -107,17 +107,17 @@ const Nt = { class: "gis-viewer" }, Wt = { style: { position: "absolute", bottom
107
107
  o == null || o.toggleTrafficObject(e), r == null || r.toggleTrafficObject(e);
108
108
  }, D = (e) => {
109
109
  r == null || r.updatePanelContent(e);
110
- }, be = async (e) => (s || (s = new W(n)), s.addOverlays(e)), Oe = async (e) => (f || (f = new It(n)), f.addClusterPoints(e)), Ae = () => {
111
- f == null || f.removeAllClusterPoints();
110
+ }, be = async (e) => (s || (s = new W(n)), s.addOverlays(e)), Oe = async (e) => (S || (S = new Bt(n)), S.addClusterPoints(e)), Ae = () => {
111
+ S == null || S.removeAllClusterPoints();
112
112
  }, ke = (e) => (s || (s = new W(n)), s.addMask(e)), De = () => {
113
113
  s == null || s.removeMask();
114
114
  }, Le = (e) => s == null ? void 0 : s.removeOverlaysByType(e), Te = (e) => s == null ? void 0 : s.removeOverlaysById(e), Ie = () => s == null ? void 0 : s.removeAllOverlays(), Be = () => {
115
115
  s == null || s.showAllOverlays();
116
116
  }, Me = (e) => {
117
- d || (d = new xt(n)), d.updateQueueLength(e);
117
+ f || (f = new Gt(n)), f.updateQueueLength(e);
118
118
  }, Pe = () => {
119
- d == null || d.removeQueueLength();
120
- }, Ve = async (e, u) => (t || (t = new N(n)), await t.showOpenDriveFromServer(e, u)), ze = async (e) => (t || (t = new N(n)), await t.clearOpenDrive(), await t.showOpenDriveFromFile(e)), _e = (e) => t ? t.setOpendriveVisibility(e) : {
119
+ f == null || f.removeQueueLength();
120
+ }, Ve = async (e, u) => (t || (t = new E(n)), await t.showOpenDriveFromServer(e, u)), ze = async (e) => (t || (t = new E(n)), await t.clearOpenDrive(), await t.showOpenDriveFromFile(e)), _e = (e) => t ? t.setOpendriveVisibility(e) : {
121
121
  status: -1,
122
122
  message: "未加载OpenDrive地图"
123
123
  }, xe = async () => await (t == null ? void 0 : t.clearOpenDrive()), Ge = async (e) => t ? await (t == null ? void 0 : t.findSumo(e)) : {
@@ -126,10 +126,10 @@ const Nt = { class: "gis-viewer" }, Wt = { style: { position: "absolute", bottom
126
126
  }, He = async (e) => t ? t.selectSumo(e) : {
127
127
  status: -1,
128
128
  message: "未加载OpenDrive地图"
129
- }, Ee = async (e) => t ? t.unselectSumo(e) : {
129
+ }, Ne = async (e) => t ? t.unselectSumo(e) : {
130
130
  status: -1,
131
131
  message: "未加载OpenDrive地图"
132
- }, Ne = async (e) => t ? t.selectComputable(e) : {
132
+ }, Ee = async (e) => t ? t.selectComputable(e) : {
133
133
  status: -1,
134
134
  message: "未加载OpenDrive地图"
135
135
  }, We = async (e) => t ? await t.geometrySearch(e) : {
@@ -150,18 +150,18 @@ const Nt = { class: "gis-viewer" }, Wt = { style: { position: "absolute", bottom
150
150
  }, Ue = (e) => t ? t == null ? void 0 : t.clearBlockLane(e) : {
151
151
  status: -1,
152
152
  message: "未加载OpenDrive地图"
153
- }, $e = async (e) => (a || (a = new B(n)), await a.showSignalControlArea(e)), qe = async (e) => (a || (a = new B(n)), await a.showDistrict(e)), Ke = async (e) => (a || (a = new B(n)), await a.showSubDistrict(e)), Fe = async () => await (a == null ? void 0 : a.clearSignalControlArea()), Xe = (e) => a == null ? void 0 : a.setLayerVisibility(e), Ye = async (e) => a ? await (a == null ? void 0 : a.locateSignalControlArea(e)) : { status: -1, message: "未加载信号控制区" }, Re = async (e) => a ? await a.highlightSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, et = () => a ? a.resetHighlight() : { status: -1, message: "未加载信号控制区" }, tt = (e) => (l || (l = new Gt(n)), l.showSubSignalControlArea(e)), nt = (e) => l ? l.editSubSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, at = () => l ? l.stopEditSubSignalControlArea() : { status: -1, message: "未加载信号控制区" }, rt = (e) => l ? l.selectSubSignalControlAreaCross(e) : { status: -1, message: "未加载信号控制区" }, st = (e) => l ? l.unselectSubSignalControlAreaCross(e) : { status: -1, message: "未加载信号控制区" }, ot = (e) => {
153
+ }, $e = async (e) => (a || (a = new B(n)), await a.showSignalControlArea(e)), qe = async (e) => (a || (a = new B(n)), await a.showDistrict(e)), Ke = async (e) => (a || (a = new B(n)), await a.showSubDistrict(e)), Fe = async () => await (a == null ? void 0 : a.clearSignalControlArea()), Xe = (e) => a == null ? void 0 : a.setLayerVisibility(e), Ye = async (e) => a ? await (a == null ? void 0 : a.locateSignalControlArea(e)) : { status: -1, message: "未加载信号控制区" }, Re = async (e) => a ? await a.highlightSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, et = () => a ? a.resetHighlight() : { status: -1, message: "未加载信号控制区" }, tt = (e) => (l || (l = new Ht(n)), l.showSubSignalControlArea(e)), nt = (e) => l ? l.editSubSignalControlArea(e) : { status: -1, message: "未加载信号控制区" }, at = () => l ? l.stopEditSubSignalControlArea() : { status: -1, message: "未加载信号控制区" }, rt = (e) => l ? l.selectSubSignalControlAreaCross(e) : { status: -1, message: "未加载信号控制区" }, st = (e) => l ? l.unselectSubSignalControlAreaCross(e) : { status: -1, message: "未加载信号控制区" }, ot = (e) => {
154
154
  if (!l)
155
155
  return { status: -1, message: "未加载信号控制区" };
156
- }, it = (e) => (S || (S = new Ht(n)), S.showSignalCross(e)), ct = () => S ? S.clearSignalCross() : { status: -1, message: "未加载信号路口" }, lt = (e) => (g || (g = new E(n)), g.addGreenWaveBand(e)), ut = () => {
156
+ }, it = (e) => (d || (d = new Nt(n)), d.showSignalCross(e)), ct = () => d ? d.clearSignalCross() : { status: -1, message: "未加载信号路口" }, lt = (e) => d ? d.changeShowName(e) : { status: -1, message: "未加载信号路口" }, ut = (e) => (g || (g = new N(n)), g.addGreenWaveBand(e)), mt = () => {
157
157
  if (!g)
158
158
  return { status: -1, message: "未加载绿波带" };
159
159
  g.stopAddGreenWaveBand();
160
- }, mt = async (e) => (g || (g = new E(n)), await g.showGreenWaveBand(e)), pt = async (e) => (C || (C = new _t(n)), await C.showJurisdiction(e)), gt = () => {
160
+ }, pt = async (e) => (g || (g = new N(n)), await g.showGreenWaveBand(e)), gt = async (e) => (C || (C = new xt(n)), await C.showJurisdiction(e)), dt = () => {
161
161
  if (!C)
162
162
  return { status: -1, message: "未加载警务管辖区" };
163
163
  C.clearJurisdiction();
164
- }, dt = async (e) => (O || (O = new Mt(n)), await O.setEdpassLayerVisibility(e)), _ = Q, h = J;
164
+ }, ft = async (e) => (O || (O = new Pt(n)), await O.setEdpassLayerVisibility(e)), _ = Q, h = J;
165
165
  return j({
166
166
  mapViewer: U,
167
167
  setLayerVisibility: te,
@@ -190,8 +190,8 @@ const Nt = { class: "gis-viewer" }, Wt = { style: { position: "absolute", bottom
190
190
  disconnectCarFlow: me,
191
191
  handleHoloVehicleTraceData: pe,
192
192
  clearHoloTrace: ge,
193
- initializeLampGroup: we,
194
- handleUniSignalData: Se,
193
+ initializeLampGroup: Se,
194
+ handleUniSignalData: we,
195
195
  handleHoloSignalData: fe,
196
196
  clearHoloSignal: Ce,
197
197
  setInterpolate: de,
@@ -208,8 +208,8 @@ const Nt = { class: "gis-viewer" }, Wt = { style: { position: "absolute", bottom
208
208
  geometrySearchInOpenDrive: We,
209
209
  findSumoInOpenDrive: Ge,
210
210
  selectSumoInOpenDrive: He,
211
- unselectSumoInOpenDrive: Ee,
212
- selectComputableInOpenDrive: Ne,
211
+ unselectSumoInOpenDrive: Ne,
212
+ selectComputableInOpenDrive: Ee,
213
213
  getSumoInfo: Ze,
214
214
  splitOpenDriveLane: Qe,
215
215
  clearSplitOpenDriveLane: je,
@@ -231,19 +231,20 @@ const Nt = { class: "gis-viewer" }, Wt = { style: { position: "absolute", bottom
231
231
  changeSubSignalControlAreaBorderVisibility: ot,
232
232
  showSignalCross: it,
233
233
  clearSignalCross: ct,
234
- addGreenWaveBand: lt,
235
- stopAddGreenWaveBand: ut,
236
- showGreenWaveBand: mt,
237
- showPoliceArea: pt,
238
- clearPoliceArea: gt,
239
- setEdpassLayerVisibility: dt
240
- }), (e, u) => (I(), G("div", Nt, [
234
+ changeSignalCrossShowName: lt,
235
+ addGreenWaveBand: ut,
236
+ stopAddGreenWaveBand: mt,
237
+ showGreenWaveBand: pt,
238
+ showPoliceArea: gt,
239
+ clearPoliceArea: dt,
240
+ setEdpassLayerVisibility: ft
241
+ }), (e, u) => (I(), G("div", Wt, [
241
242
  w("div", {
242
243
  class: "gis-viewer-main",
243
244
  ref_key: "mapContainer",
244
245
  ref: b
245
246
  }, [
246
- Ot(w("div", Wt, [
247
+ At(w("div", Zt, [
247
248
  w("button", {
248
249
  style: { "margin-right": "10px" },
249
250
  onClick: $
@@ -258,10 +259,10 @@ const Nt = { class: "gis-viewer" }, Wt = { style: { position: "absolute", bottom
258
259
  }, " 显示车辆id "),
259
260
  w("button", { onClick: F }, "显示车辆号牌")
260
261
  ], 512), [
261
- [At, A.value]
262
+ [kt, A.value]
262
263
  ])
263
264
  ], 512),
264
- (I(!0), G(kt, null, Dt(P, (i, v) => (I(), Lt(Vt, {
265
+ (I(!0), G(Dt, null, Lt(P, (i, v) => (I(), Tt(zt, {
265
266
  key: v,
266
267
  "display-mode": i.displayMode,
267
268
  flash: i.flash,
@@ -278,5 +279,5 @@ const Nt = { class: "gis-viewer" }, Wt = { style: { position: "absolute", bottom
278
279
  }
279
280
  });
280
281
  export {
281
- cn as default
282
+ ln as default
282
283
  };
@@ -176,6 +176,10 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
176
176
  status: number;
177
177
  message: string;
178
178
  };
179
+ changeSignalCrossShowName: (nameType: string) => void | {
180
+ status: number;
181
+ message: string;
182
+ };
179
183
  addGreenWaveBand: (params: import("../types").IEditSignalControlAreaParams) => void;
180
184
  stopAddGreenWaveBand: () => {
181
185
  status: number;
@@ -5,11 +5,13 @@ import { IResult, IShowSignalCrossParams } from 'packages/components/src/types';
5
5
  export default class SignalCrossController {
6
6
  private view;
7
7
  private crossLayer;
8
- private readonly symbolScale;
8
+ private readonly iconSymbolScale;
9
+ private readonly largeMarkerScale;
9
10
  private oldScale;
10
11
  private scaleWatchHandle;
11
12
  private showName;
12
13
  private showStyle;
14
+ private didCrossScaleThreshold;
13
15
  private readonly clusterRadius;
14
16
  private readonly minClusterPoints;
15
17
  private readonly maxClusterSymbolSize;
@@ -27,6 +29,15 @@ export default class SignalCrossController {
27
29
  */
28
30
  showSignalCross(params: IShowSignalCrossParams): IResult;
29
31
  clearSignalCross(): void;
32
+ /**
33
+ * 更改路口显示名称内容
34
+ * @param showName
35
+ */
36
+ changeShowName(showName: string): void;
37
+ /**
38
+ * 更新散点符号
39
+ */
40
+ private updateScatterSymbol;
30
41
  /**
31
42
  * 按照像素距离聚类
32
43
  * @param locations
@@ -1,19 +1,22 @@
1
1
  import { Point as u } from "@arcgis/core/geometry";
2
2
  import y from "@arcgis/core/Graphic";
3
- import d from "@arcgis/core/layers/GraphicsLayer";
3
+ import p from "@arcgis/core/layers/GraphicsLayer";
4
4
  class C {
5
5
  constructor(e) {
6
- this.symbolScale = 6e3, this.oldScale = 0, this.showName = "signalId", this.showStyle = "scatter", this.clusterRadius = 120, this.minClusterPoints = 2, this.maxClusterSymbolSize = 50, this.minClusterSymbolSize = 25, this.clusteredLocations = [], this.locations = [], this.view = e, this.crossLayer = new d({
6
+ this.iconSymbolScale = 1e4, this.largeMarkerScale = 4e4, this.oldScale = 0, this.showName = "detail", this.showStyle = "scatter", this.clusterRadius = 120, this.minClusterPoints = 2, this.maxClusterSymbolSize = 50, this.minClusterSymbolSize = 25, this.clusteredLocations = [], this.locations = [], this.view = e, this.crossLayer = new p({
7
7
  id: "signal-control-cross-layer",
8
8
  title: "信控路口图层"
9
9
  }), this.view.map.add(this.crossLayer);
10
10
  }
11
+ didCrossScaleThreshold(e, s, t) {
12
+ return e < t && s >= t || e >= t && s < t;
13
+ }
11
14
  locationToScreen() {
12
15
  this.clusteredLocations = [], this.locations.forEach((e) => {
13
- const t = this.view.toScreen(
16
+ const s = this.view.toScreen(
14
17
  new u({ x: e.x, y: e.y })
15
18
  );
16
- t.x > 0 && t.y > 0 && (e.properties.screenX = t.x, e.properties.screenY = t.y, e.visited = !1, e.clusterId = void 0, this.clusteredLocations.push(e));
19
+ s.x > 0 && s.y > 0 && (e.properties.screenX = s.x, e.properties.screenY = s.y, e.visited = !1, e.clusterId = void 0, this.clusteredLocations.push(e));
17
20
  });
18
21
  }
19
22
  /**
@@ -22,50 +25,57 @@ class C {
22
25
  * @returns
23
26
  */
24
27
  showSignalCross(e) {
25
- if (this.crossLayer.removeAll(), this.showName = e.showName || "signalId", this.showStyle = e.style || "scatter", this.scaleWatchHandle || (this.scaleWatchHandle = this.view.watch("stationary", () => {
26
- if (this.showStyle === "scatter")
27
- (this.oldScale < this.symbolScale && this.view.scale >= this.symbolScale || this.oldScale >= this.symbolScale && this.view.scale < this.symbolScale) && this.crossLayer.graphics.forEach((t) => {
28
- t.symbol = this.getCrossSymbol(t.attributes);
29
- }), this.oldScale = this.view.scale;
30
- else {
28
+ if (this.crossLayer.removeAll(), this.showName = e.showName || "detail", this.showStyle = e.style || "scatter", this.oldScale = this.view.scale, this.scaleWatchHandle || (this.scaleWatchHandle = this.view.watch("stationary", () => {
29
+ if (this.showStyle === "scatter") {
30
+ const s = this.view.scale, t = this.didCrossScaleThreshold(
31
+ this.oldScale,
32
+ s,
33
+ this.iconSymbolScale
34
+ ), i = this.didCrossScaleThreshold(
35
+ this.oldScale,
36
+ s,
37
+ this.largeMarkerScale
38
+ );
39
+ (t || i) && this.updateScatterSymbol(), this.oldScale = s;
40
+ } else {
31
41
  this.locationToScreen();
32
- const t = this.doPixelCluster(this.clusterRadius);
33
- this.showClusterResult(t);
42
+ const s = this.doPixelCluster(this.clusterRadius);
43
+ this.showClusterResult(s);
34
44
  }
35
45
  })), this.showStyle === "scatter") {
36
- const t = e.points.map((i) => {
37
- const s = this.getCrossSymbol(i), r = this.getBrandLabel(i.brand), o = this.getOnlineLabel(i.isOnline), n = this.getMalfunctionLabel(
38
- i.isMalfunction
46
+ const s = e.points.map((t) => {
47
+ const i = this.getCrossSymbol(t), r = this.getBrandLabel(t.brand), o = this.getOnlineLabel(t.isOnline), a = this.getMalfunctionLabel(
48
+ t.isMalfunction
39
49
  );
40
50
  return new y({
41
51
  geometry: {
42
52
  type: "point",
43
- longitude: i.x,
44
- latitude: i.y
53
+ longitude: t.x,
54
+ latitude: t.y
45
55
  },
46
- symbol: s,
56
+ symbol: i,
47
57
  attributes: {
48
58
  type: "signal-cross",
49
- id: i.crossId,
59
+ id: t.crossId,
50
60
  brandLabel: r,
51
61
  isOnlineLabel: o,
52
- isMalfunctionLabel: n,
53
- ...i
62
+ isMalfunctionLabel: a,
63
+ ...t
54
64
  }
55
65
  });
56
66
  });
57
- this.crossLayer.addMany(t);
67
+ this.crossLayer.addMany(s);
58
68
  } else {
59
- this.locations = e.points.map((i) => ({
60
- id: i.crossId,
61
- x: i.x,
62
- y: i.y,
69
+ this.locations = e.points.map((t) => ({
70
+ id: t.crossId,
71
+ x: t.x,
72
+ y: t.y,
63
73
  visited: !1,
64
74
  clusterId: void 0,
65
- properties: i
75
+ properties: t
66
76
  })), this.locationToScreen();
67
- const t = this.doPixelCluster(this.clusterRadius);
68
- this.showClusterResult(t);
77
+ const s = this.doPixelCluster(this.clusterRadius);
78
+ this.showClusterResult(s);
69
79
  }
70
80
  return { status: 0, message: "ok" };
71
81
  }
@@ -73,6 +83,21 @@ class C {
73
83
  var e;
74
84
  this.crossLayer.removeAll(), (e = this.scaleWatchHandle) == null || e.remove(), this.scaleWatchHandle = null;
75
85
  }
86
+ /**
87
+ * 更改路口显示名称内容
88
+ * @param showName
89
+ */
90
+ changeShowName(e) {
91
+ this.showName = e, this.showStyle === "scatter" && this.updateScatterSymbol();
92
+ }
93
+ /**
94
+ * 更新散点符号
95
+ */
96
+ updateScatterSymbol() {
97
+ this.crossLayer.graphics.forEach((e) => {
98
+ e.symbol = this.getCrossSymbol(e.attributes);
99
+ });
100
+ }
76
101
  /**
77
102
  * 按照像素距离聚类
78
103
  * @param locations
@@ -81,16 +106,16 @@ class C {
81
106
  * @returns
82
107
  */
83
108
  doPixelCluster(e) {
84
- let t = 0;
85
- for (let i = 0; i < this.clusteredLocations.length; i++) {
86
- const s = this.clusteredLocations[i];
87
- if (s.visited)
109
+ let s = 0;
110
+ for (let t = 0; t < this.clusteredLocations.length; t++) {
111
+ const i = this.clusteredLocations[t];
112
+ if (i.visited)
88
113
  continue;
89
- s.visited = !0;
90
- const r = this.getNeighbors(s, e);
91
- r.length < this.minClusterPoints ? s.clusterId = -1 : (r.forEach((o) => {
92
- o.visited = !0, o.clusterId = t;
93
- }), s.clusterId = t, t++);
114
+ i.visited = !0;
115
+ const r = this.getNeighbors(i, e);
116
+ r.length < this.minClusterPoints ? i.clusterId = -1 : (r.forEach((o) => {
117
+ o.visited = !0, o.clusterId = s;
118
+ }), i.clusterId = s, s++);
94
119
  }
95
120
  return this.createClusters();
96
121
  }
@@ -101,8 +126,8 @@ class C {
101
126
  * @param eps
102
127
  * @returns
103
128
  */
104
- getNeighbors(e, t) {
105
- return this.clusteredLocations.filter((i) => i.id === e.id || i.visited ? !1 : this.getDistance(e, i) <= t);
129
+ getNeighbors(e, s) {
130
+ return this.clusteredLocations.filter((t) => t.id === e.id || t.visited ? !1 : this.getDistance(e, t) <= s);
106
131
  }
107
132
  /**
108
133
  * 两点间的像素距离
@@ -110,9 +135,9 @@ class C {
110
135
  * @param point2
111
136
  * @returns
112
137
  */
113
- getDistance(e, t) {
138
+ getDistance(e, s) {
114
139
  return Math.sqrt(
115
- Math.pow(e.properties.screenX - t.properties.screenX, 2) + Math.pow(e.properties.screenY - t.properties.screenY, 2)
140
+ Math.pow(e.properties.screenX - s.properties.screenX, 2) + Math.pow(e.properties.screenY - s.properties.screenY, 2)
116
141
  );
117
142
  }
118
143
  /**
@@ -121,41 +146,41 @@ class C {
121
146
  * @returns
122
147
  */
123
148
  createClusters() {
124
- const e = {}, t = [];
125
- for (const s of this.clusteredLocations)
126
- s.clusterId === void 0 || s.clusterId === -1 ? t.push(s) : (e[s.clusterId] || (e[s.clusterId] = []), e[s.clusterId].push(s));
127
- const i = Object.keys(e).map((s, r) => {
128
- const o = e[Number(s)], n = o.length, l = o.reduce((c, h) => c + h.x, 0), a = o.reduce((c, h) => c + h.y, 0), m = l / n, p = a / n;
149
+ const e = {}, s = [];
150
+ for (const i of this.clusteredLocations)
151
+ i.clusterId === void 0 || i.clusterId === -1 ? s.push(i) : (e[i.clusterId] || (e[i.clusterId] = []), e[i.clusterId].push(i));
152
+ const t = Object.keys(e).map((i, r) => {
153
+ const o = e[Number(i)], a = o.length, l = o.reduce((c, h) => c + h.x, 0), n = o.reduce((c, h) => c + h.y, 0), m = l / a, d = n / a;
129
154
  return {
130
- id: Number(s),
155
+ id: Number(i),
131
156
  items: o,
132
- count: n,
157
+ count: a,
133
158
  center: {
134
159
  x: m,
135
- y: p
160
+ y: d
136
161
  }
137
162
  };
138
163
  });
139
- return t.length > 0 && i.push({
164
+ return s.length > 0 && t.push({
140
165
  id: -1,
141
- items: t,
142
- count: t.length,
166
+ items: s,
167
+ count: s.length,
143
168
  center: null
144
- }), i;
169
+ }), t;
145
170
  }
146
171
  showClusterResult(e) {
147
172
  this.crossLayer.removeAll();
148
- let t = Number.MIN_VALUE, i = Number.MAX_VALUE;
149
- e.forEach((s) => {
150
- s.count > 1 && (i = Math.min(i, s.count), t = Math.max(t, s.count));
151
- }), e.forEach((s) => {
152
- if (s.id !== -1) {
153
- let r = i === t ? (this.maxClusterSymbolSize + this.minClusterSymbolSize) / 2 : this.minClusterSymbolSize + (s.count - i) / (t - i) * (this.maxClusterSymbolSize - this.minClusterSymbolSize);
173
+ let s = Number.MIN_VALUE, t = Number.MAX_VALUE;
174
+ e.forEach((i) => {
175
+ i.count > 1 && (t = Math.min(t, i.count), s = Math.max(s, i.count));
176
+ }), e.forEach((i) => {
177
+ if (i.id !== -1) {
178
+ let r = t === s ? (this.maxClusterSymbolSize + this.minClusterSymbolSize) / 2 : this.minClusterSymbolSize + (i.count - t) / (s - t) * (this.maxClusterSymbolSize - this.minClusterSymbolSize);
154
179
  r *= 0.75;
155
- const l = (s.count.toString().length * 8 + 6) / 2, a = new y({
156
- geometry: new u({ x: s.center.x, y: s.center.y }),
180
+ const l = (i.count.toString().length * 8 + 6) / 2, n = new y({
181
+ geometry: new u({ x: i.center.x, y: i.center.y }),
157
182
  attributes: {
158
- count: s.count
183
+ count: i.count
159
184
  },
160
185
  symbol: {
161
186
  type: "cim",
@@ -265,9 +290,9 @@ class C {
265
290
  }
266
291
  }
267
292
  });
268
- this.crossLayer.add(a);
293
+ this.crossLayer.add(n);
269
294
  } else
270
- s.items.forEach((r) => {
295
+ i.items.forEach((r) => {
271
296
  const o = new y({
272
297
  geometry: new u({ x: r.x, y: r.y }),
273
298
  attributes: {
@@ -283,8 +308,8 @@ class C {
283
308
  });
284
309
  }
285
310
  getBrandLabel(e) {
286
- const t = (e ?? "").toLowerCase();
287
- return t === "scats" ? "SCATS" : t === "gc" ? "国产" : e ?? "";
311
+ const s = (e ?? "").toLowerCase();
312
+ return s === "scats" ? "SCATS" : s === "gc" ? "国产" : e ?? "";
288
313
  }
289
314
  getOnlineLabel(e) {
290
315
  return e ? "在线" : "离线";
@@ -293,7 +318,8 @@ class C {
293
318
  return e ? "故障" : "正常";
294
319
  }
295
320
  getCrossSymbol(e) {
296
- if (this.view.scale <= this.symbolScale) {
321
+ var s;
322
+ if (this.view.scale <= this.iconSymbolScale) {
297
323
  let t = "/GisViewerAssets/Images/cross/ic_";
298
324
  return t += e.brand === "scats" ? "scats_" : "gc_", t += e.isOnline ? "online_" : "offline_", t += e.isMalfunction ? "malfunction.png" : "normal.png", {
299
325
  type: "cim",
@@ -308,7 +334,7 @@ class C {
308
334
  valueExpressionInfo: {
309
335
  type: "CIMExpressionInfo",
310
336
  title: "Custom",
311
- expression: this.showName === "signalId" ? 'Replace($feature.name, "与", "/") + " " + $feature.signalId' : 'Replace($feature.name, "与", "/") + " " + $feature.crossId',
337
+ expression: this.showName === "crossName" ? 'Replace($feature.name, "与", "/")' : this.showName === "signalId" ? "$feature.signalId" : 'Replace($feature.name, "与", "/") + " " + $feature.signalId',
312
338
  returnType: "Default"
313
339
  }
314
340
  }
@@ -385,10 +411,10 @@ class C {
385
411
  const t = {
386
412
  type: "simple-marker",
387
413
  style: "circle",
388
- size: 6,
414
+ size: this.view.scale > this.largeMarkerScale ? 3 : 6,
389
415
  outline: { width: 0 }
390
416
  };
391
- return e.brand.toLowerCase() === "scats" ? (e.isOnline ? t.color = [23, 169, 100] : t.color = [202, 202, 202], t.outline.color = [23, 169, 100]) : e.isOnline ? t.color = [33, 240, 142] : t.color = [202, 202, 202], t;
417
+ return ((s = e.brand) == null ? void 0 : s.toLowerCase()) === "scats" ? (e.isOnline ? t.color = [104, 203, 188] : t.color = [120, 131, 81], t.outline.color = [104, 203, 188]) : (e.isOnline ? t.color = [201, 226, 73] : t.color = [120, 131, 81], t.outline.color = [201, 226, 73]), t;
392
418
  }
393
419
  }
394
420
  }
@@ -193,6 +193,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
193
193
  status: number;
194
194
  message: string;
195
195
  };
196
+ changeSignalCrossShowName: (nameType: string) => void | {
197
+ status: number;
198
+ message: string;
199
+ };
196
200
  addGreenWaveBand: (params: IEditSignalControlAreaParams) => void;
197
201
  stopAddGreenWaveBand: () => {
198
202
  status: number;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue"),q=require("./stores/index.js");require("./style/index.css");const pt=require("./utils/dbscan-cluster/index.js"),ft=require("./utils/detect-gpu.js"),wt=require("./utils/edpass-device-controller.js"),P=require("./utils/green-wave-band-controller/index.js"),yt=require("./utils/holo-flow/index.js"),St=require("./utils/holo-flow/signal-countdown-panel.vue.js"),Ct=require("./utils/map-initializer.js"),z=require("./utils/open-drive-renderer/index.js"),E=require("./utils/overlay.js"),ht=require("./utils/police-jurisdiction.js"),vt=require("./utils/queue-length.js"),N=require("./utils/road-config-tool/index.js"),bt=require("./utils/signal-control-area/edit-area.js"),B=require("./utils/signal-control-area/signal-area-controller.js"),Ot=require("./utils/signal-control-area/signal-cross-controller.js"),kt=require("./utils/traffic-flow.js"),At={class:"gis-viewer"},Dt={style:{position:"absolute",bottom:"80px",left:"10px","z-index":"9999"}},Lt=r.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick","update:zoom"],setup(H,{expose:G,emit:Z}){const b=r.ref(null);let n,g,l,i,s,o,f,t,u,a,y,p,S,O,w;const k=r.ref(!1);q.registerStore();const V=q.default.useAppDataStore,_=r.reactive([]),I=e=>Math.log2(591657527591555e-6/e);let C=null,M=null;const A=e=>{if(!Number.isFinite(e))return;const d=Math.round(e);d!==M&&(M=d,h("update:zoom",d))};ft.default(),r.onMounted(async()=>{if(!b.value)return;document.addEventListener("keydown",m=>{m.ctrlKey&&m.key==="i"&&(k.value=!k.value)});const e=r.getCurrentInstance(),{$gisviewerAssetsRoot:d}=e.appContext.config.globalProperties,c=await(await fetch(x.config)).json();c.assetsRoot=x.assetsRoot||d,V.mapConfig=c,g=new Ct.default,V.mapInitializer=g,n=await g.initialize({container:b.value,mapConfig:c,markerClickCallback:(m,L,T,gt)=>{h("markerClick",m,L,T,gt)},mapClickCallback:(m,L,T)=>{h("mapClick",m,L,T)}});const v=n.zoom??(n.scale?I(n.scale):void 0);typeof v=="number"&&A(v);const mt=n.zoom!==void 0?n.watch("zoom",m=>{A(m)}):n.watch("scale",m=>{typeof m=="number"&&m>0&&A(I(m))});C=()=>mt.remove(),s=new yt.default(n,_),await s.init(),h("mapLoaded")}),r.onUnmounted(()=>{a==null||a.clearSignalControlArea(),t==null||t.clearOpenDrive(),s.clearHoloTrace(),s.clearHoloSignal(),i==null||i.disconnectTrafficFlow(),C==null||C(),C=null});const W=r.computed(()=>n),j=()=>{const e=q.default.useAppDataStore;e.saveTrackLog=!0},J=()=>{s.downloadTrackLog()},Q=()=>{D("vehicleId")},U=()=>{D("plateNumber")},K=async e=>await g.setMapCenter(e),F=async e=>await g.setMapCamera(e),X=e=>g.setMapZoom(e),Y=async e=>await g.lookAt(e),R=e=>g.setLayerVisibility(e),$=(e,d)=>g.requestCoordinateTransform(e,d),ee=e=>{g.cancelCoordinateTransform(e)},te=e=>{g.setMapZoomRange(e)},ne=e=>(l||(l=new N.default(n)),l.showLaneNumber(e)),ae=()=>{l==null||l.clearLaneNumber()},se=async e=>(l||(l=new N.default(n)),await l.initializeSearch(e)),re=async()=>l==null?void 0:l.calCrossIndicatorArea(),oe=async()=>{},ie=async(e,d)=>{i||(i=new kt.default(n)),i.connectTrafficFlow(e,d)},ce=()=>{i==null||i.disconnectTrafficFlow()},le=async e=>{s.handleVehicleTraceData(e)},ue=()=>{s.clearHoloTrace()},de=e=>{s.setInterpolate(e)},me=async e=>{await s.handleSignalData(e)},ge=async e=>{await s.initializeLampGroup(e)},pe=e=>{s.handleUniSignalData(e)},fe=()=>{s.clearHoloSignal()},we=e=>{i==null||i.toggleTrafficInfo(e),s==null||s.toggleTrafficInfo(e)},ye=e=>{s==null||s.togglePause(e)},Se=e=>{i==null||i.toggleTrafficObject(e),s==null||s.toggleTrafficObject(e)},D=e=>{s==null||s.updatePanelContent(e)},Ce=async e=>(o||(o=new E.default(n)),o.addOverlays(e)),he=async e=>(w||(w=new pt.default(n)),w.addClusterPoints(e)),ve=()=>{w==null||w.removeAllClusterPoints()},be=e=>(o||(o=new E.default(n)),o.addMask(e)),Oe=()=>{o==null||o.removeMask()},ke=e=>o==null?void 0:o.removeOverlaysByType(e),Ae=e=>o==null?void 0:o.removeOverlaysById(e),De=()=>o==null?void 0:o.removeAllOverlays(),Le=()=>{o==null||o.showAllOverlays()},Te=e=>{f||(f=new vt.default(n)),f.updateQueueLength(e)},qe=()=>{f==null||f.removeQueueLength()},Be=async(e,d)=>(t||(t=new z.default(n)),await t.showOpenDriveFromServer(e,d)),Ve=async e=>(t||(t=new z.default(n)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),_e=e=>t?t.setOpendriveVisibility(e):{status:-1,message:"未加载OpenDrive地图"},Ie=async()=>await(t==null?void 0:t.clearOpenDrive()),Me=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},xe=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},Pe=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},ze=async e=>t?t.selectComputable(e):{status:-1,message:"未加载OpenDrive地图"},Ee=async e=>t?await t.geometrySearch(e):{status:-1,message:"未加载OpenDrive地图"},Ne=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},He=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},Ge=async()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},Ze=async e=>t?t==null?void 0:t.blockLane(e):{status:-1,message:"未加载OpenDrive地图"},We=e=>t?t==null?void 0:t.clearBlockLane(e):{status:-1,message:"未加载OpenDrive地图"},je=async e=>(a||(a=new B.default(n)),await a.showSignalControlArea(e)),Je=async e=>(a||(a=new B.default(n)),await a.showDistrict(e)),Qe=async e=>(a||(a=new B.default(n)),await a.showSubDistrict(e)),Ue=async()=>await(a==null?void 0:a.clearSignalControlArea()),Ke=e=>a==null?void 0:a.setLayerVisibility(e),Fe=async e=>a?await(a==null?void 0:a.locateSignalControlArea(e)):{status:-1,message:"未加载信号控制区"},Xe=async e=>a?await a.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Ye=()=>a?a.resetHighlight():{status:-1,message:"未加载信号控制区"},Re=e=>(u||(u=new bt.default(n)),u.showSubSignalControlArea(e)),$e=e=>u?u.editSubSignalControlArea(e):{status:-1,message:"未加载信号控制区"},et=()=>u?u.stopEditSubSignalControlArea():{status:-1,message:"未加载信号控制区"},tt=e=>u?u.selectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},nt=e=>u?u.unselectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},at=e=>{if(!u)return{status:-1,message:"未加载信号控制区"}},st=e=>(y||(y=new Ot.default(n)),y.showSignalCross(e)),rt=()=>y?y.clearSignalCross():{status:-1,message:"未加载信号路口"},ot=e=>(p||(p=new P.default(n)),p.addGreenWaveBand(e)),it=()=>{if(!p)return{status:-1,message:"未加载绿波带"};p.stopAddGreenWaveBand()},ct=async e=>(p||(p=new P.default(n)),await p.showGreenWaveBand(e)),lt=async e=>(S||(S=new ht.default(n)),await S.showJurisdiction(e)),ut=()=>{if(!S)return{status:-1,message:"未加载警务管辖区"};S.clearJurisdiction()},dt=async e=>(O||(O=new wt.default(n)),await O.setEdpassLayerVisibility(e)),x=H,h=Z;return G({mapViewer:W,setLayerVisibility:R,setMapCenter:K,lookAt:Y,setMapCamera:F,setMapZoom:X,setMapZoomRange:te,requestCoordinateTransform:$,cancelCoordinateTransform:ee,addOverlays:Ce,addClusterPoints:he,removeAllClusterPoints:ve,addMask:be,removeMask:Oe,showAllOverlays:Le,removeOverlaysByType:ke,removeOverlaysById:Ae,removeAllOverlays:De,showLaneNumber:ne,clearLaneNumber:ae,initializeAreaTool:se,calCrossIndicatorArea:re,calRoadIndicatorArea:oe,connectCarFlow:ie,disconnectCarFlow:ce,handleHoloVehicleTraceData:le,clearHoloTrace:ue,initializeLampGroup:ge,handleUniSignalData:pe,handleHoloSignalData:me,clearHoloSignal:fe,setInterpolate:de,toggleTrafficInfo:we,toggleTrafficObject:Se,toggleVehicleInfo:D,togglePause:ye,updateQueueLength:Te,removeQueueLength:qe,showOpenDriveFromServer:Be,showOpenDriveFromFile:Ve,clearOpenDrive:Ie,setOpendriveVisibility:_e,geometrySearchInOpenDrive:Ee,findSumoInOpenDrive:Me,selectSumoInOpenDrive:xe,unselectSumoInOpenDrive:Pe,selectComputableInOpenDrive:ze,getSumoInfo:Ne,splitOpenDriveLane:He,clearSplitOpenDriveLane:Ge,blockOpenDriveLane:Ze,clearBlockOpenDriveLane:We,showSignalControlArea:je,showDistrictArea:Je,showSubDistrictArea:Qe,clearSignalControlArea:Ue,setSignalControlAreaVisibility:Ke,locateSignalControlArea:Fe,highlightSignalControlArea:Xe,resetHighlightSignalControlArea:Ye,showSubSignalControlArea:Re,editSubSignalControlArea:$e,stopEditSubSignalControlArea:et,selectSubSignalControlAreaCross:tt,unselectSubSignalControlAreaCross:nt,changeSubSignalControlAreaBorderVisibility:at,showSignalCross:st,clearSignalCross:rt,addGreenWaveBand:ot,stopAddGreenWaveBand:it,showGreenWaveBand:ct,showPoliceArea:lt,clearPoliceArea:ut,setEdpassLayerVisibility:dt}),(e,d)=>(r.openBlock(),r.createElementBlock("div",At,[r.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:b},[r.withDirectives(r.createElementVNode("div",Dt,[r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:j}," 开始记录 "),r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:J}," 下载日志 "),r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:Q}," 显示车辆id "),r.createElementVNode("button",{onClick:U},"显示车辆号牌")],512),[[r.vShow,k.value]])],512),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(_,(c,v)=>(r.openBlock(),r.createBlock(St.default,{key:v,"display-mode":c.displayMode,flash:c.flash,"road-id":c.crossId,"cross-id":c.roadId,"map-point":c.mapPoint,"stop-line":c.stopLine,position:c.position,rotation:c.rotation,scale:c.scale,"lamp-status":c.lampStatus},null,8,["display-mode","flash","road-id","cross-id","map-point","stop-line","position","rotation","scale","lamp-status"]))),128))]))}});exports.default=Lt;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue"),q=require("./stores/index.js");require("./style/index.css");const ft=require("./utils/dbscan-cluster/index.js"),wt=require("./utils/detect-gpu.js"),St=require("./utils/edpass-device-controller.js"),P=require("./utils/green-wave-band-controller/index.js"),yt=require("./utils/holo-flow/index.js"),ht=require("./utils/holo-flow/signal-countdown-panel.vue.js"),Ct=require("./utils/map-initializer.js"),N=require("./utils/open-drive-renderer/index.js"),z=require("./utils/overlay.js"),vt=require("./utils/police-jurisdiction.js"),bt=require("./utils/queue-length.js"),E=require("./utils/road-config-tool/index.js"),Ot=require("./utils/signal-control-area/edit-area.js"),B=require("./utils/signal-control-area/signal-area-controller.js"),kt=require("./utils/signal-control-area/signal-cross-controller.js"),At=require("./utils/traffic-flow.js"),Dt={class:"gis-viewer"},Lt={style:{position:"absolute",bottom:"80px",left:"10px","z-index":"9999"}},Tt=r.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick","update:zoom"],setup(H,{expose:G,emit:Z}){const b=r.ref(null);let n,g,l,i,s,o,w,t,u,a,f,p,y,O,S;const k=r.ref(!1);q.registerStore();const V=q.default.useAppDataStore,_=r.reactive([]),I=e=>Math.log2(591657527591555e-6/e);let h=null,M=null;const A=e=>{if(!Number.isFinite(e))return;const d=Math.round(e);d!==M&&(M=d,C("update:zoom",d))};wt.default(),r.onMounted(async()=>{if(!b.value)return;document.addEventListener("keydown",m=>{m.ctrlKey&&m.key==="i"&&(k.value=!k.value)});const e=r.getCurrentInstance(),{$gisviewerAssetsRoot:d}=e.appContext.config.globalProperties,c=await(await fetch(x.config)).json();c.assetsRoot=x.assetsRoot||d,V.mapConfig=c,g=new Ct.default,V.mapInitializer=g,n=await g.initialize({container:b.value,mapConfig:c,markerClickCallback:(m,L,T,pt)=>{C("markerClick",m,L,T,pt)},mapClickCallback:(m,L,T)=>{C("mapClick",m,L,T)}});const v=n.zoom??(n.scale?I(n.scale):void 0);typeof v=="number"&&A(v);const gt=n.zoom!==void 0?n.watch("zoom",m=>{A(m)}):n.watch("scale",m=>{typeof m=="number"&&m>0&&A(I(m))});h=()=>gt.remove(),s=new yt.default(n,_),await s.init(),C("mapLoaded")}),r.onUnmounted(()=>{a==null||a.clearSignalControlArea(),t==null||t.clearOpenDrive(),s.clearHoloTrace(),s.clearHoloSignal(),i==null||i.disconnectTrafficFlow(),h==null||h(),h=null});const W=r.computed(()=>n),j=()=>{const e=q.default.useAppDataStore;e.saveTrackLog=!0},J=()=>{s.downloadTrackLog()},Q=()=>{D("vehicleId")},U=()=>{D("plateNumber")},K=async e=>await g.setMapCenter(e),F=async e=>await g.setMapCamera(e),X=e=>g.setMapZoom(e),Y=async e=>await g.lookAt(e),R=e=>g.setLayerVisibility(e),$=(e,d)=>g.requestCoordinateTransform(e,d),ee=e=>{g.cancelCoordinateTransform(e)},te=e=>{g.setMapZoomRange(e)},ne=e=>(l||(l=new E.default(n)),l.showLaneNumber(e)),ae=()=>{l==null||l.clearLaneNumber()},se=async e=>(l||(l=new E.default(n)),await l.initializeSearch(e)),re=async()=>l==null?void 0:l.calCrossIndicatorArea(),oe=async()=>{},ie=async(e,d)=>{i||(i=new At.default(n)),i.connectTrafficFlow(e,d)},ce=()=>{i==null||i.disconnectTrafficFlow()},le=async e=>{s.handleVehicleTraceData(e)},ue=()=>{s.clearHoloTrace()},de=e=>{s.setInterpolate(e)},me=async e=>{await s.handleSignalData(e)},ge=async e=>{await s.initializeLampGroup(e)},pe=e=>{s.handleUniSignalData(e)},fe=()=>{s.clearHoloSignal()},we=e=>{i==null||i.toggleTrafficInfo(e),s==null||s.toggleTrafficInfo(e)},Se=e=>{s==null||s.togglePause(e)},ye=e=>{i==null||i.toggleTrafficObject(e),s==null||s.toggleTrafficObject(e)},D=e=>{s==null||s.updatePanelContent(e)},he=async e=>(o||(o=new z.default(n)),o.addOverlays(e)),Ce=async e=>(S||(S=new ft.default(n)),S.addClusterPoints(e)),ve=()=>{S==null||S.removeAllClusterPoints()},be=e=>(o||(o=new z.default(n)),o.addMask(e)),Oe=()=>{o==null||o.removeMask()},ke=e=>o==null?void 0:o.removeOverlaysByType(e),Ae=e=>o==null?void 0:o.removeOverlaysById(e),De=()=>o==null?void 0:o.removeAllOverlays(),Le=()=>{o==null||o.showAllOverlays()},Te=e=>{w||(w=new bt.default(n)),w.updateQueueLength(e)},qe=()=>{w==null||w.removeQueueLength()},Be=async(e,d)=>(t||(t=new N.default(n)),await t.showOpenDriveFromServer(e,d)),Ve=async e=>(t||(t=new N.default(n)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),_e=e=>t?t.setOpendriveVisibility(e):{status:-1,message:"未加载OpenDrive地图"},Ie=async()=>await(t==null?void 0:t.clearOpenDrive()),Me=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},xe=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},Pe=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},Ne=async e=>t?t.selectComputable(e):{status:-1,message:"未加载OpenDrive地图"},ze=async e=>t?await t.geometrySearch(e):{status:-1,message:"未加载OpenDrive地图"},Ee=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},He=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},Ge=async()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},Ze=async e=>t?t==null?void 0:t.blockLane(e):{status:-1,message:"未加载OpenDrive地图"},We=e=>t?t==null?void 0:t.clearBlockLane(e):{status:-1,message:"未加载OpenDrive地图"},je=async e=>(a||(a=new B.default(n)),await a.showSignalControlArea(e)),Je=async e=>(a||(a=new B.default(n)),await a.showDistrict(e)),Qe=async e=>(a||(a=new B.default(n)),await a.showSubDistrict(e)),Ue=async()=>await(a==null?void 0:a.clearSignalControlArea()),Ke=e=>a==null?void 0:a.setLayerVisibility(e),Fe=async e=>a?await(a==null?void 0:a.locateSignalControlArea(e)):{status:-1,message:"未加载信号控制区"},Xe=async e=>a?await a.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Ye=()=>a?a.resetHighlight():{status:-1,message:"未加载信号控制区"},Re=e=>(u||(u=new Ot.default(n)),u.showSubSignalControlArea(e)),$e=e=>u?u.editSubSignalControlArea(e):{status:-1,message:"未加载信号控制区"},et=()=>u?u.stopEditSubSignalControlArea():{status:-1,message:"未加载信号控制区"},tt=e=>u?u.selectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},nt=e=>u?u.unselectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},at=e=>{if(!u)return{status:-1,message:"未加载信号控制区"}},st=e=>(f||(f=new kt.default(n)),f.showSignalCross(e)),rt=()=>f?f.clearSignalCross():{status:-1,message:"未加载信号路口"},ot=e=>f?f.changeShowName(e):{status:-1,message:"未加载信号路口"},it=e=>(p||(p=new P.default(n)),p.addGreenWaveBand(e)),ct=()=>{if(!p)return{status:-1,message:"未加载绿波带"};p.stopAddGreenWaveBand()},lt=async e=>(p||(p=new P.default(n)),await p.showGreenWaveBand(e)),ut=async e=>(y||(y=new vt.default(n)),await y.showJurisdiction(e)),dt=()=>{if(!y)return{status:-1,message:"未加载警务管辖区"};y.clearJurisdiction()},mt=async e=>(O||(O=new St.default(n)),await O.setEdpassLayerVisibility(e)),x=H,C=Z;return G({mapViewer:W,setLayerVisibility:R,setMapCenter:K,lookAt:Y,setMapCamera:F,setMapZoom:X,setMapZoomRange:te,requestCoordinateTransform:$,cancelCoordinateTransform:ee,addOverlays:he,addClusterPoints:Ce,removeAllClusterPoints:ve,addMask:be,removeMask:Oe,showAllOverlays:Le,removeOverlaysByType:ke,removeOverlaysById:Ae,removeAllOverlays:De,showLaneNumber:ne,clearLaneNumber:ae,initializeAreaTool:se,calCrossIndicatorArea:re,calRoadIndicatorArea:oe,connectCarFlow:ie,disconnectCarFlow:ce,handleHoloVehicleTraceData:le,clearHoloTrace:ue,initializeLampGroup:ge,handleUniSignalData:pe,handleHoloSignalData:me,clearHoloSignal:fe,setInterpolate:de,toggleTrafficInfo:we,toggleTrafficObject:ye,toggleVehicleInfo:D,togglePause:Se,updateQueueLength:Te,removeQueueLength:qe,showOpenDriveFromServer:Be,showOpenDriveFromFile:Ve,clearOpenDrive:Ie,setOpendriveVisibility:_e,geometrySearchInOpenDrive:ze,findSumoInOpenDrive:Me,selectSumoInOpenDrive:xe,unselectSumoInOpenDrive:Pe,selectComputableInOpenDrive:Ne,getSumoInfo:Ee,splitOpenDriveLane:He,clearSplitOpenDriveLane:Ge,blockOpenDriveLane:Ze,clearBlockOpenDriveLane:We,showSignalControlArea:je,showDistrictArea:Je,showSubDistrictArea:Qe,clearSignalControlArea:Ue,setSignalControlAreaVisibility:Ke,locateSignalControlArea:Fe,highlightSignalControlArea:Xe,resetHighlightSignalControlArea:Ye,showSubSignalControlArea:Re,editSubSignalControlArea:$e,stopEditSubSignalControlArea:et,selectSubSignalControlAreaCross:tt,unselectSubSignalControlAreaCross:nt,changeSubSignalControlAreaBorderVisibility:at,showSignalCross:st,clearSignalCross:rt,changeSignalCrossShowName:ot,addGreenWaveBand:it,stopAddGreenWaveBand:ct,showGreenWaveBand:lt,showPoliceArea:ut,clearPoliceArea:dt,setEdpassLayerVisibility:mt}),(e,d)=>(r.openBlock(),r.createElementBlock("div",Dt,[r.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:b},[r.withDirectives(r.createElementVNode("div",Lt,[r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:j}," 开始记录 "),r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:J}," 下载日志 "),r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:Q}," 显示车辆id "),r.createElementVNode("button",{onClick:U},"显示车辆号牌")],512),[[r.vShow,k.value]])],512),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(_,(c,v)=>(r.openBlock(),r.createBlock(ht.default,{key:v,"display-mode":c.displayMode,flash:c.flash,"road-id":c.crossId,"cross-id":c.roadId,"map-point":c.mapPoint,"stop-line":c.stopLine,position:c.position,rotation:c.rotation,scale:c.scale,"lamp-status":c.lampStatus},null,8,["display-mode","flash","road-id","cross-id","map-point","stop-line","position","rotation","scale","lamp-status"]))),128))]))}});exports.default=Tt;
@@ -176,6 +176,10 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
176
176
  status: number;
177
177
  message: string;
178
178
  };
179
+ changeSignalCrossShowName: (nameType: string) => void | {
180
+ status: number;
181
+ message: string;
182
+ };
179
183
  addGreenWaveBand: (params: import("../types").IEditSignalControlAreaParams) => void;
180
184
  stopAddGreenWaveBand: () => {
181
185
  status: number;
@@ -5,11 +5,13 @@ import { IResult, IShowSignalCrossParams } from 'packages/components/src/types';
5
5
  export default class SignalCrossController {
6
6
  private view;
7
7
  private crossLayer;
8
- private readonly symbolScale;
8
+ private readonly iconSymbolScale;
9
+ private readonly largeMarkerScale;
9
10
  private oldScale;
10
11
  private scaleWatchHandle;
11
12
  private showName;
12
13
  private showStyle;
14
+ private didCrossScaleThreshold;
13
15
  private readonly clusterRadius;
14
16
  private readonly minClusterPoints;
15
17
  private readonly maxClusterSymbolSize;
@@ -27,6 +29,15 @@ export default class SignalCrossController {
27
29
  */
28
30
  showSignalCross(params: IShowSignalCrossParams): IResult;
29
31
  clearSignalCross(): void;
32
+ /**
33
+ * 更改路口显示名称内容
34
+ * @param showName
35
+ */
36
+ changeShowName(showName: string): void;
37
+ /**
38
+ * 更新散点符号
39
+ */
40
+ private updateScatterSymbol;
30
41
  /**
31
42
  * 按照像素距离聚类
32
43
  * @param locations
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("@arcgis/core/geometry"),y=require("@arcgis/core/Graphic"),d=require("@arcgis/core/layers/GraphicsLayer");class b{constructor(e){this.symbolScale=6e3,this.oldScale=0,this.showName="signalId",this.showStyle="scatter",this.clusterRadius=120,this.minClusterPoints=2,this.maxClusterSymbolSize=50,this.minClusterSymbolSize=25,this.clusteredLocations=[],this.locations=[],this.view=e,this.crossLayer=new d({id:"signal-control-cross-layer",title:"信控路口图层"}),this.view.map.add(this.crossLayer)}locationToScreen(){this.clusteredLocations=[],this.locations.forEach(e=>{const t=this.view.toScreen(new h.Point({x:e.x,y:e.y}));t.x>0&&t.y>0&&(e.properties.screenX=t.x,e.properties.screenY=t.y,e.visited=!1,e.clusterId=void 0,this.clusteredLocations.push(e))})}showSignalCross(e){if(this.crossLayer.removeAll(),this.showName=e.showName||"signalId",this.showStyle=e.style||"scatter",this.scaleWatchHandle||(this.scaleWatchHandle=this.view.watch("stationary",()=>{if(this.showStyle==="scatter")(this.oldScale<this.symbolScale&&this.view.scale>=this.symbolScale||this.oldScale>=this.symbolScale&&this.view.scale<this.symbolScale)&&this.crossLayer.graphics.forEach(t=>{t.symbol=this.getCrossSymbol(t.attributes)}),this.oldScale=this.view.scale;else{this.locationToScreen();const t=this.doPixelCluster(this.clusterRadius);this.showClusterResult(t)}})),this.showStyle==="scatter"){const t=e.points.map(i=>{const s=this.getCrossSymbol(i),r=this.getBrandLabel(i.brand),o=this.getOnlineLabel(i.isOnline),n=this.getMalfunctionLabel(i.isMalfunction);return new y({geometry:{type:"point",longitude:i.x,latitude:i.y},symbol:s,attributes:{type:"signal-cross",id:i.crossId,brandLabel:r,isOnlineLabel:o,isMalfunctionLabel:n,...i}})});this.crossLayer.addMany(t)}else{this.locations=e.points.map(i=>({id:i.crossId,x:i.x,y:i.y,visited:!1,clusterId:void 0,properties:i})),this.locationToScreen();const t=this.doPixelCluster(this.clusterRadius);this.showClusterResult(t)}return{status:0,message:"ok"}}clearSignalCross(){var e;this.crossLayer.removeAll(),(e=this.scaleWatchHandle)==null||e.remove(),this.scaleWatchHandle=null}doPixelCluster(e){let t=0;for(let i=0;i<this.clusteredLocations.length;i++){const s=this.clusteredLocations[i];if(s.visited)continue;s.visited=!0;const r=this.getNeighbors(s,e);r.length<this.minClusterPoints?s.clusterId=-1:(r.forEach(o=>{o.visited=!0,o.clusterId=t}),s.clusterId=t,t++)}return this.createClusters()}getNeighbors(e,t){return this.clusteredLocations.filter(i=>i.id===e.id||i.visited?!1:this.getDistance(e,i)<=t)}getDistance(e,t){return Math.sqrt(Math.pow(e.properties.screenX-t.properties.screenX,2)+Math.pow(e.properties.screenY-t.properties.screenY,2))}createClusters(){const e={},t=[];for(const s of this.clusteredLocations)s.clusterId===void 0||s.clusterId===-1?t.push(s):(e[s.clusterId]||(e[s.clusterId]=[]),e[s.clusterId].push(s));const i=Object.keys(e).map((s,r)=>{const o=e[Number(s)],n=o.length,l=o.reduce((c,u)=>c+u.x,0),a=o.reduce((c,u)=>c+u.y,0),m=l/n,p=a/n;return{id:Number(s),items:o,count:n,center:{x:m,y:p}}});return t.length>0&&i.push({id:-1,items:t,count:t.length,center:null}),i}showClusterResult(e){this.crossLayer.removeAll();let t=Number.MIN_VALUE,i=Number.MAX_VALUE;e.forEach(s=>{s.count>1&&(i=Math.min(i,s.count),t=Math.max(t,s.count))}),e.forEach(s=>{if(s.id!==-1){let r=i===t?(this.maxClusterSymbolSize+this.minClusterSymbolSize)/2:this.minClusterSymbolSize+(s.count-i)/(t-i)*(this.maxClusterSymbolSize-this.minClusterSymbolSize);r*=.75;const l=(s.count.toString().length*8+6)/2,a=new y({geometry:new h.Point({x:s.center.x,y:s.center.y}),attributes:{count:s.count},symbol:{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:"$feature.count",returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:r,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[-l,40],[l,40],[l,20],[-l,20],[-l,40]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[2,72,200,255]},{type:"CIMSolidStroke",enable:!0,width:5,color:[2,72,200,128]}]}},{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:16,horizontalAlignment:"Center",offsetX:0,offsetY:30,symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:r,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}}});this.crossLayer.add(a)}else s.items.forEach(r=>{const o=new y({geometry:new h.Point({x:r.x,y:r.y}),attributes:{...r,...r.properties,type:"signal-cross",id:r.id},symbol:this.getCrossSymbol(r.properties)});this.crossLayer.add(o)})})}getBrandLabel(e){const t=(e??"").toLowerCase();return t==="scats"?"SCATS":t==="gc"?"国产":e??""}getOnlineLabel(e){return e?"在线":"离线"}getMalfunctionLabel(e){return e?"故障":"正常"}getCrossSymbol(e){if(this.view.scale<=this.symbolScale){let t="/GisViewerAssets/Images/cross/ic_";return t+=e.brand==="scats"?"scats_":"gc_",t+=e.isOnline?"online_":"offline_",t+=e.isMalfunction?"malfunction.png":"normal.png",{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:this.showName==="signalId"?'Replace($feature.name, "与", "/") + " " + $feature.signalId':'Replace($feature.name, "与", "/") + " " + $feature.crossId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:25,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:20,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:20,rotateClockwise:!0,textureFilter:"Picture",url:t}]}}}}else{const t={type:"simple-marker",style:"circle",size:6,outline:{width:0}};return e.brand.toLowerCase()==="scats"?(e.isOnline?t.color=[23,169,100]:t.color=[202,202,202],t.outline.color=[23,169,100]):e.isOnline?t.color=[33,240,142]:t.color=[202,202,202],t}}}exports.default=b;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("@arcgis/core/geometry"),y=require("@arcgis/core/Graphic"),p=require("@arcgis/core/layers/GraphicsLayer");class S{constructor(e){this.iconSymbolScale=1e4,this.largeMarkerScale=4e4,this.oldScale=0,this.showName="detail",this.showStyle="scatter",this.clusterRadius=120,this.minClusterPoints=2,this.maxClusterSymbolSize=50,this.minClusterSymbolSize=25,this.clusteredLocations=[],this.locations=[],this.view=e,this.crossLayer=new p({id:"signal-control-cross-layer",title:"信控路口图层"}),this.view.map.add(this.crossLayer)}didCrossScaleThreshold(e,s,t){return e<t&&s>=t||e>=t&&s<t}locationToScreen(){this.clusteredLocations=[],this.locations.forEach(e=>{const s=this.view.toScreen(new u.Point({x:e.x,y:e.y}));s.x>0&&s.y>0&&(e.properties.screenX=s.x,e.properties.screenY=s.y,e.visited=!1,e.clusterId=void 0,this.clusteredLocations.push(e))})}showSignalCross(e){if(this.crossLayer.removeAll(),this.showName=e.showName||"detail",this.showStyle=e.style||"scatter",this.oldScale=this.view.scale,this.scaleWatchHandle||(this.scaleWatchHandle=this.view.watch("stationary",()=>{if(this.showStyle==="scatter"){const s=this.view.scale,t=this.didCrossScaleThreshold(this.oldScale,s,this.iconSymbolScale),i=this.didCrossScaleThreshold(this.oldScale,s,this.largeMarkerScale);(t||i)&&this.updateScatterSymbol(),this.oldScale=s}else{this.locationToScreen();const s=this.doPixelCluster(this.clusterRadius);this.showClusterResult(s)}})),this.showStyle==="scatter"){const s=e.points.map(t=>{const i=this.getCrossSymbol(t),r=this.getBrandLabel(t.brand),o=this.getOnlineLabel(t.isOnline),n=this.getMalfunctionLabel(t.isMalfunction);return new y({geometry:{type:"point",longitude:t.x,latitude:t.y},symbol:i,attributes:{type:"signal-cross",id:t.crossId,brandLabel:r,isOnlineLabel:o,isMalfunctionLabel:n,...t}})});this.crossLayer.addMany(s)}else{this.locations=e.points.map(t=>({id:t.crossId,x:t.x,y:t.y,visited:!1,clusterId:void 0,properties:t})),this.locationToScreen();const s=this.doPixelCluster(this.clusterRadius);this.showClusterResult(s)}return{status:0,message:"ok"}}clearSignalCross(){var e;this.crossLayer.removeAll(),(e=this.scaleWatchHandle)==null||e.remove(),this.scaleWatchHandle=null}changeShowName(e){this.showName=e,this.showStyle==="scatter"&&this.updateScatterSymbol()}updateScatterSymbol(){this.crossLayer.graphics.forEach(e=>{e.symbol=this.getCrossSymbol(e.attributes)})}doPixelCluster(e){let s=0;for(let t=0;t<this.clusteredLocations.length;t++){const i=this.clusteredLocations[t];if(i.visited)continue;i.visited=!0;const r=this.getNeighbors(i,e);r.length<this.minClusterPoints?i.clusterId=-1:(r.forEach(o=>{o.visited=!0,o.clusterId=s}),i.clusterId=s,s++)}return this.createClusters()}getNeighbors(e,s){return this.clusteredLocations.filter(t=>t.id===e.id||t.visited?!1:this.getDistance(e,t)<=s)}getDistance(e,s){return Math.sqrt(Math.pow(e.properties.screenX-s.properties.screenX,2)+Math.pow(e.properties.screenY-s.properties.screenY,2))}createClusters(){const e={},s=[];for(const i of this.clusteredLocations)i.clusterId===void 0||i.clusterId===-1?s.push(i):(e[i.clusterId]||(e[i.clusterId]=[]),e[i.clusterId].push(i));const t=Object.keys(e).map((i,r)=>{const o=e[Number(i)],n=o.length,l=o.reduce((c,h)=>c+h.x,0),a=o.reduce((c,h)=>c+h.y,0),m=l/n,d=a/n;return{id:Number(i),items:o,count:n,center:{x:m,y:d}}});return s.length>0&&t.push({id:-1,items:s,count:s.length,center:null}),t}showClusterResult(e){this.crossLayer.removeAll();let s=Number.MIN_VALUE,t=Number.MAX_VALUE;e.forEach(i=>{i.count>1&&(t=Math.min(t,i.count),s=Math.max(s,i.count))}),e.forEach(i=>{if(i.id!==-1){let r=t===s?(this.maxClusterSymbolSize+this.minClusterSymbolSize)/2:this.minClusterSymbolSize+(i.count-t)/(s-t)*(this.maxClusterSymbolSize-this.minClusterSymbolSize);r*=.75;const l=(i.count.toString().length*8+6)/2,a=new y({geometry:new u.Point({x:i.center.x,y:i.center.y}),attributes:{count:i.count},symbol:{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:"$feature.count",returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:r,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[-l,40],[l,40],[l,20],[-l,20],[-l,40]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[2,72,200,255]},{type:"CIMSolidStroke",enable:!0,width:5,color:[2,72,200,128]}]}},{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:16,horizontalAlignment:"Center",offsetX:0,offsetY:30,symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:r,rotateClockwise:!0,textureFilter:"Picture",url:"/GisViewerAssets/Images/cross/gis_xhj_blue.png"}]}}}});this.crossLayer.add(a)}else i.items.forEach(r=>{const o=new y({geometry:new u.Point({x:r.x,y:r.y}),attributes:{...r,...r.properties,type:"signal-cross",id:r.id},symbol:this.getCrossSymbol(r.properties)});this.crossLayer.add(o)})})}getBrandLabel(e){const s=(e??"").toLowerCase();return s==="scats"?"SCATS":s==="gc"?"国产":e??""}getOnlineLabel(e){return e?"在线":"离线"}getMalfunctionLabel(e){return e?"故障":"正常"}getCrossSymbol(e){var s;if(this.view.scale<=this.iconSymbolScale){let t="/GisViewerAssets/Images/cross/ic_";return t+=e.brand==="scats"?"scats_":"gc_",t+=e.isOnline?"online_":"offline_",t+=e.isMalfunction?"malfunction.png":"normal.png",{type:"cim",data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textGraphic",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:this.showName==="crossName"?'Replace($feature.name, "与", "/")':this.showName==="signalId"?"$feature.signalId":'Replace($feature.name, "与", "/") + " " + $feature.signalId',returnType:"Default"}}],symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",size:25,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",primitiveName:"textGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",height:12,horizontalAlignment:"Center",offsetX:0,offsetY:20,haloSize:1,haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[0,0,0,255]}]},verticalAlignment:"Center"},textString:""}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMPictureMarker",enable:!0,anchorPoint:{x:0,y:0},anchorPointUnits:"Relative",size:20,rotateClockwise:!0,textureFilter:"Picture",url:t}]}}}}else{const t={type:"simple-marker",style:"circle",size:this.view.scale>this.largeMarkerScale?3:6,outline:{width:0}};return((s=e.brand)==null?void 0:s.toLowerCase())==="scats"?(e.isOnline?t.color=[104,203,188]:t.color=[120,131,81],t.outline.color=[104,203,188]):(e.isOnline?t.color=[201,226,73]:t.color=[120,131,81],t.outline.color=[201,226,73]),t}}}exports.default=S;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gisviewer-vue3-arcgis",
3
- "version": "1.0.269",
3
+ "version": "1.0.270",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [