gisviewer-vue3-arcgis 1.0.108 → 1.0.110
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 -0
- package/es/src/gis-map/gis-map.vue.mjs +117 -98
- package/es/src/gis-map/index.d.ts +3 -0
- package/es/src/gis-map/stores/appData.d.ts +1 -0
- package/es/src/gis-map/stores/appData.mjs +5 -4
- package/es/src/gis-map/utils/holo-flow/index.d.ts +2 -0
- package/es/src/gis-map/utils/holo-flow/index.mjs +26 -27
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow.d.ts +2 -0
- package/es/src/gis-map/utils/holo-flow/signal-holo-flow.mjs +69 -57
- package/es/src/gis-map/utils/holo-flow/trace-holo-flow.d.ts +4 -3
- package/es/src/gis-map/utils/holo-flow/trace-holo-flow.mjs +92 -37
- package/es/src/gis-map/utils/holo-flow/trace-renderer-external.d.ts +9 -5
- package/es/src/gis-map/utils/holo-flow/trace-renderer-external.mjs +168 -121
- package/es/src/gis-map/utils/holo-flow/trace-renderer-layer.d.ts +1 -0
- package/es/src/gis-map/utils/holo-flow/trace-renderer-layer.mjs +3 -0
- package/es/src/types/index.d.ts +1 -0
- package/lib/src/gis-map/gis-map.vue.d.ts +3 -0
- package/lib/src/gis-map/gis-map.vue.js +1 -1
- package/lib/src/gis-map/index.d.ts +3 -0
- package/lib/src/gis-map/stores/appData.d.ts +1 -0
- package/lib/src/gis-map/stores/appData.js +1 -1
- 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 +2 -0
- package/lib/src/gis-map/utils/holo-flow/signal-holo-flow.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.d.ts +4 -3
- package/lib/src/gis-map/utils/holo-flow/trace-holo-flow.js +2 -1
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-external.d.ts +9 -5
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-external.js +1 -1
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-layer.d.ts +1 -0
- package/lib/src/gis-map/utils/holo-flow/trace-renderer-layer.js +1 -1
- package/lib/src/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import * as
|
|
5
|
-
import
|
|
1
|
+
import * as P from "@arcgis/core/core/promiseUtils.js";
|
|
2
|
+
import * as b from "@arcgis/core/core/reactiveUtils.js";
|
|
3
|
+
import v from "@arcgis/core/geometry/SpatialReference";
|
|
4
|
+
import * as u from "@arcgis/core/views/3d/externalRenderers";
|
|
5
|
+
import * as l from "three";
|
|
6
|
+
import { GLTFLoader as y } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
6
7
|
import { EVehiclePlateState as d } from "../../../types/index.mjs";
|
|
7
|
-
import
|
|
8
|
-
class
|
|
8
|
+
import G from "../../stores/index.mjs";
|
|
9
|
+
class I {
|
|
9
10
|
constructor(i) {
|
|
10
|
-
this.cameraHeightThreshold = 1e3, this.roughness = 0.2, this.metalness = 0.8, this.defaultMaterial = new
|
|
11
|
+
this.cameraHeightThreshold = 1e3, this.roughness = 0.2, this.metalness = 0.8, this.defaultMaterial = new l.MeshPhongMaterial({
|
|
11
12
|
color: 16777215
|
|
12
13
|
}), this.materialMap = /* @__PURE__ */ new Map([
|
|
13
14
|
[1, this.createCarMaterial(16777215)],
|
|
@@ -21,48 +22,95 @@ class k {
|
|
|
21
22
|
[9, this.createCarMaterial(2105376)],
|
|
22
23
|
[10, this.createCarMaterial(9662683)],
|
|
23
24
|
[99, this.createCarMaterial(6908265)]
|
|
24
|
-
]), this.
|
|
25
|
-
const e =
|
|
25
|
+
]), this.isInitialized = !1, this.showGroundVehicle = !0, this.showElevatedVehicle = !0, this.isPaused = !1, this.currentSpriteContent = d.None, this.historyPositionMap = /* @__PURE__ */ new Map(), this.vehicleObjectMap = /* @__PURE__ */ new Map(), this.needInterpolate = !0, this.updateModel = !1;
|
|
26
|
+
const e = G.useAppDataStore;
|
|
26
27
|
this.assetsRoot = JSON.parse(
|
|
27
28
|
JSON.stringify(e.mapConfig)
|
|
28
|
-
).assetsRoot, this.view = i
|
|
29
|
-
const t = new R();
|
|
30
|
-
t.load(`${this.assetsRoot}/3DModels/car.glb`, (s) => {
|
|
31
|
-
this.carModel = s.scene, this.carModel.rotation.x = h.MathUtils.degToRad(90), this.carModelReady = !0;
|
|
32
|
-
}), t.load(`${this.assetsRoot}/3DModels/van.glb`, (s) => {
|
|
33
|
-
this.vanModel = s.scene, this.vanModel.rotation.x = h.MathUtils.degToRad(90), this.vanModelReady = !0;
|
|
34
|
-
}), t.load(`${this.assetsRoot}/3DModels/truck.glb`, (s) => {
|
|
35
|
-
this.truckModel = s.scene, this.truckModel.scale.set(1.2, 1, 1.5), this.truckModel.rotation.x = h.MathUtils.degToRad(90), this.truckModelReady = !0;
|
|
36
|
-
}), t.load(`${this.assetsRoot}/3DModels/bus.glb`, (s) => {
|
|
37
|
-
this.busModel = s.scene, this.busModel.rotation.x = h.MathUtils.degToRad(90), this.busModelReady = !0;
|
|
38
|
-
}), t.load(`${this.assetsRoot}/3DModels/bicycle.glb`, (s) => {
|
|
39
|
-
this.bicycleModel = s.scene, this.bicycleModel.rotation.x = h.MathUtils.degToRad(90), this.bicycleModel.rotation.y = h.MathUtils.degToRad(180), this.bicycleModelReady = !0;
|
|
40
|
-
}), document.addEventListener(
|
|
41
|
-
"visibilitychange",
|
|
42
|
-
() => {
|
|
43
|
-
this.clearVehicles(), this.needInterpolate = !document.hidden;
|
|
44
|
-
},
|
|
45
|
-
!1
|
|
46
|
-
), y.watch(
|
|
29
|
+
).assetsRoot, this.view = i, b.watch(
|
|
47
30
|
() => this.view.camera.position.z,
|
|
48
|
-
(
|
|
49
|
-
(
|
|
31
|
+
(t, s) => {
|
|
32
|
+
(s <= this.cameraHeightThreshold && t > this.cameraHeightThreshold || s > this.cameraHeightThreshold && t <= this.cameraHeightThreshold) && (this.updateModel = !0);
|
|
50
33
|
}
|
|
51
34
|
);
|
|
52
35
|
}
|
|
53
36
|
createCarMaterial(i) {
|
|
54
|
-
return new
|
|
37
|
+
return new l.MeshPhongMaterial({
|
|
55
38
|
color: i
|
|
56
39
|
// // emissive: 0xc3c3c3,
|
|
57
40
|
// roughness: this.roughness,
|
|
58
41
|
// metalness: this.metalness
|
|
59
42
|
});
|
|
60
43
|
}
|
|
44
|
+
async init() {
|
|
45
|
+
const i = new y();
|
|
46
|
+
await P.eachAlways([
|
|
47
|
+
new Promise((e) => {
|
|
48
|
+
i.load(`${this.assetsRoot}/3DModels/car.glb`, (t) => {
|
|
49
|
+
this.carModel = t.scene, this.carModel.rotation.x = l.MathUtils.degToRad(90), e();
|
|
50
|
+
});
|
|
51
|
+
}),
|
|
52
|
+
new Promise((e) => {
|
|
53
|
+
i.load(`${this.assetsRoot}/3DModels/van.glb`, (t) => {
|
|
54
|
+
this.vanModel = t.scene, this.vanModel.rotation.x = l.MathUtils.degToRad(90), e();
|
|
55
|
+
});
|
|
56
|
+
}),
|
|
57
|
+
new Promise((e) => {
|
|
58
|
+
i.load(`${this.assetsRoot}/3DModels/truck.glb`, (t) => {
|
|
59
|
+
this.truckModel = t.scene, this.truckModel.scale.set(1.2, 1, 1.5), this.truckModel.rotation.x = l.MathUtils.degToRad(90), e();
|
|
60
|
+
});
|
|
61
|
+
}),
|
|
62
|
+
new Promise((e) => {
|
|
63
|
+
i.load(`${this.assetsRoot}/3DModels/bus.glb`, (t) => {
|
|
64
|
+
this.busModel = t.scene, this.busModel.rotation.x = l.MathUtils.degToRad(90), e();
|
|
65
|
+
});
|
|
66
|
+
}),
|
|
67
|
+
new Promise((e) => {
|
|
68
|
+
i.load(`${this.assetsRoot}/3DModels/bicycle.glb`, (t) => {
|
|
69
|
+
this.bicycleModel = t.scene, this.bicycleModel.rotation.x = l.MathUtils.degToRad(90), this.bicycleModel.rotation.y = l.MathUtils.degToRad(180), e();
|
|
70
|
+
});
|
|
71
|
+
}),
|
|
72
|
+
new Promise((e) => {
|
|
73
|
+
this.bluePlateBG = new Image(), this.bluePlateBG.src = `${this.assetsRoot}/Images/PlateBG/blue.png`, this.bluePlateBG.onload = () => {
|
|
74
|
+
e();
|
|
75
|
+
};
|
|
76
|
+
}),
|
|
77
|
+
new Promise((e) => {
|
|
78
|
+
this.yellowPlateBG = new Image(), this.yellowPlateBG.src = `${this.assetsRoot}/Images/PlateBG/yellow.png`, this.yellowPlateBG.onload = () => {
|
|
79
|
+
e();
|
|
80
|
+
};
|
|
81
|
+
}),
|
|
82
|
+
new Promise((e) => {
|
|
83
|
+
this.whitePlateBG = new Image(), this.whitePlateBG.src = `${this.assetsRoot}/Images/PlateBG/white.png`, this.whitePlateBG.onload = () => {
|
|
84
|
+
e();
|
|
85
|
+
};
|
|
86
|
+
}),
|
|
87
|
+
new Promise((e) => {
|
|
88
|
+
this.blackPlateBG = new Image(), this.blackPlateBG.src = `${this.assetsRoot}/Images/PlateBG/black.png`, this.blackPlateBG.onload = () => {
|
|
89
|
+
e();
|
|
90
|
+
};
|
|
91
|
+
}),
|
|
92
|
+
new Promise((e) => {
|
|
93
|
+
this.neoYellowPlateBG = new Image(), this.neoYellowPlateBG.src = `${this.assetsRoot}/Images/PlateBG/neo_yellow.png`, this.neoYellowPlateBG.onload = () => {
|
|
94
|
+
e();
|
|
95
|
+
};
|
|
96
|
+
}),
|
|
97
|
+
new Promise((e) => {
|
|
98
|
+
this.neoGreenPlateBG = new Image(), this.neoGreenPlateBG.src = `${this.assetsRoot}/Images/PlateBG/neo_green.png`, this.neoGreenPlateBG.onload = () => {
|
|
99
|
+
e();
|
|
100
|
+
};
|
|
101
|
+
}),
|
|
102
|
+
new Promise((e) => {
|
|
103
|
+
this.greyPlateBG = new Image(), this.greyPlateBG.src = `${this.assetsRoot}/Images/PlateBG/grey.png`, this.greyPlateBG.onload = () => {
|
|
104
|
+
e();
|
|
105
|
+
};
|
|
106
|
+
})
|
|
107
|
+
]), this.isInitialized = !0;
|
|
108
|
+
}
|
|
61
109
|
setInterpolate(i) {
|
|
62
110
|
this.clearVehicles(), this.needInterpolate = i;
|
|
63
111
|
}
|
|
64
112
|
async setup(i) {
|
|
65
|
-
this.context = i, this.renderer = new
|
|
113
|
+
this.context = i, this.renderer = new l.WebGLRenderer({
|
|
66
114
|
context: i.gl,
|
|
67
115
|
premultipliedAlpha: !0,
|
|
68
116
|
logarithmicDepthBuffer: !0,
|
|
@@ -74,62 +122,62 @@ class k {
|
|
|
74
122
|
);
|
|
75
123
|
this.renderer.setRenderTarget = (s) => {
|
|
76
124
|
e(s), s == null && i.bindRenderTarget();
|
|
77
|
-
}, this.scene = new
|
|
125
|
+
}, this.scene = new l.Scene();
|
|
78
126
|
const { camera: t } = i;
|
|
79
|
-
this.camera = new
|
|
127
|
+
this.camera = new l.PerspectiveCamera(
|
|
80
128
|
t.fovY,
|
|
81
129
|
t.aspect,
|
|
82
130
|
0.1,
|
|
83
131
|
1e5
|
|
84
|
-
), this.ambient = new
|
|
132
|
+
), this.ambient = new l.AmbientLight(16777215, 2), this.scene.add(this.ambient), this.sun = new l.DirectionalLight(16777215, 2), this.scene.add(this.sun), i.resetWebGLState();
|
|
85
133
|
}
|
|
86
134
|
async render(i) {
|
|
87
135
|
var s;
|
|
88
136
|
const e = i.camera;
|
|
89
137
|
if (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(
|
|
90
|
-
new
|
|
138
|
+
new l.Vector3(e.center[0], e.center[1], e.center[2])
|
|
91
139
|
), this.camera.projectionMatrix.fromArray(e.projectionMatrix), !this.isPaused && this.needInterpolate)
|
|
92
140
|
for (const a of this.vehicleObjectMap.keys()) {
|
|
93
|
-
const
|
|
94
|
-
if (!
|
|
141
|
+
const n = (s = this.vehicleObjectMap.get(a)) == null ? void 0 : s.model;
|
|
142
|
+
if (!n)
|
|
95
143
|
continue;
|
|
96
|
-
const
|
|
97
|
-
if (
|
|
98
|
-
const
|
|
99
|
-
|
|
144
|
+
const o = this.computeVehiclePosition(a);
|
|
145
|
+
if (o) {
|
|
146
|
+
const h = this.toRenderCoordinates(o);
|
|
147
|
+
n.position.set(h[0], h[1], h[2]), n.rotation.y = l.MathUtils.degToRad(-o[3]);
|
|
100
148
|
}
|
|
101
149
|
}
|
|
102
150
|
const t = i.sunLight;
|
|
103
|
-
this.sun.position.set(t.direction[0], t.direction[1], t.direction[2]), this.sun.intensity = t.diffuse.intensity, this.sun.color = new
|
|
151
|
+
this.sun.position.set(t.direction[0], t.direction[1], t.direction[2]), this.sun.intensity = t.diffuse.intensity, this.sun.color = new l.Color(
|
|
104
152
|
t.diffuse.color[0],
|
|
105
153
|
t.diffuse.color[1],
|
|
106
154
|
t.diffuse.color[2]
|
|
107
|
-
), this.ambient.intensity = t.ambient.intensity, this.ambient.color = new
|
|
155
|
+
), this.ambient.intensity = t.ambient.intensity, this.ambient.color = new l.Color(
|
|
108
156
|
t.ambient.color[0],
|
|
109
157
|
t.ambient.color[1],
|
|
110
158
|
t.ambient.color[2]
|
|
111
|
-
), this.renderer.resetState(), i.bindRenderTarget(), this.renderer.render(this.scene, this.camera),
|
|
159
|
+
), this.renderer.resetState(), i.bindRenderTarget(), this.renderer.render(this.scene, this.camera), u.requestRender(this.view), i.resetWebGLState();
|
|
112
160
|
}
|
|
113
161
|
/**
|
|
114
162
|
* 新增车辆
|
|
115
163
|
* */
|
|
116
164
|
async addVehicles(i) {
|
|
117
|
-
if (!(this.isPaused || !this.
|
|
165
|
+
if (!(this.isPaused || !this.isInitialized))
|
|
118
166
|
for (const e of i) {
|
|
119
|
-
const { vehicleId: t, localTimestamp: s } = e, a = Number(e.x),
|
|
167
|
+
const { vehicleId: t, localTimestamp: s } = e, a = Number(e.x), n = Number(e.y), o = Number(e.heading);
|
|
120
168
|
this.historyPositionMap.set(t, [
|
|
121
|
-
{ pos: [a,
|
|
169
|
+
{ pos: [a, n, 0], heading: o, time: s }
|
|
122
170
|
]);
|
|
123
|
-
const
|
|
124
|
-
|
|
171
|
+
const h = this.getVehicleModel(e);
|
|
172
|
+
h.name = t, h.visible = !this.needInterpolate;
|
|
125
173
|
try {
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
} catch (
|
|
129
|
-
console.log("createPlateSprite error:",
|
|
174
|
+
const r = await this.createPlateSprite(e);
|
|
175
|
+
r && (h.add(r), r.position.set(0, 5, -4));
|
|
176
|
+
} catch (r) {
|
|
177
|
+
console.log("createPlateSprite error:", r);
|
|
130
178
|
}
|
|
131
|
-
this.scene.add(
|
|
132
|
-
model:
|
|
179
|
+
this.scene.add(h), this.vehicleObjectMap.set(t, {
|
|
180
|
+
model: h,
|
|
133
181
|
data: e,
|
|
134
182
|
waitForDelete: !1,
|
|
135
183
|
isMoving: !1
|
|
@@ -140,42 +188,42 @@ class k {
|
|
|
140
188
|
* 更新车辆
|
|
141
189
|
* */
|
|
142
190
|
async updateVehicles(i) {
|
|
143
|
-
if (this.isPaused || !this.
|
|
191
|
+
if (this.isPaused || !this.isInitialized)
|
|
144
192
|
return;
|
|
145
193
|
const e = [];
|
|
146
194
|
for (const t of i) {
|
|
147
|
-
const { vehicleId: s,
|
|
148
|
-
let
|
|
149
|
-
const
|
|
195
|
+
const { vehicleId: s, timestamp: a } = t, n = Number(t.x), o = Number(t.y);
|
|
196
|
+
let h = Number(t.heading);
|
|
197
|
+
const r = this.vehicleObjectMap.get(s), m = this.historyPositionMap.get(
|
|
150
198
|
s
|
|
151
199
|
);
|
|
152
|
-
if (!
|
|
200
|
+
if (!r || !m)
|
|
153
201
|
e.push(t);
|
|
154
202
|
else {
|
|
155
|
-
if (this.updateModel ||
|
|
156
|
-
this.scene.remove(
|
|
203
|
+
if (m.length >= 5 && console.log(s, m.length), this.updateModel || r.data.vehicleColor !== t.vehicleColor || r.data.vehicleType !== t.vehicleType) {
|
|
204
|
+
this.scene.remove(r.model), this.disposeModel(r.model), r.model = this.getVehicleModel(t);
|
|
157
205
|
const c = await this.createPlateSprite(t);
|
|
158
|
-
c && (
|
|
206
|
+
c && (r.model.add(c), c.position.set(0, 5, -4)), this.scene.add(r.model);
|
|
159
207
|
}
|
|
160
|
-
if (
|
|
161
|
-
const c =
|
|
162
|
-
c && (
|
|
208
|
+
if (r.data.showName !== t.showName || r.data.plateColor !== t.plateColor) {
|
|
209
|
+
const c = r.model.getObjectByName("VehiclePlate");
|
|
210
|
+
c && (r.model.remove(c), this.disposeModel(c));
|
|
163
211
|
const p = await this.createPlateSprite(t);
|
|
164
|
-
p && (
|
|
212
|
+
p && (r.model.add(p), p.position.set(0, 5, -4));
|
|
165
213
|
}
|
|
166
|
-
if (
|
|
214
|
+
if (r.data = t, this.needInterpolate) {
|
|
167
215
|
const c = m[m.length - 1];
|
|
168
|
-
Math.abs(
|
|
169
|
-
pos: [
|
|
170
|
-
heading:
|
|
216
|
+
Math.abs(h - c.heading) >= 180 && (h > c.heading ? c.heading += 360 : h += 360), m.push({
|
|
217
|
+
pos: [n, o, 0],
|
|
218
|
+
heading: h,
|
|
171
219
|
time: a
|
|
172
220
|
});
|
|
173
221
|
} else {
|
|
174
222
|
this.historyPositionMap.set(s, [
|
|
175
|
-
{ pos: [
|
|
223
|
+
{ pos: [n, o, 0], heading: h, time: a }
|
|
176
224
|
]);
|
|
177
|
-
const c = this.toRenderCoordinates([
|
|
178
|
-
|
|
225
|
+
const c = this.toRenderCoordinates([n, o, 0]);
|
|
226
|
+
r.model.position.set(c[0], c[1], c[2]), r.model.rotation.y = l.MathUtils.degToRad(-h);
|
|
179
227
|
}
|
|
180
228
|
}
|
|
181
229
|
}
|
|
@@ -183,12 +231,12 @@ class k {
|
|
|
183
231
|
}
|
|
184
232
|
toRenderCoordinates(i) {
|
|
185
233
|
const e = [0, 0, 0];
|
|
186
|
-
return
|
|
234
|
+
return u.toRenderCoordinates(
|
|
187
235
|
// @ts-ignore
|
|
188
236
|
this.view,
|
|
189
237
|
i,
|
|
190
238
|
0,
|
|
191
|
-
|
|
239
|
+
v.WGS84,
|
|
192
240
|
e,
|
|
193
241
|
0,
|
|
194
242
|
1
|
|
@@ -257,7 +305,7 @@ class k {
|
|
|
257
305
|
* */
|
|
258
306
|
disposeModel(i) {
|
|
259
307
|
i.traverse((e) => {
|
|
260
|
-
e instanceof
|
|
308
|
+
e instanceof l.Mesh && (e.geometry.dispose(), e.material.dispose());
|
|
261
309
|
});
|
|
262
310
|
}
|
|
263
311
|
/**
|
|
@@ -269,33 +317,34 @@ class k {
|
|
|
269
317
|
return;
|
|
270
318
|
const s = Date.now();
|
|
271
319
|
t.isMoving = !0, t.data.roadLayer === "1" ? t.model.visible = this.showGroundVehicle : t.model.visible = this.showElevatedVehicle, t.segmentStartTime || (t.segmentStartTime = s, t.segmentTotalTime = e[1].time - e[0].time);
|
|
272
|
-
const a = s - t.segmentStartTime,
|
|
320
|
+
const a = s - t.segmentStartTime, n = Math.min(
|
|
273
321
|
a / t.segmentTotalTime,
|
|
274
322
|
1
|
|
275
323
|
);
|
|
276
|
-
if (
|
|
324
|
+
if (n === 1)
|
|
277
325
|
if (e.shift(), e.length === 1) {
|
|
278
326
|
t.waitForDelete === !0 ? this.deleteVehicle(t) : (t.segmentStartTime = void 0, t.segmentTotalTime = void 0, t.model.visible = !1, t.isMoving = !1, console.log("hide vehicle", i));
|
|
279
327
|
return;
|
|
280
328
|
} else
|
|
281
329
|
return t.segmentStartTime = Date.now(), t.segmentTotalTime = e[1].time - e[0].time, (e[1].heading >= 270 && e[0].heading <= 90 || e[1].heading <= 90 && e[0].heading >= 270) && (e[1].heading > e[0].heading ? e[0].heading += 360 : e[1].heading += 360), e[0].pos.concat(e[0].heading);
|
|
282
|
-
else {
|
|
283
|
-
const
|
|
284
|
-
return [
|
|
285
|
-
}
|
|
330
|
+
else if (e.length >= 2) {
|
|
331
|
+
const o = e[0].pos[0] + (e[1].pos[0] - e[0].pos[0]) * n, h = e[0].pos[1] + (e[1].pos[1] - e[0].pos[1]) * n, r = e[0].heading + (e[1].heading - e[0].heading) * n;
|
|
332
|
+
return [o, h, 0, r];
|
|
333
|
+
} else
|
|
334
|
+
return;
|
|
286
335
|
}
|
|
287
336
|
/**
|
|
288
337
|
* 根据车辆类型、车身颜色获取模型
|
|
289
338
|
* */
|
|
290
339
|
getVehicleModel(i) {
|
|
291
340
|
if (this.view.camera.position.z >= this.cameraHeightThreshold) {
|
|
292
|
-
const e = new
|
|
341
|
+
const e = new l.SphereGeometry(5, 32, 32), t = new l.MeshPhysicalMaterial({
|
|
293
342
|
color: 325253,
|
|
294
343
|
emissive: 0,
|
|
295
344
|
roughness: this.roughness,
|
|
296
345
|
metalness: this.metalness
|
|
297
346
|
});
|
|
298
|
-
return new
|
|
347
|
+
return new l.Mesh(e, t);
|
|
299
348
|
} else {
|
|
300
349
|
let e;
|
|
301
350
|
if (i.ptcType === 2)
|
|
@@ -321,7 +370,7 @@ class k {
|
|
|
321
370
|
const t = this.materialMap.get(i.vehicleColor) || this.defaultMaterial;
|
|
322
371
|
let s = !1;
|
|
323
372
|
e.traverse((a) => {
|
|
324
|
-
!s && a instanceof
|
|
373
|
+
!s && a instanceof l.Mesh && (a.material = t, s = !0);
|
|
325
374
|
});
|
|
326
375
|
}
|
|
327
376
|
return e;
|
|
@@ -331,72 +380,70 @@ class k {
|
|
|
331
380
|
* 创建号牌canvas
|
|
332
381
|
* */
|
|
333
382
|
createCanvas(i, e, t) {
|
|
334
|
-
const s = document.createElement("canvas"), a = i.width,
|
|
335
|
-
s.width = a, s.height =
|
|
336
|
-
const
|
|
337
|
-
if (!
|
|
383
|
+
const s = document.createElement("canvas"), a = i.width, n = i.height;
|
|
384
|
+
s.width = a, s.height = n;
|
|
385
|
+
const o = s.getContext("2d");
|
|
386
|
+
if (!o) {
|
|
338
387
|
console.log("canvas创建失败");
|
|
339
388
|
return;
|
|
340
389
|
}
|
|
341
|
-
return
|
|
390
|
+
return o.fillStyle = "rgba(0,0,0,0.0)", o.fillRect(0, 0, a, n), o.drawImage(i, 0, 0, a, n), o.beginPath(), o.translate(a / 2, n / 2), o.fillStyle = t, o.font = "bold 32px 宋体", o.textBaseline = "middle", o.textAlign = "center", o.fillText(e, 0, 0), s;
|
|
342
391
|
}
|
|
343
392
|
createPlateSprite(i) {
|
|
344
393
|
return new Promise((e, t) => {
|
|
345
|
-
var
|
|
394
|
+
var r, m;
|
|
346
395
|
const s = !i.plateNo || i.plateNo === "0" || i.plateNo === "000000";
|
|
347
396
|
if (this.currentSpriteContent === d.None || this.currentSpriteContent === d.PlateNumber && s) {
|
|
348
397
|
e(void 0);
|
|
349
398
|
return;
|
|
350
399
|
}
|
|
351
|
-
|
|
352
|
-
let o = "", r = "", l = "";
|
|
400
|
+
let a = new Image(), n = "", o = "";
|
|
353
401
|
if (this.currentSpriteContent === d.PlateNumber || this.currentSpriteContent === d.Mix)
|
|
354
402
|
if (s)
|
|
355
|
-
|
|
403
|
+
a = this.greyPlateBG, n = i.ptcId, o = "#ffffff";
|
|
356
404
|
else
|
|
357
|
-
switch (
|
|
405
|
+
switch (n = ((r = i.showName) == null ? void 0 : r.substring(0, 2)) + "•" + ((m = i.showName) == null ? void 0 : m.substring(2)), i.plateColor) {
|
|
358
406
|
case 1:
|
|
359
|
-
|
|
407
|
+
a = this.bluePlateBG, o = "#ffffff";
|
|
360
408
|
break;
|
|
361
409
|
case 2:
|
|
362
|
-
|
|
410
|
+
a = this.yellowPlateBG, o = "#000000";
|
|
363
411
|
break;
|
|
364
412
|
case 3:
|
|
365
|
-
|
|
413
|
+
a = this.whitePlateBG, o = "#000000";
|
|
366
414
|
break;
|
|
367
415
|
case 4:
|
|
368
|
-
o = "
|
|
416
|
+
a = this.blackPlateBG, o = "#ffffff";
|
|
369
417
|
break;
|
|
370
418
|
case 5:
|
|
371
|
-
|
|
419
|
+
a = this.neoYellowPlateBG, o = "#000000";
|
|
372
420
|
break;
|
|
373
421
|
case 6:
|
|
374
|
-
|
|
422
|
+
a = this.neoGreenPlateBG, o = "#000000";
|
|
375
423
|
break;
|
|
376
424
|
default:
|
|
377
|
-
|
|
425
|
+
a = this.greyPlateBG, n = i.plateNo, o = "#ffffff";
|
|
378
426
|
break;
|
|
379
427
|
}
|
|
380
428
|
else
|
|
381
|
-
this.currentSpriteContent === d.Id && (
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
};
|
|
429
|
+
this.currentSpriteContent === d.Id && (a = this.greyPlateBG, n = i.ptcId, o = "#ffffff");
|
|
430
|
+
const h = this.createCanvas(a, n, o);
|
|
431
|
+
if (h) {
|
|
432
|
+
const c = new l.CanvasTexture(h), p = new l.SpriteMaterial({
|
|
433
|
+
map: c,
|
|
434
|
+
transparent: !1
|
|
435
|
+
}), g = new l.Sprite(p), f = 0.05, M = h.width * f, w = h.height * f;
|
|
436
|
+
g.scale.set(M, w, 1), g.name = "VehiclePlate", e(g);
|
|
437
|
+
} else {
|
|
438
|
+
t("canvas创建失败");
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
a.onerror = (c) => {
|
|
442
|
+
console.log(`号牌背景加载失败: ${a.src}`, c), t(c);
|
|
396
443
|
};
|
|
397
444
|
});
|
|
398
445
|
}
|
|
399
446
|
}
|
|
400
447
|
export {
|
|
401
|
-
|
|
448
|
+
I as default
|
|
402
449
|
};
|
|
@@ -9,6 +9,9 @@ class f {
|
|
|
9
9
|
id: "vehicleLayer"
|
|
10
10
|
}), this.view.map.add(this.vehicleLayer), this.rafSignal = requestAnimationFrame(() => this.render());
|
|
11
11
|
}
|
|
12
|
+
async init() {
|
|
13
|
+
console.log("init");
|
|
14
|
+
}
|
|
12
15
|
addVehicles(i) {
|
|
13
16
|
return new Promise((e) => {
|
|
14
17
|
if (this.isPaused) {
|
package/es/src/types/index.d.ts
CHANGED
|
@@ -140,6 +140,7 @@ export interface IToggleTrafficInfoParams {
|
|
|
140
140
|
visible: boolean;
|
|
141
141
|
}
|
|
142
142
|
export interface ITraceRendererInterface {
|
|
143
|
+
init(): Promise<void>;
|
|
143
144
|
addVehicles(objects: IVehicleTrack[]): Promise<void>;
|
|
144
145
|
updateVehicles(objects: IVehicleTrack[]): Promise<void>;
|
|
145
146
|
deleteVehicles(idList: string[]): void;
|
|
@@ -27,7 +27,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
27
27
|
overlay: Overlay;
|
|
28
28
|
queueLength: QueueLength;
|
|
29
29
|
openDriveRenderer: OpenDriveRenderer;
|
|
30
|
+
showLogDiv: import("vue").Ref<boolean>;
|
|
30
31
|
mapViewer: import("vue").ComputedRef<MapView | SceneView>;
|
|
32
|
+
startSaveTrackLog: () => void;
|
|
33
|
+
downloadTrackLog: () => void;
|
|
31
34
|
setMapCenter: (params: ISetMapCenterParams) => Promise<import("../types").IResult>;
|
|
32
35
|
setMapCamera: (params: ISetMapCameraParams) => Promise<import("../types").IResult>;
|
|
33
36
|
lookAt: (params: ILookAtParams) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),v=require("./stores/index.js");require("./style/index.css");const ce=require("./utils/holo-flow/index.js"),ie=require("./utils/map-initializer.js"),le=require("./utils/open-drive-renderer/index.js"),ue=require("./utils/overlay.js"),de=require("./utils/queue-length.js"),C=require("./utils/road-config-tool/index.js"),pe=require("./utils/traffic-flow.js"),me={class:"gis-viewer"},fe={style:{position:"absolute",bottom:"10px",left:"10px"}},ge=a.defineComponent({__name:"gis-map",props:{config:{},assetsRoot:{}},emits:["mapLoaded","markerClick","mapClick"],setup(k,{expose:T,emit:b}){const p=a.ref(null);let s,c,n,o,r,t,l,u;const m=a.ref(!1);v.registerStore(),a.onMounted(async()=>{if(!p.value)return;document.addEventListener("keydown",d=>{d.ctrlKey&&d.key==="i"&&(m.value=!m.value)});const e=a.getCurrentInstance(),{$gisviewerAssetsRoot:i}=e.appContext.config.globalProperties,h=await(await fetch(y.config)).json();h.assetsRoot=y.assetsRoot||i;const re=v.default.useAppDataStore;re.mapConfig=h,c=new ie.default,s=await c.initialize({container:p.value,markerClickCallback:(d,g,w,se)=>{f("markerClick",d,g,w,se)},mapClickCallback:(d,g,w)=>{f("mapClick",d,g,w)}}),r=new ce.default(s),await r.init(),f("mapLoaded")});const L=a.computed(()=>s),O=()=>{const e=v.default.useAppDataStore;e.saveTrackLog=!0},I=()=>{r.downloadTrackLog()},S=async e=>await c.setMapCenter(e),A=async e=>await c.setMapCamera(e),D=async e=>await c.lookAt(e),_=e=>c.setLayerVisibility(e),q=(e,i)=>c.requestCoordinateTransform(e,i),x=e=>{c.cancelCoordinateTransform(e)},V=e=>{c.setMapZoomRange(e)},M=e=>(n||(n=new C.default(s)),n.showLaneNumber(e)),N=()=>{n==null||n.clearLaneNumber()},B=async e=>(n||(n=new C.default(s)),await n.initializeSearch(e)),E=async()=>n==null?void 0:n.calCrossIndicatorArea(),H=async()=>{},R=async(e,i)=>{o||(o=new pe.default(s)),o.connectTrafficFlow(e,i)},j=()=>{o==null||o.disconnectTrafficFlow()},z=e=>{r.handleVehicleTraceData(e)},P=()=>{r.clearHoloTrace()},Q=e=>{r.setInterpolate(e)},Z=async e=>{await r.handleSignalData(e)},F=()=>{r.clearHoloSignal()},K=e=>{o==null||o.toggleTrafficInfo(e),r.toggleTrafficInfo(e)},G=e=>{r.togglePause(e)},J=e=>{o==null||o.toggleTrafficObject(e),r.toggleTrafficObject(e)},U=e=>{r.updatePanelContent(e)},W=async e=>(t||(t=new ue.default(s)),t.addOverlays(e)),X=e=>t==null?void 0:t.removeOverlaysByType(e),Y=e=>t==null?void 0:t.removeOverlaysById(e),$=()=>t==null?void 0:t.removeAllOverlays(),ee=()=>{t==null||t.showAllOverlays()},te=e=>{l||(l=new de.default(s)),l.updateQueueLength(e)},ae=()=>{l==null||l.removeQueueLength()},ne=async(e,i)=>{u||(u=new le.default(s)),await u.showOpenDrive(e,i)},oe=async()=>{await(u==null?void 0:u.hideOpenDrive())},y=k,f=b;return T({mapViewer:L,setLayerVisibility:_,setMapCenter:S,lookAt:D,setMapCamera:A,setMapZoomRange:V,requestCoordinateTransform:q,cancelCoordinateTransform:x,addOverlays:W,showAllOverlays:ee,removeOverlaysByType:X,removeOverlaysById:Y,removeAllOverlays:$,showLaneNumber:M,clearLaneNumber:N,initializeAreaTool:B,calCrossIndicatorArea:E,calRoadIndicatorArea:H,connectCarFlow:R,disconnectCarFlow:j,handleHoloVehicleTraceData:z,clearHoloTrace:P,handleHoloSignalData:Z,clearHoloSignal:F,setInterpolate:Q,toggleTrafficInfo:K,toggleTrafficObject:J,toggleVehicleInfo:U,togglePause:G,updateQueueLength:te,removeQueueLength:ae,showOpenDrive:ne,hideOpenDrive:oe}),(e,i)=>(a.openBlock(),a.createElementBlock("div",me,[a.createElementVNode("div",{class:"gis-viewer-main",ref_key:"mapContainer",ref:p},[a.withDirectives(a.createElementVNode("div",fe,[a.createElementVNode("button",{style:{"margin-right":"10px"},onClick:O}," 开始记录 "),a.createElementVNode("button",{onClick:I},"下载日志")],512),[[a.vShow,m.value]])],512)]))}});exports.default=ge;
|
|
@@ -17,7 +17,10 @@ export declare const GisMap: import("@easyest/utils/dist/lib/withinstall").SFCWi
|
|
|
17
17
|
overlay: import("./utils/overlay").default;
|
|
18
18
|
queueLength: import("./utils/queue-length").default;
|
|
19
19
|
openDriveRenderer: import("./utils/open-drive-renderer").default;
|
|
20
|
+
showLogDiv: import("vue").Ref<boolean>;
|
|
20
21
|
mapViewer: import("vue").ComputedRef<__esri.MapView | __esri.SceneView>;
|
|
22
|
+
startSaveTrackLog: () => void;
|
|
23
|
+
downloadTrackLog: () => void;
|
|
21
24
|
setMapCenter: (params: import("../types").ISetMapCenterParams) => Promise<import("../types").IResult>;
|
|
22
25
|
setMapCamera: (params: import("../types").ISetMapCameraParams) => Promise<import("../types").IResult>;
|
|
23
26
|
lookAt: (params: import("../types").ILookAtParams) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("pinia"),t=e.defineStore("appData",{state:()=>({mapConfig:{}})});exports.useAppDataStore=t;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("pinia"),t=e.defineStore("appData",{state:()=>({mapConfig:{},saveTrackLog:!1})});exports.useAppDataStore=t;
|
|
@@ -5,6 +5,7 @@ export default class Index {
|
|
|
5
5
|
private traceHoloFlow;
|
|
6
6
|
private signalHoloFlow;
|
|
7
7
|
constructor(view: View);
|
|
8
|
+
init(): Promise<void>;
|
|
8
9
|
/**
|
|
9
10
|
* 处理全息流轨迹数据
|
|
10
11
|
* */
|
|
@@ -17,4 +18,5 @@ export default class Index {
|
|
|
17
18
|
handleSignalData(data: any): Promise<void>;
|
|
18
19
|
clearHoloSignal(): void;
|
|
19
20
|
setInterpolate(enable: boolean): void;
|
|
21
|
+
downloadTrackLog(): void;
|
|
20
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../../../types/index.js"),a=require("./signal-holo-flow.js"),o=require("./trace-holo-flow.js");class i{constructor(e){this.view=e}async init(){this.traceHoloFlow=new o.default(this.view),await this.traceHoloFlow.init()}handleVehicleTraceData(e){this.traceHoloFlow.handleVehicleTraceData(e)}toggleTrafficObject(e){switch(e.name.toLowerCase()){case"groundVehicle".toLowerCase():this.traceHoloFlow.toggleGroundVehicle(e.visible);break;case"elevatedVehicle".toLowerCase():this.traceHoloFlow.toggleElevatedVehicle(e.visible);break}}clearHoloTrace(){this.traceHoloFlow.clearTrace()}toggleTrafficInfo(e){this.traceHoloFlow.toggleTrafficInfo(e)}togglePause(e){this.traceHoloFlow.togglePause(e)}updatePanelContent(e){let l=t.EVehiclePlateState.None;switch(e){case"none":l=t.EVehiclePlateState.None;break;case"plateNumber":l=t.EVehiclePlateState.PlateNumber;break;case"vehicleId":l=t.EVehiclePlateState.Id;break;case"mix":l=t.EVehiclePlateState.Mix;break}this.traceHoloFlow.updatePanelContent(l)}async handleSignalData(e){this.signalHoloFlow||(this.signalHoloFlow=new a.default(this.view)),await this.signalHoloFlow.initializeLayer(),await this.signalHoloFlow.handleSignalData(e)}clearHoloSignal(){this.signalHoloFlow.clearSignal()}setInterpolate(e){this.traceHoloFlow.setInterpolate(e)}downloadTrackLog(){this.traceHoloFlow.downloadLog()}}exports.default=i;
|
|
@@ -9,12 +9,14 @@ export default class SignalHoloFlow {
|
|
|
9
9
|
/** 每个路口倒计时canvas */
|
|
10
10
|
private countdownCanvasMap;
|
|
11
11
|
private countdownWatchHandel;
|
|
12
|
+
private plateBackground;
|
|
12
13
|
private lastDataTime;
|
|
13
14
|
constructor(view: View);
|
|
14
15
|
/**
|
|
15
16
|
* 初始化相位线图层
|
|
16
17
|
* */
|
|
17
18
|
initializeLayer(): Promise<void>;
|
|
19
|
+
private initializePlateBackground;
|
|
18
20
|
handleSignalData(data: any): Promise<void>;
|
|
19
21
|
/**
|
|
20
22
|
* 清除实时信号相关图层
|