修改仿真驾驶换车错位

This commit is contained in:
sunzhenyu 2019-12-31 18:20:53 +08:00
parent e2e9bc7be3
commit 432aff42a3
3 changed files with 47 additions and 34 deletions

View File

@ -24,7 +24,7 @@ import { SetLights } from '@/jlmap3d/config/SetLights';
//加载器
// import { Jlmap3ddata } from '@/jlmap3d/edit/Jlmap3ddata';
import { Jlmap3ddata } from '@/jlmap3d/edit/Jlmap3dnewdata';
import { Jlmap3ddata } from '@/jlmap3d/edit/Jlmap3ddata';
//操作管理器
import { Actionmanage } from '@/jlmap3d/edit/actionmanage';

View File

@ -103,12 +103,13 @@ export function Jl3dDriving(mixers,updatemmi,sound,translation,routegroup) {
switch (data.type) {
case 'Simulation_Driver_Change':
trainlisttest.list[drivingcode].dispose = true;
trainlisttest.group.remove(trainlisttest.list[drivingcode]);
trainlisttest.list[data.body.code].dispose = true;
trainlisttest.list[drivingcode].dispose = true;
drivingcode = data.body.code;
trainlisttest.group.add(trainlisttest.list[drivingcode]);
// sound.volswitch = true;
updatemmi.updatedrivingcode( data.body.code);
break;
@ -356,19 +357,15 @@ export function Jl3dDriving(mixers,updatemmi,sound,translation,routegroup) {
trainlisttest.list[code].pc = 1;
// console.log(data.body[i]);
if (data.body[i].directionType == '02') { // 向右
let point = rails.linkrail[data.body[i].linkCode].lineleft.getPointAt(data.body[i].linkOffsetPercent);
trainlisttest.list[code].rotation.y = 0;
trainlisttest.list[code].position.x = point.x;
trainlisttest.list[code].position.y = 0;
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = point.z;
}
if(data.body[i].targetStation){
trainlisttest.list[code].stopstation = data.body[i].targetStation;
// console.log(rails.stops[data.body[i].targetStation].direct2.percent);
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].progress = data.body[i].linkOffsetPercent*trainlisttest.list[code].pc;
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{
@ -379,14 +376,15 @@ export function Jl3dDriving(mixers,updatemmi,sound,translation,routegroup) {
trainlisttest.list[code].status = '02';
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineleft;
} else if (data.body[i].directionType == '03') { // 向左
let point = rails.linkrail[data.body[i].linkCode].lineright.getPointAt((1-data.body[i].linkOffsetPercent));
trainlisttest.list[code].rotation.y = Math.PI;
let point = rails.linkrail[data.body[i].linkCode].lineleft.getPointAt(trainlisttest.list[code].progress);
trainlisttest.list[code].rotation.y = 0;
trainlisttest.list[code].position.x = point.x;
trainlisttest.list[code].position.y = 0;
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = -point.z;
trainlisttest.list[code].children[tl].position.z = point.z;
}
} else if (data.body[i].directionType == '03') { // 向左
// if(trainlisttest.list[code].rname == "006"){
// console.log("0000000000000000");
// console.log(data.body[i].linkOffsetPercent);
@ -399,17 +397,28 @@ export function Jl3dDriving(mixers,updatemmi,sound,translation,routegroup) {
// console.log(rails.stops[data.body[i].targetStation].direct1.percent);
// console.log(trainlisttest.list[code].pc);
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].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;
}
// console.log("progress:"+trainlisttest.list[code].progress);
// console.log("linkOffsetPercent:"+trainlisttest.list[code].linkOffsetPercent);
// console.log("datatarget:"+ data.body[i].targetLinkPercent);
// console.log("directpercent:"+trainlisttest.list[code].targetpercent);
// console.log("====================");
trainlisttest.list[code].status = '03';
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineright;
let point = rails.linkrail[data.body[i].linkCode].lineright.getPointAt(trainlisttest.list[code].progress);
trainlisttest.list[code].rotation.y = Math.PI;
trainlisttest.list[code].position.x = point.x;
trainlisttest.list[code].position.y = 0;
for (let tl=0; tl<6; tl++) {
trainlisttest.list[code].children[tl].position.z = -point.z;
}
}
trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact;
// trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.body[i].sectionCode].isStandTrack;
@ -541,6 +550,8 @@ export function Jl3dDriving(mixers,updatemmi,sound,translation,routegroup) {
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;
// trainlisttest.list[code].progress = trainlisttest.list[code].linkOffsetPercent*trainlisttest.list[code].pc;
}
}
@ -562,6 +573,7 @@ export function Jl3dDriving(mixers,updatemmi,sound,translation,routegroup) {
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].progress = (1-trainlisttest.list[code].linkOffsetPercent)*trainlisttest.list[code].pc;
}
}
trainlisttest.list[code].status = '03';
@ -596,7 +608,6 @@ export function Jl3dDriving(mixers,updatemmi,sound,translation,routegroup) {
console.log(data.body[i]);
let nextcode;
if(data.body[i].directionType == '02'){
if(rails.linkrail[data.body[i].linkCode].lineleft){
@ -612,9 +623,10 @@ export function Jl3dDriving(mixers,updatemmi,sound,translation,routegroup) {
trainlisttest.list[code].progress = data.body[i].linkOffsetPercent;
trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent;
if(data.body[i].targetStation){
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].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].targetLink = data.body[i].targetLink;
trainlisttest.list[code].progress = data.body[i].linkOffsetPercent/trainlisttest.list[code].pc;
}
trainlisttest.list[code].speeds = parseFloat(trainlisttest.list[code].speed*10/36/25/trainlisttest.list[code].len);
}
@ -636,6 +648,7 @@ export function Jl3dDriving(mixers,updatemmi,sound,translation,routegroup) {
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].targetLink = data.body[i].targetLink;
trainlisttest.list[code].progress = (1-data.body[i].linkOffsetPercent)/trainlisttest.list[code].pc;
}
trainlisttest.list[code].speeds = parseFloat(trainlisttest.list[code].speed*10/36/25/trainlisttest.list[code].len);
}
@ -662,17 +675,17 @@ export function Jl3dDriving(mixers,updatemmi,sound,translation,routegroup) {
function simulationreset(data){
// console.log(data);
if(drivingcode){
trainlisttest.list[drivingcode].dispose = true;
trainlisttest.group.remove(trainlisttest.list[drivingcode]);
trainlisttest.list[drivingcode].stopstation = null;
trainlisttest.list[drivingcode].pc = null;
trainlisttest.list[drivingcode].targetpercent = null;
trainlisttest.list[drivingcode].progress = null;
trainlisttest.list[drivingcode].linkOffsetPercent = null;
trainlisttest.list[drivingcode].targetLink = null;
drivingcode = null;
}
for(let k in trainlisttest.list){
trainlisttest.list[k].dispose = true;
trainlisttest.group.remove(trainlisttest.list[k]);
trainlisttest.list[k].stopstation = null;
trainlisttest.list[k].pc = null;
trainlisttest.list[k].targetpercent = null;
trainlisttest.list[k].progress = null;
trainlisttest.list[k].linkOffsetPercent = null;
trainlisttest.list[k].targetLink = null;
drivingcode = null;
}
}
function devicestatus(data){

View File

@ -3,11 +3,11 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
} else {
BASE_API = process.env.VUE_APP_BASE_API;
}