gisviewer-vue3-arcgis 1.0.85
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/README.md +103 -0
- package/es/index.d.ts +8 -0
- package/es/index.mjs +16 -0
- package/es/src/components.d.ts +9 -0
- package/es/src/gis-map/gis-map.vue.d.ts +91 -0
- package/es/src/gis-map/gis-map.vue.mjs +124 -0
- package/es/src/gis-map/gis-map.vue2.mjs +4 -0
- package/es/src/gis-map/index.d.ts +81 -0
- package/es/src/gis-map/index.mjs +7 -0
- package/es/src/gis-map/stores/appData.d.ts +3 -0
- package/es/src/gis-map/stores/appData.mjs +9 -0
- package/es/src/gis-map/stores/index.d.ts +7 -0
- package/es/src/gis-map/stores/index.mjs +10 -0
- package/es/src/gis-map/style/index.css +13 -0
- package/es/src/gis-map/utils/FlyToPoints.d.ts +37 -0
- package/es/src/gis-map/utils/FlyToPoints.mjs +67 -0
- package/es/src/gis-map/utils/GreenWaveline.mjs +193 -0
- package/es/src/gis-map/utils/Layers.d.ts +31 -0
- package/es/src/gis-map/utils/Layers.mjs +99 -0
- package/es/src/gis-map/utils/common-utils.d.ts +65 -0
- package/es/src/gis-map/utils/common-utils.mjs +159 -0
- package/es/src/gis-map/utils/holo-flow/index.d.ts +15 -0
- package/es/src/gis-map/utils/holo-flow/index.mjs +50 -0
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow.d.ts +40 -0
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow.mjs +209 -0
- package/es/src/gis-map/utils/holo-flow/trace-external-renderer.d.ts +69 -0
- package/es/src/gis-map/utils/holo-flow/trace-external-renderer.mjs +316 -0
- package/es/src/gis-map/utils/holo-flow/trace-holo-flow.d.ts +18 -0
- package/es/src/gis-map/utils/holo-flow/trace-holo-flow.mjs +75 -0
- package/es/src/gis-map/utils/holo-flow/trace-layer-renderer.d.ts +35 -0
- package/es/src/gis-map/utils/holo-flow/trace-layer-renderer.mjs +286 -0
- package/es/src/gis-map/utils/index.d.ts +21 -0
- package/es/src/gis-map/utils/index.mjs +23 -0
- package/es/src/gis-map/utils/map-initializer.d.ts +50 -0
- package/es/src/gis-map/utils/map-initializer.mjs +248 -0
- package/es/src/gis-map/utils/open-drive-renderer/index.d.ts +9 -0
- package/es/src/gis-map/utils/open-drive-renderer/index.mjs +271 -0
- package/es/src/gis-map/utils/overlay.d.ts +83 -0
- package/es/src/gis-map/utils/overlay.mjs +149 -0
- package/es/src/gis-map/utils/queue-length.d.ts +14 -0
- package/es/src/gis-map/utils/queue-length.mjs +83 -0
- package/es/src/gis-map/utils/renderer/greenWaveline.d.ts +2 -0
- package/es/src/gis-map/utils/renderer/greenWaveline.mjs +169 -0
- package/es/src/gis-map/utils/road-config-tool/cross.d.ts +51 -0
- package/es/src/gis-map/utils/road-config-tool/cross.mjs +127 -0
- package/es/src/gis-map/utils/road-config-tool/entrance.d.ts +24 -0
- package/es/src/gis-map/utils/road-config-tool/entrance.mjs +79 -0
- package/es/src/gis-map/utils/road-config-tool/exit.d.ts +18 -0
- package/es/src/gis-map/utils/road-config-tool/exit.mjs +86 -0
- package/es/src/gis-map/utils/road-config-tool/index.d.ts +44 -0
- package/es/src/gis-map/utils/road-config-tool/index.mjs +112 -0
- package/es/src/gis-map/utils/road-config-tool/indicator-area.d.ts +22 -0
- package/es/src/gis-map/utils/road-config-tool/indicator-area.mjs +44 -0
- package/es/src/gis-map/utils/road-config-tool/lane.d.ts +21 -0
- package/es/src/gis-map/utils/road-config-tool/lane.mjs +35 -0
- package/es/src/gis-map/utils/road-config-tool/search-nearby-lanes.d.ts +62 -0
- package/es/src/gis-map/utils/road-config-tool/search-nearby-lanes.mjs +265 -0
- package/es/src/gis-map/utils/sketchView.d.ts +209 -0
- package/es/src/gis-map/utils/sketchView.mjs +516 -0
- package/es/src/gis-map/utils/sketchViewTool.d.ts +259 -0
- package/es/src/gis-map/utils/sketchViewTool.mjs +503 -0
- package/es/src/gis-map/utils/syncMapView.d.ts +43 -0
- package/es/src/gis-map/utils/syncMapView.mjs +64 -0
- package/es/src/gis-map/utils/traffic-flow.d.ts +66 -0
- package/es/src/gis-map/utils/traffic-flow.mjs +308 -0
- package/es/src/index.d.ts +1 -0
- package/es/src/index.mjs +4 -0
- package/es/src/types/index.d.ts +142 -0
- package/es/src/types/index.mjs +5 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.js +1 -0
- package/lib/src/components.d.ts +9 -0
- package/lib/src/gis-map/gis-map.vue.d.ts +91 -0
- package/lib/src/gis-map/gis-map.vue.js +1 -0
- package/lib/src/gis-map/gis-map.vue2.js +1 -0
- package/lib/src/gis-map/index.d.ts +81 -0
- package/lib/src/gis-map/index.js +1 -0
- package/lib/src/gis-map/stores/appData.d.ts +3 -0
- package/lib/src/gis-map/stores/appData.js +1 -0
- package/lib/src/gis-map/stores/index.d.ts +7 -0
- package/lib/src/gis-map/stores/index.js +1 -0
- package/lib/src/gis-map/style/index.css +13 -0
- package/lib/src/gis-map/utils/FlyToPoints.d.ts +37 -0
- package/lib/src/gis-map/utils/FlyToPoints.js +1 -0
- package/lib/src/gis-map/utils/GreenWaveline.js +1 -0
- package/lib/src/gis-map/utils/Layers.d.ts +31 -0
- package/lib/src/gis-map/utils/Layers.js +1 -0
- package/lib/src/gis-map/utils/common-utils.d.ts +65 -0
- package/lib/src/gis-map/utils/common-utils.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/index.d.ts +15 -0
- package/lib/src/gis-map/utils/holo-flow/index.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.d.ts +40 -0
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/trace-external-renderer.d.ts +69 -0
- package/lib/src/gis-map/utils/holo-flow/trace-external-renderer.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.d.ts +18 -0
- package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.js +1 -0
- package/lib/src/gis-map/utils/holo-flow/trace-layer-renderer.d.ts +35 -0
- package/lib/src/gis-map/utils/holo-flow/trace-layer-renderer.js +1 -0
- package/lib/src/gis-map/utils/index.d.ts +21 -0
- package/lib/src/gis-map/utils/index.js +1 -0
- package/lib/src/gis-map/utils/map-initializer.d.ts +50 -0
- package/lib/src/gis-map/utils/map-initializer.js +1 -0
- package/lib/src/gis-map/utils/open-drive-renderer/index.d.ts +9 -0
- package/lib/src/gis-map/utils/open-drive-renderer/index.js +1 -0
- package/lib/src/gis-map/utils/overlay.d.ts +83 -0
- package/lib/src/gis-map/utils/overlay.js +1 -0
- package/lib/src/gis-map/utils/queue-length.d.ts +14 -0
- package/lib/src/gis-map/utils/queue-length.js +1 -0
- package/lib/src/gis-map/utils/renderer/greenWaveline.d.ts +2 -0
- package/lib/src/gis-map/utils/renderer/greenWaveline.js +43 -0
- package/lib/src/gis-map/utils/road-config-tool/cross.d.ts +51 -0
- package/lib/src/gis-map/utils/road-config-tool/cross.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/entrance.d.ts +24 -0
- package/lib/src/gis-map/utils/road-config-tool/entrance.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/exit.d.ts +18 -0
- package/lib/src/gis-map/utils/road-config-tool/exit.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/index.d.ts +44 -0
- package/lib/src/gis-map/utils/road-config-tool/index.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/indicator-area.d.ts +22 -0
- package/lib/src/gis-map/utils/road-config-tool/indicator-area.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/lane.d.ts +21 -0
- package/lib/src/gis-map/utils/road-config-tool/lane.js +1 -0
- package/lib/src/gis-map/utils/road-config-tool/search-nearby-lanes.d.ts +62 -0
- package/lib/src/gis-map/utils/road-config-tool/search-nearby-lanes.js +1 -0
- package/lib/src/gis-map/utils/sketchView.d.ts +209 -0
- package/lib/src/gis-map/utils/sketchView.js +1 -0
- package/lib/src/gis-map/utils/sketchViewTool.d.ts +259 -0
- package/lib/src/gis-map/utils/sketchViewTool.js +1 -0
- package/lib/src/gis-map/utils/syncMapView.d.ts +43 -0
- package/lib/src/gis-map/utils/syncMapView.js +1 -0
- package/lib/src/gis-map/utils/traffic-flow.d.ts +66 -0
- package/lib/src/gis-map/utils/traffic-flow.js +1 -0
- package/lib/src/index.d.ts +1 -0
- package/lib/src/index.js +1 -0
- package/lib/src/types/index.d.ts +142 -0
- package/lib/src/types/index.js +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import * as d from "@arcgis/core/core/reactiveUtils";
|
|
2
|
+
import { Point as c } from "@arcgis/core/geometry";
|
|
3
|
+
import p from "@arcgis/core/layers/FeatureLayer";
|
|
4
|
+
import u from "../../stores/index.mjs";
|
|
5
|
+
class f {
|
|
6
|
+
constructor(e) {
|
|
7
|
+
this.currentPhaseMap = /* @__PURE__ */ new Map(), this.countdownCanvasMap = /* @__PURE__ */ new Map(), this.lastDataTime = 0, this.isDeletingCanvas = !1, this.canvasWidth = 80, this.canvasHeight = 50, this.view = (e.type === "2d", e);
|
|
8
|
+
const t = u.useAppDataStore;
|
|
9
|
+
this.mapConfig = JSON.parse(JSON.stringify(t.mapConfig));
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 初始化相位线图层
|
|
13
|
+
* */
|
|
14
|
+
async initializeLayer() {
|
|
15
|
+
if (this.mapConfig.phaseLineLayer)
|
|
16
|
+
if (this.phaseLineLayer)
|
|
17
|
+
this.phaseLineLayer.visible || (this.phaseLineLayer.visible = !0);
|
|
18
|
+
else {
|
|
19
|
+
const e = `${this.mapConfig.assetsRoot}/${this.mapConfig.phaseLineLayer}`, o = (await (await fetch(e)).json()).features.map((i, s) => ({
|
|
20
|
+
geometry: {
|
|
21
|
+
type: "polyline",
|
|
22
|
+
paths: [i.geometry.coordinates]
|
|
23
|
+
},
|
|
24
|
+
attributes: {
|
|
25
|
+
ObjectID: s + 1,
|
|
26
|
+
id: i.properties.id,
|
|
27
|
+
color: "hide"
|
|
28
|
+
}
|
|
29
|
+
}));
|
|
30
|
+
this.phaseLineLayer = new p({
|
|
31
|
+
source: o,
|
|
32
|
+
geometryType: "polyline",
|
|
33
|
+
objectIdField: "ObjectID",
|
|
34
|
+
outFields: ["*"],
|
|
35
|
+
fields: [
|
|
36
|
+
{
|
|
37
|
+
name: "ObjectID",
|
|
38
|
+
alias: "ObjectID",
|
|
39
|
+
type: "oid"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "color",
|
|
43
|
+
alias: "color",
|
|
44
|
+
type: "string"
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
renderer: {
|
|
48
|
+
type: "unique-value",
|
|
49
|
+
field: "color",
|
|
50
|
+
// 没更新相位数据的路口不显示相位线
|
|
51
|
+
defaultSymbol: {
|
|
52
|
+
type: "simple-line",
|
|
53
|
+
color: "lightblue",
|
|
54
|
+
width: "2px",
|
|
55
|
+
style: "none"
|
|
56
|
+
},
|
|
57
|
+
uniqueValueInfos: [
|
|
58
|
+
{
|
|
59
|
+
value: "green",
|
|
60
|
+
symbol: {
|
|
61
|
+
type: "line-3d",
|
|
62
|
+
symbolLayers: [
|
|
63
|
+
{
|
|
64
|
+
type: "path",
|
|
65
|
+
profile: "quad",
|
|
66
|
+
material: { color: [19, 255, 69, 0.8] },
|
|
67
|
+
width: 1,
|
|
68
|
+
height: 0.5
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
value: "red",
|
|
75
|
+
symbol: {
|
|
76
|
+
type: "line-3d",
|
|
77
|
+
symbolLayers: [
|
|
78
|
+
{
|
|
79
|
+
type: "path",
|
|
80
|
+
profile: "quad",
|
|
81
|
+
material: { color: [254, 5, 9, 0.8] },
|
|
82
|
+
width: 1,
|
|
83
|
+
height: 0.5
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
value: "yellow",
|
|
90
|
+
symbol: {
|
|
91
|
+
type: "line-3d",
|
|
92
|
+
symbolLayers: [
|
|
93
|
+
{
|
|
94
|
+
type: "path",
|
|
95
|
+
profile: "quad",
|
|
96
|
+
material: { color: [255, 215, 0, 0.8] },
|
|
97
|
+
width: 1,
|
|
98
|
+
height: 0.5
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
}), this.view.map.add(this.phaseLineLayer);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async handleSignalData(e) {
|
|
109
|
+
const t = new Date().getTime();
|
|
110
|
+
if (t - this.lastDataTime < 100)
|
|
111
|
+
return;
|
|
112
|
+
this.lastDataTime = t;
|
|
113
|
+
const { crossId: o, lat: i, lon: s, rtStage: n, channelsConfig: l } = e;
|
|
114
|
+
await this.updateCountdown(o, i, s, n), this.phaseLineLayer && ((!this.currentPhaseMap.has(o) || this.currentPhaseMap.get(o) !== n.stagePhase) && await this.updatePhaseLine(
|
|
115
|
+
o,
|
|
116
|
+
n.channelsConfig,
|
|
117
|
+
l
|
|
118
|
+
), this.currentPhaseMap.set(o, n.stagePhase));
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* 清除实时信号相关图层
|
|
122
|
+
* */
|
|
123
|
+
clearSignal() {
|
|
124
|
+
this.phaseLineLayer.visible = !1, this.countdownWatchHandel && (this.countdownWatchHandel.remove(), this.countdownWatchHandel = void 0), this.countdownCanvasMap.forEach((e) => {
|
|
125
|
+
this.view.container.removeChild(e.backgroundCanvas), this.view.container.removeChild(e.countdownCanvas);
|
|
126
|
+
}), this.countdownCanvasMap.clear();
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* 获取显示倒计时的canvas
|
|
130
|
+
* */
|
|
131
|
+
async updateCountdown(e, t, a, o) {
|
|
132
|
+
if (this.isDeletingCanvas)
|
|
133
|
+
return;
|
|
134
|
+
const i = this.countdownCanvasMap.get(e);
|
|
135
|
+
if (i)
|
|
136
|
+
this.drawCountdownText(i.countdownCanvas, o);
|
|
137
|
+
else {
|
|
138
|
+
const s = new c({
|
|
139
|
+
longitude: a,
|
|
140
|
+
latitude: t,
|
|
141
|
+
z: 10
|
|
142
|
+
}), n = this.view.toScreen(s);
|
|
143
|
+
if (n.x > this.view.width || n.y > this.view.height)
|
|
144
|
+
return;
|
|
145
|
+
this.createCountdownCanvas((l) => {
|
|
146
|
+
const r = l[0], h = l[1];
|
|
147
|
+
r.style.left = n.x + "px", r.style.top = n.y + "px", h.style.left = n.x + "px", h.style.top = n.y + "px", this.countdownCanvasMap.set(e, {
|
|
148
|
+
backgroundCanvas: r,
|
|
149
|
+
countdownCanvas: h,
|
|
150
|
+
mapPoint: s
|
|
151
|
+
}), this.drawCountdownText(h, o);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
this.countdownWatchHandel || (this.countdownWatchHandel = d.watch(
|
|
155
|
+
() => this.view.extent,
|
|
156
|
+
() => {
|
|
157
|
+
this.countdownCanvasMap.forEach((s) => {
|
|
158
|
+
const n = this.view.toScreen(s.mapPoint);
|
|
159
|
+
n.x > this.view.width || n.y > this.view.height ? (this.isDeletingCanvas = !0, this.view.container.removeChild(s.backgroundCanvas), this.view.container.removeChild(s.countdownCanvas), this.countdownCanvasMap.delete(e), this.isDeletingCanvas = !1) : (s.backgroundCanvas.style.left = n.x + "px", s.backgroundCanvas.style.top = n.y + "px", s.countdownCanvas.style.left = n.x + "px", s.countdownCanvas.style.top = n.y + "px");
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
));
|
|
163
|
+
}
|
|
164
|
+
drawCountdownText(e, t) {
|
|
165
|
+
const a = e.getContext("2d");
|
|
166
|
+
a.clearRect(0, 0, e.width, e.height), a.font = "32px LESLIE", a.textBaseline = "middle", a.textAlign = "center", a.fillStyle = t.stageRemainingTime <= t.stageAllRedTime ? "red" : t.stageRemainingTime <= t.stageAllRedTime + t.stageYellowTime ? "yellow" : "lime", a.fillText(
|
|
167
|
+
t.stageRemainingTime,
|
|
168
|
+
e.width / 2,
|
|
169
|
+
e.height / 2
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
async updatePhaseLine(e, t, a) {
|
|
173
|
+
const o = this.phaseLineLayer.source.filter(
|
|
174
|
+
(i) => i.getAttribute("id").includes(e)
|
|
175
|
+
);
|
|
176
|
+
o.forEach((i) => {
|
|
177
|
+
const s = i.getAttribute("id");
|
|
178
|
+
this.isLaneInChannels(s, t) ? i.setAttribute("color", "green") : this.isLaneInChannels(s, a) ? i.setAttribute("color", "red") : i.setAttribute("color", "green");
|
|
179
|
+
}), await this.phaseLineLayer.applyEdits({ updateFeatures: o });
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* 车道是否在通道中
|
|
183
|
+
* @param laneCode 车道编码
|
|
184
|
+
* @param channels 通道列表
|
|
185
|
+
* @returns
|
|
186
|
+
*/
|
|
187
|
+
isLaneInChannels(e, t) {
|
|
188
|
+
const a = e.split("+"), o = a[1], i = a[2];
|
|
189
|
+
for (let s = 0; s < t.length; s++)
|
|
190
|
+
for (let n = 0; n < t[s].laneSnList.length; n++) {
|
|
191
|
+
const l = t[s].laneSnList[n].toFixed(0);
|
|
192
|
+
if (o === l[0] && i === l[1])
|
|
193
|
+
return !0;
|
|
194
|
+
}
|
|
195
|
+
return !1;
|
|
196
|
+
}
|
|
197
|
+
createCountdownCanvas(e) {
|
|
198
|
+
const t = new Image();
|
|
199
|
+
t.src = `${this.mapConfig.assetsRoot}/Images/timeboard/CountdownBG.png`, t.onload = () => {
|
|
200
|
+
const a = document.createElement("canvas");
|
|
201
|
+
a.width = this.canvasWidth, a.height = this.canvasHeight, a.style.position = "absolute", a.style.transform = "translate(-50%, -50%)", a.getContext("2d").drawImage(t, 0, 0, this.canvasWidth, this.canvasHeight), this.view.container.appendChild(a);
|
|
202
|
+
const i = document.createElement("canvas");
|
|
203
|
+
i.width = this.canvasWidth - 10, i.height = this.canvasHeight - 10, i.style.position = "absolute", i.style.transform = "translate(-50%, -50%)", this.view.container.appendChild(i), e([a, i]);
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
export {
|
|
208
|
+
f as default
|
|
209
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { EVehiclePlateState, ITraceRendererInterface, IVehicleTrack } from '../../../types';
|
|
2
|
+
export default class TraceExternalRenderer implements ITraceRendererInterface {
|
|
3
|
+
private renderer;
|
|
4
|
+
private scene;
|
|
5
|
+
private camera;
|
|
6
|
+
private ambient;
|
|
7
|
+
private sun;
|
|
8
|
+
/** 默认车身材质 */
|
|
9
|
+
private defaultMaterial;
|
|
10
|
+
/** 车身颜色材质 */
|
|
11
|
+
private materialMap;
|
|
12
|
+
private readonly view;
|
|
13
|
+
private readonly assetsRoot;
|
|
14
|
+
private carModel;
|
|
15
|
+
private carModelReady;
|
|
16
|
+
private vanModel;
|
|
17
|
+
private vanModelReady;
|
|
18
|
+
private truckModel;
|
|
19
|
+
private truckModelReady;
|
|
20
|
+
private busModel;
|
|
21
|
+
private busModelReady;
|
|
22
|
+
private bicycleModel;
|
|
23
|
+
private bicycleModelReady;
|
|
24
|
+
private currentSpriteContent;
|
|
25
|
+
private historyPositionMap;
|
|
26
|
+
private vehicleObjectMap;
|
|
27
|
+
constructor(view: __esri.SceneView);
|
|
28
|
+
setup(context: any): Promise<void>;
|
|
29
|
+
render(context: any): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* 新增车辆
|
|
32
|
+
* */
|
|
33
|
+
addVehicles(objects: IVehicleTrack[]): void;
|
|
34
|
+
/**
|
|
35
|
+
* 更新车辆
|
|
36
|
+
* */
|
|
37
|
+
updateVehicles(objects: IVehicleTrack[]): void;
|
|
38
|
+
/**
|
|
39
|
+
* 删除车辆
|
|
40
|
+
* */
|
|
41
|
+
deleteVehicles(idList: string[]): void;
|
|
42
|
+
/**
|
|
43
|
+
* 清除全部车辆
|
|
44
|
+
* */
|
|
45
|
+
clearVehicles(): void;
|
|
46
|
+
/**
|
|
47
|
+
* 设置号牌显示状态
|
|
48
|
+
* @param contentType
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
updatePanelContent(contentType: EVehiclePlateState): void;
|
|
52
|
+
/**
|
|
53
|
+
* 释放模型资源
|
|
54
|
+
* */
|
|
55
|
+
private disposeModel;
|
|
56
|
+
/**
|
|
57
|
+
* 计算车辆位置
|
|
58
|
+
* */
|
|
59
|
+
private computeVehiclePosition;
|
|
60
|
+
/**
|
|
61
|
+
* 根据车辆类型、车身颜色获取模型
|
|
62
|
+
* */
|
|
63
|
+
private getVehicleModel;
|
|
64
|
+
/**
|
|
65
|
+
* 创建号牌canvas
|
|
66
|
+
* */
|
|
67
|
+
private createCanvas;
|
|
68
|
+
private createPlateSprite;
|
|
69
|
+
}
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import b from "@arcgis/core/geometry/SpatialReference";
|
|
2
|
+
import * as g from "@arcgis/core/views/3d/externalRenderers";
|
|
3
|
+
import * as o from "three";
|
|
4
|
+
import { GLTFLoader as v } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
5
|
+
import { EVehiclePlateState as M } from "../../../types/index.mjs";
|
|
6
|
+
import w from "../../stores/index.mjs";
|
|
7
|
+
class k {
|
|
8
|
+
constructor(i) {
|
|
9
|
+
this.defaultMaterial = new o.MeshBasicMaterial({
|
|
10
|
+
color: 6908265
|
|
11
|
+
}), this.materialMap = /* @__PURE__ */ new Map([
|
|
12
|
+
[1, new o.MeshBasicMaterial({ color: 16777215 })],
|
|
13
|
+
[2, new o.MeshBasicMaterial({ color: 7833753 })],
|
|
14
|
+
[3, new o.MeshBasicMaterial({ color: 16766720 })],
|
|
15
|
+
[4, new o.MeshBasicMaterial({ color: 16758465 })],
|
|
16
|
+
[5, new o.MeshBasicMaterial({ color: 14423100 })],
|
|
17
|
+
[6, new o.MeshBasicMaterial({ color: 3329330 })],
|
|
18
|
+
[7, new o.MeshBasicMaterial({ color: 2003183 })],
|
|
19
|
+
[8, new o.MeshBasicMaterial({ color: 16032864 })],
|
|
20
|
+
[9, new o.MeshBasicMaterial({ color: 2105376 })],
|
|
21
|
+
[10, new o.MeshBasicMaterial({ color: 9662683 })],
|
|
22
|
+
[99, new o.MeshBasicMaterial({ color: 6908265 })]
|
|
23
|
+
]), this.carModelReady = !1, this.vanModelReady = !1, this.truckModelReady = !1, this.busModelReady = !1, this.bicycleModelReady = !1, this.currentSpriteContent = M.None, this.historyPositionMap = /* @__PURE__ */ new Map(), this.vehicleObjectMap = /* @__PURE__ */ new Map();
|
|
24
|
+
const e = w.useAppDataStore;
|
|
25
|
+
this.assetsRoot = JSON.parse(
|
|
26
|
+
JSON.stringify(e.mapConfig)
|
|
27
|
+
).assetsRoot, this.view = i;
|
|
28
|
+
const t = new v();
|
|
29
|
+
t.load(`${this.assetsRoot}/3DModels/car.glb`, (s) => {
|
|
30
|
+
this.carModel = s.scene, this.carModel.rotation.x = o.MathUtils.degToRad(90), this.carModelReady = !0;
|
|
31
|
+
}), t.load(`${this.assetsRoot}/3DModels/van.glb`, (s) => {
|
|
32
|
+
this.vanModel = s.scene, this.vanModel.rotation.x = o.MathUtils.degToRad(90), this.vanModelReady = !0;
|
|
33
|
+
}), t.load(`${this.assetsRoot}/3DModels/truck.glb`, (s) => {
|
|
34
|
+
this.truckModel = s.scene, this.truckModel.scale.set(1.2, 1, 1.5), this.truckModel.rotation.x = o.MathUtils.degToRad(90), this.truckModelReady = !0;
|
|
35
|
+
}), t.load(`${this.assetsRoot}/3DModels/bus.glb`, (s) => {
|
|
36
|
+
this.busModel = s.scene, this.busModel.rotation.x = o.MathUtils.degToRad(90), this.busModelReady = !0;
|
|
37
|
+
}), t.load(`${this.assetsRoot}/3DModels/bicycle.glb`, (s) => {
|
|
38
|
+
this.bicycleModel = s.scene, this.bicycleModel.rotation.x = o.MathUtils.degToRad(90), this.bicycleModel.rotation.y = o.MathUtils.degToRad(180), this.bicycleModelReady = !0;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
async setup(i) {
|
|
42
|
+
this.renderer = new o.WebGLRenderer({
|
|
43
|
+
context: i.gl,
|
|
44
|
+
premultipliedAlpha: !1,
|
|
45
|
+
antialias: !0
|
|
46
|
+
}), this.renderer.setPixelRatio(window.devicePixelRatio), this.renderer.setViewport(0, 0, this.view.width, this.view.height), this.renderer.autoClearDepth = !1, this.renderer.autoClearStencil = !1, this.renderer.autoClearColor = !1;
|
|
47
|
+
const e = this.renderer.setRenderTarget.bind(
|
|
48
|
+
this.renderer
|
|
49
|
+
);
|
|
50
|
+
this.renderer.setRenderTarget = (t) => {
|
|
51
|
+
e(t), t == null && i.bindRenderTarget();
|
|
52
|
+
}, this.scene = new o.Scene(), this.camera = new o.PerspectiveCamera(), this.ambient = new o.AmbientLight(16777215, 0.5), this.scene.add(this.ambient), this.sun = new o.DirectionalLight(16777215, 0.5), this.scene.add(this.sun), i.resetWebGLState();
|
|
53
|
+
}
|
|
54
|
+
async render(i) {
|
|
55
|
+
var s;
|
|
56
|
+
const e = i.camera;
|
|
57
|
+
this.camera.position.set(e.eye[0], e.eye[1], e.eye[2]), this.camera.up.set(e.up[0], e.up[1], e.up[2]), this.camera.lookAt(
|
|
58
|
+
new o.Vector3(e.center[0], e.center[1], e.center[2])
|
|
59
|
+
), this.camera.projectionMatrix.fromArray(e.projectionMatrix);
|
|
60
|
+
for (const r of this.vehicleObjectMap.keys()) {
|
|
61
|
+
const l = (s = this.vehicleObjectMap.get(r)) == null ? void 0 : s.model;
|
|
62
|
+
if (!l)
|
|
63
|
+
continue;
|
|
64
|
+
const a = this.computeVehiclePosition(r);
|
|
65
|
+
if (a) {
|
|
66
|
+
const c = [0, 0, 0];
|
|
67
|
+
g.toRenderCoordinates(
|
|
68
|
+
this.view,
|
|
69
|
+
a,
|
|
70
|
+
0,
|
|
71
|
+
b.WGS84,
|
|
72
|
+
c,
|
|
73
|
+
0,
|
|
74
|
+
1
|
|
75
|
+
), l.position.set(c[0], c[1], c[2]), l.rotation.y = o.MathUtils.degToRad(-a[3]);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const t = i.sunLight;
|
|
79
|
+
this.sun.position.set(t.direction[0], t.direction[1], t.direction[2]), this.sun.intensity = t.diffuse.intensity, this.sun.color = new o.Color(
|
|
80
|
+
t.diffuse.color[0],
|
|
81
|
+
t.diffuse.color[1],
|
|
82
|
+
t.diffuse.color[2]
|
|
83
|
+
), this.ambient.intensity = t.ambient.intensity, this.ambient.color = new o.Color(
|
|
84
|
+
t.ambient.color[0],
|
|
85
|
+
t.ambient.color[1],
|
|
86
|
+
t.ambient.color[2]
|
|
87
|
+
), this.renderer.resetState(), i.bindRenderTarget(), this.renderer.render(this.scene, this.camera), g.requestRender(this.view), i.resetWebGLState();
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* 新增车辆
|
|
91
|
+
* */
|
|
92
|
+
addVehicles(i) {
|
|
93
|
+
!this.carModelReady || !this.vanModelReady || !this.truckModelReady || !this.busModelReady || !this.bicycleModelReady || i.forEach((e) => {
|
|
94
|
+
const { crossId: t, ptcId: s, localTimestamp: r } = e, l = Number(e.x), a = Number(e.y), c = Number(e.heading), h = `${t}-${s}`;
|
|
95
|
+
this.historyPositionMap.set(h, [
|
|
96
|
+
{ pos: [l, a, 0], heading: c, time: r }
|
|
97
|
+
]);
|
|
98
|
+
const n = this.getVehicleModel(e);
|
|
99
|
+
n.name = h, n.visible = !1, this.createPlateSprite(e, (d) => {
|
|
100
|
+
n.add(d), d.position.set(0, 5, -4);
|
|
101
|
+
}), this.scene.add(n), this.vehicleObjectMap.set(h, {
|
|
102
|
+
model: n,
|
|
103
|
+
data: e
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* 更新车辆
|
|
109
|
+
* */
|
|
110
|
+
updateVehicles(i) {
|
|
111
|
+
!this.carModelReady || !this.vanModelReady || !this.truckModelReady || !this.busModelReady || !this.bicycleModelReady || i.forEach((e) => {
|
|
112
|
+
const { crossId: t, ptcId: s, localTimestamp: r } = e, l = Number(e.x), a = Number(e.y);
|
|
113
|
+
let c = Number(e.heading);
|
|
114
|
+
const h = `${t}-${s}`, n = this.vehicleObjectMap.get(h);
|
|
115
|
+
if (n) {
|
|
116
|
+
if ((n.data.vehicleColor !== e.vehicleColor || n.data.vehicleType !== e.vehicleType) && (this.scene.remove(n.model), this.disposeModel(n.model), n.model = this.getVehicleModel(e), this.scene.add(n.model)), n.data.showName !== e.showName || n.data.plateColor !== e.plateColor) {
|
|
117
|
+
const m = n.model.getObjectByName("VehiclePlate");
|
|
118
|
+
m && (n.model.remove(m), this.disposeModel(m)), this.createPlateSprite(e, (u) => {
|
|
119
|
+
n.model.add(u), u.position.set(0, 5, -4);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
n.data = e;
|
|
123
|
+
const d = this.historyPositionMap.get(
|
|
124
|
+
h
|
|
125
|
+
), p = d[d.length - 1];
|
|
126
|
+
Math.abs(c - p.heading) >= 180 && (c > p.heading ? p.heading += 360 : c += 360), d.push({
|
|
127
|
+
pos: [l, a, 0],
|
|
128
|
+
heading: c,
|
|
129
|
+
time: r
|
|
130
|
+
});
|
|
131
|
+
} else {
|
|
132
|
+
this.historyPositionMap.set(h, [
|
|
133
|
+
{ pos: [l, a, 0], heading: c, time: r }
|
|
134
|
+
]);
|
|
135
|
+
const d = this.getVehicleModel(e);
|
|
136
|
+
d.name = h, d.visible = !1, this.createPlateSprite(e, (p) => {
|
|
137
|
+
d.add(p), p.position.set(0, 5, -4);
|
|
138
|
+
}), this.scene.add(d), this.vehicleObjectMap.set(h, {
|
|
139
|
+
model: d,
|
|
140
|
+
data: e
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* 删除车辆
|
|
147
|
+
* */
|
|
148
|
+
deleteVehicles(i) {
|
|
149
|
+
i.forEach((e) => {
|
|
150
|
+
const t = this.vehicleObjectMap.get(e);
|
|
151
|
+
t && (this.disposeModel(t.model), this.scene.remove(t.model), this.vehicleObjectMap.delete(e), this.historyPositionMap.delete(e));
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* 清除全部车辆
|
|
156
|
+
* */
|
|
157
|
+
clearVehicles() {
|
|
158
|
+
for (const i of this.vehicleObjectMap.keys()) {
|
|
159
|
+
const e = this.vehicleObjectMap.get(i);
|
|
160
|
+
e && (this.disposeModel(e.model), this.scene.remove(e.model));
|
|
161
|
+
}
|
|
162
|
+
this.vehicleObjectMap.clear(), this.historyPositionMap.clear();
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* 设置号牌显示状态
|
|
166
|
+
* @param contentType
|
|
167
|
+
* @returns
|
|
168
|
+
*/
|
|
169
|
+
updatePanelContent(i) {
|
|
170
|
+
if (i !== this.currentSpriteContent) {
|
|
171
|
+
this.currentSpriteContent = i;
|
|
172
|
+
for (const e of this.vehicleObjectMap.keys()) {
|
|
173
|
+
const t = this.vehicleObjectMap.get(e);
|
|
174
|
+
if (t) {
|
|
175
|
+
const s = t.model.getObjectByName("VehiclePlate");
|
|
176
|
+
s && (t.model.remove(s), this.disposeModel(s)), i !== M.None && this.createPlateSprite(t.data, (r) => {
|
|
177
|
+
t.model.add(r), r.position.set(0, 5, -4);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* 释放模型资源
|
|
185
|
+
* */
|
|
186
|
+
disposeModel(i) {
|
|
187
|
+
i.traverse((e) => {
|
|
188
|
+
e instanceof o.Mesh && (e.geometry.dispose(), e.material.dispose());
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* 计算车辆位置
|
|
193
|
+
* */
|
|
194
|
+
computeVehiclePosition(i) {
|
|
195
|
+
const e = this.historyPositionMap.get(i), t = this.vehicleObjectMap.get(i);
|
|
196
|
+
if (!t || !e)
|
|
197
|
+
return [0, 0, 0, 0];
|
|
198
|
+
if (e.length === 0)
|
|
199
|
+
return [0, 0, 0, 0];
|
|
200
|
+
if (e.length <= 2)
|
|
201
|
+
return [...e[0].pos, e[0].heading];
|
|
202
|
+
const s = Date.now();
|
|
203
|
+
t.model.visible = !0, t.segmentStartTime || (t.segmentStartTime = s, t.segmentTotalTime = e[1].time - e[0].time);
|
|
204
|
+
const r = s - t.segmentStartTime, l = Math.min(
|
|
205
|
+
r / t.segmentTotalTime,
|
|
206
|
+
1
|
|
207
|
+
);
|
|
208
|
+
if (l === 1)
|
|
209
|
+
if (e.shift(), e.length === 1) {
|
|
210
|
+
t.segmentStartTime = void 0;
|
|
211
|
+
return;
|
|
212
|
+
} else
|
|
213
|
+
return t.segmentStartTime = s, t.segmentTotalTime = e[1].time - e[0].time, Math.abs(
|
|
214
|
+
e[1].heading - e[0].heading
|
|
215
|
+
) >= 180 && (e[1].heading > e[0].heading ? e[0].heading += 360 : e[1].heading += 360), [...e[0].pos, e[0].heading];
|
|
216
|
+
else {
|
|
217
|
+
const a = e[0].pos[0] + (e[1].pos[0] - e[0].pos[0]) * l, c = e[0].pos[1] + (e[1].pos[1] - e[0].pos[1]) * l, h = e[0].heading + (e[1].heading - e[0].heading) * l;
|
|
218
|
+
return [a, c, 0, h];
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* 根据车辆类型、车身颜色获取模型
|
|
223
|
+
* */
|
|
224
|
+
getVehicleModel(i) {
|
|
225
|
+
let e;
|
|
226
|
+
if (i.ptcType === 2)
|
|
227
|
+
e = this.bicycleModel.clone();
|
|
228
|
+
else {
|
|
229
|
+
switch (i.vehicleType) {
|
|
230
|
+
case 10:
|
|
231
|
+
e = this.carModel.clone();
|
|
232
|
+
break;
|
|
233
|
+
case 20:
|
|
234
|
+
e = this.vanModel.clone();
|
|
235
|
+
break;
|
|
236
|
+
case 25:
|
|
237
|
+
e = this.truckModel.clone();
|
|
238
|
+
break;
|
|
239
|
+
case 50:
|
|
240
|
+
e = this.busModel.clone();
|
|
241
|
+
break;
|
|
242
|
+
default:
|
|
243
|
+
e = this.carModel.clone();
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
const t = this.materialMap.get(i.vehicleColor) || this.defaultMaterial;
|
|
247
|
+
let s = !1;
|
|
248
|
+
e.traverse((r) => {
|
|
249
|
+
!s && r instanceof o.Mesh && (r.material = t, s = !0);
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
return e;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* 创建号牌canvas
|
|
256
|
+
* */
|
|
257
|
+
createCanvas(i, e, t) {
|
|
258
|
+
const s = document.createElement("canvas"), r = i.width, l = i.height;
|
|
259
|
+
s.width = r, s.height = l;
|
|
260
|
+
const a = s.getContext("2d");
|
|
261
|
+
if (!a) {
|
|
262
|
+
console.log("canvas创建失败");
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
return a.fillStyle = "rgba(0,0,0,0.0)", a.fillRect(0, 0, r, l), a.drawImage(i, 0, 0, r, l), a.beginPath(), a.translate(r / 2, l / 2), a.fillStyle = t, a.font = "bold 32px 宋体", a.textBaseline = "middle", a.textAlign = "center", a.fillText(e, 0, 0), s;
|
|
266
|
+
}
|
|
267
|
+
createPlateSprite(i, e) {
|
|
268
|
+
var c, h;
|
|
269
|
+
const t = !i.plateNo || i.plateNo === "0" || i.plateNo === "000000";
|
|
270
|
+
if (this.currentSpriteContent === M.None || this.currentSpriteContent === M.PlateNumber && t)
|
|
271
|
+
return;
|
|
272
|
+
const s = new Image();
|
|
273
|
+
let r = "", l = "", a = "";
|
|
274
|
+
if (this.currentSpriteContent === M.PlateNumber || this.currentSpriteContent === M.Mix)
|
|
275
|
+
if (t)
|
|
276
|
+
r = "grey", l = i.ptcId, a = "#ffffff";
|
|
277
|
+
else
|
|
278
|
+
switch (l = ((c = i.showName) == null ? void 0 : c.substring(0, 2)) + "•" + ((h = i.showName) == null ? void 0 : h.substring(2)), i.plateColor) {
|
|
279
|
+
case 1:
|
|
280
|
+
r = "blue", a = "#ffffff";
|
|
281
|
+
break;
|
|
282
|
+
case 2:
|
|
283
|
+
r = "yellow", a = "#000000";
|
|
284
|
+
break;
|
|
285
|
+
case 3:
|
|
286
|
+
r = "white", a = "#000000";
|
|
287
|
+
break;
|
|
288
|
+
case 4:
|
|
289
|
+
r = "black";
|
|
290
|
+
break;
|
|
291
|
+
case 5:
|
|
292
|
+
r = "neo_yellow", a = "#000000";
|
|
293
|
+
break;
|
|
294
|
+
case 6:
|
|
295
|
+
r = "neo_green", a = "#000000";
|
|
296
|
+
break;
|
|
297
|
+
default:
|
|
298
|
+
r = "grey", l = i.plateNo, a = "#ffffff";
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
else
|
|
302
|
+
this.currentSpriteContent === M.Id && (r = "grey", l = i.ptcId, a = "#ffffff");
|
|
303
|
+
s.src = `${this.assetsRoot}/Images/PlateBG/${r}.png`, s.onload = () => {
|
|
304
|
+
const n = this.createCanvas(s, l, a);
|
|
305
|
+
if (!n)
|
|
306
|
+
return;
|
|
307
|
+
const d = new o.CanvasTexture(n), p = new o.SpriteMaterial({
|
|
308
|
+
map: d
|
|
309
|
+
}), f = new o.Sprite(p), m = 0.05, u = n.width * m, y = n.height * m;
|
|
310
|
+
f.scale.set(u, y, 1), f.name = "VehiclePlate", e(f);
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
export {
|
|
315
|
+
k as default
|
|
316
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EVehiclePlateState } from '../../../types';
|
|
2
|
+
export default class TraceHoloFlow {
|
|
3
|
+
private mapConfig;
|
|
4
|
+
private view;
|
|
5
|
+
private lastDataTime;
|
|
6
|
+
private readonly traceRenderer;
|
|
7
|
+
constructor(view: __esri.View);
|
|
8
|
+
/**
|
|
9
|
+
* 处理全息流轨迹数据
|
|
10
|
+
* */
|
|
11
|
+
handleVehicleTraceData(data: any): void;
|
|
12
|
+
/**
|
|
13
|
+
* 清除轨迹流
|
|
14
|
+
* */
|
|
15
|
+
clearTrace(): void;
|
|
16
|
+
updatePanelContent(contentType: EVehiclePlateState): void;
|
|
17
|
+
private buildVehicleTrackData;
|
|
18
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
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 {
|
|
6
|
+
constructor(e) {
|
|
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(
|
|
10
|
+
e,
|
|
11
|
+
this.traceRenderer
|
|
12
|
+
)) : this.traceRenderer = new f(e);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 处理全息流轨迹数据
|
|
16
|
+
* */
|
|
17
|
+
handleVehicleTraceData(e) {
|
|
18
|
+
const c = new Date().getTime();
|
|
19
|
+
if (c - this.lastDataTime < 100)
|
|
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);
|
|
27
|
+
}
|
|
28
|
+
this.traceRenderer.addVehicles(a);
|
|
29
|
+
}
|
|
30
|
+
if (o && o.length > 0) {
|
|
31
|
+
for (const t of o) {
|
|
32
|
+
const r = this.buildVehicleTrackData(t, s);
|
|
33
|
+
r && l.push(r);
|
|
34
|
+
}
|
|
35
|
+
this.traceRenderer.updateVehicles(l);
|
|
36
|
+
}
|
|
37
|
+
if (i && i.length > 0) {
|
|
38
|
+
const t = i.map(
|
|
39
|
+
(r) => s + "-" + r.ptcId
|
|
40
|
+
);
|
|
41
|
+
this.traceRenderer.deleteVehicles(t);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 清除轨迹流
|
|
46
|
+
* */
|
|
47
|
+
clearTrace() {
|
|
48
|
+
this.traceRenderer.clearVehicles();
|
|
49
|
+
}
|
|
50
|
+
updatePanelContent(e) {
|
|
51
|
+
this.traceRenderer.updatePanelContent(e);
|
|
52
|
+
}
|
|
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))
|
|
56
|
+
return {
|
|
57
|
+
ptcId: o,
|
|
58
|
+
crossId: c,
|
|
59
|
+
x: p,
|
|
60
|
+
y: n,
|
|
61
|
+
ptcType: i,
|
|
62
|
+
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
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
export {
|
|
74
|
+
b as default
|
|
75
|
+
};
|