Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
方 梦梦
world51tocmap
Commits
9709da2a
Commit
9709da2a
authored
Apr 15, 2025
by
chengdong.lv@inzymeits.com
Browse files
更新交通事件处理逻辑,修改车辆ID,调整摄像机飞行到事件位置的功能
parent
4c5d1edc
Changes
1
Hide whitespace changes
Inline
Side-by-side
index.html
View file @
9709da2a
...
...
@@ -209,11 +209,12 @@
</div>
<div>
<input
type=
"button"
id=
"addTrafficIncident"
value=
"交通流中的事件"
/>
<!-- <input
<input
style=
"display: none"
type=
"button"
id=
"addTrafficIncident2"
value=
"不在交通流中的事件"
/>
-->
/>
<input
type=
"button"
id=
"addTrafficIncident3"
...
...
@@ -822,7 +823,7 @@
document
.
getElementById
(
"
focusCar1
"
).
onclick
=
focusCar1
;
async
function
focusCar1
()
{
let
options
=
{
vehicleId
:
"
仿AYZQS001
"
,
vehicleId
:
"
XM140004
"
,
//
仿AYZQS001
perspective
:
1
,
// 1第一人称视角、3第三人称视角
};
map
.
getVehicle
(
"
21e7a9e6d2884122804788dac1e002cc
"
).
focusVehicle
(
options
);
...
...
@@ -832,7 +833,7 @@
document
.
getElementById
(
"
focusCar3
"
).
onclick
=
focusCar3
;
async
function
focusCar3
()
{
let
options
=
{
vehicleId
:
"
仿AYZQS001
"
,
vehicleId
:
"
XM140004
"
,
//
仿AYZQS001
perspective
:
3
,
// 1第一人称视角、3第三人称视角
};
map
.
getVehicle
(
"
21e7a9e6d2884122804788dac1e002cc
"
).
focusVehicle
(
options
);
...
...
@@ -1017,7 +1018,7 @@
var
arr
=
[];
//开始交通事件
document
.
getElementById
(
"
addTrafficIncident
"
).
onclick
=
addTrafficIncident
;
async
function
addTrafficIncident
()
{
// 订阅事件 websocket事件
const
url
=
...
...
@@ -1026,14 +1027,36 @@
socket
.
onopen
=
function
(
event
)
{
console
.
log
(
"
socket连接成功!
"
);
};
// let optionsTest1 = {
// position: ["117.3445813", "39.0059179", 28.12],
// orientation: [-34.930073, -0.426579],
// };
// camera.flyTo(optionsTest1);
const
fun
=
async
(
json
)
=>
{
const
{
id
,
name
,
type
,
location
}
=
json
;
const
{
id
,
name
,
type
,
location
,
ptcIds
}
=
json
;
const
find
=
trafficIncidentArr
.
find
((
item
)
=>
item
.
id
==
id
);
if
(
json
.
endTime
)
{
console
.
log
(
"
结束事件
"
,
json
);
if
(
find
)
{
map
.
stopTrafficIncident
(
id
,
json
);
// 视角飞到这个位置
if
(
type
==
"
ILLEGAL_PARKING
"
||
type
==
"
MOTOR_VEHICLE_RUN_RED_LIGHT
"
)
{
console
.
log
(
"
zhaodang
"
,
find
.
ptcIds
);
// 飞到
optionsTest1
=
{
position
:
[
location
[
0
].
longitude
,
location
[
0
].
latitude
,
,
28.12
],
orientation
:
[
-
34.930073
,
20.426579
],
};
camera
.
flyTo
(
optionsTest1
);
}
else
{
map
.
stopTrafficIncident
(
id
,
json
);
}
return
;
}
return
;
...
...
@@ -1042,6 +1065,19 @@
if
(
find
)
{
return
;
}
if
(
type
==
"
ILLEGAL_PARKING
"
||
type
==
"
MOTOR_VEHICLE_RUN_RED_LIGHT
"
)
{
console
.
log
(
"
高亮
"
,
ptcIds
);
// 飞到
optionsTest1
=
{
position
:
[
location
[
0
].
longitude
,
location
[
0
].
latitude
,
,
28.12
],
orientation
:
[
-
34.930073
,
20.426579
],
};
camera
.
flyTo
(
optionsTest1
);
}
trafficIncidentArr
.
push
(
json
);
await
map
.
renderTrafficIncident
(
json
);
};
...
...
@@ -1192,7 +1228,7 @@
camera
.
flyTo
(
options
);
const
json
=
{
id
:
"
21002cc
"
,
url
:
"
ws://192.168.60.137:31000/ws/streamer/
2a9e3045-8ff6-4da8-970c-8bb1e4ca1ed9
"
,
url
:
"
ws://192.168.60.137:31000/ws/streamer/
489d02b4-80de-42e6-b0fc-95c4bd006760
"
,
};
map
.
bindHistoryVehicle
(
json
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment