gisviewer-vue3-arcgis 1.0.268 → 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,23 @@ 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;
10
+ private oldScale;
9
11
  private scaleWatchHandle;
10
12
  private showName;
11
13
  private showStyle;
14
+ private didCrossScaleThreshold;
15
+ private readonly clusterRadius;
16
+ private readonly minClusterPoints;
17
+ private readonly maxClusterSymbolSize;
18
+ private readonly minClusterSymbolSize;
19
+ /** 需要进行聚合的点位,一般为当前屏幕范围内的点位 */
20
+ private clusteredLocations;
21
+ /** 所有路口点位 */
22
+ private locations;
12
23
  constructor(view: __esri.MapView | __esri.SceneView);
24
+ private locationToScreen;
13
25
  /**
14
26
  * 显示信控路口
15
27
  * @param params
@@ -17,6 +29,45 @@ export default class SignalCrossController {
17
29
  */
18
30
  showSignalCross(params: IShowSignalCrossParams): IResult;
19
31
  clearSignalCross(): void;
32
+ /**
33
+ * 更改路口显示名称内容
34
+ * @param showName
35
+ */
36
+ changeShowName(showName: string): void;
37
+ /**
38
+ * 更新散点符号
39
+ */
40
+ private updateScatterSymbol;
41
+ /**
42
+ * 按照像素距离聚类
43
+ * @param locations
44
+ * @param eps
45
+ * @param minPoints
46
+ * @returns
47
+ */
48
+ private doPixelCluster;
49
+ /**
50
+ * 获取邻居点
51
+ * @param locations
52
+ * @param index
53
+ * @param eps
54
+ * @returns
55
+ */
56
+ private getNeighbors;
57
+ /**
58
+ * 两点间的像素距离
59
+ * @param point1
60
+ * @param point2
61
+ * @returns
62
+ */
63
+ private getDistance;
64
+ /**
65
+ * 从聚类结果中创建聚类对象
66
+ * @param locations
67
+ * @returns
68
+ */
69
+ private createClusters;
70
+ private showClusterResult;
20
71
  private getBrandLabel;
21
72
  private getOnlineLabel;
22
73
  private getMalfunctionLabel;
@@ -1,76 +1,81 @@
1
- import o from "@arcgis/core/Graphic";
2
- import n from "@arcgis/core/layers/GraphicsLayer";
3
- class b {
1
+ import { Point as u } from "@arcgis/core/geometry";
2
+ import y from "@arcgis/core/Graphic";
3
+ import p from "@arcgis/core/layers/GraphicsLayer";
4
+ class C {
4
5
  constructor(e) {
5
- this.symbolScale = 6e3, this.showName = "signalId", this.showStyle = "scatter", this.view = e, this.crossLayer = new n({
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({
6
7
  id: "signal-control-cross-layer",
7
8
  title: "信控路口图层"
8
9
  }), this.view.map.add(this.crossLayer);
9
10
  }
11
+ didCrossScaleThreshold(e, s, t) {
12
+ return e < t && s >= t || e >= t && s < t;
13
+ }
14
+ locationToScreen() {
15
+ this.clusteredLocations = [], this.locations.forEach((e) => {
16
+ const s = this.view.toScreen(
17
+ new u({ x: e.x, y: e.y })
18
+ );
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));
20
+ });
21
+ }
10
22
  /**
11
23
  * 显示信控路口
12
24
  * @param params
13
25
  * @returns
14
26
  */
15
27
  showSignalCross(e) {
16
- if (this.crossLayer.removeAll(), this.showName = e.showName || "signalId", this.showStyle = e.style || "scatter", this.scaleWatchHandle || (this.scaleWatchHandle = this.view.watch("scale", (t, i) => {
17
- (t <= this.symbolScale && i > this.symbolScale || t > this.symbolScale && i <= this.symbolScale) && this.crossLayer.graphics.forEach((l) => {
18
- const s = l.attributes;
19
- l.symbol = this.getCrossSymbol(s);
20
- });
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 {
41
+ this.locationToScreen();
42
+ const s = this.doPixelCluster(this.clusterRadius);
43
+ this.showClusterResult(s);
44
+ }
21
45
  })), this.showStyle === "scatter") {
22
- const t = e.points.map((i) => {
23
- const l = this.getCrossSymbol(i), s = this.getBrandLabel(i.brand), a = this.getOnlineLabel(i.isOnline), r = this.getMalfunctionLabel(
24
- 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
25
49
  );
26
- return new o({
50
+ return new y({
27
51
  geometry: {
28
52
  type: "point",
29
- longitude: i.x,
30
- latitude: i.y
53
+ longitude: t.x,
54
+ latitude: t.y
31
55
  },
32
- symbol: l,
56
+ symbol: i,
33
57
  attributes: {
34
58
  type: "signal-cross",
35
- id: i.crossId,
36
- brandLabel: s,
37
- isOnlineLabel: a,
38
- isMalfunctionLabel: r,
39
- ...i
40
- },
41
- popupTemplate: {
42
- title: "{name}信号机",
43
- content: [
44
- {
45
- type: "fields",
46
- fieldInfos: [
47
- {
48
- fieldName: "signalId",
49
- label: "信号机编号"
50
- },
51
- {
52
- fieldName: "crossId",
53
- label: "路口编号"
54
- },
55
- {
56
- fieldName: "brandLabel",
57
- label: "品牌"
58
- },
59
- {
60
- fieldName: "isOnlineLabel",
61
- label: "是否在线"
62
- },
63
- {
64
- fieldName: "isMalfunctionLabel",
65
- label: "是否故障"
66
- }
67
- ]
68
- }
69
- ]
59
+ id: t.crossId,
60
+ brandLabel: r,
61
+ isOnlineLabel: o,
62
+ isMalfunctionLabel: a,
63
+ ...t
70
64
  }
71
65
  });
72
66
  });
73
- this.crossLayer.addMany(t);
67
+ this.crossLayer.addMany(s);
68
+ } else {
69
+ this.locations = e.points.map((t) => ({
70
+ id: t.crossId,
71
+ x: t.x,
72
+ y: t.y,
73
+ visited: !1,
74
+ clusterId: void 0,
75
+ properties: t
76
+ })), this.locationToScreen();
77
+ const s = this.doPixelCluster(this.clusterRadius);
78
+ this.showClusterResult(s);
74
79
  }
75
80
  return { status: 0, message: "ok" };
76
81
  }
@@ -78,9 +83,233 @@ class b {
78
83
  var e;
79
84
  this.crossLayer.removeAll(), (e = this.scaleWatchHandle) == null || e.remove(), this.scaleWatchHandle = null;
80
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
+ }
101
+ /**
102
+ * 按照像素距离聚类
103
+ * @param locations
104
+ * @param eps
105
+ * @param minPoints
106
+ * @returns
107
+ */
108
+ doPixelCluster(e) {
109
+ let s = 0;
110
+ for (let t = 0; t < this.clusteredLocations.length; t++) {
111
+ const i = this.clusteredLocations[t];
112
+ if (i.visited)
113
+ continue;
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++);
119
+ }
120
+ return this.createClusters();
121
+ }
122
+ /**
123
+ * 获取邻居点
124
+ * @param locations
125
+ * @param index
126
+ * @param eps
127
+ * @returns
128
+ */
129
+ getNeighbors(e, s) {
130
+ return this.clusteredLocations.filter((t) => t.id === e.id || t.visited ? !1 : this.getDistance(e, t) <= s);
131
+ }
132
+ /**
133
+ * 两点间的像素距离
134
+ * @param point1
135
+ * @param point2
136
+ * @returns
137
+ */
138
+ getDistance(e, s) {
139
+ return Math.sqrt(
140
+ Math.pow(e.properties.screenX - s.properties.screenX, 2) + Math.pow(e.properties.screenY - s.properties.screenY, 2)
141
+ );
142
+ }
143
+ /**
144
+ * 从聚类结果中创建聚类对象
145
+ * @param locations
146
+ * @returns
147
+ */
148
+ createClusters() {
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;
154
+ return {
155
+ id: Number(i),
156
+ items: o,
157
+ count: a,
158
+ center: {
159
+ x: m,
160
+ y: d
161
+ }
162
+ };
163
+ });
164
+ return s.length > 0 && t.push({
165
+ id: -1,
166
+ items: s,
167
+ count: s.length,
168
+ center: null
169
+ }), t;
170
+ }
171
+ showClusterResult(e) {
172
+ this.crossLayer.removeAll();
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);
179
+ r *= 0.75;
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 }),
182
+ attributes: {
183
+ count: i.count
184
+ },
185
+ symbol: {
186
+ type: "cim",
187
+ data: {
188
+ type: "CIMSymbolReference",
189
+ primitiveOverrides: [
190
+ {
191
+ // 将textGraphic的TextString替换为graphic.attributes.name
192
+ type: "CIMPrimitiveOverride",
193
+ primitiveName: "textGraphic",
194
+ propertyName: "TextString",
195
+ valueExpressionInfo: {
196
+ type: "CIMExpressionInfo",
197
+ title: "Custom",
198
+ expression: "$feature.count",
199
+ returnType: "Default"
200
+ }
201
+ }
202
+ ],
203
+ symbol: {
204
+ type: "CIMPointSymbol",
205
+ symbolLayers: [
206
+ // 聚合数量
207
+ {
208
+ type: "CIMVectorMarker",
209
+ size: r,
210
+ colorLocked: !0,
211
+ anchorPointUnits: "Relative",
212
+ frame: { xmin: -16, ymin: -16, xmax: 16, ymax: 16 },
213
+ markerGraphics: [
214
+ // 数量文本框
215
+ {
216
+ type: "CIMMarkerGraphic",
217
+ geometry: {
218
+ rings: [
219
+ [
220
+ [-l, 40],
221
+ [l, 40],
222
+ [l, 20],
223
+ [-l, 20],
224
+ [-l, 40]
225
+ ]
226
+ ]
227
+ },
228
+ symbol: {
229
+ type: "CIMPolygonSymbol",
230
+ symbolLayers: [
231
+ {
232
+ type: "CIMSolidFill",
233
+ enable: !0,
234
+ color: [2, 72, 200, 255]
235
+ },
236
+ {
237
+ type: "CIMSolidStroke",
238
+ enable: !0,
239
+ width: 5,
240
+ color: [2, 72, 200, 128]
241
+ }
242
+ ]
243
+ }
244
+ },
245
+ // 数量文字
246
+ {
247
+ type: "CIMMarkerGraphic",
248
+ primitiveName: "textGraphic",
249
+ geometry: { x: 0, y: 0 },
250
+ symbol: {
251
+ type: "CIMTextSymbol",
252
+ height: 16,
253
+ horizontalAlignment: "Center",
254
+ offsetX: 0,
255
+ offsetY: 30,
256
+ symbol: {
257
+ type: "CIMPolygonSymbol",
258
+ symbolLayers: [
259
+ {
260
+ type: "CIMSolidFill",
261
+ enable: !0,
262
+ color: [255, 255, 255, 255]
263
+ }
264
+ ]
265
+ },
266
+ verticalAlignment: "Center"
267
+ },
268
+ textString: ""
269
+ }
270
+ ],
271
+ scaleSymbolsProportionally: !0,
272
+ respectFrame: !0
273
+ },
274
+ // 聚合图标
275
+ {
276
+ type: "CIMPictureMarker",
277
+ enable: !0,
278
+ anchorPoint: {
279
+ x: 0,
280
+ y: 0
281
+ },
282
+ anchorPointUnits: "Relative",
283
+ size: r,
284
+ rotateClockwise: !0,
285
+ textureFilter: "Picture",
286
+ url: "/GisViewerAssets/Images/cross/gis_xhj_blue.png"
287
+ }
288
+ ]
289
+ }
290
+ }
291
+ }
292
+ });
293
+ this.crossLayer.add(n);
294
+ } else
295
+ i.items.forEach((r) => {
296
+ const o = new y({
297
+ geometry: new u({ x: r.x, y: r.y }),
298
+ attributes: {
299
+ ...r,
300
+ ...r.properties,
301
+ type: "signal-cross",
302
+ id: r.id
303
+ },
304
+ symbol: this.getCrossSymbol(r.properties)
305
+ });
306
+ this.crossLayer.add(o);
307
+ });
308
+ });
309
+ }
81
310
  getBrandLabel(e) {
82
- const t = (e ?? "").toLowerCase();
83
- return t === "scats" ? "SCATS" : t === "gc" ? "国产" : e ?? "";
311
+ const s = (e ?? "").toLowerCase();
312
+ return s === "scats" ? "SCATS" : s === "gc" ? "国产" : e ?? "";
84
313
  }
85
314
  getOnlineLabel(e) {
86
315
  return e ? "在线" : "离线";
@@ -89,7 +318,8 @@ class b {
89
318
  return e ? "故障" : "正常";
90
319
  }
91
320
  getCrossSymbol(e) {
92
- if (this.view.scale <= this.symbolScale) {
321
+ var s;
322
+ if (this.view.scale <= this.iconSymbolScale) {
93
323
  let t = "/GisViewerAssets/Images/cross/ic_";
94
324
  return t += e.brand === "scats" ? "scats_" : "gc_", t += e.isOnline ? "online_" : "offline_", t += e.isMalfunction ? "malfunction.png" : "normal.png", {
95
325
  type: "cim",
@@ -104,7 +334,7 @@ class b {
104
334
  valueExpressionInfo: {
105
335
  type: "CIMExpressionInfo",
106
336
  title: "Custom",
107
- 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',
108
338
  returnType: "Default"
109
339
  }
110
340
  }
@@ -181,13 +411,13 @@ class b {
181
411
  const t = {
182
412
  type: "simple-marker",
183
413
  style: "circle",
184
- size: 6,
414
+ size: this.view.scale > this.largeMarkerScale ? 3 : 6,
185
415
  outline: { width: 0 }
186
416
  };
187
- 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;
188
418
  }
189
419
  }
190
420
  }
191
421
  export {
192
- b as default
422
+ C as default
193
423
  };
@@ -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,23 @@ 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;
10
+ private oldScale;
9
11
  private scaleWatchHandle;
10
12
  private showName;
11
13
  private showStyle;
14
+ private didCrossScaleThreshold;
15
+ private readonly clusterRadius;
16
+ private readonly minClusterPoints;
17
+ private readonly maxClusterSymbolSize;
18
+ private readonly minClusterSymbolSize;
19
+ /** 需要进行聚合的点位,一般为当前屏幕范围内的点位 */
20
+ private clusteredLocations;
21
+ /** 所有路口点位 */
22
+ private locations;
12
23
  constructor(view: __esri.MapView | __esri.SceneView);
24
+ private locationToScreen;
13
25
  /**
14
26
  * 显示信控路口
15
27
  * @param params
@@ -17,6 +29,45 @@ export default class SignalCrossController {
17
29
  */
18
30
  showSignalCross(params: IShowSignalCrossParams): IResult;
19
31
  clearSignalCross(): void;
32
+ /**
33
+ * 更改路口显示名称内容
34
+ * @param showName
35
+ */
36
+ changeShowName(showName: string): void;
37
+ /**
38
+ * 更新散点符号
39
+ */
40
+ private updateScatterSymbol;
41
+ /**
42
+ * 按照像素距离聚类
43
+ * @param locations
44
+ * @param eps
45
+ * @param minPoints
46
+ * @returns
47
+ */
48
+ private doPixelCluster;
49
+ /**
50
+ * 获取邻居点
51
+ * @param locations
52
+ * @param index
53
+ * @param eps
54
+ * @returns
55
+ */
56
+ private getNeighbors;
57
+ /**
58
+ * 两点间的像素距离
59
+ * @param point1
60
+ * @param point2
61
+ * @returns
62
+ */
63
+ private getDistance;
64
+ /**
65
+ * 从聚类结果中创建聚类对象
66
+ * @param locations
67
+ * @returns
68
+ */
69
+ private createClusters;
70
+ private showClusterResult;
20
71
  private getBrandLabel;
21
72
  private getOnlineLabel;
22
73
  private getMalfunctionLabel;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("@arcgis/core/Graphic"),n=require("@arcgis/core/layers/GraphicsLayer");class c{constructor(e){this.symbolScale=6e3,this.showName="signalId",this.showStyle="scatter",this.view=e,this.crossLayer=new n({id:"signal-control-cross-layer",title:"信控路口图层"}),this.view.map.add(this.crossLayer)}showSignalCross(e){if(this.crossLayer.removeAll(),this.showName=e.showName||"signalId",this.showStyle=e.style||"scatter",this.scaleWatchHandle||(this.scaleWatchHandle=this.view.watch("scale",(t,i)=>{(t<=this.symbolScale&&i>this.symbolScale||t>this.symbolScale&&i<=this.symbolScale)&&this.crossLayer.graphics.forEach(l=>{const s=l.attributes;l.symbol=this.getCrossSymbol(s)})})),this.showStyle==="scatter"){const t=e.points.map(i=>{const l=this.getCrossSymbol(i),s=this.getBrandLabel(i.brand),a=this.getOnlineLabel(i.isOnline),r=this.getMalfunctionLabel(i.isMalfunction);return new o({geometry:{type:"point",longitude:i.x,latitude:i.y},symbol:l,attributes:{type:"signal-cross",id:i.crossId,brandLabel:s,isOnlineLabel:a,isMalfunctionLabel:r,...i},popupTemplate:{title:"{name}信号机",content:[{type:"fields",fieldInfos:[{fieldName:"signalId",label:"信号机编号"},{fieldName:"crossId",label:"路口编号"},{fieldName:"brandLabel",label:"品牌"},{fieldName:"isOnlineLabel",label:"是否在线"},{fieldName:"isMalfunctionLabel",label:"是否故障"}]}]}})});this.crossLayer.addMany(t)}return{status:0,message:"ok"}}clearSignalCross(){var e;this.crossLayer.removeAll(),(e=this.scaleWatchHandle)==null||e.remove(),this.scaleWatchHandle=null}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=c;
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.268",
3
+ "version": "1.0.270",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [