修改三维仿真通信中初始化信息修改后调用

This commit is contained in:
sunzhenyu 2020-05-28 13:33:39 +08:00
parent ef3401fb44
commit 1fa3e7f6d8

View File

@ -53,12 +53,12 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
jsonwebwork.onmessage = function (event) {
// console.log(event.data);
// if(event.data.deviceType == "TRAIN"){
// // console.log(event.data);
//
// }
console.log(event.data);
// console.log(event.data);
if(event.data.type == "Device_Load_Destroy_3D"){
DeviceDestroy(event.data);
return;
@ -150,7 +150,6 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
let code = data.code;
if(trainlisttest.list[code].right != data.right){
if(data.right == "0"){
trainlisttest.list[code].right = "0";
trainlisttest.list[code].rotation.y = Math.PI;
@ -442,27 +441,28 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
for(let i=0,leni=data.length;i<leni;i++){
if(data[i].deviceType == "SWITCH"){
initswitch(data[i]);
}
if(data[i].deviceType == "PSD"){
}else if(data[i].deviceType == "PSD"){
initstand(data[i]);
}else{
console.log(data[i]);
}
}
}
function DeviceDestroy(data){
for(let i=0,leni=data.body.length;i<leni;i++){
for(let i=0,leni=data.body.deviceList.length;i<leni;i++){
if(data.body[i].type == "TRAIN"){
code =data.body[i].code;
if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == "0") {
if(data.body.deviceList[i].type == "TRAIN"){
code =data.body.deviceList[i].code;
if (trainlisttest.list[code].dispose != data.body.deviceList[i].dispose && data.body.deviceList[i].dispose == "0") {
if (rails.sectionrail[data.body[i].section]) {
if (rails.sectionrail[data.body.deviceList[i].section]) {
trainlisttest.group.add(trainlisttest.list[code]);
trainlisttest.list[code].position.y = 0;
// trainlisttest.list[code].progress = 0;
trainlisttest.list[code].dispose = "0";
trainlisttest.list[code].nowcode = data.body[i].section;
trainlisttest.list[code].nowcode = data.body.deviceList[i].section;
trainlisttest.list[code].nextcode = null;
trainlisttest.list[code].curve = null;
trainlisttest.list[code].nextcurve = null;
@ -476,7 +476,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
trainlisttest.list[code].mixerpush = true;
}
}
} else if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == "1") {
} else if (trainlisttest.list[code].dispose != data.body.deviceList[i].dispose && data.body.deviceList[i].dispose == "1") {
trainlisttest.list[code].status = 1;
trainlisttest.group.remove(trainlisttest.list[code]);
trainlisttest.list[code].progress = null;
@ -493,17 +493,17 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
}
}
if(data.body[i].type == "SIGNAL"){
signalupdate(data.body[i]);
if(data.body.deviceList[i].type == "SIGNAL"){
signalupdate(data.body.deviceList[i]);
}
if(data.body[i].type == "SWITCH"){
switchupdate(data.body[i]);
if(data.body.deviceList[i].type == "SWITCH"){
switchupdate(data.body.deviceList[i]);
}
if(data.body[i].type == "PSD"){
standupdate(data.body[i]);
if(data.body.deviceList[i].type == "PSD"){
standupdate(data.body.deviceList[i]);
}
if(data.body[i].type == "TRAIN_DOOR"){
traindoorupdate(data.body[i]);
if(data.body.deviceList[i].type == "TRAIN_DOOR"){
traindoorupdate(data.body.deviceList[i]);
}
}
}