Commit 9709da2a authored by chengdong.lv@inzymeits.com's avatar chengdong.lv@inzymeits.com
Browse files

更新交通事件处理逻辑,修改车辆ID,调整摄像机飞行到事件位置的功能

parent 4c5d1edc
...@@ -209,11 +209,12 @@ ...@@ -209,11 +209,12 @@
</div> </div>
<div> <div>
<input type="button" id="addTrafficIncident" value="交通流中的事件" /> <input type="button" id="addTrafficIncident" value="交通流中的事件" />
<!-- <input <input
style="display: none"
type="button" type="button"
id="addTrafficIncident2" id="addTrafficIncident2"
value="不在交通流中的事件" value="不在交通流中的事件"
/> --> />
<input <input
type="button" type="button"
id="addTrafficIncident3" id="addTrafficIncident3"
...@@ -822,7 +823,7 @@ ...@@ -822,7 +823,7 @@
document.getElementById("focusCar1").onclick = focusCar1; document.getElementById("focusCar1").onclick = focusCar1;
async function focusCar1() { async function focusCar1() {
let options = { let options = {
vehicleId: "仿AYZQS001", vehicleId: "XM140004",// 仿AYZQS001
perspective: 1, // 1第一人称视角、3第三人称视角 perspective: 1, // 1第一人称视角、3第三人称视角
}; };
map.getVehicle("21e7a9e6d2884122804788dac1e002cc").focusVehicle(options); map.getVehicle("21e7a9e6d2884122804788dac1e002cc").focusVehicle(options);
...@@ -832,7 +833,7 @@ ...@@ -832,7 +833,7 @@
document.getElementById("focusCar3").onclick = focusCar3; document.getElementById("focusCar3").onclick = focusCar3;
async function focusCar3() { async function focusCar3() {
let options = { let options = {
vehicleId: "仿AYZQS001", vehicleId: "XM140004",//仿AYZQS001
perspective: 3, // 1第一人称视角、3第三人称视角 perspective: 3, // 1第一人称视角、3第三人称视角
}; };
map.getVehicle("21e7a9e6d2884122804788dac1e002cc").focusVehicle(options); map.getVehicle("21e7a9e6d2884122804788dac1e002cc").focusVehicle(options);
...@@ -1026,14 +1027,36 @@ ...@@ -1026,14 +1027,36 @@
socket.onopen = function (event) { socket.onopen = function (event) {
console.log("socket连接成功!"); 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 fun = async (json) => {
const { id, name, type, location } = json; const { id, name, type, location, ptcIds } = json;
const find = trafficIncidentArr.find((item) => item.id == id); const find = trafficIncidentArr.find((item) => item.id == id);
if (json.endTime) { if (json.endTime) {
console.log("结束事件", json);
if (find) { if (find) {
// 视角飞到这个位置
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); map.stopTrafficIncident(id, json);
}
return; return;
} }
return; return;
...@@ -1042,6 +1065,19 @@ ...@@ -1042,6 +1065,19 @@
if (find) { if (find) {
return; 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); trafficIncidentArr.push(json);
await map.renderTrafficIncident(json); await map.renderTrafficIncident(json);
}; };
...@@ -1192,7 +1228,7 @@ ...@@ -1192,7 +1228,7 @@
camera.flyTo(options); camera.flyTo(options);
const json = { const json = {
id: "21002cc", 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); map.bindHistoryVehicle(json);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment