gisviewer-vue3-arcgis 1.0.202 → 1.0.204

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/es/index.d.ts +1 -1
  2. package/es/index.mjs +11 -10
  3. package/es/src/gis-map/gis-map.vue.d.ts +22 -14
  4. package/es/src/gis-map/gis-map.vue.mjs +101 -100
  5. package/es/src/gis-map/index.d.ts +19 -12
  6. package/es/src/gis-map/utils/signal-control-area-controller/district-controller.d.ts +7 -3
  7. package/es/src/gis-map/utils/signal-control-area-controller/district-controller.mjs +29 -25
  8. package/es/src/gis-map/utils/signal-control-area-controller/{index.d.ts → edit-area.d.ts} +2 -14
  9. package/es/src/gis-map/utils/signal-control-area-controller/{index.mjs → edit-area.mjs} +40 -162
  10. package/es/src/gis-map/utils/signal-control-area-controller/show-area.d.ts +68 -0
  11. package/es/src/gis-map/utils/signal-control-area-controller/show-area.mjs +806 -0
  12. package/es/src/types/index.d.ts +4 -0
  13. package/lib/index.d.ts +1 -1
  14. package/lib/index.js +1 -1
  15. package/lib/src/gis-map/gis-map.vue.d.ts +22 -14
  16. package/lib/src/gis-map/gis-map.vue.js +1 -1
  17. package/lib/src/gis-map/index.d.ts +19 -12
  18. package/lib/src/gis-map/utils/queue-length.js +1 -1
  19. package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.d.ts +7 -3
  20. package/lib/src/gis-map/utils/signal-control-area-controller/district-controller.js +1 -1
  21. package/lib/src/gis-map/utils/signal-control-area-controller/{index.d.ts → edit-area.d.ts} +2 -14
  22. package/lib/src/gis-map/utils/signal-control-area-controller/edit-area.js +1 -0
  23. package/lib/src/gis-map/utils/signal-control-area-controller/show-area.d.ts +68 -0
  24. package/lib/src/gis-map/utils/signal-control-area-controller/show-area.js +1 -0
  25. package/lib/src/gis-map/utils/sketchView.js +1 -1
  26. package/lib/src/types/index.d.ts +4 -0
  27. package/package.json +2 -1
  28. package/lib/src/gis-map/utils/signal-control-area-controller/index.js +0 -1
@@ -1,144 +1,33 @@
1
- import * as p from "@arcgis/core/core/reactiveUtils.js";
2
1
  import n from "@arcgis/core/Graphic";
3
- import y from "@arcgis/core/layers/GraphicsLayer";
4
- import d from "@turf/buffer";
5
- import g from "@turf/convex";
2
+ import u from "@arcgis/core/layers/GraphicsLayer";
3
+ import g from "@turf/buffer";
4
+ import p from "@turf/convex";
6
5
  import * as a from "@turf/helpers";
7
- import b from "axios";
8
- import f from "concaveman";
9
- import C from "../../stores/index.mjs";
10
- import v from "./district-controller.mjs";
11
- class G {
6
+ import h from "axios";
7
+ import b from "concaveman";
8
+ import f from "../../stores/index.mjs";
9
+ class L {
12
10
  constructor(e) {
13
11
  var i;
14
12
  this.crossScale = 5e3, this.hasGpu = !1, this.crossIdsInDistrict = [], this.view = e, this.hasGpu = localStorage.getItem("gpu") !== "Unknown";
15
- const r = C.useAppDataStore.mapConfig;
16
- this.openDriveServer = (i = r.openDriveServer) == null ? void 0 : i.url, this.districtControllerLayer = new y({
13
+ const r = f.useAppDataStore.mapConfig;
14
+ this.openDriveServer = (i = r.openDriveServer) == null ? void 0 : i.url, this.districtControllerLayer = new u({
17
15
  id: "districtControllerLayer"
18
- }), this.subDistrictControllerLayer = new y({
19
- id: "subDistrictControllerLayer",
20
- visible: !1
21
- // maxScale: 0,
22
- // minScale: 144447
23
- }), this.crossLayer = new y({
24
- id: "crossLayer",
25
- visible: !1
26
- // maxScale: 0,
27
- // minScale: 36112
28
- }), this.highlightLayer = new y({
29
- id: "highlightLayer"
16
+ }), this.subDistrictControllerLayer = new u({
17
+ id: "subDistrictControllerLayer"
18
+ }), this.crossLayer = new u({
19
+ id: "crossLayer"
30
20
  }), this.view.map.addMany([
31
21
  this.districtControllerLayer,
32
22
  this.subDistrictControllerLayer,
33
- this.crossLayer,
34
- this.highlightLayer
23
+ this.crossLayer
35
24
  ]);
36
25
  }
37
26
  /**
38
- * 显示信控区控与子区
27
+ * 显示单个子区
39
28
  * @param params
40
29
  * @returns
41
30
  */
42
- showSignalControlArea(e) {
43
- this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), this.crossLayer.removeAll(), this.highlightLayer.removeAll(), this.subDistrictControllerLayer.visible = !1, this.crossLayer.visible = !1, this.districtControllerLayer.visible = !0;
44
- for (const t of e.areaList) {
45
- const r = new v(
46
- t,
47
- e.style || ""
48
- );
49
- this.drawArea(r, !0);
50
- }
51
- return this.scaleWatcher = p.watch(
52
- () => this.view.scale,
53
- (t, r) => {
54
- t > this.crossScale && r <= this.crossScale ? (this.crossLayer.graphics.forEach((i) => {
55
- i.symbol = this.getCrossGraphicSymbol(
56
- i.attributes,
57
- "marker"
58
- );
59
- }), this.highlightLayer.graphics.forEach((i) => {
60
- i.getAttribute("type") === "cross" && (i.symbol = this.getCrossGraphicSymbol(
61
- i.attributes,
62
- "marker"
63
- ));
64
- })) : t <= this.crossScale && r > this.crossScale && (this.crossLayer.graphics.forEach((i) => {
65
- i.symbol = this.getCrossGraphicSymbol(
66
- i.attributes,
67
- "picture"
68
- );
69
- }), this.highlightLayer.graphics.forEach((i) => {
70
- i.getAttribute("type") === "cross" && (i.symbol = this.getCrossGraphicSymbol(
71
- i.attributes,
72
- "picture"
73
- ));
74
- }));
75
- }
76
- ), { status: 0, message: "ok" };
77
- }
78
- clearSignalControlArea() {
79
- var e, t;
80
- return this.districtControllerLayer.removeAll(), this.subDistrictControllerLayer.removeAll(), this.crossLayer.removeAll(), this.highlightLayer.removeAll(), (e = this.scaleWatcher) == null || e.remove(), this.scaleWatcher = void 0, (t = this.viewClickWatcher) == null || t.remove(), this.viewClickWatcher = void 0, this.view.closePopup(), { status: 0, message: "ok" };
81
- }
82
- async locateSignalControlArea(e) {
83
- const t = this.findAreaGraphic(e.id);
84
- return t ? (t.attributes.type === "cross" ? await this.view.goTo(
85
- {
86
- target: t.geometry,
87
- scale: 1500
88
- },
89
- {
90
- duration: this.hasGpu ? 1e3 : 0
91
- }
92
- ) : await this.view.goTo(t.geometry, {
93
- duration: this.hasGpu ? 1e3 : 0
94
- }), { status: 0, message: "ok" }) : { status: 1, message: "未找到" };
95
- }
96
- async highlightSignalControlArea(e) {
97
- if (!e.id || e.id === "")
98
- return { status: 1, message: "请输入id" };
99
- this.highlightLayer.removeAll(), this.districtControllerLayer.visible = !1;
100
- const t = this.districtControllerLayer.graphics.filter((s) => s.getAttribute("id") === e.id).toArray().map((s) => {
101
- const o = s.clone();
102
- return o.symbol.style = "none", o;
103
- }), r = this.subDistrictControllerLayer.graphics.filter(
104
- (s) => s.getAttribute("id") === e.id || s.getAttribute("parentId") === e.id
105
- ).toArray().map((s) => s.clone()), i = this.crossLayer.graphics.filter(
106
- (s) => s.getAttribute("nodeId") === e.id || s.getAttribute("districtId") === e.id || s.getAttribute("subDistrictId") === e.id
107
- ).toArray().map((s) => s.clone());
108
- if (r.length > 0 && this.highlightLayer.addMany(r), i.length > 0 && this.highlightLayer.addMany(i), this.highlightLayer.graphics.length === 0)
109
- return { status: 1, message: "未找到" };
110
- if (t.length > 0)
111
- await this.view.goTo(t, {
112
- duration: this.hasGpu ? 1e3 : 0
113
- });
114
- else if (r.length > 0) {
115
- const s = r[0].geometry.centroid;
116
- await this.view.goTo(
117
- {
118
- target: s,
119
- scale: this.crossScale - 500
120
- },
121
- {
122
- duration: this.hasGpu ? 1e3 : 0
123
- }
124
- );
125
- } else
126
- i.length > 1 ? await this.view.goTo(i, {
127
- duration: this.hasGpu ? 1e3 : 0
128
- }) : await this.view.goTo(
129
- {
130
- target: i[0].geometry,
131
- scale: 1500
132
- },
133
- {
134
- duration: this.hasGpu ? 1e3 : 0
135
- }
136
- );
137
- return { status: 0, message: "ok" };
138
- }
139
- resetHighlight() {
140
- return this.highlightLayer.removeAll(), this.view.closePopup(), this.districtControllerLayer.visible = !0, { status: 0, message: "ok" };
141
- }
142
31
  showSubSignalControlArea(e) {
143
32
  this.crossLayer.removeAll(), this.crossLayer.visible = !0;
144
33
  const r = e.children.map((i) => {
@@ -184,7 +73,7 @@ class G {
184
73
  * @returns
185
74
  */
186
75
  async showNearbyCrosses(e) {
187
- const t = await b.get(
76
+ const t = await h.get(
188
77
  `http://${this.openDriveServer}/api/computable/getRelatedNodesForNode`,
189
78
  { params: { nodeIds: e } }
190
79
  );
@@ -200,10 +89,10 @@ class G {
200
89
  continue;
201
90
  }
202
91
  if (this.crossLayer.graphics.some(
203
- (h) => h.getAttribute("id") === o
92
+ (c) => c.getAttribute("id") === o
204
93
  ))
205
94
  continue;
206
- const u = new n({
95
+ const m = new n({
207
96
  geometry: {
208
97
  type: "point",
209
98
  x: s.lon,
@@ -217,7 +106,7 @@ class G {
217
106
  selected: !1
218
107
  }
219
108
  });
220
- i.push(u);
109
+ i.push(m);
221
110
  }
222
111
  return this.crossLayer.addMany(i), { status: 0, message: "ok" };
223
112
  } else
@@ -236,7 +125,7 @@ class G {
236
125
  e.crossesInArea.map(
237
126
  (s) => a.point([s.longitude, s.latitude])
238
127
  )
239
- ), r = g(t);
128
+ ), r = p(t);
240
129
  r && (this.districtControllerLayer.removeAll(), this.districtControllerLayer.add(
241
130
  new n({
242
131
  geometry: {
@@ -293,11 +182,6 @@ class G {
293
182
  ), { status: 0, message: "ok" };
294
183
  }), { status: 0, message: "未找到" };
295
184
  }
296
- changeSubSignalControlAreaBorderVisibility(e) {
297
- this.highlightLayer.graphics.forEach((t) => {
298
- t.getAttribute("type") === "signalControlArea" && (t.visible = e);
299
- });
300
- }
301
185
  /**
302
186
  * 在区控\子区\路口图层中查找对应的graphic
303
187
  * @param id
@@ -318,24 +202,24 @@ class G {
318
202
  * @returns
319
203
  */
320
204
  drawArea(e, t) {
321
- const r = e.getAllCrossCoordinates();
205
+ const r = e.getAllSignalCoordinates();
322
206
  if (r.length >= 2) {
323
207
  let s = null;
324
208
  if (r.length === 2)
325
209
  s = a.lineString(r);
326
210
  else {
327
211
  if (t) {
328
- const c = a.featureCollection(
329
- r.map((m) => a.point(m))
212
+ const y = a.featureCollection(
213
+ r.map((d) => a.point(d))
330
214
  );
331
- s = g(c);
215
+ s = p(y);
332
216
  } else {
333
- const c = f(r, 0.5);
334
- c.length >= 4 && (s = a.polygon([c]));
217
+ const y = b(r, 0.5);
218
+ y.length >= 4 && (s = a.polygon([y]));
335
219
  }
336
220
  s || (s = a.lineString(r));
337
221
  }
338
- const o = d(
222
+ const o = g(
339
223
  s.geometry,
340
224
  // 区控面积更大,需要更大的缓冲半径
341
225
  t ? 200 : 30,
@@ -367,15 +251,15 @@ class G {
367
251
  label: "路口数量"
368
252
  }
369
253
  ];
370
- const u = {
254
+ const m = {
371
255
  type: "signalControlArea",
372
256
  id: e.id,
373
257
  name: e.name,
374
258
  parentId: e.parentId,
375
259
  parentName: e.parentName,
376
- crossCount: e.crossCount,
260
+ crossCount: e.signalCount,
377
261
  subDistrictCount: e.subDistrictCount
378
- }, h = new n({
262
+ }, c = new n({
379
263
  geometry: {
380
264
  type: "polygon",
381
265
  rings: o.geometry.coordinates
@@ -383,14 +267,14 @@ class G {
383
267
  symbol: {
384
268
  type: "simple-fill",
385
269
  style: "none",
386
- color: [...e.areaColor, 0.3],
270
+ // color: [...districtController.areaColor, 0.3],
387
271
  outline: {
388
- color: e.areaColor,
272
+ color: t ? [111, 100, 255] : [5, 196, 104],
389
273
  width: 3,
390
274
  style: t ? "long-dash" : "solid"
391
275
  }
392
276
  },
393
- attributes: u,
277
+ attributes: m,
394
278
  popupTemplate: {
395
279
  title: `${e.name}`,
396
280
  content: [
@@ -401,17 +285,16 @@ class G {
401
285
  ]
402
286
  }
403
287
  });
404
- t ? this.districtControllerLayer.add(h) : this.subDistrictControllerLayer.add(h);
288
+ t ? this.districtControllerLayer.add(c) : this.subDistrictControllerLayer.add(c);
405
289
  }
406
290
  for (const s of e.subDistricts)
407
291
  this.drawArea(s, !1);
408
292
  const i = [];
409
- e.crosses.forEach((s) => {
293
+ e.signals.forEach((s) => {
410
294
  const o = {
411
295
  type: "cross",
412
296
  id: s.id,
413
297
  name: s.name,
414
- color: e.areaColor,
415
298
  signalId: s.signalId,
416
299
  nodeId: s.nodeId,
417
300
  districtId: t ? e.id : e.parentId,
@@ -561,18 +444,13 @@ class G {
561
444
  * @returns
562
445
  */
563
446
  getCrossGraphicSymbol(e, t) {
564
- const { isKey: r, color: i } = e;
447
+ const r = e.isKey;
565
448
  if (t === "marker")
566
- return r ? {
567
- type: "picture-marker",
568
- url: "/GisViewerAssets/Images/cross/gis_gjxklk_orange.png",
569
- width: "30px",
570
- height: "30px"
571
- } : {
449
+ return {
572
450
  type: "simple-marker",
573
451
  style: "circle",
574
- color: i,
575
- size: 8,
452
+ color: r ? [254, 172, 22] : [5, 116, 255],
453
+ size: r ? 12 : 8,
576
454
  outline: {
577
455
  color: "white",
578
456
  width: 1
@@ -668,5 +546,5 @@ class G {
668
546
  }
669
547
  }
670
548
  export {
671
- G as default
549
+ L as default
672
550
  };
@@ -0,0 +1,68 @@
1
+ import { IFindSignalControlAreaParams, ILayerVisibleParams, IResult, IShowSignalControlAreaParams } from '../../../types';
2
+ export default class SignalControlAreaController1 {
3
+ private view;
4
+ private hasGpu;
5
+ private openDriveServer;
6
+ /** 区控虚线图层 */
7
+ private districtControllerDashLayer;
8
+ /** 区控虚线图层,区控由透明实线+不透明虚线组成 */
9
+ private districtControllerSolidLayer;
10
+ /** 子区图层 */
11
+ private subDistrictControllerLayer;
12
+ /** 信号机图层 */
13
+ private signalMarkerLayer;
14
+ private signalPictureLayer;
15
+ private districtControllerOid;
16
+ private subDistrictControllerOid;
17
+ private signalOid;
18
+ constructor(view: __esri.MapView | __esri.SceneView);
19
+ /** 暂存等待绘制的子区graphic */
20
+ private subDistrictGraphics;
21
+ /**
22
+ * 显示所有区控、子区、信号机
23
+ * @param params
24
+ * @returns
25
+ */
26
+ showSignalControlArea(params: IShowSignalControlAreaParams): Promise<IResult>;
27
+ /**
28
+ * 清空区控、子区、信号机
29
+ * @returns
30
+ */
31
+ clearSignalControlArea(): Promise<IResult>;
32
+ /**
33
+ * 设置区控、子区、信号机图层可见性
34
+ * @param layerName
35
+ * @param visible
36
+ */
37
+ setLayerVisibility(params: ILayerVisibleParams): IResult;
38
+ /**
39
+ * 定位区控、子区、信号机
40
+ * @param params
41
+ * @returns
42
+ */
43
+ locateSignalControlArea(params: IFindSignalControlAreaParams): Promise<IResult>;
44
+ /**
45
+ * 高亮指定的区控、子区、信号机,其他隐藏
46
+ * @param params
47
+ * @returns
48
+ */
49
+ highlightSignalControlArea(params: IFindSignalControlAreaParams): Promise<{
50
+ status: number;
51
+ message: string;
52
+ }>;
53
+ /**
54
+ * 重置高亮,恢复全图视角
55
+ * @returns
56
+ */
57
+ resetHighlight(): Promise<{
58
+ status: number;
59
+ message: string;
60
+ }>;
61
+ /**
62
+ * 绘制区控、子区和信号机
63
+ * @param districtController
64
+ * @param isDistrict 是否是区控
65
+ * @returns
66
+ */
67
+ private drawArea;
68
+ }