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.
- package/es/src/gis-map/gis-map.vue.d.ts +3 -5
- package/es/src/gis-map/gis-map.vue.mjs +64 -65
- package/es/src/gis-map/index.d.ts +2 -4
- package/es/src/gis-map/utils/holo-flow/index.d.ts +2 -0
- package/es/src/gis-map/utils/holo-flow/index.mjs +30 -19
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow.d.ts +8 -0
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow.mjs +56 -48
- package/es/src/gis-map/utils/holo-flow/trace-external-renderer.d.ts +2 -0
- package/es/src/gis-map/utils/holo-flow/trace-external-renderer.mjs +11 -7
- package/es/src/gis-map/utils/holo-flow/trace-holo-flow.d.ts +2 -0
- package/es/src/gis-map/utils/holo-flow/trace-holo-flow.mjs +49 -41
- package/es/src/gis-map/utils/holo-flow/trace-layer-renderer.d.ts +12 -0
- package/es/src/gis-map/utils/holo-flow/trace-layer-renderer.mjs +31 -17
- package/es/src/gis-map/utils/map-initializer.mjs +113 -104
- package/es/src/gis-map/utils/traffic-flow.d.ts +14 -3
- package/es/src/gis-map/utils/traffic-flow.mjs +156 -130
- package/es/src/types/index.d.ts +9 -2
- package/lib/src/gis-map/gis-map.vue.d.ts +3 -5
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +2 -4
- package/lib/src/gis-map/utils/holo-flow/index.d.ts +2 -0
- package/lib/src/gis-map/utils/holo-flow/index.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.d.ts +8 -0
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/trace-external-renderer.d.ts +2 -0
- package/lib/src/gis-map/utils/holo-flow/trace-external-renderer.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.d.ts +2 -0
- package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/trace-layer-renderer.d.ts +12 -0
- package/lib/src/gis-map/utils/holo-flow/trace-layer-renderer.js +1 -1
- package/lib/src/gis-map/utils/map-initializer.js +1 -1
- package/lib/src/gis-map/utils/traffic-flow.d.ts +14 -3
- package/lib/src/gis-map/utils/traffic-flow.js +1 -1
- package/lib/src/types/index.d.ts +9 -2
- package/package.json +1 -1
|
@@ -1,44 +1,45 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
class
|
|
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
|
|
9
|
-
this.mapConfig = JSON.parse(JSON.stringify(
|
|
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
|
|
12
|
+
)) : this.traceRenderer = new g(e);
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* 处理全息流轨迹数据
|
|
16
16
|
* */
|
|
17
17
|
handleVehicleTraceData(e) {
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
18
|
+
const i = new Date().getTime();
|
|
19
|
+
if (i - this.lastDataTime < 100)
|
|
20
20
|
return;
|
|
21
|
-
this.lastDataTime =
|
|
22
|
-
const { newVehList:
|
|
23
|
-
if (
|
|
24
|
-
for (const
|
|
25
|
-
|
|
26
|
-
|
|
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(
|
|
29
|
+
this.traceRenderer.addVehicles(h);
|
|
29
30
|
}
|
|
30
|
-
if (
|
|
31
|
-
for (const
|
|
32
|
-
const
|
|
33
|
-
|
|
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(
|
|
36
|
+
this.traceRenderer.updateVehicles(r);
|
|
36
37
|
}
|
|
37
|
-
if (
|
|
38
|
-
const
|
|
39
|
-
(
|
|
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(
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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:
|
|
58
|
-
crossId:
|
|
64
|
+
ptcId: n,
|
|
65
|
+
crossId: i,
|
|
59
66
|
x: p,
|
|
60
|
-
y:
|
|
61
|
-
ptcType:
|
|
67
|
+
y: s,
|
|
68
|
+
ptcType: o,
|
|
62
69
|
vehicleType: a,
|
|
63
|
-
heading:
|
|
64
|
-
vehicleColor:
|
|
65
|
-
showName:
|
|
66
|
-
plateNo:
|
|
67
|
-
plateColor:
|
|
68
|
-
timestamp:
|
|
69
|
-
localTimestamp:
|
|
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
|
-
|
|
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
|
|
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:
|
|
15
|
-
this.historyPositionMap.set(
|
|
16
|
-
{ pos: [
|
|
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:
|
|
22
|
-
y:
|
|
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(
|
|
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:
|
|
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
|
|
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
|
-
|
|
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: [
|
|
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 =
|
|
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,
|
|
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:
|
|
97
|
-
}, t.data.heading =
|
|
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
|
-
|
|
299
|
+
C as default
|
|
286
300
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import M from "@arcgis/core/Basemap";
|
|
2
|
-
import
|
|
2
|
+
import T from "@arcgis/core/Map";
|
|
3
3
|
import g from "@arcgis/core/config";
|
|
4
|
-
import * as
|
|
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
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import * as
|
|
14
|
-
import
|
|
15
|
-
function
|
|
16
|
-
return m.startsWith("http://") || m.startsWith("https://") ? 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
|
|
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(
|
|
28
|
-
const
|
|
29
|
-
this.mapConfig =
|
|
30
|
-
const { container: a, markerClickCallback: r, mapClickCallback: d } =
|
|
31
|
-
g.assetsPath = `${
|
|
32
|
-
const c = new
|
|
33
|
-
if ((
|
|
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
|
-
...
|
|
37
|
-
}) : this.view = new
|
|
36
|
+
...e.mapOptions
|
|
37
|
+
}) : this.view = new H({
|
|
38
38
|
map: c,
|
|
39
39
|
container: a,
|
|
40
|
-
...
|
|
41
|
-
}), this.view.on("click", async (
|
|
42
|
-
var
|
|
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 =
|
|
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
|
-
[
|
|
50
|
-
|
|
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), (
|
|
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 = (
|
|
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
|
-
|
|
85
|
+
s
|
|
86
86
|
);
|
|
87
87
|
});
|
|
88
|
-
}),
|
|
89
|
-
switch (
|
|
88
|
+
}), e != null && e.baseLayers ? e.baseLayers.forEach((s) => {
|
|
89
|
+
switch (s.type.toLowerCase()) {
|
|
90
90
|
case "webTile".toLowerCase(): {
|
|
91
|
-
const n =
|
|
91
|
+
const n = y(s.url, e.assetsRoot), h = new R({
|
|
92
92
|
urlTemplate: n,
|
|
93
|
-
...
|
|
93
|
+
...s.options
|
|
94
94
|
});
|
|
95
95
|
c.add(h);
|
|
96
96
|
break;
|
|
97
97
|
}
|
|
98
98
|
case "tile": {
|
|
99
|
-
const n =
|
|
99
|
+
const n = y(s.url, e.assetsRoot), h = new L({
|
|
100
100
|
url: n,
|
|
101
|
-
...
|
|
101
|
+
...s.options
|
|
102
102
|
});
|
|
103
103
|
c.add(h);
|
|
104
104
|
break;
|
|
105
105
|
}
|
|
106
106
|
case "arcgis": {
|
|
107
|
-
const n = new M(
|
|
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
|
-
}),
|
|
118
|
-
const
|
|
117
|
+
}), e != null && e.hdLayers) {
|
|
118
|
+
const s = e.hdLayers.map(
|
|
119
119
|
(n) => (
|
|
120
120
|
// 图层文件为GeoJson格式, renderer和symbol使用autocast配置
|
|
121
|
-
new
|
|
122
|
-
url:
|
|
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(
|
|
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
|
|
135
|
-
this.view.spatialReference.isWebMercator && (
|
|
136
|
-
|
|
137
|
-
)), u = { center: [
|
|
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
|
|
140
|
-
this.view.spatialReference.isWebMercator && (
|
|
141
|
-
|
|
139
|
+
let s = this.view.camera.position;
|
|
140
|
+
this.view.spatialReference.isWebMercator && (s = f.webMercatorToGeographic(
|
|
141
|
+
s
|
|
142
142
|
)), u = {
|
|
143
|
-
position:
|
|
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(
|
|
151
|
-
const { id:
|
|
152
|
-
return a ? (a.visible =
|
|
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(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
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(
|
|
182
|
+
async lookAt(t) {
|
|
174
183
|
if (this.view.type === "2d")
|
|
175
184
|
return;
|
|
176
|
-
const
|
|
177
|
-
if (
|
|
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:
|
|
182
|
-
y:
|
|
183
|
-
z:
|
|
190
|
+
x: t.center[0],
|
|
191
|
+
y: t.center[1],
|
|
192
|
+
z: t.height
|
|
184
193
|
},
|
|
185
|
-
heading:
|
|
194
|
+
heading: e,
|
|
186
195
|
tilt: 0
|
|
187
196
|
},
|
|
188
|
-
{ duration: (
|
|
197
|
+
{ duration: (t.duration || 2) * 1e3 }
|
|
189
198
|
);
|
|
190
199
|
else {
|
|
191
|
-
const a = Math.tan(
|
|
192
|
-
|
|
200
|
+
const a = Math.tan(i * Math.PI / 180) * t.height, r = I(
|
|
201
|
+
O.point(t.center),
|
|
193
202
|
a,
|
|
194
|
-
|
|
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:
|
|
213
|
+
z: t.height
|
|
205
214
|
},
|
|
206
|
-
heading:
|
|
207
|
-
tilt:
|
|
215
|
+
heading: e,
|
|
216
|
+
tilt: i
|
|
208
217
|
},
|
|
209
|
-
{ duration: (
|
|
218
|
+
{ duration: (t.duration || 2) * 1e3 }
|
|
210
219
|
);
|
|
211
220
|
}
|
|
212
221
|
}
|
|
213
|
-
async setMapCamera(
|
|
222
|
+
async setMapCamera(t) {
|
|
214
223
|
if (!this.view)
|
|
215
224
|
return { status: -1, message: "未初始化" };
|
|
216
|
-
const { name:
|
|
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[
|
|
220
|
-
return r ? (
|
|
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(
|
|
226
|
-
let
|
|
227
|
-
const r = 1e3 / 30, d =
|
|
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(
|
|
231
|
-
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(
|
|
243
|
+
return this.handleIndex++, this.watchHandleMap.set(this.handleIndex, d), { handle: this.handleIndex, points: this.transformPoints(t) };
|
|
235
244
|
}
|
|
236
|
-
transformPoints(
|
|
237
|
-
return
|
|
238
|
-
const
|
|
239
|
-
x:
|
|
240
|
-
y:
|
|
241
|
-
}), a = this.view.toScreen(
|
|
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(
|
|
249
|
-
const
|
|
250
|
-
|
|
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(
|
|
256
|
-
const { min:
|
|
257
|
-
!
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
31
|
+
* 切换交通信息可见性
|
|
32
|
+
* @param params
|
|
28
33
|
*/
|
|
29
|
-
|
|
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
|