diff --git a/src/jlmap3d/jl3dtrafficplan/connect/stationconnect.js b/src/jlmap3d/jl3dtrafficplan/connect/stationconnect.js index 747dcb79d..0dbbfcfe9 100644 --- a/src/jlmap3d/jl3dtrafficplan/connect/stationconnect.js +++ b/src/jlmap3d/jl3dtrafficplan/connect/stationconnect.js @@ -10,7 +10,8 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe let start = true; let topic = '/user/queue/simulation/jl3d/'+routegroup; let header = {'X-Token': getToken() }; - + let topswitch = false; + let downswitch = false; socketon(topic); function socketon(topic) { @@ -68,12 +69,12 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe if(data.type == "TRAIN_PFI_BL"){ - if(toptrain.nowcode == data.body.code){ + if(toptrain.nowcode == data.body.code && topswitch == true){ console.log(data); //根据上下车人数创建人 jl3d.updateNowLeaveData("top",data.body.out); } - if(downtrain.nowcode == data.body.code){ + if(downtrain.nowcode == data.body.code && downswitch == true){ console.log(data); //根据上下车人数创建人 jl3d.updateNowLeaveData("down",data.body.out); @@ -153,25 +154,32 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe if(data.body[i].section == passerStation.nowStation.topsection){ if(toptrain.nowcode != data.body[i].code){ toptrain.nowcode = data.body[i].code; + topswitch = true; } toptrain.position.copy(toptrain.curve.getPointAt(data.body[i].offset)); + }else{ if(downtrain.nowcode == data.body[i].code){ + topswitch = false toptrain.position.x -= 1; } + } if(data.body[i].section == passerStation.nowStation.downsection){ if(downtrain.nowcode != data.body[i].code){ downtrain.nowcode = data.body[i].code; + downswitch = true; } downtrain.position.copy(downtrain.curve.getPointAt(data.body[i].offset)); }else{ if(downtrain.nowcode == data.body[i].code){ + downswitch = false; downtrain.position.x += 1; } + } } } @@ -186,21 +194,21 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe function opentraindoor(train,doorcode,direct){ // console.log(train); if(direct == "top"){ - if(doorcode == "1"){ - actions = train.action.down; - } - - if(doorcode == "2"){ + // if(doorcode == "1"){ + // actions = train.action.down; + // } + // + // if(doorcode == "2"){ actions = train.action.top; - } + // } }else{ - if(doorcode == "1"){ + // if(doorcode == "1"){ actions = train.action.top; - } - - if(doorcode == "2"){ - actions = train.action.down; - } + // } + // + // if(doorcode == "2"){ + // actions = train.action.down; + // } } for(let an=actions.length-1;an>=0;an--){ @@ -213,20 +221,20 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe function closetraindoor(train,doorcode,direct){ if(direct == "top"){ - if(doorcode == "1"){ - actions = train.action.down; - } - if(doorcode == "2"){ + // if(doorcode == "1"){ + // actions = train.action.down; + // } + // if(doorcode == "2"){ actions = train.action.top; - } + // } toptrain.nowcode = null; }else{ - if(doorcode == "1"){ + // if(doorcode == "1"){ actions = train.action.top; - } - if(doorcode == "2"){ - actions = train.action.down; - } + // } + // if(doorcode == "2"){ + // actions = train.action.down; + // } downtrain.nowcode = null; } diff --git a/src/jlmap3d/jl3dtrafficplan/connect/trainconnect.js b/src/jlmap3d/jl3dtrafficplan/connect/trainconnect.js index 2409de364..f7558989f 100644 --- a/src/jlmap3d/jl3dtrafficplan/connect/trainconnect.js +++ b/src/jlmap3d/jl3dtrafficplan/connect/trainconnect.js @@ -29,19 +29,58 @@ export function TrainConnect(trafficTrain,deviceaction,toptrain,routegroup,passe // 仿真socket接口回调函数 function callback(Response) { const data = JSON.parse(Response.body); - // console.log(data); - if(data.type == "TrainRun_3D"){ - trafficTrain.trainList = data.body; - // console.log(trafficTrain.nowTrainCode); + + + if(data.type == "BeAbout2Arrive_3D"){ + if(toptrain.nowcode == data.body.groupNumber){ + console.log(data); + } + + } + if(data.type == "TRAIN_PFI_BL"){ + + trafficTrain.updateTrainData(data.body); + + + // if(toptrain.nowcode == data.body.code){ + // console.log(data); + // //根据上下车人数创建人 + // jl3d.updateNowLeaveData("top",data.body.out); + // } + // if(downtrain.nowcode == data.body.code){ + // console.log(data); + // //根据上下车人数创建人 + // jl3d.updateNowLeaveData("down",data.body.out); + // } + } + if(data.type == "TRAIN_PFI_NUM"){ + + trafficTrain.trainList = []; + // trafficTrain.trainList = data.body; + + for(let i=0;i=0;an--){ actions[an].reset(); actions[an].time = 0; @@ -99,7 +137,6 @@ export function TrainConnect(trafficTrain,deviceaction,toptrain,routegroup,passe if(doorcode == "2"){ actions = train.action.top; } - toptrain.nowcode = null; }else{ if(doorcode == "1"){ actions = train.action.top; @@ -108,7 +145,7 @@ export function TrainConnect(trafficTrain,deviceaction,toptrain,routegroup,passe actions = train.action.down; } } - console.log(actions); + for(let an=actions.length-1;an>=0;an--){ actions[an].reset(); actions[an].time = actions[an]._clip.duration; diff --git a/src/jlmap3d/jl3dtrafficplan/jl3dtrafficplan.js b/src/jlmap3d/jl3dtrafficplan/jl3dtrafficplan.js index 271b3e2bd..8e2a8ea83 100644 --- a/src/jlmap3d/jl3dtrafficplan/jl3dtrafficplan.js +++ b/src/jlmap3d/jl3dtrafficplan/jl3dtrafficplan.js @@ -372,7 +372,6 @@ export function Jl3dTrafficPlan(dom,skinCode,routegroup,viewMap) { // console.log(humanlist.children.length); this.allStationData = []; - console.log("create"); if(waitForCreatIn.length>0){ let direct = Math.floor(Math.random()*(3-1+1))+1; //1--top diff --git a/src/jlmap3d/jl3dtrafficplan/jl3dtraffictrain.js b/src/jlmap3d/jl3dtrafficplan/jl3dtraffictrain.js index 2b6f2af18..c9ff7e1ea 100644 --- a/src/jlmap3d/jl3dtrafficplan/jl3dtraffictrain.js +++ b/src/jlmap3d/jl3dtrafficplan/jl3dtraffictrain.js @@ -69,14 +69,20 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) { this.showmodel = null; this.nowTrainCode = ""; + this.nowTrunk = { + code:null, + index:null, + numList:[ + ] + }; this.trainList = []; this.humanWaitIn = []; this.humanWaitOut = []; this.humanInSpeed = 0; this.humanOutSpeed = 0; - + //定义相机 camerass = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 1000); camerass.position.set(0, 80, 40); @@ -128,7 +134,7 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) { let passerTrain = new PasserTrain(); this.modelmanager.loadpromise(Staticmodel, scope.mixers,"2").then(function (data) { - console.log(data); + // console.log(data); passerTrain.initTrain(scope.modelmanager.train.mesh,mixers,deviceaction,scene); passerTrain.toptrain.position.x = 0; passerTrain.toptrain.position.y = 0; @@ -159,15 +165,7 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) { this.resetscene = function(){ - aiswitch = 1; - passerAi.toppasserin = false; - passerAi.downpasserin = false; - //下车控制开关 - passerAi.toppasseron = false; - passerAi.downpasseron = false; - passerTrain.toptrain.nowcode = null; - passerTrain.downtrain.nowcode = null; // humanlist = new THREE.Group(); for(let j=0; j=0;an--){ passerTrain.toptrain.action.top[an].reset(); passerTrain.toptrain.action.top[an].time = passerTrain.toptrain.action.top[an]._clip.duration; passerTrain.toptrain.action.top[an].timeScale = -1; passerTrain.toptrain.action.top[an].play(); } - for(let an=passerTrain.toptrain.action.down.length-1;an>=0;an--){ - passerTrain.toptrain.action.down[an].reset(); - passerTrain.toptrain.action.down[an].time = passerTrain.toptrain.action.down[an]._clip.duration; - passerTrain.toptrain.action.down[an].timeScale = -1; - passerTrain.toptrain.action.down[an].play(); - } - // for(let an=actions.length-1;an>=0;an--){ - // actions[an].reset(); - // actions[an].time = actions[an]._clip.duration; - // actions[an].timeScale = -1; - // actions[an].play(); - // } + setTimeout(function(){ passerHuman.setNowTrunkPasser(humanlist); aiswitch = 0; @@ -213,12 +189,12 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) { } function startWorker(){ - passerHuman.setNowTrunkPasser(humanlist,200,0); + passerHuman.setNowTrunkPasser(humanlist,0,0); let updateaianimate = setInterval( function(){ // console.log("?"); if(aiswitch == 0){ - // passerHuman.moveAnimateUpdate(humanlist,olddataai,passerHuman); + passerHuman.moveAnimateUpdate(humanlist,passerHuman); // passerAi.aiUpdate(humanlist,passerHuman,passerCheckDoor,deviceaction); delta = clock.getDelta(); @@ -229,40 +205,16 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) { mixers[i].update( delta ); } } - // for(let i=humanlist.children.length-1;i>=0;i--){ - // if(humanlist.children[i].mixer._actions[0].isRunning()){ - // humanlist.children[i].mixer.update( delta ); - // } - // } + for(let i=humanlist.children.length-1;i>=0;i--){ + if(humanlist.children[i].mixer._actions[0].isRunning()){ + humanlist.children[i].mixer.update( delta ); + } + } + } } , 100); - passerWebWork.onmessage = function (event) { - if(aiswitch == 0){ - // console.log(humanlist.children.length); - if(humanlist.children.length < 80){ - let direct = Math.floor(Math.random()*(3-1+1))+1; - - if(passerAi.toppasseron){ - for(let i=0,leni=passerZone.list["standtop"].doorpoints.length;i 0){ + for(let i=0;i=0;an--){ + passerTrain.toptrain.action.top[an].reset(); + passerTrain.toptrain.action.top[an].time = passerTrain.toptrain.action.top[an]._clip.duration; + passerTrain.toptrain.action.top[an].timeScale = -1; + passerTrain.toptrain.action.top[an].play(); + } + + for(let an=passerTrain.toptrain.action.top.length-1;an>=0;an--){ + passerTrain.toptrain.action.down[an].reset(); + passerTrain.toptrain.action.down[an].time = passerTrain.toptrain.action.top[an]._clip.duration; + passerTrain.toptrain.action.down[an].timeScale = -1; + passerTrain.toptrain.action.down[an].play(); + } + + if(scope.trainList[i].open != "0"){ + if(scope.trainList[i].doorCode == "1"){ + for(let an=passerTrain.toptrain.action.top.length-1;an>=0;an--){ + passerTrain.toptrain.action.top[an].reset(); + passerTrain.toptrain.action.top[an].time = 0; + passerTrain.toptrain.action.top[an].timeScale = 1; + passerTrain.toptrain.action.top[an].play(); + } + }else{ + for(let an=passerTrain.toptrain.action.top.length-1;an>=0;an--){ + passerTrain.toptrain.action.down[an].reset(); + passerTrain.toptrain.action.down[an].time = 0; + passerTrain.toptrain.action.down[an].timeScale = 1; + passerTrain.toptrain.action.down[an].play(); + } + } + } + + updateTrainNum(trainDataList); + i = scope.trainList.length; + } + } + + } this.switchviews = function(viewmode){ passerRender.changeRenderMode(viewmode); } + function getnum(num,pnum){ + let re = []; + let base = Math.floor(num/pnum); + let reset = num%pnum; + for(let i=0;i=1){ - outStationPassers.children[i].progress = 1; - outStationPassers.children[i].action.stop(); - outStationPassers.children[i].status = 0; - - if(outStationPassers.children[i].stage == 8){ - passerHuman.uncache(outStationPassers.children[i]); - outStationPassers.remove(outStationPassers.children[i]); - i--; - }else if(outStationPassers.children[i].stage == 7){ - outStationPassers.children[i].stage = 8; - } - else if(outStationPassers.children[i].stage == 5){ - - outStationPassers.children[i].stage = 7; - - } - }else{ - //根据动画进度获取动画轨迹上点 - // console.log(i); - // console.log(humanlist.children[i].runrail); - // console.log(humanlist.children[i].progress); - let point = outStationPassers.children[i].runrail.getPointAt(outStationPassers.children[i].progress); - - //更新模型坐标 - outStationPassers.children[i].position.x = point.x; - outStationPassers.children[i].position.y = point.y; - outStationPassers.children[i].position.z = point.z; - if((outStationPassers.children[i].progress+0.001)<1){ - let tangent = outStationPassers.children[i].runrail.getPointAt(outStationPassers.children[i].progress+0.001); - outStationPassers.children[i].lookAt(new THREE.Vector3(tangent.x,outStationPassers.children[i].position.y,tangent.z)); - } - - outStationPassers.children[i].progress += outStationPassers.children[i].speed; - point = null; - - } - } - } - - for(let i=0;i=1){ - topWaitPassers.children[i].progress = 1; - topWaitPassers.children[i].action.stop(); - topWaitPassers.children[i].status = 0; - - if(topWaitPassers.children[i].stage == 4){ - passerHuman.uncache(topWaitPassers.children[i]); - topWaitPassers.remove(topWaitPassers.children[i]); - i--; - } - }else{ - //根据动画进度获取动画轨迹上点 - // console.log(i); - // console.log(humanlist.children[i].runrail); - // console.log(humanlist.children[i].progress); - let point = topWaitPassers.children[i].runrail.getPointAt(topWaitPassers.children[i].progress); - - //更新模型坐标 - topWaitPassers.children[i].position.x = point.x; - topWaitPassers.children[i].position.y = point.y; - topWaitPassers.children[i].position.z = point.z; - if((topWaitPassers.children[i].progress+0.001)<1){ - let tangent = topWaitPassers.children[i].runrail.getPointAt(topWaitPassers.children[i].progress+0.001); - topWaitPassers.children[i].lookAt(new THREE.Vector3(tangent.x,topWaitPassers.children[i].position.y,tangent.z)); - } - - topWaitPassers.children[i].progress += topWaitPassers.children[i].speed; - point = null; - - } - } - } - - for(let i=0;i=1){ - downWaitPassers.children[i].progress = 1; - downWaitPassers.children[i].action.stop(); - downWaitPassers.children[i].status = 0; - if(downWaitPassers.children[i].stage == 4){ - passerHuman.uncache(downWaitPassers.children[i]); - downWaitPassers.remove(downWaitPassers.children[i]); - i--; - } - }else{ - //根据动画进度获取动画轨迹上点 - // console.log(i); - // console.log(humanlist.children[i].runrail); - // console.log(humanlist.children[i].progress); - let point = downWaitPassers.children[i].runrail.getPointAt(downWaitPassers.children[i].progress); - - //更新模型坐标 - downWaitPassers.children[i].position.x = point.x; - downWaitPassers.children[i].position.y = point.y; - downWaitPassers.children[i].position.z = point.z; - if((downWaitPassers.children[i].progress+0.001)<1){ - let tangent = downWaitPassers.children[i].runrail.getPointAt(downWaitPassers.children[i].progress+0.001); - downWaitPassers.children[i].lookAt(new THREE.Vector3(tangent.x,downWaitPassers.children[i].position.y,tangent.z)); - } - - downWaitPassers.children[i].progress += downWaitPassers.children[i].speed; - point = null; - - } - } - } - + this.moveAnimateUpdate = function(humanlist,passerHuman){ for(let i=0;i=1){ //更新模型坐标 + humanlist.children[i].progress = 1; + humanlist.children[i].action.stop(); if(humanlist.children[i].status == 1){ - humanlist.children[i].progress = 1; - humanlist.children[i].action.stop(); - humanlist.children[i].status = 0; - if(humanlist.children[i].stage == 3){ - - humanlist.children[i].stage = 4; - if(humanlist.children[i].direct == "top"){ - topWaitPassers.add(humanlist.children[i]); - i--; - }else if(humanlist.children[i].direct == "down"){ - downWaitPassers.add(humanlist.children[i]); - i--; - } - - }else if(humanlist.children[i].stage == 2){ - humanlist.children[i].stage = 3; - - }else if(humanlist.children[i].stage == 1){ - - - humanlist.children[i].stage = 2; - - }else if(humanlist.children[i].stage == 0){ - // // console.log(humans[i].doors); - // zhajiin[humanlist.children[i].doors].waiting = 0; - humanlist.children[i].stage = 1; - } + waitGroup.add(humanlist.children[i]); } }else{ @@ -283,7 +148,6 @@ export function PasserHuman() { point = null; } - } } } @@ -294,49 +158,111 @@ export function PasserHuman() { } } - this.inTrainRail = function(inNum,direct){ - for(let i=0;i y ? (x > c ? x : c) : (y > c ? y : c); // var min = x < y ? (x < c ? x : c) : (y < c ? y : c); - function getnum(num,pnum){ - let re = []; - let base = Math.floor(num/pnum); - let reset = num%pnum; - for(let i=0;i>>>>>> 009f7b57a22a8c59a26fe0b2be01d24377f37873 // BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康 // BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛 diff --git a/src/views/jlmap3d/trafficplan/jl3dtraffictrain.vue b/src/views/jlmap3d/trafficplan/jl3dtraffictrain.vue index 88c0677c4..2b87b1a21 100644 --- a/src/views/jlmap3d/trafficplan/jl3dtraffictrain.vue +++ b/src/views/jlmap3d/trafficplan/jl3dtraffictrain.vue @@ -134,7 +134,7 @@ export default { trainlist:[], value:'', isCctv:true, - allPassers:890, + allPassers:0, loadingProjectList: ['login', 'design', 'xty', 'designxty', 'gzb', 'designxty', 'xadt', 'designxadt', 'drts', 'designdrts'] }; }, @@ -164,6 +164,8 @@ export default { if (this.$route.query.type == 'CCTV') { this.isCctv = false; } + + window.updateTrainNum = this.updateTrainNum; }, beforeDestroy() { @@ -191,9 +193,9 @@ export default { this.jl3d.switchviews('4views'); } }, - updateTrainCode(codeData){ - this.jl3d.updateNowTrainCode(codeData); - }, + // updateTrainCode(codeData){ + // this.jl3d.updateNowTrainCode(codeData); + // }, updateTrainList(){ this.trainlist = this.jl3d.getTrainList(); // console.log(this.trainlist); @@ -201,12 +203,21 @@ export default { updateTrainCode(selVal) { // this.jl3d.changeTrain(selVal); this.isActive=0; + this.jl3d.updateNowTrainCode(selVal); this.jl3d.switchcamera(0+''); - this.jl3d.updateNowTrainCode(selVal); + // let oldgroupnum = this.groupnum; // this.value = selVal; }, + updateTrainNum(dataList){ + this.takelist = dataList; + this.allPassers = 0; + for(let i = 0;i{{ jl3dname }} {{ $t('display.demon.passengerflow') }} + + {{ $t('display.demon.trafficplantext') }} + {{ $t('display.demon.maintainer') }} 生成二维码 @@ -377,6 +380,19 @@ export default { jumpjl3dpassflow() { this.$emit('passflow'); }, + jumpjl3dtrafficplan() { + const routeData = this.$router.resolve({ + path:'/jlmap3d/trafficplan', + query:{ + mapid:this.mapId, + group:this.group, + project: this.project, + noPreLogout: true, + lineCode:this.lineCode + } + }); + window.open(routeData.href, '_blank', 'noopener noreferrer'); + }, jumpjl3dfaultdevice() { this.$emit('faultdevice'); },