修改三维行车位置发送逻辑

This commit is contained in:
sunzhenyu 2019-11-12 19:02:54 +08:00
parent c51bb4c7c6
commit 74c0df432f

View File

@ -205,18 +205,26 @@ export function Jl3dDriving(updatemmi,sound,translation) {
percent: 0
};
if (trainlisttest.list[code].status == '02') {
if(trainlisttest.list[code].targetLink == trainlisttest.list[code].nowcode){
if((trainlisttest.list[code].linkOffsetPercent/trainlisttest.list[code].pc)>=trainlisttest.list[code].targetpercent){
syncdata.percent = trainlisttest.list[code].progress;
}else{
syncdata.percent = trainlisttest.list[code].progress*trainlisttest.list[code].pc;
}
}else{
syncdata.percent = trainlisttest.list[code].progress;
}
} else {
if(trainlisttest.list[code].targetLink == trainlisttest.list[code].nowcode){
if(trainlisttest.list[code].progress<=trainlisttest.list[code].targetpercent){
syncdata.percent = (1 - trainlisttest.list[code].progress);
}else{
syncdata.percent = (1 - trainlisttest.list[code].progress)*trainlisttest.list[code].pc;
}
}else{
syncdata.percent = (1 - trainlisttest.list[code].progress);
}
}
// console.log(syncdata);
@ -348,6 +356,7 @@ export function Jl3dDriving(updatemmi,sound,translation) {
trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct2.percent;
trainlisttest.list[code].progress = data.body[i].linkOffsetPercent/trainlisttest.list[code].pc;
trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent;
trainlisttest.list[code].targetLink = data.body[i].targetLink;
}else{
trainlisttest.list[code].progress = data.body[i].linkOffsetPercent;
trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent;
@ -375,6 +384,7 @@ export function Jl3dDriving(updatemmi,sound,translation) {
trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct1.percent;
trainlisttest.list[code].progress = (1-data.body[i].linkOffsetPercent)/trainlisttest.list[code].pc;
trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent;
trainlisttest.list[code].targetLink = data.body[i].targetLink;
}else{
trainlisttest.list[code].progress = 1-data.body[i].linkOffsetPercent;
trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent;
@ -508,19 +518,19 @@ export function Jl3dDriving(updatemmi,sound,translation) {
// console.log(rails.linkrail[nextcode].lineleft.points);
let nextcode;
if(code == drivingcode){
// console.log(data.body[i].targetStation);
// console.log("netpercent");
// console.log(data.body[i].targetLinkPercent);
// console.log(data.body[i].linkOffsetPercent);
// console.log("3dpercent");
// if(rails.stops[data.body[i].targetStation]){
// console.log(rails.stops[data.body[i].targetStation].direct2.percent);
// }
//
// console.log(trainlisttest.list[code].progress);
// console.log(trainlisttest.list[code].pc);
// console.log("===============");
// console.log(data.body[i]);
console.log(data.body[i].targetStation);
console.log("netpercent");
console.log(data.body[i].targetLinkPercent);
console.log(data.body[i].linkOffsetPercent);
console.log("3dpercent");
if(rails.stops[data.body[i].targetStation]){
console.log(rails.stops[data.body[i].targetStation].direct2.percent);
}
console.log(trainlisttest.list[code].progress);
console.log(trainlisttest.list[code].pc);
console.log("===============");
console.log(data.body[i]);
if(data.body[i].directionType == '02'){
if(trainlisttest.list[code].stopstation != data.body[i].targetStation){
trainlisttest.list[code].stopstation = data.body[i].targetStation;
@ -528,6 +538,7 @@ export function Jl3dDriving(updatemmi,sound,translation) {
trainlisttest.list[code].pc = data.body[i].targetLinkPercent/rails.stops[data.body[i].targetStation].direct2.percent;
trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct2.percent;
trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent;
trainlisttest.list[code].targetLink = data.body[i].targetLink;
}
}
@ -549,6 +560,7 @@ export function Jl3dDriving(updatemmi,sound,translation) {
trainlisttest.list[code].pc = data.body[i].targetLinkPercent/rails.stops[data.body[i].targetStation].direct1.percent;
trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct1.percent;
trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent;
trainlisttest.list[code].targetLink = data.body[i].targetLink;
}
}
trainlisttest.list[code].status = '03';