From 432aff42a3977a9333a5d1863623e9dd9783d8e3 Mon Sep 17 00:00:00 2001 From: sunzhenyu Date: Tue, 31 Dec 2019 18:20:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=BF=E7=9C=9F=E9=A9=BE?= =?UTF-8?q?=E9=A9=B6=E6=8D=A2=E8=BD=A6=E9=94=99=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jlmap3d/edit/jlmap3dedit.js | 2 +- .../jl3ddrive/moveupdate/DrivingConnect.js | 75 +++++++++++-------- src/utils/baseUrl.js | 4 +- 3 files changed, 47 insertions(+), 34 deletions(-) diff --git a/src/jlmap3d/edit/jlmap3dedit.js b/src/jlmap3d/edit/jlmap3dedit.js index d4ddc97f3..b627c27c1 100644 --- a/src/jlmap3d/edit/jlmap3dedit.js +++ b/src/jlmap3d/edit/jlmap3dedit.js @@ -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'; diff --git a/src/jlmap3d/jl3ddrive/moveupdate/DrivingConnect.js b/src/jlmap3d/jl3ddrive/moveupdate/DrivingConnect.js index 25fa811cb..65802534c 100644 --- a/src/jlmap3d/jl3ddrive/moveupdate/DrivingConnect.js +++ b/src/jlmap3d/jl3ddrive/moveupdate/DrivingConnect.js @@ -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){ diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index 79d1c6346..1e9afea51 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -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; }