gisviewer-vue3-arcgis 1.0.90 → 1.0.91

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 (35) hide show
  1. package/es/src/gis-map/gis-map.vue.d.ts +3 -5
  2. package/es/src/gis-map/gis-map.vue.mjs +64 -65
  3. package/es/src/gis-map/index.d.ts +2 -4
  4. package/es/src/gis-map/utils/holo-flow/index.d.ts +2 -0
  5. package/es/src/gis-map/utils/holo-flow/index.mjs +30 -19
  6. package/es/src/gis-map/utils/holo-flow/signal-holo-flow.d.ts +8 -0
  7. package/es/src/gis-map/utils/holo-flow/signal-holo-flow.mjs +56 -48
  8. package/es/src/gis-map/utils/holo-flow/trace-external-renderer.d.ts +2 -0
  9. package/es/src/gis-map/utils/holo-flow/trace-external-renderer.mjs +11 -7
  10. package/es/src/gis-map/utils/holo-flow/trace-holo-flow.d.ts +2 -0
  11. package/es/src/gis-map/utils/holo-flow/trace-holo-flow.mjs +49 -41
  12. package/es/src/gis-map/utils/holo-flow/trace-layer-renderer.d.ts +12 -0
  13. package/es/src/gis-map/utils/holo-flow/trace-layer-renderer.mjs +31 -17
  14. package/es/src/gis-map/utils/map-initializer.mjs +113 -104
  15. package/es/src/gis-map/utils/traffic-flow.d.ts +14 -3
  16. package/es/src/gis-map/utils/traffic-flow.mjs +156 -130
  17. package/es/src/types/index.d.ts +9 -2
  18. package/lib/src/gis-map/gis-map.vue.d.ts +3 -5
  19. package/lib/src/gis-map/gis-map.vue.js +1 -1
  20. package/lib/src/gis-map/index.d.ts +2 -4
  21. package/lib/src/gis-map/utils/holo-flow/index.d.ts +2 -0
  22. package/lib/src/gis-map/utils/holo-flow/index.js +1 -1
  23. package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.d.ts +8 -0
  24. package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.js +1 -1
  25. package/lib/src/gis-map/utils/holo-flow/trace-external-renderer.d.ts +2 -0
  26. package/lib/src/gis-map/utils/holo-flow/trace-external-renderer.js +1 -1
  27. package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.d.ts +2 -0
  28. package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.js +1 -1
  29. package/lib/src/gis-map/utils/holo-flow/trace-layer-renderer.d.ts +12 -0
  30. package/lib/src/gis-map/utils/holo-flow/trace-layer-renderer.js +1 -1
  31. package/lib/src/gis-map/utils/map-initializer.js +1 -1
  32. package/lib/src/gis-map/utils/traffic-flow.d.ts +14 -3
  33. package/lib/src/gis-map/utils/traffic-flow.js +1 -1
  34. package/lib/src/types/index.d.ts +9 -2
  35. package/package.json +1 -1
@@ -1,44 +1,45 @@
1
- import * as d from "@arcgis/core/views/3d/externalRenderers";
2
- import u from "../../stores/index.mjs";
3
- import T from "./trace-external-renderer.mjs";
4
- import f from "./trace-layer-renderer.mjs";
5
- class b {
1
+ import * as u from "@arcgis/core/views/3d/externalRenderers";
2
+ import T from "../../stores/index.mjs";
3
+ import f from "./trace-external-renderer.mjs";
4
+ import g from "./trace-layer-renderer.mjs";
5
+ class N {
6
6
  constructor(e) {
7
7
  this.lastDataTime = 0, this.view = e;
8
- const c = u.useAppDataStore;
9
- this.mapConfig = JSON.parse(JSON.stringify(c.mapConfig)), e.type === "3d" ? (this.traceRenderer = new T(e), d.add(
8
+ const i = T.useAppDataStore;
9
+ this.mapConfig = JSON.parse(JSON.stringify(i.mapConfig)), e.type === "3d" ? (this.traceRenderer = new f(e), u.add(
10
10
  e,
11
11
  this.traceRenderer
12
- )) : this.traceRenderer = new f(e);
12
+ )) : this.traceRenderer = new g(e);
13
13
  }
14
14
  /**
15
15
  * 处理全息流轨迹数据
16
16
  * */
17
17
  handleVehicleTraceData(e) {
18
- const c = new Date().getTime();
19
- if (c - this.lastDataTime < 100)
18
+ const i = new Date().getTime();
19
+ if (i - this.lastDataTime < 100)
20
20
  return;
21
- this.lastDataTime = c;
22
- const { newVehList: n, updateVehList: o, deleteVehList: i, crossId: s } = e, a = [], l = [];
23
- if (n && n.length > 0) {
24
- for (const t of n) {
25
- const r = this.buildVehicleTrackData(t, s);
26
- r && a.push(r);
21
+ this.lastDataTime = i;
22
+ const { newVehList: s, updateVehList: n, deleteVehList: o, jgsj: l } = e, a = e.crossId || "", h = [], r = [];
23
+ if (s && s.length > 0) {
24
+ for (const c of s) {
25
+ c.localTimestamp || (c.localTimestamp = l || i);
26
+ const t = this.buildVehicleTrackData(c, a);
27
+ t && h.push(t);
27
28
  }
28
- this.traceRenderer.addVehicles(a);
29
+ this.traceRenderer.addVehicles(h);
29
30
  }
30
- if (o && o.length > 0) {
31
- for (const t of o) {
32
- const r = this.buildVehicleTrackData(t, s);
33
- r && l.push(r);
31
+ if (n && n.length > 0) {
32
+ for (const c of n) {
33
+ const t = this.buildVehicleTrackData(c, a);
34
+ t && r.push(t);
34
35
  }
35
- this.traceRenderer.updateVehicles(l);
36
+ this.traceRenderer.updateVehicles(r);
36
37
  }
37
- if (i && i.length > 0) {
38
- const t = i.map(
39
- (r) => s + "-" + r.ptcId
38
+ if (o && o.length > 0) {
39
+ const c = o.map(
40
+ (t) => a + "-" + (t.ptcId || t.vehno || t.vehNo)
40
41
  );
41
- this.traceRenderer.deleteVehicles(t);
42
+ this.traceRenderer.deleteVehicles(c);
42
43
  }
43
44
  }
44
45
  /**
@@ -50,26 +51,33 @@ class b {
50
51
  updatePanelContent(e) {
51
52
  this.traceRenderer.updatePanelContent(e);
52
53
  }
53
- buildVehicleTrackData(e, c) {
54
- const p = e.longitude, n = e.latitude, o = e.ptcId, i = Number(e.ptcType), s = e.heading, a = Number(e.vehicleType), l = Number(e.vehicleColor), t = e.plateNo || e.plateno, r = Number(e.plateColor), h = e.timestamp, m = e.localTimestamp;
55
- if (!(i < 0 || i > 8))
54
+ toggleGroundVehicle(e) {
55
+ this.traceRenderer.toggleGroundVehicle(e);
56
+ }
57
+ toggleElevatedVehicle(e) {
58
+ this.traceRenderer.toggleElevatedVehicle(e);
59
+ }
60
+ buildVehicleTrackData(e, i) {
61
+ const p = e.longitude, s = e.latitude, n = e.ptcId, o = Number(e.ptcType), l = e.heading, a = Number(e.vehicleType), h = Number(e.vehicleColor), r = e.plateNo || e.plateno, c = Number(e.plateColor), t = e.timestamp, d = e.localTimestamp, m = String(e.roadLayer) || "1";
62
+ if (!(o < 0 || o > 8))
56
63
  return {
57
- ptcId: o,
58
- crossId: c,
64
+ ptcId: n,
65
+ crossId: i,
59
66
  x: p,
60
- y: n,
61
- ptcType: i,
67
+ y: s,
68
+ ptcType: o,
62
69
  vehicleType: a,
63
- heading: i === 2 ? -s : s,
64
- vehicleColor: l,
65
- showName: t && t !== "" && t !== "0" && t !== "000000" ? t : "",
66
- plateNo: t,
67
- plateColor: r,
68
- timestamp: h,
69
- localTimestamp: m
70
+ heading: o === 2 ? -l : l,
71
+ vehicleColor: h,
72
+ showName: r && r !== "" && r !== "0" && r !== "000000" ? r : "",
73
+ plateNo: r,
74
+ plateColor: c,
75
+ timestamp: t,
76
+ localTimestamp: d,
77
+ roadLayer: m
70
78
  };
71
79
  }
72
80
  }
73
81
  export {
74
- b as default
82
+ N as default
75
83
  };
@@ -3,6 +3,8 @@ export default class TraceLayerRenderer implements ITraceRendererInterface {
3
3
  private view;
4
4
  private readonly vehicleLayer;
5
5
  private mapConfig;
6
+ private showGroundVehicle;
7
+ private showElevatedVehicle;
6
8
  constructor(view: __esri.MapView);
7
9
  private showVehiclePlate;
8
10
  private historyPositionMap;
@@ -12,6 +14,16 @@ export default class TraceLayerRenderer implements ITraceRendererInterface {
12
14
  deleteVehicles(idList: string[]): void;
13
15
  clearVehicles(): void;
14
16
  updatePanelContent(contentType: EVehiclePlateState): void;
17
+ /**
18
+ * 设置地面车辆显示隐藏
19
+ * @param visible
20
+ */
21
+ toggleGroundVehicle(visible: boolean): void;
22
+ /**
23
+ * 设置高架车辆显示隐藏
24
+ * @param visible
25
+ */
26
+ toggleElevatedVehicle(visible: boolean): void;
15
27
  private render;
16
28
  private updatePosition;
17
29
  /**
@@ -1,9 +1,9 @@
1
1
  import g from "@arcgis/core/Graphic";
2
2
  import y from "@arcgis/core/layers/GraphicsLayer";
3
3
  import d from "../../stores/index.mjs";
4
- class v {
4
+ class C {
5
5
  constructor(i) {
6
- this.showVehiclePlate = !1, this.historyPositionMap = /* @__PURE__ */ new Map(), this.vehicleObjectMap = /* @__PURE__ */ new Map(), this.view = i;
6
+ this.showGroundVehicle = !0, this.showElevatedVehicle = !0, this.showVehiclePlate = !1, this.historyPositionMap = /* @__PURE__ */ new Map(), this.vehicleObjectMap = /* @__PURE__ */ new Map(), this.view = i;
7
7
  const e = d.useAppDataStore;
8
8
  this.mapConfig = JSON.parse(JSON.stringify(e.mapConfig)), this.vehicleLayer = new y({
9
9
  id: "vehicleLayer"
@@ -11,22 +11,22 @@ class v {
11
11
  }
12
12
  addVehicles(i) {
13
13
  const e = i.map((t) => {
14
- const { crossId: o, ptcId: c, localTimestamp: a } = t, r = Number(t.x), n = Number(t.y), s = Number(t.heading), h = `${o}-${c}`;
15
- this.historyPositionMap.set(h, [
16
- { pos: [r, n, 0], heading: s, time: a }
14
+ const { crossId: o, ptcId: h, localTimestamp: c } = t, a = Number(t.x), r = Number(t.y), s = Number(t.heading), n = `${o}-${h}`;
15
+ this.historyPositionMap.set(n, [
16
+ { pos: [a, r, 0], heading: s, time: c }
17
17
  ]);
18
18
  const l = new g({
19
19
  geometry: {
20
20
  type: "point",
21
- x: r,
22
- y: n
21
+ x: a,
22
+ y: r
23
23
  },
24
24
  attributes: {
25
25
  ...t
26
26
  },
27
27
  symbol: this.createCIMSymbol(t)
28
28
  });
29
- return l.visible = !1, this.vehicleObjectMap.set(h, {
29
+ return l.visible = !1, this.vehicleObjectMap.set(n, {
30
30
  graphic: l,
31
31
  data: t
32
32
  }), l;
@@ -36,15 +36,15 @@ class v {
36
36
  updateVehicles(i) {
37
37
  const e = [];
38
38
  i.forEach((t) => {
39
- const { crossId: o, ptcId: c, localTimestamp: a } = t, r = Number(t.x), n = Number(t.y);
39
+ const { crossId: o, ptcId: h, localTimestamp: c } = t, a = Number(t.x), r = Number(t.y);
40
40
  let s = Number(t.heading);
41
- const h = `${o}-${c}`, l = this.vehicleObjectMap.get(h);
41
+ const n = `${o}-${h}`, l = this.vehicleObjectMap.get(n);
42
42
  if (l) {
43
43
  l.data = t;
44
44
  const p = this.historyPositionMap.get(
45
- h
45
+ n
46
46
  ), m = p[p.length - 1];
47
- Math.abs(s - m.heading) >= 180 && (s > m.heading ? m.heading += 360 : s += 360), p.push({ pos: [r, n, 0], heading: s, time: a });
47
+ Math.abs(s - m.heading) >= 180 && (s > m.heading ? m.heading += 360 : s += 360), p.push({ pos: [a, r, 0], heading: s, time: c });
48
48
  } else
49
49
  e.push(t);
50
50
  }), this.addVehicles(e);
@@ -61,6 +61,20 @@ class v {
61
61
  updatePanelContent(i) {
62
62
  console.log(i);
63
63
  }
64
+ /**
65
+ * 设置地面车辆显示隐藏
66
+ * @param visible
67
+ */
68
+ toggleGroundVehicle(i) {
69
+ this.showGroundVehicle = i;
70
+ }
71
+ /**
72
+ * 设置高架车辆显示隐藏
73
+ * @param visible
74
+ */
75
+ toggleElevatedVehicle(i) {
76
+ this.showElevatedVehicle = i;
77
+ }
64
78
  render() {
65
79
  this.vehicleObjectMap.forEach((i, e) => {
66
80
  this.updatePosition(e);
@@ -71,7 +85,7 @@ class v {
71
85
  if (!e || !t || e.length < 2)
72
86
  return;
73
87
  const o = Date.now();
74
- t.graphic.visible = !0, t.segmentStartTime || (t.segmentStartTime = o, t.segmentTotalTime = e[1].time - e[0].time);
88
+ (t.graphic.getAttribute("roadLayer") || "1") === "1" ? t.graphic.visible = this.showGroundVehicle : t.graphic.visible = this.showElevatedVehicle, t.segmentStartTime || (t.segmentStartTime = o, t.segmentTotalTime = e[1].time - e[0].time);
75
89
  const c = o - t.segmentStartTime, a = Math.min(
76
90
  1,
77
91
  c / t.segmentTotalTime
@@ -89,12 +103,12 @@ class v {
89
103
  y: e[0].pos[1]
90
104
  };
91
105
  else {
92
- const r = e[0].pos[0] + (e[1].pos[0] - e[0].pos[0]) * a, n = e[0].pos[1] + (e[1].pos[1] - e[0].pos[1]) * a, s = e[0].heading + (e[1].heading - e[0].heading) * a;
106
+ const r = e[0].pos[0] + (e[1].pos[0] - e[0].pos[0]) * a, s = e[0].pos[1] + (e[1].pos[1] - e[0].pos[1]) * a, n = e[0].heading + (e[1].heading - e[0].heading) * a;
93
107
  t.graphic.geometry = {
94
108
  type: "point",
95
109
  x: r,
96
- y: n
97
- }, t.data.heading = s, t.graphic.symbol = this.createCIMSymbol(t.data);
110
+ y: s
111
+ }, t.data.heading = n, t.graphic.symbol = this.createCIMSymbol(t.data);
98
112
  }
99
113
  }
100
114
  /**
@@ -282,5 +296,5 @@ class v {
282
296
  }
283
297
  }
284
298
  export {
285
- v as default
299
+ C as default
286
300
  };
@@ -1,21 +1,21 @@
1
1
  import M from "@arcgis/core/Basemap";
2
- import P from "@arcgis/core/Map";
2
+ import T from "@arcgis/core/Map";
3
3
  import g from "@arcgis/core/config";
4
- import * as T from "@arcgis/core/core/reactiveUtils";
5
- import { Point as k } from "@arcgis/core/geometry";
4
+ import * as P from "@arcgis/core/core/reactiveUtils";
5
+ import { Polygon as z, Polyline as W, Point as k } from "@arcgis/core/geometry";
6
6
  import * as f from "@arcgis/core/geometry/support/webMercatorUtils";
7
- import z from "@arcgis/core/layers/GeoJSONLayer";
8
- import W from "@arcgis/core/layers/TileLayer";
9
- import x from "@arcgis/core/layers/WebTileLayer";
10
- import L from "@arcgis/core/views/MapView";
11
- import R from "@arcgis/core/views/SceneView";
12
- import S from "@turf/destination";
13
- import * as H from "@turf/helpers";
14
- import I from "../stores/index.mjs";
15
- function v(m, e) {
16
- return m.startsWith("http://") || m.startsWith("https://") ? m : e + m;
7
+ import x from "@arcgis/core/layers/GeoJSONLayer";
8
+ import L from "@arcgis/core/layers/TileLayer";
9
+ import R from "@arcgis/core/layers/WebTileLayer";
10
+ import S from "@arcgis/core/views/MapView";
11
+ import H from "@arcgis/core/views/SceneView";
12
+ import I from "@turf/destination";
13
+ import * as O from "@turf/helpers";
14
+ import G from "../stores/index.mjs";
15
+ function y(m, t) {
16
+ return m.startsWith("http://") || m.startsWith("https://") ? m : t + m;
17
17
  }
18
- class D {
18
+ class Q {
19
19
  constructor() {
20
20
  this.mapConfig = {}, this.watchHandleMap = /* @__PURE__ */ new Map(), this.handleIndex = 0, this.zoomWatchHandle = null;
21
21
  }
@@ -24,30 +24,30 @@ class D {
24
24
  * @param params 容器
25
25
  * @returns view
26
26
  */
27
- async initialize(e) {
28
- const s = I.useAppDataStore, t = JSON.parse(JSON.stringify(s.mapConfig));
29
- this.mapConfig = t;
30
- const { container: a, markerClickCallback: r, mapClickCallback: d } = e;
31
- g.assetsPath = `${t.assetsRoot}/ArcgisAssets`, g.fontsUrl = `${t.assetsRoot}/fonts`, g.apiKey = "AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";
32
- const c = new P();
33
- if ((t == null ? void 0 : t.mapOptions.mode.toLowerCase()) === "2d" ? this.view = new L({
27
+ async initialize(t) {
28
+ const i = G.useAppDataStore, e = JSON.parse(JSON.stringify(i.mapConfig));
29
+ this.mapConfig = e;
30
+ const { container: a, markerClickCallback: r, mapClickCallback: d } = t;
31
+ g.assetsPath = `${e.assetsRoot}/ArcgisAssets`, g.fontsUrl = `${e.assetsRoot}/fonts`, g.apiKey = "AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";
32
+ const c = new T();
33
+ if ((e == null ? void 0 : e.mapOptions.mode.toLowerCase()) === "2d" ? this.view = new S({
34
34
  map: c,
35
35
  container: a,
36
- ...t.mapOptions
37
- }) : this.view = new R({
36
+ ...e.mapOptions
37
+ }) : this.view = new H({
38
38
  map: c,
39
39
  container: a,
40
- ...t == null ? void 0 : t.mapOptions
41
- }), this.view.on("click", async (i) => {
42
- var y, b;
40
+ ...e == null ? void 0 : e.mapOptions
41
+ }), this.view.on("click", async (s) => {
42
+ var b, v;
43
43
  if (d) {
44
- let o = i.mapPoint;
44
+ let o = s.mapPoint;
45
45
  o.spatialReference.isWebMercator && (o = f.webMercatorToGeographic(
46
46
  o
47
47
  )), d(
48
48
  [o.x, o.y],
49
- [i.screenPoint.x, i.screenPoint.y],
50
- i
49
+ [s.screenPoint.x, s.screenPoint.y],
50
+ s
51
51
  );
52
52
  }
53
53
  if (this.view.type === "3d") {
@@ -60,7 +60,7 @@ class D {
60
60
  tilt: o.tilt,
61
61
  position: l.toJSON()
62
62
  };
63
- console.log(w), (y = navigator.clipboard) == null || y.writeText(JSON.stringify(w));
63
+ console.log(w), (b = navigator.clipboard) == null || b.writeText(JSON.stringify(w));
64
64
  } else
65
65
  console.log(o.toJSON());
66
66
  } else {
@@ -72,7 +72,7 @@ class D {
72
72
  zoom: this.view.zoom
73
73
  });
74
74
  }
75
- const h = (b = (await this.view.hitTest(i)).results) == null ? void 0 : b.filter(
75
+ const h = (v = (await this.view.hitTest(s)).results) == null ? void 0 : v.filter(
76
76
  (o) => o.type === "graphic"
77
77
  );
78
78
  h.length > 0 && h.forEach((o) => {
@@ -82,29 +82,29 @@ class D {
82
82
  l.attributes.type,
83
83
  l.attributes.id,
84
84
  l.attributes,
85
- i
85
+ s
86
86
  );
87
87
  });
88
- }), t != null && t.baseLayers ? t.baseLayers.forEach((i) => {
89
- switch (i.type.toLowerCase()) {
88
+ }), e != null && e.baseLayers ? e.baseLayers.forEach((s) => {
89
+ switch (s.type.toLowerCase()) {
90
90
  case "webTile".toLowerCase(): {
91
- const n = v(i.url, t.assetsRoot), h = new x({
91
+ const n = y(s.url, e.assetsRoot), h = new R({
92
92
  urlTemplate: n,
93
- ...i.options
93
+ ...s.options
94
94
  });
95
95
  c.add(h);
96
96
  break;
97
97
  }
98
98
  case "tile": {
99
- const n = v(i.url, t.assetsRoot), h = new W({
99
+ const n = y(s.url, e.assetsRoot), h = new L({
100
100
  url: n,
101
- ...i.options
101
+ ...s.options
102
102
  });
103
103
  c.add(h);
104
104
  break;
105
105
  }
106
106
  case "arcgis": {
107
- const n = new M(i.options);
107
+ const n = new M(s.options);
108
108
  c.basemap = n;
109
109
  break;
110
110
  }
@@ -114,84 +114,93 @@ class D {
114
114
  id: "arcgis/dark-gray",
115
115
  language: "zh-CN"
116
116
  }
117
- }), t != null && t.hdLayers) {
118
- const i = t.hdLayers.map(
117
+ }), e != null && e.hdLayers) {
118
+ const s = e.hdLayers.map(
119
119
  (n) => (
120
120
  // 图层文件为GeoJson格式, renderer和symbol使用autocast配置
121
- new z({
122
- url: v(n.url, t.assetsRoot),
121
+ new x({
122
+ url: y(n.url, e.assetsRoot),
123
123
  ...n.options,
124
124
  title: n.options.id
125
125
  })
126
126
  )
127
127
  );
128
- c.addMany(i);
128
+ c.addMany(s);
129
129
  }
130
130
  this.view.ui.remove("attribution"), this.view.ui.add("compass", "top-left"), await this.view.when();
131
131
  const p = this.mapConfig.camera;
132
132
  let u;
133
133
  if (this.view.type === "2d") {
134
- let i = this.view.center;
135
- this.view.spatialReference.isWebMercator && (i = f.webMercatorToGeographic(
136
- i
137
- )), u = { center: [i.x, i.y], zoom: this.view.zoom };
134
+ let s = this.view.center;
135
+ this.view.spatialReference.isWebMercator && (s = f.webMercatorToGeographic(
136
+ s
137
+ )), u = { center: [s.x, s.y], zoom: this.view.zoom };
138
138
  } else {
139
- let i = this.view.camera.position;
140
- this.view.spatialReference.isWebMercator && (i = f.webMercatorToGeographic(
141
- i
139
+ let s = this.view.camera.position;
140
+ this.view.spatialReference.isWebMercator && (s = f.webMercatorToGeographic(
141
+ s
142
142
  )), u = {
143
- position: i,
143
+ position: s,
144
144
  heading: this.view.camera.heading,
145
145
  tilt: this.view.camera.tilt
146
146
  };
147
147
  }
148
148
  return p ? p.home = u : this.mapConfig.camera = { home: u }, this.view;
149
149
  }
150
- setLayerVisibility(e) {
151
- const { id: s, visible: t } = e, a = this.view.map.findLayerById(s);
152
- return a ? (a.visible = t, { status: 0, message: "ok" }) : { status: -1, message: "未找到图层" };
150
+ setLayerVisibility(t) {
151
+ const { id: i, visible: e } = t, a = this.view.map.findLayerById(i);
152
+ return a ? (a.visible = e, { status: 0, message: "ok" }) : { status: -1, message: "未找到图层" };
153
153
  }
154
154
  /**
155
155
  * 设置地图中心点
156
156
  * @param params
157
157
  * @returns
158
158
  */
159
- async setMapCenter(e) {
160
- return this.view ? (e.center ? await this.view.goTo(
161
- {
162
- target: e.center,
163
- zoom: e.zoom
164
- },
165
- { duration: (e.duration || 0) * 1e3 }
166
- ) : e.camera && await this.view.goTo(e.camera, {
167
- duration: (e.duration || 0) * 1e3
168
- }), { status: 0, message: "成功" }) : { status: -1, message: "未初始化" };
159
+ async setMapCenter(t) {
160
+ var i;
161
+ if (!this.view)
162
+ return { status: -1, message: "未初始化" };
163
+ if (t.center || t.target) {
164
+ switch ((i = t.target) == null ? void 0 : i.type) {
165
+ case "point":
166
+ t.target = new k(t.target);
167
+ break;
168
+ case "polyline":
169
+ t.target = new W(t.target);
170
+ break;
171
+ case "polygon":
172
+ t.target = new z(t.target);
173
+ break;
174
+ }
175
+ await this.view.goTo(t, { duration: (t.duration || 0) * 1e3 });
176
+ }
177
+ return { status: 0, message: "成功" };
169
178
  }
170
179
  /**
171
180
  * 在一定的高度,以一定的角度去观察某个坐标
172
181
  * */
173
- async lookAt(e) {
182
+ async lookAt(t) {
174
183
  if (this.view.type === "2d")
175
184
  return;
176
- const s = e.tilt || 0, t = e.heading || 0;
177
- if (s === 0)
185
+ const i = t.tilt || 0, e = t.heading || 0;
186
+ if (i === 0)
178
187
  await this.view.goTo(
179
188
  {
180
189
  position: {
181
- x: e.center[0],
182
- y: e.center[1],
183
- z: e.height
190
+ x: t.center[0],
191
+ y: t.center[1],
192
+ z: t.height
184
193
  },
185
- heading: t,
194
+ heading: e,
186
195
  tilt: 0
187
196
  },
188
- { duration: (e.duration || 2) * 1e3 }
197
+ { duration: (t.duration || 2) * 1e3 }
189
198
  );
190
199
  else {
191
- const a = Math.tan(s * Math.PI / 180) * e.height, r = S(
192
- H.point(e.center),
200
+ const a = Math.tan(i * Math.PI / 180) * t.height, r = I(
201
+ O.point(t.center),
193
202
  a,
194
- t + 180,
203
+ e + 180,
195
204
  {
196
205
  units: "meters"
197
206
  }
@@ -201,67 +210,67 @@ class D {
201
210
  position: {
202
211
  x: r.geometry.coordinates[0],
203
212
  y: r.geometry.coordinates[1],
204
- z: e.height
213
+ z: t.height
205
214
  },
206
- heading: t,
207
- tilt: s
215
+ heading: e,
216
+ tilt: i
208
217
  },
209
- { duration: (e.duration || 2) * 1e3 }
218
+ { duration: (t.duration || 2) * 1e3 }
210
219
  );
211
220
  }
212
221
  }
213
- async setMapCamera(e) {
222
+ async setMapCamera(t) {
214
223
  if (!this.view)
215
224
  return { status: -1, message: "未初始化" };
216
- const { name: s, duration: t = 0 } = e, { camera: a } = this.mapConfig;
225
+ const { name: i, duration: e = 0 } = t, { camera: a } = this.mapConfig;
217
226
  if (!a)
218
227
  return { status: -1, message: "未配置camera" };
219
- const r = a[s];
220
- return r ? (console.log("target:", r, t * 1e3), await this.view.goTo(r, { duration: t * 1e3 }), { status: 0, message: "成功" }) : { status: -1, message: "未配置camera" };
228
+ const r = a[i];
229
+ return r ? (await this.view.goTo(r, { duration: e * 1e3 }), { status: 0, message: "成功" }) : { status: -1, message: "未配置camera" };
221
230
  }
222
231
  /**
223
232
  * 经纬度转像素坐标,在地图移动时回调
224
233
  * */
225
- requestCoordinateTransform(e, s) {
226
- let t = 0;
227
- const r = 1e3 / 30, d = T.watch(
234
+ requestCoordinateTransform(t, i) {
235
+ let e = 0;
236
+ const r = 1e3 / 30, d = P.watch(
228
237
  () => this.view.center,
229
238
  () => {
230
- const c = this.transformPoints(e), p = Date.now();
231
- p - t > r && (s(c), t = p);
239
+ const c = this.transformPoints(t), p = Date.now();
240
+ p - e > r && (i(c), e = p);
232
241
  }
233
242
  );
234
- return this.handleIndex++, this.watchHandleMap.set(this.handleIndex, d), { handle: this.handleIndex, points: this.transformPoints(e) };
243
+ return this.handleIndex++, this.watchHandleMap.set(this.handleIndex, d), { handle: this.handleIndex, points: this.transformPoints(t) };
235
244
  }
236
- transformPoints(e) {
237
- return e.map((s) => {
238
- const t = new k({
239
- x: s[0],
240
- y: s[1]
241
- }), a = this.view.toScreen(t);
245
+ transformPoints(t) {
246
+ return t.map((i) => {
247
+ const e = new k({
248
+ x: i[0],
249
+ y: i[1]
250
+ }), a = this.view.toScreen(e);
242
251
  return [a.x, a.y];
243
252
  });
244
253
  }
245
254
  /**
246
255
  * 停止坐标转换回调
247
256
  * */
248
- cancelCoordinateTransform(e) {
249
- const s = this.watchHandleMap.get(e);
250
- s && (s.remove(), this.watchHandleMap.delete(e));
257
+ cancelCoordinateTransform(t) {
258
+ const i = this.watchHandleMap.get(t);
259
+ i && (i.remove(), this.watchHandleMap.delete(t));
251
260
  }
252
261
  /**
253
262
  * 设置地图zoom范围
254
263
  * */
255
- setMapZoomRange(e) {
256
- const { min: s, max: t } = e;
257
- !s && !t || (this.zoomWatchHandle && this.zoomWatchHandle.remove(), this.zoomWatchHandle = T.watch(
264
+ setMapZoomRange(t) {
265
+ const { min: i, max: e } = t;
266
+ !i && !e || (this.zoomWatchHandle && this.zoomWatchHandle.remove(), this.zoomWatchHandle = P.watch(
258
267
  () => this.view.zoom,
259
268
  (a) => {
260
- s && a <= s && (this.view.zoom = s), t && a >= t && (this.view.zoom = t);
269
+ i && a <= i && (this.view.zoom = i), e && a >= e && (this.view.zoom = e);
261
270
  }
262
271
  ));
263
272
  }
264
273
  }
265
274
  export {
266
- D as default
275
+ Q as default
267
276
  };
@@ -1,4 +1,5 @@
1
1
  import View from '@arcgis/core/views/View';
2
+ import { IToggleTrafficInfoParams } from '../../types';
2
3
  export default class TrafficFlow {
3
4
  private view;
4
5
  private mapConfig;
@@ -10,6 +11,10 @@ export default class TrafficFlow {
10
11
  private objectMissCount;
11
12
  /** 是否显示车牌号码 */
12
13
  private showVehiclePlate;
14
+ /** 是否显示地面车辆 */
15
+ private showGroundVehicle;
16
+ /** 是否显示高架车辆 */
17
+ private showElevatedVehicle;
13
18
  private showLog;
14
19
  constructor(view: View);
15
20
  /**
@@ -23,10 +28,15 @@ export default class TrafficFlow {
23
28
  */
24
29
  disconnectTrafficFlow(): void;
25
30
  /**
26
- * 控制车辆号牌是否显示
27
- * @param visible
31
+ * 切换交通信息可见性
32
+ * @param params
28
33
  */
29
- toggleVehiclePlate(visible: boolean): void;
34
+ toggleTrafficInfo(params: IToggleTrafficInfoParams): void;
35
+ /**
36
+ * 切换交通对象可见性
37
+ * @param params
38
+ */
39
+ toggleTrafficObject(params: IToggleTrafficInfoParams): void;
30
40
  private focusVehNo;
31
41
  private handleTrafficFlowData;
32
42
  /**
@@ -34,6 +44,7 @@ export default class TrafficFlow {
34
44
  * @param objects
35
45
  */
36
46
  private addTrafficObjects;
47
+ private getVehicleVisibility;
37
48
  /**
38
49
  * 更新交通对象
39
50
  * @param objects