gisviewer-vue3-arcgis 1.0.262 → 1.0.264

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.
@@ -1,20 +1,29 @@
1
+ import { IFindSignalControlAreaParams } from 'packages/components/src/types';
1
2
  import DistrictController from './district-controller';
2
3
  export default class CrossRenderer {
3
4
  private view;
4
5
  private crossLayer;
5
6
  private crossGraphicSymbol;
6
7
  private locations;
8
+ private clusteredLocations;
9
+ private filteredLocations;
7
10
  private currentShowMode;
8
11
  private zoomWatchHandle;
9
12
  private symbolScale;
10
- private currentZoom;
13
+ private oldScale;
11
14
  private readonly clusterRadius;
12
15
  private readonly minClusterPoints;
13
16
  private readonly maxClusterSymbolSize;
14
17
  private readonly minClusterSymbolSize;
15
18
  constructor(view: __esri.MapView | __esri.SceneView);
16
19
  addCrosses(controllers: DistrictController[]): Promise<void>;
20
+ /**
21
+ * 清除所有路口
22
+ */
17
23
  clearCrosses(): void;
24
+ /**
25
+ * 更新散点符号
26
+ */
18
27
  private updateScatterSymbol;
19
28
  /**
20
29
  * 将地理位置转换为屏幕坐标
@@ -29,7 +38,13 @@ export default class CrossRenderer {
29
38
  */
30
39
  showScatter(): void;
31
40
  /**
32
- * 确定路口符号
41
+ * 隐藏路口
42
+ */
43
+ hideCrosses(): void;
44
+ filter(params: IFindSignalControlAreaParams): void;
45
+ resetFilter(): void;
46
+ /**
47
+ * 根据当前比例尺更新路口符号
33
48
  * @param attributes
34
49
  * @returns
35
50
  */
@@ -1,7 +1,7 @@
1
- import { Point as y } from "@arcgis/core/geometry";
1
+ import { Point as h } from "@arcgis/core/geometry";
2
2
  import u from "@arcgis/core/Graphic";
3
- import b from "@arcgis/core/layers/GraphicsLayer";
4
- class f {
3
+ import d from "@arcgis/core/layers/GraphicsLayer";
4
+ class C {
5
5
  constructor(e) {
6
6
  this.crossGraphicSymbol = {
7
7
  type: "cim",
@@ -85,7 +85,7 @@ class f {
85
85
  ]
86
86
  }
87
87
  }
88
- }, this.locations = [], this.currentShowMode = "scatter", this.symbolScale = 5e3, this.currentZoom = 0, this.clusterRadius = 120, this.minClusterPoints = 2, this.maxClusterSymbolSize = 50, this.minClusterSymbolSize = 25, this.view = e, this.crossLayer = new b(), this.view.map.add(this.crossLayer), this.currentZoom = e.zoom;
88
+ }, this.locations = [], this.clusteredLocations = [], this.filteredLocations = [], this.currentShowMode = "scatter", this.symbolScale = 5e3, this.oldScale = 0, this.clusterRadius = 120, this.minClusterPoints = 2, this.maxClusterSymbolSize = 50, this.minClusterSymbolSize = 25, this.view = e, this.crossLayer = new d(), this.view.map.add(this.crossLayer), this.oldScale = e.scale;
89
89
  }
90
90
  async addCrosses(e) {
91
91
  e.forEach((t) => {
@@ -95,8 +95,13 @@ class f {
95
95
  x: r.longitude,
96
96
  y: r.latitude,
97
97
  visited: !1,
98
+ filtered: !1,
98
99
  clusterId: void 0,
99
- properties: r
100
+ properties: {
101
+ ...r,
102
+ districtId: t.id,
103
+ subDistrictId: ""
104
+ }
100
105
  });
101
106
  }), t.subDistricts.forEach((r) => {
102
107
  r.signals.forEach((s) => {
@@ -105,31 +110,38 @@ class f {
105
110
  x: s.longitude,
106
111
  y: s.latitude,
107
112
  visited: !1,
113
+ filtered: !1,
108
114
  clusterId: void 0,
109
- properties: s
115
+ properties: {
116
+ ...s,
117
+ districtId: t.id,
118
+ subDistrictId: r.id
119
+ }
110
120
  });
111
121
  });
112
122
  });
113
- }), this.zoomWatchHandle = this.view.watch(
114
- "scale",
115
- (t, r) => {
123
+ }), this.zoomWatchHandle = this.view.watch("stationary", () => {
124
+ if (this.view.stationary !== !1) {
116
125
  if (this.currentShowMode === "scatter")
117
- (t < this.symbolScale && r >= this.symbolScale || t >= this.symbolScale && r < this.symbolScale) && (console.log("Scale changed, updating cross display symbol"), this.updateScatterSymbol());
118
- else if (this.currentShowMode === "cluster" && Math.abs(this.view.zoom - this.currentZoom) >= 1) {
119
- this.currentZoom = this.view.zoom, this.locationToScreen(), console.time("cluster");
120
- const s = this.doPixelCluster(
121
- this.clusterRadius,
122
- this.minClusterPoints
123
- );
124
- console.timeEnd("cluster"), this.showClusterResult(s);
126
+ (this.oldScale < this.symbolScale && this.view.scale >= this.symbolScale || this.oldScale >= this.symbolScale && this.view.scale < this.symbolScale) && this.updateScatterSymbol(), this.oldScale = this.view.scale;
127
+ else if (this.currentShowMode === "cluster") {
128
+ this.locationToScreen(), console.time("cluster");
129
+ const t = this.doPixelCluster(this.clusterRadius);
130
+ console.timeEnd("cluster"), this.showClusterResult(t);
125
131
  }
126
132
  }
127
- );
133
+ });
128
134
  }
135
+ /**
136
+ * 清除所有路口
137
+ */
129
138
  clearCrosses() {
130
139
  var e;
131
- console.log("Clearing crosses"), this.crossLayer.removeAll(), this.locations = [], (e = this.zoomWatchHandle) == null || e.remove();
140
+ console.log("Clearing crosses"), this.crossLayer.removeAll(), this.locations = [], this.clusteredLocations = [], (e = this.zoomWatchHandle) == null || e.remove();
132
141
  }
142
+ /**
143
+ * 更新散点符号
144
+ */
133
145
  updateScatterSymbol() {
134
146
  this.crossLayer.graphics.forEach((e) => {
135
147
  e.symbol = this.getCrossSymbol(e.attributes);
@@ -139,11 +151,11 @@ class f {
139
151
  * 将地理位置转换为屏幕坐标
140
152
  */
141
153
  locationToScreen() {
142
- this.locations.forEach((e) => {
154
+ this.clusteredLocations = [], this.locations.forEach((e) => {
143
155
  const t = this.view.toScreen(
144
- new y({ x: e.x, y: e.y })
156
+ new h({ x: e.x, y: e.y })
145
157
  );
146
- e.properties.screenX = t.x, e.properties.screenY = t.y;
158
+ e.filtered === !1 && 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));
147
159
  });
148
160
  }
149
161
  /**
@@ -151,10 +163,7 @@ class f {
151
163
  */
152
164
  showCluster() {
153
165
  this.crossLayer.removeAll(), this.currentShowMode = "cluster", this.locationToScreen();
154
- const e = this.doPixelCluster(
155
- this.clusterRadius,
156
- this.minClusterPoints
157
- );
166
+ const e = this.doPixelCluster(this.clusterRadius);
158
167
  this.showClusterResult(e);
159
168
  }
160
169
  /**
@@ -162,19 +171,45 @@ class f {
162
171
  */
163
172
  showScatter() {
164
173
  this.crossLayer.removeAll(), this.currentShowMode = "scatter";
165
- const e = this.locations.map((t) => new u({
166
- geometry: {
167
- type: "point",
168
- longitude: t.x,
169
- latitude: t.y
170
- },
171
- symbol: this.getCrossSymbol(t.properties),
172
- attributes: t.properties
173
- }));
174
- this.crossLayer.addMany(e);
174
+ const e = [];
175
+ this.locations.forEach((t) => {
176
+ if (!t.filtered) {
177
+ const r = new u({
178
+ geometry: {
179
+ type: "point",
180
+ longitude: t.x,
181
+ latitude: t.y
182
+ },
183
+ symbol: this.getCrossSymbol(t.properties),
184
+ attributes: t.properties
185
+ });
186
+ e.push(r);
187
+ }
188
+ }), this.crossLayer.addMany(e);
189
+ }
190
+ /**
191
+ * 隐藏路口
192
+ */
193
+ hideCrosses() {
194
+ this.crossLayer.removeAll();
195
+ }
196
+ filter(e) {
197
+ this.locations.forEach((t) => {
198
+ if (e.type === "district")
199
+ t.filtered = t.properties.districtId === e.id;
200
+ else if (e.type === "subDistrict")
201
+ t.filtered = t.properties.subDistrictId === e.id;
202
+ else if (e.type === "signal" && (t.filtered = t.id === e.id, t.filtered))
203
+ return t.properties;
204
+ });
205
+ }
206
+ resetFilter() {
207
+ this.locations.forEach((e) => {
208
+ e.filtered = !1;
209
+ });
175
210
  }
176
211
  /**
177
- * 确定路口符号
212
+ * 根据当前比例尺更新路口符号
178
213
  * @param attributes
179
214
  * @returns
180
215
  */
@@ -295,7 +330,7 @@ class f {
295
330
  * @returns
296
331
  */
297
332
  getNeighbors(e, t) {
298
- return this.locations.filter((r) => r.id === e.id || r.visited ? !1 : this.getDistance(e, r) <= t);
333
+ return this.clusteredLocations.filter((r) => r.id === e.id || r.visited ? !1 : this.getDistance(e, r) <= t);
299
334
  }
300
335
  /**
301
336
  * 两点间的像素距离
@@ -313,30 +348,28 @@ class f {
313
348
  * @param locations
314
349
  * @returns
315
350
  */
316
- createClusters(e) {
317
- const t = {}, r = [];
318
- for (let i = 0; i < e.length; i++) {
319
- const o = e[i];
320
- o.clusterId === void 0 || o.clusterId === -1 ? r.push(o) : (t[o.clusterId] || (t[o.clusterId] = []), t[o.clusterId].push(o));
321
- }
322
- const s = Object.keys(t).map((i, o) => {
323
- const a = t[Number(i)], l = a.length, n = a.reduce((c, m) => c + m.x, 0), h = a.reduce((c, m) => c + m.y, 0), p = n / l, d = h / l;
351
+ createClusters() {
352
+ const e = {}, t = [];
353
+ for (const s of this.clusteredLocations)
354
+ s.clusterId === void 0 || s.clusterId === -1 ? t.push(s) : (e[s.clusterId] || (e[s.clusterId] = []), e[s.clusterId].push(s));
355
+ const r = Object.keys(e).map((s, i) => {
356
+ const o = e[Number(s)], a = o.length, l = o.reduce((n, y) => n + y.x, 0), c = o.reduce((n, y) => n + y.y, 0), m = l / a, p = c / a;
324
357
  return {
325
- id: Number(i),
326
- items: a,
327
- count: l,
358
+ id: Number(s),
359
+ items: o,
360
+ count: a,
328
361
  center: {
329
- x: p,
330
- y: d
362
+ x: m,
363
+ y: p
331
364
  }
332
365
  };
333
366
  });
334
- return r.length > 0 && s.push({
367
+ return t.length > 0 && r.push({
335
368
  id: -1,
336
- items: r,
337
- count: r.length,
369
+ items: t,
370
+ count: t.length,
338
371
  center: null
339
- }), s;
372
+ }), r;
340
373
  }
341
374
  /**
342
375
  * 按照像素距离聚类
@@ -345,22 +378,19 @@ class f {
345
378
  * @param minPoints
346
379
  * @returns
347
380
  */
348
- doPixelCluster(e, t) {
349
- let r = 0;
350
- this.locations.forEach((s) => {
351
- s.visited = !1, s.clusterId = void 0;
352
- });
353
- for (let s = 0; s < this.locations.length; s++) {
354
- const i = this.locations[s];
355
- if (i.visited)
381
+ doPixelCluster(e) {
382
+ let t = 0;
383
+ for (let r = 0; r < this.clusteredLocations.length; r++) {
384
+ const s = this.clusteredLocations[r];
385
+ if (s.visited)
356
386
  continue;
357
- i.visited = !0;
358
- const o = this.getNeighbors(i, e);
359
- o.length < t ? i.clusterId = -1 : (o.forEach((a) => {
360
- a.visited = !0, a.clusterId = r;
361
- }), i.clusterId = r, r++);
387
+ s.visited = !0;
388
+ const i = this.getNeighbors(s, e);
389
+ i.length < this.minClusterPoints ? s.clusterId = -1 : (i.forEach((o) => {
390
+ o.visited = !0, o.clusterId = t;
391
+ }), s.clusterId = t, t++);
362
392
  }
363
- return this.createClusters(this.locations);
393
+ return this.createClusters();
364
394
  }
365
395
  showClusterResult(e) {
366
396
  this.crossLayer.removeAll();
@@ -371,8 +401,8 @@ class f {
371
401
  if (s.id !== -1) {
372
402
  let i = r === t ? (this.maxClusterSymbolSize + this.minClusterSymbolSize) / 2 : this.minClusterSymbolSize + (s.count - r) / (t - r) * (this.maxClusterSymbolSize - this.minClusterSymbolSize);
373
403
  i *= 0.75;
374
- const l = (s.count.toString().length * 8 + 6) / 2, n = new u({
375
- geometry: new y({ x: s.center.x, y: s.center.y }),
404
+ const l = (s.count.toString().length * 8 + 6) / 2, c = new u({
405
+ geometry: new h({ x: s.center.x, y: s.center.y }),
376
406
  attributes: {
377
407
  count: s.count
378
408
  },
@@ -484,11 +514,11 @@ class f {
484
514
  }
485
515
  }
486
516
  });
487
- this.crossLayer.add(n);
517
+ this.crossLayer.add(c);
488
518
  } else
489
519
  s.items.forEach((i) => {
490
520
  const o = new u({
491
- geometry: new y({ x: i.x, y: i.y }),
521
+ geometry: new h({ x: i.x, y: i.y }),
492
522
  attributes: {
493
523
  ...i,
494
524
  ...i.properties,
@@ -503,5 +533,5 @@ class f {
503
533
  }
504
534
  }
505
535
  export {
506
- f as default
536
+ C as default
507
537
  };
@@ -18,15 +18,15 @@ class f {
18
18
  */
19
19
  async showSignalControlArea(t) {
20
20
  await this.clearSignalControlArea(), this.districtRenderer.setVisible(!1), this.subDistrictRenderer.setVisible(!1), this.signalRenderer.setClusterVisible(!1), this.signalRenderer.setPointVisible(!1);
21
- const s = [], i = [];
22
- for (const e of t.areaList) {
21
+ const s = [], e = [];
22
+ for (const i of t.areaList) {
23
23
  const n = new r(
24
- e,
24
+ i,
25
25
  t.style || ""
26
26
  );
27
- s.push(n), i.push(...n.subDistricts);
27
+ s.push(n), e.push(...n.subDistricts);
28
28
  }
29
- return this.districtRenderer.style = t.style || "", await this.districtRenderer.showDistricts(s), await this.subDistrictRenderer.showSubDistricts(i), this.crossRenderer.addCrosses(s), { status: 0, message: "ok" };
29
+ return this.districtRenderer.style = t.style || "", await this.districtRenderer.showDistricts(s), await this.subDistrictRenderer.showSubDistricts(e), await this.signalRenderer.showSignals(s), { status: 0, message: "ok" };
30
30
  }
31
31
  /**
32
32
  * 显示单个区控
@@ -81,10 +81,10 @@ class f {
81
81
  this.subDistrictRenderer.setVisible(t.visible);
82
82
  break;
83
83
  case "signal":
84
- this.crossRenderer.showScatter();
84
+ t.visible === !1 ? this.crossRenderer.hideCrosses() : this.crossRenderer.showScatter();
85
85
  break;
86
86
  case "signalCluster":
87
- this.crossRenderer.showCluster();
87
+ t.visible === !1 ? this.crossRenderer.hideCrosses() : this.crossRenderer.showCluster();
88
88
  break;
89
89
  }
90
90
  return { status: 0, message: "ok" };
@@ -116,12 +116,12 @@ class f {
116
116
  case "district":
117
117
  return await this.districtRenderer.highlightDistrict(t) ? (this.subDistrictRenderer.filter(t), this.signalRenderer.filter(t), await this.subDistrictRenderer.showRoads(t), { status: 0, message: "ok" }) : { status: 1, message: "未找到区控" };
118
118
  case "subDistrict": {
119
- const { count: s, parentId: i } = await this.subDistrictRenderer.highlightSubDistrict(t);
120
- return s > 0 ? (this.districtRenderer.filter(i), this.signalRenderer.filter(t), { status: 0, message: "ok" }) : { status: 1, message: "未找到子区" };
119
+ const { count: s, parentId: e } = await this.subDistrictRenderer.highlightSubDistrict(t);
120
+ return s > 0 ? (this.districtRenderer.filter(e), this.signalRenderer.filter(t), { status: 0, message: "ok" }) : { status: 1, message: "未找到子区" };
121
121
  }
122
122
  case "signal": {
123
- const { districtId: s, subDistrictId: i, count: e } = await this.signalRenderer.highlightSignal(t.id);
124
- return e > 0 ? (this.districtRenderer.filter(s), this.subDistrictRenderer.filter(t), { status: 0, message: "ok" }) : { status: 1, message: "未找到信号机" };
123
+ const { districtId: s, subDistrictId: e, count: i } = await this.signalRenderer.highlightSignal(t.id);
124
+ return i > 0 ? (this.districtRenderer.filter(s), this.subDistrictRenderer.filter(t), { status: 0, message: "ok" }) : { status: 1, message: "未找到信号机" };
125
125
  }
126
126
  default:
127
127
  return { status: 1, message: "未知类型" };
@@ -156,6 +156,7 @@ export interface IClusterLocation {
156
156
  y: number;
157
157
  properties?: any;
158
158
  visited?: boolean;
159
+ filtered?: boolean;
159
160
  clusterId?: number;
160
161
  symbol?: any;
161
162
  }
@@ -135,6 +135,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
135
135
  findSumoInOpenDrive: (params: IFindSumoParams) => Promise<import("../types").IResult>;
136
136
  selectSumoInOpenDrive: (params: IFindSumoParams) => Promise<import("../types").IResult>;
137
137
  unselectSumoInOpenDrive: (params?: IUnselectSumoParams | undefined) => Promise<import("../types").IResult>;
138
+ selectComputableInOpenDrive: (params: IFindSumoParams) => Promise<void | {
139
+ status: number;
140
+ message: string;
141
+ }>;
138
142
  geometrySearchInOpenDrive: (params: any) => Promise<import("../types").IResult>;
139
143
  getSumoInfo: (params: IFindSumoParams) => Promise<import("../types").IResult>;
140
144
  splitOpenDriveLane: (params: ISplitOpenDriveLaneParams) => Promise<import("../types").IResult>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue"),T=require("./stores/index.js");require("./style/index.css");const ut=require("./utils/dbscan-cluster/index.js"),dt=require("./utils/detect-gpu.js"),mt=require("./utils/edpass-device-controller.js"),x=require("./utils/green-wave-band-controller/index.js"),pt=require("./utils/holo-flow/index.js"),gt=require("./utils/holo-flow/signal-countdown-panel.vue.js"),ft=require("./utils/map-initializer.js"),P=require("./utils/open-drive-renderer/index.js"),z=require("./utils/overlay.js"),yt=require("./utils/police-jurisdiction.js"),wt=require("./utils/queue-length.js"),E=require("./utils/road-config-tool/index.js"),vt=require("./utils/signal-control-area/edit-area.js"),q=require("./utils/signal-control-area/show-area.js"),St=require("./utils/traffic-flow.js"),ht={class:"gis-viewer"},Ct={style:{position:"absolute",bottom:"80px",left:"10px","z-index":"9999"}},bt=r.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick","update:zoom"],setup(N,{expose:H,emit:G}){const C=r.ref(null);let a,p,l,i,s,o,f,t,u,n,g,w,b,y;const O=r.ref(!1);T.registerStore();const V=T.default.useAppDataStore,_=r.reactive([]),B=e=>Math.log2(591657527591555e-6/e);let v=null,I=null;const A=e=>{if(!Number.isFinite(e))return;const d=Math.round(e);d!==I&&(I=d,S("update:zoom",d))};dt.default(),r.onMounted(async()=>{if(!C.value)return;document.addEventListener("keydown",m=>{m.ctrlKey&&m.key==="i"&&(O.value=!O.value)});const e=r.getCurrentInstance(),{$gisviewerAssetsRoot:d}=e.appContext.config.globalProperties,c=await(await fetch(M.config)).json();c.assetsRoot=M.assetsRoot||d,V.mapConfig=c,p=new ft.default,V.mapInitializer=p,a=await p.initialize({container:C.value,mapConfig:c,markerClickCallback:(m,D,L,lt)=>{S("markerClick",m,D,L,lt)},mapClickCallback:(m,D,L)=>{S("mapClick",m,D,L)}});const h=a.zoom??(a.scale?B(a.scale):void 0);typeof h=="number"&&A(h);const ct=a.zoom!==void 0?a.watch("zoom",m=>{A(m)}):a.watch("scale",m=>{typeof m=="number"&&m>0&&A(B(m))});v=()=>ct.remove(),s=new pt.default(a,_),await s.init(),S("mapLoaded")}),r.onUnmounted(()=>{n==null||n.clearSignalControlArea(),t==null||t.clearOpenDrive(),s.clearHoloTrace(),s.clearHoloSignal(),i==null||i.disconnectTrafficFlow(),v==null||v(),v=null});const Z=r.computed(()=>a),W=()=>{const e=T.default.useAppDataStore;e.saveTrackLog=!0},j=()=>{s.downloadTrackLog()},J=()=>{k("vehicleId")},Q=()=>{k("plateNumber")},U=async e=>await p.setMapCenter(e),K=async e=>await p.setMapCamera(e),F=e=>p.setMapZoom(e),X=async e=>await p.lookAt(e),Y=e=>p.setLayerVisibility(e),R=(e,d)=>p.requestCoordinateTransform(e,d),$=e=>{p.cancelCoordinateTransform(e)},ee=e=>{p.setMapZoomRange(e)},te=e=>(l||(l=new E.default(a)),l.showLaneNumber(e)),ae=()=>{l==null||l.clearLaneNumber()},ne=async e=>(l||(l=new E.default(a)),await l.initializeSearch(e)),se=async()=>l==null?void 0:l.calCrossIndicatorArea(),re=async()=>{},oe=async(e,d)=>{i||(i=new St.default(a)),i.connectTrafficFlow(e,d)},ie=()=>{i==null||i.disconnectTrafficFlow()},ce=async e=>{s.handleVehicleTraceData(e)},le=()=>{s.clearHoloTrace()},ue=e=>{s.setInterpolate(e)},de=async e=>{await s.handleSignalData(e)},me=async e=>{await s.initializeLampGroup(e)},pe=e=>{s.handleUniSignalData(e)},ge=()=>{s.clearHoloSignal()},fe=e=>{i==null||i.toggleTrafficInfo(e),s==null||s.toggleTrafficInfo(e)},ye=e=>{s==null||s.togglePause(e)},we=e=>{i==null||i.toggleTrafficObject(e),s==null||s.toggleTrafficObject(e)},k=e=>{s==null||s.updatePanelContent(e)},ve=async e=>(o||(o=new z.default(a)),o.addOverlays(e)),Se=async e=>(y||(y=new ut.default(a)),y.addClusterPoints(e)),he=()=>{y==null||y.removeAllClusterPoints()},Ce=e=>(o||(o=new z.default(a)),o.addMask(e)),be=()=>{o==null||o.removeMask()},Oe=e=>o==null?void 0:o.removeOverlaysByType(e),Ae=e=>o==null?void 0:o.removeOverlaysById(e),ke=()=>o==null?void 0:o.removeAllOverlays(),De=()=>{o==null||o.showAllOverlays()},Le=e=>{f||(f=new wt.default(a)),f.updateQueueLength(e)},Te=()=>{f==null||f.removeQueueLength()},qe=async(e,d)=>(t||(t=new P.default(a)),await t.showOpenDriveFromServer(e,d)),Ve=async e=>(t||(t=new P.default(a)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),_e=e=>t?t.setOpendriveVisibility(e):{status:-1,message:"未加载OpenDrive地图"},Be=async()=>await(t==null?void 0:t.clearOpenDrive()),Ie=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},Me=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},xe=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},Pe=async e=>t?await t.geometrySearch(e):{status:-1,message:"未加载OpenDrive地图"},ze=async e=>t?await t.getSumoInfo(e):{status:-1,message:"未加载OpenDrive地图"},Ee=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},Ne=async()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},He=async e=>t?t==null?void 0:t.blockOpenDriveLane(e):{status:-1,message:"未加载OpenDrive地图"},Ge=()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},Ze=async e=>(n||(n=new q.default(a)),await n.showSignalControlArea(e)),We=async e=>(n||(n=new q.default(a)),await n.showDistrict(e)),je=async e=>(n||(n=new q.default(a)),await n.showSubDistrict(e)),Je=async()=>await(n==null?void 0:n.clearSignalControlArea()),Qe=e=>n==null?void 0:n.setLayerVisibility(e),Ue=async e=>n?await(n==null?void 0:n.locateSignalControlArea(e)):{status:-1,message:"未加载信号控制区"},Ke=async e=>n?await n.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Fe=()=>n?n.resetHighlight():{status:-1,message:"未加载信号控制区"},Xe=e=>(u||(u=new vt.default(a)),u.showSubSignalControlArea(e)),Ye=e=>u?u.editSubSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Re=()=>u?u.stopEditSubSignalControlArea():{status:-1,message:"未加载信号控制区"},$e=e=>u?u.selectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},et=e=>u?u.unselectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},tt=e=>{if(!u)return{status:-1,message:"未加载信号控制区"}},at=e=>(g||(g=new x.default(a)),g.addGreenWaveBand(e)),nt=()=>{if(!g)return{status:-1,message:"未加载绿波带"};g.stopAddGreenWaveBand()},st=async e=>(g||(g=new x.default(a)),await g.showGreenWaveBand(e)),rt=async e=>(w||(w=new yt.default(a)),await w.showJurisdiction(e)),ot=()=>{if(!w)return{status:-1,message:"未加载警务管辖区"};w.clearJurisdiction()},it=async e=>(b||(b=new mt.default(a)),await b.setEdpassLayerVisibility(e)),M=N,S=G;return H({mapViewer:Z,setLayerVisibility:Y,setMapCenter:U,lookAt:X,setMapCamera:K,setMapZoom:F,setMapZoomRange:ee,requestCoordinateTransform:R,cancelCoordinateTransform:$,addOverlays:ve,addClusterPoints:Se,removeAllClusterPoints:he,addMask:Ce,removeMask:be,showAllOverlays:De,removeOverlaysByType:Oe,removeOverlaysById:Ae,removeAllOverlays:ke,showLaneNumber:te,clearLaneNumber:ae,initializeAreaTool:ne,calCrossIndicatorArea:se,calRoadIndicatorArea:re,connectCarFlow:oe,disconnectCarFlow:ie,handleHoloVehicleTraceData:ce,clearHoloTrace:le,initializeLampGroup:me,handleUniSignalData:pe,handleHoloSignalData:de,clearHoloSignal:ge,setInterpolate:ue,toggleTrafficInfo:fe,toggleTrafficObject:we,toggleVehicleInfo:k,togglePause:ye,updateQueueLength:Le,removeQueueLength:Te,showOpenDriveFromServer:qe,showOpenDriveFromFile:Ve,clearOpenDrive:Be,setOpendriveVisibility:_e,geometrySearchInOpenDrive:Pe,findSumoInOpenDrive:Ie,selectSumoInOpenDrive:Me,unselectSumoInOpenDrive:xe,getSumoInfo:ze,splitOpenDriveLane:Ee,clearSplitOpenDriveLane:Ne,blockOpenDriveLane:He,clearBlockOpenDriveLane:Ge,showSignalControlArea:Ze,showDistrictArea:We,showSubDistrictArea:je,clearSignalControlArea:Je,setSignalControlAreaVisibility:Qe,locateSignalControlArea:Ue,highlightSignalControlArea:Ke,resetHighlightSignalControlArea:Fe,showSubSignalControlArea:Xe,editSubSignalControlArea:Ye,stopEditSubSignalControlArea:Re,selectSubSignalControlAreaCross:$e,unselectSubSignalControlAreaCross:et,changeSubSignalControlAreaBorderVisibility:tt,addGreenWaveBand:at,stopAddGreenWaveBand:nt,showGreenWaveBand:st,showPoliceArea:rt,clearPoliceArea:ot,setEdpassLayerVisibility:it}),(e,d)=>(r.openBlock(),r.createElementBlock("div",ht,[r.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:C},[r.withDirectives(r.createElementVNode("div",Ct,[r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:W}," 开始记录 "),r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:j}," 下载日志 "),r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:J}," 显示车辆id "),r.createElementVNode("button",{onClick:Q},"显示车辆号牌")],512),[[r.vShow,O.value]])],512),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(_,(c,h)=>(r.openBlock(),r.createBlock(gt.default,{key:h,"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=bt;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue"),T=require("./stores/index.js");require("./style/index.css");const dt=require("./utils/dbscan-cluster/index.js"),mt=require("./utils/detect-gpu.js"),pt=require("./utils/edpass-device-controller.js"),x=require("./utils/green-wave-band-controller/index.js"),gt=require("./utils/holo-flow/index.js"),ft=require("./utils/holo-flow/signal-countdown-panel.vue.js"),yt=require("./utils/map-initializer.js"),P=require("./utils/open-drive-renderer/index.js"),z=require("./utils/overlay.js"),wt=require("./utils/police-jurisdiction.js"),vt=require("./utils/queue-length.js"),E=require("./utils/road-config-tool/index.js"),St=require("./utils/signal-control-area/edit-area.js"),q=require("./utils/signal-control-area/show-area.js"),ht=require("./utils/traffic-flow.js"),Ct={class:"gis-viewer"},bt={style:{position:"absolute",bottom:"80px",left:"10px","z-index":"9999"}},Ot=r.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick","update:zoom"],setup(N,{expose:H,emit:G}){const C=r.ref(null);let a,p,l,i,s,o,f,t,u,n,g,w,b,y;const O=r.ref(!1);T.registerStore();const V=T.default.useAppDataStore,_=r.reactive([]),B=e=>Math.log2(591657527591555e-6/e);let v=null,I=null;const A=e=>{if(!Number.isFinite(e))return;const d=Math.round(e);d!==I&&(I=d,S("update:zoom",d))};mt.default(),r.onMounted(async()=>{if(!C.value)return;document.addEventListener("keydown",m=>{m.ctrlKey&&m.key==="i"&&(O.value=!O.value)});const e=r.getCurrentInstance(),{$gisviewerAssetsRoot:d}=e.appContext.config.globalProperties,c=await(await fetch(M.config)).json();c.assetsRoot=M.assetsRoot||d,V.mapConfig=c,p=new yt.default,V.mapInitializer=p,a=await p.initialize({container:C.value,mapConfig:c,markerClickCallback:(m,D,L,ut)=>{S("markerClick",m,D,L,ut)},mapClickCallback:(m,D,L)=>{S("mapClick",m,D,L)}});const h=a.zoom??(a.scale?B(a.scale):void 0);typeof h=="number"&&A(h);const lt=a.zoom!==void 0?a.watch("zoom",m=>{A(m)}):a.watch("scale",m=>{typeof m=="number"&&m>0&&A(B(m))});v=()=>lt.remove(),s=new gt.default(a,_),await s.init(),S("mapLoaded")}),r.onUnmounted(()=>{n==null||n.clearSignalControlArea(),t==null||t.clearOpenDrive(),s.clearHoloTrace(),s.clearHoloSignal(),i==null||i.disconnectTrafficFlow(),v==null||v(),v=null});const Z=r.computed(()=>a),W=()=>{const e=T.default.useAppDataStore;e.saveTrackLog=!0},j=()=>{s.downloadTrackLog()},J=()=>{k("vehicleId")},Q=()=>{k("plateNumber")},U=async e=>await p.setMapCenter(e),K=async e=>await p.setMapCamera(e),F=e=>p.setMapZoom(e),X=async e=>await p.lookAt(e),Y=e=>p.setLayerVisibility(e),R=(e,d)=>p.requestCoordinateTransform(e,d),$=e=>{p.cancelCoordinateTransform(e)},ee=e=>{p.setMapZoomRange(e)},te=e=>(l||(l=new E.default(a)),l.showLaneNumber(e)),ae=()=>{l==null||l.clearLaneNumber()},ne=async e=>(l||(l=new E.default(a)),await l.initializeSearch(e)),se=async()=>l==null?void 0:l.calCrossIndicatorArea(),re=async()=>{},oe=async(e,d)=>{i||(i=new ht.default(a)),i.connectTrafficFlow(e,d)},ie=()=>{i==null||i.disconnectTrafficFlow()},ce=async e=>{s.handleVehicleTraceData(e)},le=()=>{s.clearHoloTrace()},ue=e=>{s.setInterpolate(e)},de=async e=>{await s.handleSignalData(e)},me=async e=>{await s.initializeLampGroup(e)},pe=e=>{s.handleUniSignalData(e)},ge=()=>{s.clearHoloSignal()},fe=e=>{i==null||i.toggleTrafficInfo(e),s==null||s.toggleTrafficInfo(e)},ye=e=>{s==null||s.togglePause(e)},we=e=>{i==null||i.toggleTrafficObject(e),s==null||s.toggleTrafficObject(e)},k=e=>{s==null||s.updatePanelContent(e)},ve=async e=>(o||(o=new z.default(a)),o.addOverlays(e)),Se=async e=>(y||(y=new dt.default(a)),y.addClusterPoints(e)),he=()=>{y==null||y.removeAllClusterPoints()},Ce=e=>(o||(o=new z.default(a)),o.addMask(e)),be=()=>{o==null||o.removeMask()},Oe=e=>o==null?void 0:o.removeOverlaysByType(e),Ae=e=>o==null?void 0:o.removeOverlaysById(e),ke=()=>o==null?void 0:o.removeAllOverlays(),De=()=>{o==null||o.showAllOverlays()},Le=e=>{f||(f=new vt.default(a)),f.updateQueueLength(e)},Te=()=>{f==null||f.removeQueueLength()},qe=async(e,d)=>(t||(t=new P.default(a)),await t.showOpenDriveFromServer(e,d)),Ve=async e=>(t||(t=new P.default(a)),await t.clearOpenDrive(),await t.showOpenDriveFromFile(e)),_e=e=>t?t.setOpendriveVisibility(e):{status:-1,message:"未加载OpenDrive地图"},Be=async()=>await(t==null?void 0:t.clearOpenDrive()),Ie=async e=>t?await(t==null?void 0:t.findSumo(e)):{status:-1,message:"未加载OpenDrive地图"},Me=async e=>t?t.selectSumo(e):{status:-1,message:"未加载OpenDrive地图"},xe=async e=>t?t.unselectSumo(e):{status:-1,message:"未加载OpenDrive地图"},Pe=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地图"},Ne=async e=>t?await(t==null?void 0:t.splitLane(e)):{status:-1,message:"未加载OpenDrive地图"},He=async()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},Ge=async e=>t?t==null?void 0:t.blockLane(e):{status:-1,message:"未加载OpenDrive地图"},Ze=()=>t?t==null?void 0:t.clearSplitLane():{status:-1,message:"未加载OpenDrive地图"},We=async e=>(n||(n=new q.default(a)),await n.showSignalControlArea(e)),je=async e=>(n||(n=new q.default(a)),await n.showDistrict(e)),Je=async e=>(n||(n=new q.default(a)),await n.showSubDistrict(e)),Qe=async()=>await(n==null?void 0:n.clearSignalControlArea()),Ue=e=>n==null?void 0:n.setLayerVisibility(e),Ke=async e=>n?await(n==null?void 0:n.locateSignalControlArea(e)):{status:-1,message:"未加载信号控制区"},Fe=async e=>n?await n.highlightSignalControlArea(e):{status:-1,message:"未加载信号控制区"},Xe=()=>n?n.resetHighlight():{status:-1,message:"未加载信号控制区"},Ye=e=>(u||(u=new St.default(a)),u.showSubSignalControlArea(e)),Re=e=>u?u.editSubSignalControlArea(e):{status:-1,message:"未加载信号控制区"},$e=()=>u?u.stopEditSubSignalControlArea():{status:-1,message:"未加载信号控制区"},et=e=>u?u.selectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},tt=e=>u?u.unselectSubSignalControlAreaCross(e):{status:-1,message:"未加载信号控制区"},at=e=>{if(!u)return{status:-1,message:"未加载信号控制区"}},nt=e=>(g||(g=new x.default(a)),g.addGreenWaveBand(e)),st=()=>{if(!g)return{status:-1,message:"未加载绿波带"};g.stopAddGreenWaveBand()},rt=async e=>(g||(g=new x.default(a)),await g.showGreenWaveBand(e)),ot=async e=>(w||(w=new wt.default(a)),await w.showJurisdiction(e)),it=()=>{if(!w)return{status:-1,message:"未加载警务管辖区"};w.clearJurisdiction()},ct=async e=>(b||(b=new pt.default(a)),await b.setEdpassLayerVisibility(e)),M=N,S=G;return H({mapViewer:Z,setLayerVisibility:Y,setMapCenter:U,lookAt:X,setMapCamera:K,setMapZoom:F,setMapZoomRange:ee,requestCoordinateTransform:R,cancelCoordinateTransform:$,addOverlays:ve,addClusterPoints:Se,removeAllClusterPoints:he,addMask:Ce,removeMask:be,showAllOverlays:De,removeOverlaysByType:Oe,removeOverlaysById:Ae,removeAllOverlays:ke,showLaneNumber:te,clearLaneNumber:ae,initializeAreaTool:ne,calCrossIndicatorArea:se,calRoadIndicatorArea:re,connectCarFlow:oe,disconnectCarFlow:ie,handleHoloVehicleTraceData:ce,clearHoloTrace:le,initializeLampGroup:me,handleUniSignalData:pe,handleHoloSignalData:de,clearHoloSignal:ge,setInterpolate:ue,toggleTrafficInfo:fe,toggleTrafficObject:we,toggleVehicleInfo:k,togglePause:ye,updateQueueLength:Le,removeQueueLength:Te,showOpenDriveFromServer:qe,showOpenDriveFromFile:Ve,clearOpenDrive:Be,setOpendriveVisibility:_e,geometrySearchInOpenDrive:ze,findSumoInOpenDrive:Ie,selectSumoInOpenDrive:Me,unselectSumoInOpenDrive:xe,selectComputableInOpenDrive:Pe,getSumoInfo:Ee,splitOpenDriveLane:Ne,clearSplitOpenDriveLane:He,blockOpenDriveLane:Ge,clearBlockOpenDriveLane:Ze,showSignalControlArea:We,showDistrictArea:je,showSubDistrictArea:Je,clearSignalControlArea:Qe,setSignalControlAreaVisibility:Ue,locateSignalControlArea:Ke,highlightSignalControlArea:Fe,resetHighlightSignalControlArea:Xe,showSubSignalControlArea:Ye,editSubSignalControlArea:Re,stopEditSubSignalControlArea:$e,selectSubSignalControlAreaCross:et,unselectSubSignalControlAreaCross:tt,changeSubSignalControlAreaBorderVisibility:at,addGreenWaveBand:nt,stopAddGreenWaveBand:st,showGreenWaveBand:rt,showPoliceArea:ot,clearPoliceArea:it,setEdpassLayerVisibility:ct}),(e,d)=>(r.openBlock(),r.createElementBlock("div",Ct,[r.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:C},[r.withDirectives(r.createElementVNode("div",bt,[r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:W}," 开始记录 "),r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:j}," 下载日志 "),r.createElementVNode("button",{style:{"margin-right":"10px"},onClick:J}," 显示车辆id "),r.createElementVNode("button",{onClick:Q},"显示车辆号牌")],512),[[r.vShow,O.value]])],512),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(_,(c,h)=>(r.openBlock(),r.createBlock(ft.default,{key:h,"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=Ot;
@@ -119,6 +119,10 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
119
119
  findSumoInOpenDrive: (params: import("../types").IFindSumoParams) => Promise<import("../types").IResult>;
120
120
  selectSumoInOpenDrive: (params: import("../types").IFindSumoParams) => Promise<import("../types").IResult>;
121
121
  unselectSumoInOpenDrive: (params?: import("../types").IUnselectSumoParams | undefined) => Promise<import("../types").IResult>;
122
+ selectComputableInOpenDrive: (params: import("../types").IFindSumoParams) => Promise<void | {
123
+ status: number;
124
+ message: string;
125
+ }>;
122
126
  geometrySearchInOpenDrive: (params: any) => Promise<import("../types").IResult>;
123
127
  getSumoInfo: (params: import("../types").IFindSumoParams) => Promise<import("../types").IResult>;
124
128
  splitOpenDriveLane: (params: import("../types").ISplitOpenDriveLaneParams) => Promise<import("../types").IResult>;
@@ -11,7 +11,6 @@ export default class DbscanCluster {
11
11
  private locations;
12
12
  private clusteredLocations;
13
13
  private clusterMarkUrl;
14
- private currentZoom;
15
14
  /**
16
15
  * 将地理位置转换为屏幕坐标
17
16
  */
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("@arcgis/core/geometry"),m=require("@arcgis/core/Graphic"),p=require("@arcgis/core/layers/GraphicsLayer");class b{constructor(t){this.maxClusterSymbolSize=50,this.minClusterSymbolSize=25,this.clusterRadius=120,this.minClusterPoints=2,this.zoomWatchHandle=null,this.locations=[],this.clusteredLocations=[],this.clusterMarkUrl="",this.currentZoom=0,this.view=t,this.currentZoom=t.zoom,this.clusterLayer=new p,this.view.map.add(this.clusterLayer)}locationToScreen(){this.clusteredLocations=[],this.locations.forEach(t=>{const s=this.view.toScreen(new h.Point({x:t.x,y:t.y}));s.x>0&&s.y>0&&(t.properties.screenX=s.x,t.properties.screenY=s.y,t.visited=!1,t.clusterId=void 0,this.clusteredLocations.push(t))})}addClusterPoints(t){var r;this.locations=t.points,this.clusterMarkUrl=((r=t.clusterSymbol)==null?void 0:r.url)||"/GisViewerAssets/Images/cross/gis_xhj_blue.png",this.locations=this.locations.filter(e=>e.x!==null&&e.y!==null&&!isNaN(e.x)&&!isNaN(e.y)),this.locations.forEach(e=>{e.x=Number(e.x),e.y=Number(e.y),e.symbol||(e.symbol=t.pointSymbol||{type:"simple-marker",style:"circle",color:"#3388ff",size:8,outline:{color:"#ffffff",width:1}})}),this.zoomWatchHandle||(this.zoomWatchHandle=this.view.watch("stationary",()=>{if(Math.abs(this.currentZoom-this.view.zoom)>=1){this.currentZoom=this.view.zoom,this.locationToScreen(),console.time("cluster");const e=this.doPixelCluster(this.clusterRadius,this.minClusterPoints);console.timeEnd("cluster"),this.showClusters(e)}})),this.locationToScreen();const s=this.doPixelCluster(this.clusterRadius,this.minClusterPoints);this.showClusters(s)}removeAllClusterPoints(){var t;(t=this.zoomWatchHandle)==null||t.remove(),this.zoomWatchHandle=null,this.clusterLayer.removeAll()}showClusters(t){this.clusterLayer.removeAll();let s=Number.MIN_VALUE,r=Number.MAX_VALUE;t.forEach(e=>{e.count>1&&(r=Math.min(r,e.count),s=Math.max(s,e.count))}),t.forEach(e=>{if(e.id!==-1){let i=r===s?(this.maxClusterSymbolSize+this.minClusterSymbolSize)/2:this.minClusterSymbolSize+(e.count-r)/(s-r)*(this.maxClusterSymbolSize-this.minClusterSymbolSize);i*=.75;const n=(e.count.toString().length*8+6)/2,c=new m({geometry:new h.Point({x:e.center.x,y:e.center.y}),attributes:{count:e.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:i,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[-n,40],[n,40],[n,20],[-n,20],[-n,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:i,rotateClockwise:!0,textureFilter:"Picture",url:this.clusterMarkUrl}]}}}});this.clusterLayer.add(c)}else e.items.forEach(i=>{const o=new m({geometry:new h.Point({x:i.x,y:i.y}),attributes:{...i,...i.properties,type:"clusterPoint",id:i.id},symbol:i.symbol});this.clusterLayer.add(o)})})}getNeighbors(t,s){return this.clusteredLocations.filter(r=>r.id===t.id||r.visited?!1:this.getDistance(t,r)<=s)}getDistance(t,s){return Math.sqrt(Math.pow(t.properties.screenX-s.properties.screenX,2)+Math.pow(t.properties.screenY-s.properties.screenY,2))}createClusters(){const t={},s=[];for(const e of this.clusteredLocations)e.clusterId===void 0||e.clusterId===-1?s.push(e):(t[e.clusterId]||(t[e.clusterId]=[]),t[e.clusterId].push(e));const r=Object.keys(t).map((e,i)=>{const o=t[Number(e)],l=o.length,n=o.reduce((u,a)=>u+a.x,0),c=o.reduce((u,a)=>u+a.y,0),y=n/l,d=c/l;return{id:Number(e),items:o,count:l,center:{x:y,y:d}}});return s.length>0&&r.push({id:-1,items:s,count:s.length,center:null}),r}doPixelCluster(t,s){let r=0;for(let e=0;e<this.clusteredLocations.length;e++){const i=this.clusteredLocations[e];if(i.visited)continue;i.visited=!0;const o=this.getNeighbors(i,t);o.length<s?i.clusterId=-1:(o.forEach(l=>{l.visited=!0,l.clusterId=r}),i.clusterId=r,r++)}return this.createClusters()}}exports.default=b;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const h=require("@arcgis/core/geometry"),m=require("@arcgis/core/Graphic"),p=require("@arcgis/core/layers/GraphicsLayer");class b{constructor(t){this.maxClusterSymbolSize=50,this.minClusterSymbolSize=25,this.clusterRadius=120,this.minClusterPoints=2,this.zoomWatchHandle=null,this.locations=[],this.clusteredLocations=[],this.clusterMarkUrl="",this.view=t,this.clusterLayer=new p,this.view.map.add(this.clusterLayer)}locationToScreen(){this.clusteredLocations=[],this.locations.forEach(t=>{const s=this.view.toScreen(new h.Point({x:t.x,y:t.y}));s.x>0&&s.y>0&&(t.properties.screenX=s.x,t.properties.screenY=s.y,t.visited=!1,t.clusterId=void 0,this.clusteredLocations.push(t))})}addClusterPoints(t){var r;this.locations=t.points,this.clusterMarkUrl=((r=t.clusterSymbol)==null?void 0:r.url)||"/GisViewerAssets/Images/cross/gis_xhj_blue.png",this.locations=this.locations.filter(e=>e.x!==null&&e.y!==null&&!isNaN(e.x)&&!isNaN(e.y)),this.locations.forEach(e=>{e.x=Number(e.x),e.y=Number(e.y),e.symbol||(e.symbol=t.pointSymbol||{type:"simple-marker",style:"circle",color:"#3388ff",size:8,outline:{color:"#ffffff",width:1}})}),this.zoomWatchHandle||(this.zoomWatchHandle=this.view.watch("stationary",()=>{if(this.view.stationary){this.locationToScreen(),console.time("cluster");const e=this.doPixelCluster(this.clusterRadius,this.minClusterPoints);this.showClusters(e),console.timeEnd("cluster")}})),this.locationToScreen();const s=this.doPixelCluster(this.clusterRadius,this.minClusterPoints);this.showClusters(s)}removeAllClusterPoints(){var t;(t=this.zoomWatchHandle)==null||t.remove(),this.zoomWatchHandle=null,this.clusterLayer.removeAll()}showClusters(t){this.clusterLayer.removeAll();let s=Number.MIN_VALUE,r=Number.MAX_VALUE;t.forEach(e=>{e.count>1&&(r=Math.min(r,e.count),s=Math.max(s,e.count))}),t.forEach(e=>{if(e.id!==-1){let i=r===s?(this.maxClusterSymbolSize+this.minClusterSymbolSize)/2:this.minClusterSymbolSize+(e.count-r)/(s-r)*(this.maxClusterSymbolSize-this.minClusterSymbolSize);i*=.75;const n=(e.count.toString().length*8+6)/2,c=new m({geometry:new h.Point({x:e.center.x,y:e.center.y}),attributes:{count:e.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:i,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-16,ymin:-16,xmax:16,ymax:16},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[-n,40],[n,40],[n,20],[-n,20],[-n,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:i,rotateClockwise:!0,textureFilter:"Picture",url:this.clusterMarkUrl}]}}}});this.clusterLayer.add(c)}else e.items.forEach(i=>{const o=new m({geometry:new h.Point({x:i.x,y:i.y}),attributes:{...i,...i.properties,type:"clusterPoint",id:i.id},symbol:i.symbol});this.clusterLayer.add(o)})})}getNeighbors(t,s){return this.clusteredLocations.filter(r=>r.id===t.id||r.visited?!1:this.getDistance(t,r)<=s)}getDistance(t,s){return Math.sqrt(Math.pow(t.properties.screenX-s.properties.screenX,2)+Math.pow(t.properties.screenY-s.properties.screenY,2))}createClusters(){const t={},s=[];for(const e of this.clusteredLocations)e.clusterId===void 0||e.clusterId===-1?s.push(e):(t[e.clusterId]||(t[e.clusterId]=[]),t[e.clusterId].push(e));const r=Object.keys(t).map((e,i)=>{const o=t[Number(e)],l=o.length,n=o.reduce((u,a)=>u+a.x,0),c=o.reduce((u,a)=>u+a.y,0),y=n/l,d=c/l;return{id:Number(e),items:o,count:l,center:{x:y,y:d}}});return s.length>0&&r.push({id:-1,items:s,count:s.length,center:null}),r}doPixelCluster(t,s){let r=0;for(let e=0;e<this.clusteredLocations.length;e++){const i=this.clusteredLocations[e];if(i.visited)continue;i.visited=!0;const o=this.getNeighbors(i,t);o.length<s?i.clusterId=-1:(o.forEach(l=>{l.visited=!0,l.clusterId=r}),i.clusterId=r,r++)}return this.createClusters()}}exports.default=b;
@@ -112,9 +112,19 @@ export default class OpenDriveRenderer {
112
112
  */
113
113
  selectSumo(params: IFindSumoParams): Promise<IResult>;
114
114
  geometrySearch(coordinate: number[][]): Promise<IResult>;
115
+ /**
116
+ * 封闭车道,使用sumo的id
117
+ * @param params
118
+ * @returns
119
+ */
115
120
  splitLane(params: ISplitOpenDriveLaneParams): Promise<IResult>;
116
- blockOpenDriveLane(params: IBlockOpenDriveLaneParams): void;
121
+ /**
122
+ * 封闭车道,使用可计算路网的id
123
+ * @param params
124
+ */
125
+ blockLane(params: IBlockOpenDriveLaneParams): void;
117
126
  clearSplitLane(): void;
127
+ selectComputable(params: IFindSumoParams): void;
118
128
  /**
119
129
  * 更新所有路口的symbol
120
130
  * @param symbolStyle