gisviewer-vue3-arcgis 1.0.89 → 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 (41) hide show
  1. package/es/src/gis-map/gis-map.vue.d.ts +4 -5
  2. package/es/src/gis-map/gis-map.vue.mjs +80 -80
  3. package/es/src/gis-map/index.d.ts +3 -4
  4. package/es/src/gis-map/utils/GreenWaveline.mjs +1 -1
  5. package/es/src/gis-map/utils/holo-flow/index.d.ts +2 -0
  6. package/es/src/gis-map/utils/holo-flow/index.mjs +30 -19
  7. package/es/src/gis-map/utils/holo-flow/signal-holo-flow.d.ts +8 -0
  8. package/es/src/gis-map/utils/holo-flow/signal-holo-flow.mjs +56 -48
  9. package/es/src/gis-map/utils/holo-flow/trace-external-renderer.d.ts +2 -0
  10. package/es/src/gis-map/utils/holo-flow/trace-external-renderer.mjs +11 -7
  11. package/es/src/gis-map/utils/holo-flow/trace-holo-flow.d.ts +2 -0
  12. package/es/src/gis-map/utils/holo-flow/trace-holo-flow.mjs +49 -41
  13. package/es/src/gis-map/utils/holo-flow/trace-layer-renderer.d.ts +12 -0
  14. package/es/src/gis-map/utils/holo-flow/trace-layer-renderer.mjs +31 -17
  15. package/es/src/gis-map/utils/map-initializer.d.ts +2 -1
  16. package/es/src/gis-map/utils/map-initializer.mjs +135 -107
  17. package/es/src/gis-map/utils/renderer/greenWaveline.d.ts +2 -2
  18. package/es/src/gis-map/utils/traffic-flow.d.ts +14 -3
  19. package/es/src/gis-map/utils/traffic-flow.mjs +156 -130
  20. package/es/src/types/index.d.ts +14 -3
  21. package/lib/src/gis-map/gis-map.vue.d.ts +4 -5
  22. package/lib/src/gis-map/gis-map.vue.js +1 -1
  23. package/lib/src/gis-map/index.d.ts +3 -4
  24. package/lib/src/gis-map/utils/GreenWaveline.js +1 -1
  25. package/lib/src/gis-map/utils/holo-flow/index.d.ts +2 -0
  26. package/lib/src/gis-map/utils/holo-flow/index.js +1 -1
  27. package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.d.ts +8 -0
  28. package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.js +1 -1
  29. package/lib/src/gis-map/utils/holo-flow/trace-external-renderer.d.ts +2 -0
  30. package/lib/src/gis-map/utils/holo-flow/trace-external-renderer.js +1 -1
  31. package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.d.ts +2 -0
  32. package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.js +1 -1
  33. package/lib/src/gis-map/utils/holo-flow/trace-layer-renderer.d.ts +12 -0
  34. package/lib/src/gis-map/utils/holo-flow/trace-layer-renderer.js +1 -1
  35. package/lib/src/gis-map/utils/map-initializer.d.ts +2 -1
  36. package/lib/src/gis-map/utils/map-initializer.js +1 -1
  37. package/lib/src/gis-map/utils/renderer/greenWaveline.d.ts +2 -2
  38. package/lib/src/gis-map/utils/traffic-flow.d.ts +14 -3
  39. package/lib/src/gis-map/utils/traffic-flow.js +1 -1
  40. package/lib/src/types/index.d.ts +14 -3
  41. 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,6 +1,6 @@
1
1
  import MapView from '@arcgis/core/views/MapView';
2
2
  import SceneView from '@arcgis/core/views/SceneView';
3
- import { ILookAtParams, IResult, ISetMapCameraParams, ISetMapCenterParams } from '../../types';
3
+ import { ILayerVisibleParams, ILookAtParams, IResult, ISetMapCameraParams, ISetMapCenterParams } from '../../types';
4
4
  export default class MapInitializer {
5
5
  private view;
6
6
  private mapConfig;
@@ -14,6 +14,7 @@ export default class MapInitializer {
14
14
  markerClickCallback?: (type: string, id: string, detail: any, event?: any) => void;
15
15
  mapClickCallback?: (mapPoint: number[], screenPoint: number[], event?: any) => void;
16
16
  }): Promise<MapView | SceneView>;
17
+ setLayerVisibility(params: ILayerVisibleParams): IResult;
17
18
  /**
18
19
  * 设置地图中心点
19
20
  * @param params
@@ -1,21 +1,21 @@
1
- import b from "@arcgis/core/Basemap";
2
- import M from "@arcgis/core/Map";
3
- import d from "@arcgis/core/config";
4
- import * as v from "@arcgis/core/core/reactiveUtils";
5
- import { Point as P } from "@arcgis/core/geometry";
1
+ import M from "@arcgis/core/Basemap";
2
+ import T from "@arcgis/core/Map";
3
+ import g from "@arcgis/core/config";
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 T from "@arcgis/core/layers/GeoJSONLayer";
8
- import z from "@arcgis/core/layers/TileLayer";
9
- import k from "@arcgis/core/layers/WebTileLayer";
10
- import x from "@arcgis/core/views/MapView";
11
- import W from "@arcgis/core/views/SceneView";
12
- import S from "@turf/destination";
13
- import * as L from "@turf/helpers";
14
- import I from "../stores/index.mjs";
15
- function u(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 j {
18
+ class Q {
19
19
  constructor() {
20
20
  this.mapConfig = {}, this.watchHandleMap = /* @__PURE__ */ new Map(), this.handleIndex = 0, this.zoomWatchHandle = null;
21
21
  }
@@ -24,27 +24,27 @@ class j {
24
24
  * @param params 容器
25
25
  * @returns view
26
26
  */
27
- async initialize(e) {
28
- const i = I.useAppDataStore, t = JSON.parse(JSON.stringify(i.mapConfig));
29
- this.mapConfig = t;
30
- const { container: a, markerClickCallback: c, mapClickCallback: w } = e;
31
- d.assetsPath = `${t.assetsRoot}/ArcgisAssets`, d.fontsUrl = `${t.assetsRoot}/fonts`, d.apiKey = "AAPKf5a3e1044d7a4faeb3b1ec7060f5c68equIrP2KbRyL-t_b40Kk4GTWUQ1BFCyttvyQPQnWpFmBd7kp9gkrVihjfmcKBwxjW";
32
- const n = new M();
33
- if ((t == null ? void 0 : t.mapOptions.mode.toLowerCase()) === "2d" ? this.view = new x({
34
- map: n,
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
+ map: c,
35
35
  container: a,
36
- ...t.mapOptions
37
- }) : this.view = new W({
38
- map: n,
36
+ ...e.mapOptions
37
+ }) : this.view = new H({
38
+ map: c,
39
39
  container: a,
40
- ...t == null ? void 0 : t.mapOptions
40
+ ...e == null ? void 0 : e.mapOptions
41
41
  }), this.view.on("click", async (s) => {
42
- var g, y;
43
- if (w) {
42
+ var b, v;
43
+ if (d) {
44
44
  let o = s.mapPoint;
45
45
  o.spatialReference.isWebMercator && (o = f.webMercatorToGeographic(
46
46
  o
47
- )), w(
47
+ )), d(
48
48
  [o.x, o.y],
49
49
  [s.screenPoint.x, s.screenPoint.y],
50
50
  s
@@ -55,12 +55,12 @@ class j {
55
55
  if (this.view.spatialReference.isWebMercator) {
56
56
  const l = f.webMercatorToGeographic(
57
57
  o.position
58
- ), p = {
58
+ ), w = {
59
59
  heading: o.heading,
60
60
  tilt: o.tilt,
61
61
  position: l.toJSON()
62
62
  };
63
- console.log(p), (g = navigator.clipboard) == null || g.writeText(JSON.stringify(p));
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,104 +72,135 @@ class j {
72
72
  zoom: this.view.zoom
73
73
  });
74
74
  }
75
- const h = (y = (await this.view.hitTest(s)).results) == null ? void 0 : y.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) => {
79
- var p;
79
+ var w;
80
80
  const l = o.graphic;
81
- (p = l.attributes) != null && p.type && c && c(
81
+ (w = l.attributes) != null && w.type && r && r(
82
82
  l.attributes.type,
83
83
  l.attributes.id,
84
84
  l.attributes,
85
85
  s
86
86
  );
87
87
  });
88
- }), t != null && t.baseLayers ? t.baseLayers.forEach((s) => {
88
+ }), e != null && e.baseLayers ? e.baseLayers.forEach((s) => {
89
89
  switch (s.type.toLowerCase()) {
90
90
  case "webTile".toLowerCase(): {
91
- const r = u(s.url, t.assetsRoot), h = new k({
92
- urlTemplate: r,
91
+ const n = y(s.url, e.assetsRoot), h = new R({
92
+ urlTemplate: n,
93
93
  ...s.options
94
94
  });
95
- n.add(h);
95
+ c.add(h);
96
96
  break;
97
97
  }
98
98
  case "tile": {
99
- const r = u(s.url, t.assetsRoot), h = new z({
100
- url: r,
99
+ const n = y(s.url, e.assetsRoot), h = new L({
100
+ url: n,
101
101
  ...s.options
102
102
  });
103
- n.add(h);
103
+ c.add(h);
104
104
  break;
105
105
  }
106
106
  case "arcgis": {
107
- const r = new b(s.options);
108
- n.basemap = r;
107
+ const n = new M(s.options);
108
+ c.basemap = n;
109
109
  break;
110
110
  }
111
111
  }
112
- }) : n.basemap = new b({
112
+ }) : c.basemap = new M({
113
113
  style: {
114
114
  id: "arcgis/dark-gray",
115
115
  language: "zh-CN"
116
116
  }
117
- }), t != null && t.hdLayers) {
118
- const s = t.hdLayers.map(
119
- (r) => (
117
+ }), e != null && e.hdLayers) {
118
+ const s = e.hdLayers.map(
119
+ (n) => (
120
120
  // 图层文件为GeoJson格式, renderer和symbol使用autocast配置
121
- new T({
122
- url: u(r.url, t.assetsRoot),
123
- ...r.options,
124
- title: r.options.id
121
+ new x({
122
+ url: y(n.url, e.assetsRoot),
123
+ ...n.options,
124
+ title: n.options.id
125
125
  })
126
126
  )
127
127
  );
128
- n.addMany(s);
128
+ c.addMany(s);
129
129
  }
130
- return this.view.ui.remove("attribution"), this.view.ui.add("compass", "top-left"), await this.view.when(), this.view;
130
+ this.view.ui.remove("attribution"), this.view.ui.add("compass", "top-left"), await this.view.when();
131
+ const p = this.mapConfig.camera;
132
+ let u;
133
+ if (this.view.type === "2d") {
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
+ } else {
139
+ let s = this.view.camera.position;
140
+ this.view.spatialReference.isWebMercator && (s = f.webMercatorToGeographic(
141
+ s
142
+ )), u = {
143
+ position: s,
144
+ heading: this.view.camera.heading,
145
+ tilt: this.view.camera.tilt
146
+ };
147
+ }
148
+ return p ? p.home = u : this.mapConfig.camera = { home: u }, this.view;
149
+ }
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: "未找到图层" };
131
153
  }
132
154
  /**
133
155
  * 设置地图中心点
134
156
  * @param params
135
157
  * @returns
136
158
  */
137
- async setMapCenter(e) {
138
- return this.view ? (e.center ? await this.view.goTo(
139
- {
140
- target: e.center,
141
- zoom: e.zoom
142
- },
143
- { duration: (e.duration || 0) * 1e3 }
144
- ) : e.camera && await this.view.goTo(e.camera, {
145
- duration: (e.duration || 0) * 1e3
146
- }), { 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: "成功" };
147
178
  }
148
179
  /**
149
180
  * 在一定的高度,以一定的角度去观察某个坐标
150
181
  * */
151
- async lookAt(e) {
182
+ async lookAt(t) {
152
183
  if (this.view.type === "2d")
153
184
  return;
154
- const i = e.tilt || 0, t = e.heading || 0;
185
+ const i = t.tilt || 0, e = t.heading || 0;
155
186
  if (i === 0)
156
187
  await this.view.goTo(
157
188
  {
158
189
  position: {
159
- x: e.center[0],
160
- y: e.center[1],
161
- z: e.height
190
+ x: t.center[0],
191
+ y: t.center[1],
192
+ z: t.height
162
193
  },
163
- heading: t,
194
+ heading: e,
164
195
  tilt: 0
165
196
  },
166
- { duration: (e.duration || 2) * 1e3 }
197
+ { duration: (t.duration || 2) * 1e3 }
167
198
  );
168
199
  else {
169
- const a = Math.tan(i * Math.PI / 180) * e.height, c = S(
170
- L.point(e.center),
200
+ const a = Math.tan(i * Math.PI / 180) * t.height, r = I(
201
+ O.point(t.center),
171
202
  a,
172
- t + 180,
203
+ e + 180,
173
204
  {
174
205
  units: "meters"
175
206
  }
@@ -177,72 +208,69 @@ class j {
177
208
  await this.view.goTo(
178
209
  {
179
210
  position: {
180
- x: c.geometry.coordinates[0],
181
- y: c.geometry.coordinates[1],
182
- z: e.height
211
+ x: r.geometry.coordinates[0],
212
+ y: r.geometry.coordinates[1],
213
+ z: t.height
183
214
  },
184
- heading: t,
215
+ heading: e,
185
216
  tilt: i
186
217
  },
187
- { duration: (e.duration || 2) * 1e3 }
218
+ { duration: (t.duration || 2) * 1e3 }
188
219
  );
189
220
  }
190
221
  }
191
- async setMapCamera(e) {
222
+ async setMapCamera(t) {
192
223
  if (!this.view)
193
224
  return { status: -1, message: "未初始化" };
194
- const { crossId: i, duration: t = 0 } = e, { camera: a } = this.mapConfig;
195
- return a ? a[i] ? (await this.view.goTo(
196
- {
197
- target: a.center,
198
- zoom: e.zoom || 15
199
- },
200
- { duration: t * 1e3 }
201
- ), { status: 0, message: "成功" }) : { status: -1, message: "未配置camera" } : { status: -1, message: "未配置camera" };
225
+ const { name: i, duration: e = 0 } = t, { camera: a } = this.mapConfig;
226
+ if (!a)
227
+ return { 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" };
202
230
  }
203
231
  /**
204
232
  * 经纬度转像素坐标,在地图移动时回调
205
233
  * */
206
- requestCoordinateTransform(e, i) {
207
- let t = 0;
208
- const c = 1e3 / 30, w = v.watch(
234
+ requestCoordinateTransform(t, i) {
235
+ let e = 0;
236
+ const r = 1e3 / 30, d = P.watch(
209
237
  () => this.view.center,
210
238
  () => {
211
- const n = this.transformPoints(e), s = Date.now();
212
- s - t > c && (i(n), t = s);
239
+ const c = this.transformPoints(t), p = Date.now();
240
+ p - e > r && (i(c), e = p);
213
241
  }
214
242
  );
215
- return this.handleIndex++, this.watchHandleMap.set(this.handleIndex, w), { handle: this.handleIndex, points: this.transformPoints(e) };
243
+ return this.handleIndex++, this.watchHandleMap.set(this.handleIndex, d), { handle: this.handleIndex, points: this.transformPoints(t) };
216
244
  }
217
- transformPoints(e) {
218
- return e.map((i) => {
219
- const t = new P({
245
+ transformPoints(t) {
246
+ return t.map((i) => {
247
+ const e = new k({
220
248
  x: i[0],
221
249
  y: i[1]
222
- }), a = this.view.toScreen(t);
250
+ }), a = this.view.toScreen(e);
223
251
  return [a.x, a.y];
224
252
  });
225
253
  }
226
254
  /**
227
255
  * 停止坐标转换回调
228
256
  * */
229
- cancelCoordinateTransform(e) {
230
- const i = this.watchHandleMap.get(e);
231
- i && (i.remove(), this.watchHandleMap.delete(e));
257
+ cancelCoordinateTransform(t) {
258
+ const i = this.watchHandleMap.get(t);
259
+ i && (i.remove(), this.watchHandleMap.delete(t));
232
260
  }
233
261
  /**
234
262
  * 设置地图zoom范围
235
263
  * */
236
- setMapZoomRange(e) {
237
- const { min: i, max: t } = e;
238
- !i && !t || (this.zoomWatchHandle && this.zoomWatchHandle.remove(), this.zoomWatchHandle = v.watch(
264
+ setMapZoomRange(t) {
265
+ const { min: i, max: e } = t;
266
+ !i && !e || (this.zoomWatchHandle && this.zoomWatchHandle.remove(), this.zoomWatchHandle = P.watch(
239
267
  () => this.view.zoom,
240
268
  (a) => {
241
- i && a <= i && (this.view.zoom = i), t && a >= t && (this.view.zoom = t);
269
+ i && a <= i && (this.view.zoom = i), e && a >= e && (this.view.zoom = e);
242
270
  }
243
271
  ));
244
272
  }
245
273
  }
246
274
  export {
247
- j as default
275
+ Q as default
248
276
  };
@@ -1,2 +1,2 @@
1
- declare const greenWavelineView: any;
2
- export default greenWavelineView;
1
+ declare const GreenWavelineView: any;
2
+ export default GreenWavelineView;