修改三维客流模块

This commit is contained in:
sunzhenyu 2020-11-13 18:26:22 +08:00
parent 9a286521a6
commit 015632678f
10 changed files with 467 additions and 323 deletions

View File

@ -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;
}

View File

@ -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<data.body.length;i++){
let train = {
code:data.body[i].code,
num:data.body[i].num,
doorCode:1,
open:0,
};
trafficTrain.trainList.push(train);
}
}
if(data.type == "DeviceCtrl_3D"){
if(data.body.type == "TRAIN_DOOR"){
for(let i=0;i<trafficTrain.trainList.length;i++){
if(trafficTrain.trainList[i].code == data.body.code){
trafficTrain.trainList[i].open = data.body.open;
trafficTrain.trainList[i].doorCode = data.body.doorCode;
i = trafficTrain.trainList.length;
}
}
if(toptrain.nowcode == data.body.code){
console.log(data.body);
console.log(toptrain.nowcode);
trafficTrain.updatePasserMove(data.body);
if(data.body.open == "0"){
closetraindoor(toptrain,data.body.doorCode,"top");
@ -82,7 +121,6 @@ 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 = 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;

View File

@ -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

View File

@ -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<humanlist.children.length;j++){
@ -175,36 +173,14 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) {
j--;
// j--;
}
passerTrain.toptrain.position.y = -20000;
passerTrain.downtrain.position.y = -20000;
deviceaction.down.action.reset();
deviceaction.down.action.time = deviceaction.down.action._clip.duration;
deviceaction.down.action.timeScale = -1;
deviceaction.down.action.play();
deviceaction.top.action.reset();
deviceaction.top.action.time = deviceaction.down.action._clip.duration;
deviceaction.top.action.timeScale = -1;
deviceaction.top.action.play();
for(let an=passerTrain.toptrain.action.top.length-1;an>=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<leni;i++ ){
setTimeout(function(){
passerHuman.newHumanCreate(humanlist,passerZone.list["standtop"].doorpoints[i],5,"top",i);
}, Math.random()*1000);
}
}
if(passerAi.downpasseron){
for(let i=0,leni=passerZone.list["standdown"].doorpoints.length;i<leni;i++ ){
setTimeout(function(){
passerHuman.newHumanCreate(humanlist,passerZone.list["standdown"].doorpoints[i],5,"down",i);
}, Math.random()*1000);
}
}
}
}
};
}
@ -283,14 +235,13 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) {
}
this.switchcamera = function(trunkNum){
// console.log(passerTrain.toptrain);
// console.log(camerass.position);
console.log(trunkNum);
// let test = "";
passerHuman.nowTrunk = trunkNum;
passerHuman.resetPasser(humanlist);
passerHuman.setNowTrunkPasser(humanlist,200,trunkNum);
passerHuman.setNowTrunkPasser(humanlist,scope.nowTrunk.numList[trunkNum].num,trunkNum);
switch (trunkNum) {
case '0':
camerass.position.x = 4.78;
@ -342,12 +293,106 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) {
return scope.trainList;
}
let nowLeaveDoor = null;
this.updatePasserMove = function(doorData){
nowLeaveDoor = doorData.doorCode;
// console.log(doorData);
}
this.updateTrainData = function(newData){
if(scope.trainList.length > 0){
for(let i=0;i<scope.trainList.length;i++){
if(newData.code == scope.trainList[i].code){
scope.trainList[i].num = scope.trainList[i].num + newData.in - newData.out;
if(passerTrain.toptrain.nowcode == newData.code){
scope.humanWaitIn = getnum(newData.in,6);
scope.humanWaitOut = getnum(newData.out,6);
// console.log(scope.humanWaitIn);
// console.log(scope.humanWaitOut);
// console.log(nowLeaveDoor);
// console.log("------------------");
passerHuman.initTrainRail(humanlist,scope.humanWaitIn,scope.humanWaitOut,nowLeaveDoor);
let trainDataList = getnum(scope.trainList[i].num,6);
// nowTrunk.code = newCode;
scope.nowTrunk.numList = trainDataList;
updateTrainNum(trainDataList);
}
i = scope.trainList.length;
}
}
}
}
this.updateNowTrainCode = function(newCode){
passerTrain.toptrain.nowcode = newCode;
scope.nowTrainCode = newCode;
// console.log(scope.trainList);
for(let i=0;i<scope.trainList.length;i++){
if(scope.trainList[i].code == newCode){
let trainDataList = getnum(scope.trainList[i].num,6);
scope.nowTrunk.code = newCode;
scope.nowTrunk.numList = trainDataList;
// console.log(scope.trainList[i]);
for(let an=passerTrain.toptrain.action.top.length-1;an>=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<pnum;i++){
let nownum = base+(i<reset?1:0);
let newtraindata = {
num:nownum,
percent:parseInt(nownum/220*100)+"%",
}
re.push(newtraindata);
}
return re;
}
}

View File

@ -31,9 +31,9 @@ export function PasserTrain() {
} );
scope.toptrain = object.clone(true);
scope.toptrain.nowcode = null;
let newTrain = object.clone(true);
newTrain.nowcode = null;
scope.toptrain = newTrain;
scope.toptrain.action = {
top:[],
down:[]

View File

@ -28,7 +28,7 @@ export function PasserHuman() {
for(let i=0;i<220;i++){
let newhuman;
createHumanModel(newhuman,waitGroup,new THREE.Vector3(0,0,0));
createHumanModel(newhuman,waitGroup,mixers,new THREE.Vector3(0,0,0));
}
// console.log(waitGroup);
}
@ -55,7 +55,7 @@ export function PasserHuman() {
// createHumanModel(newhuman,humanlist,position,stage,direct,door);
// }
function createHumanModel(newhuman,humanlist,position,stage,direct,door){
function createHumanModel(newhuman,humanlist,mixers,position,stage,direct,door){
let mantype = Math.floor(Math.random()*(3-1+1))+1;
if(mantype == 1){
@ -89,6 +89,7 @@ export function PasserHuman() {
}else{
newhuman.door = null;
}
newhuman.progress = 1;
newhuman.action = mixer.clipAction( newhuman.animations[ 0 ] );
newhuman.mixer = mixer;
newhuman.runrail = null;
@ -114,153 +115,17 @@ export function PasserHuman() {
model.speed = 0.2/curve.getLength();
}
//更新人物列表中人物的动画
this.moveAnimateUpdate = function(humanlist,topWaitPassers,downWaitPassers,outStationPassers,passerHuman){
for(let i=0;i<outStationPassers.children.length;i++){
if(outStationPassers.children[i].status == 1){
if(outStationPassers.children[i].progress>=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<topWaitPassers.children.length;i++){
if(topWaitPassers.children[i].status == 1){
if(topWaitPassers.children[i].progress>=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<downWaitPassers.children.length;i++){
if(downWaitPassers.children[i].status == 1){
if(downWaitPassers.children[i].progress>=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<humanlist.children.length;i++){
if(humanlist.children[i].status == 1){
if(humanlist.children[i].progress>=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<leaceNum;i++){
if(direct == 1){
this.initTrainRail = function(humanlist,inNum,leaveNum,direct){
// console.log(inNum[scope.nowTrunk]);
let inPasser = getnum(inNum[scope.nowTrunk].num,3);
let outPasser = getnum(leaveNum[scope.nowTrunk].num,3);
// console.log(inPasser);
// console.log(outPasser);
// let outPassers = inNum[scope.nowTrunk].num;
}else if(direct == 2){
for(let i=0;i<inPasser.length;i++){
for(let j=0;j<inPasser[i];j++){
setTimeout(function(){
scope.createInPasser(humanlist,direct);
}, Math.random()*1000*i);
}
}
let created = 0;
for(let i=0;i<outPasser.length;i++){
for(let j=0;j<outPasser[i];j++){
// setTimeout(function(){
scope.createOutPasser(humanlist,created,direct);
// }, Math.random()*1000*i);
created++;
}
let pos = trunkManager.getTrunkRandomPos(trunknum);
trunkManager.getRail(direct,scope.nowTrunk,pos);
humanlist.add(waitGroup.children[0]);
}
}
this.leaveTrainRail = function(leaveNum,doorCode){
for(let i=0;i<leaceNum;i++){
trunkManager.getRail(direct,scope.nowTrunk,humanlist.children[i]);
this.createInPasser = function(humanlist,direct){
waitGroup.children[0].progress = 0;
waitGroup.children[0].status = 0;
waitGroup.children[0].action.play();
let points = [];
let point1 = trunkManager.getDoorRandomPos(scope.nowTrunk,direct);
let overpoint = trunkManager.getTrunkRandomPos(scope.nowTrunk);
waitGroup.children[0].position.copy(point1);
points.push(point1);
if(direct == 1){
points.push(new THREE.Vector3(point1.x,point1.y,point1.z+0.5));
}else{
points.push(new THREE.Vector3(point1.x,point1.y,point1.z-0.5));
}
points.push(overpoint);
let curve = new THREE.CatmullRomCurve3(points);
waitGroup.children[0].runrail = curve;
waitGroup.children[0].speed = 0.2/curve.getLength();
humanlist.add(waitGroup.children[0]);
}
this.createOutPasser = function(humanlist,created,direct){
humanlist.children[created].progress = 0;
humanlist.children[created].status = 1;
humanlist.children[created].action.play();
let points = [];
let point1 = new THREE.Vector3(humanlist.children[created].position.x,humanlist.children[created].position.y,humanlist.children[created].position.z);
let overpoint = trunkManager.getDoorRandomPos(scope.nowTrunk,direct);
points.push(point1);
if(direct == 1){
points.push(new THREE.Vector3(point1.x,point1.y,point1.z+0.5));
}else{
points.push(new THREE.Vector3(point1.x,point1.y,point1.z-0.5));
}
points.push(overpoint);
let curve = new THREE.CatmullRomCurve3(points);
humanlist.children[created].runrail = curve;
humanlist.children[created].speed = 0.2/curve.getLength();
}
this.setNowTrunkPasser = function(humanlist,num,trunknum){
// let array = getnum(num,6);
// console.log(array);
if(num){
// for(let i=0;i<array.length;i++){
for(let j=0;j<num;j++){
let pos = trunkManager.getTrunkRandomPos(trunknum);
waitGroup.children[0].zone = trunkManager.trunk[trunknum].name;
waitGroup.children[0].position.x = pos.x;
waitGroup.children[0].position.y = pos.y;
waitGroup.children[0].position.z = pos.z;
for(let j=0;j<num;j++){
let pos = trunkManager.getTrunkRandomPos(trunknum);
waitGroup.children[0].zone = trunkManager.trunk[trunknum].name;
waitGroup.children[0].position.x = pos.x;
waitGroup.children[0].position.y = pos.y;
waitGroup.children[0].position.z = pos.z;
if(pos.z<0){
waitGroup.children[0].rotation.y = Math.PI;
}else{
waitGroup.children[0].rotation.y = 0;
}
humanlist.add(waitGroup.children[0]);
if(pos.z<0){
waitGroup.children[0].rotation.y = Math.PI;
}else{
waitGroup.children[0].rotation.y = 0;
}
humanlist.add(waitGroup.children[0]);
}
// }
}
}
//计算距离
//let dx = Math.abs(point1.x - point2.x);
//let dy = Math.abs(point1.y - point2.y);
@ -346,19 +272,17 @@ export function PasserHuman() {
// var max = x > 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<pnum;i++){
let nownum = base+(i<reset?1:0);
let newtraindata = {
num:nownum,
}
re.push(newtraindata);
}
return re;
}
function getnum(num,pnum){
let re = [];
let base = Math.floor(num/pnum);
let reset = num%pnum;
for(let i=0;i<pnum;i++){
let nownum = base+(i<reset?1:0);
re.push(nownum);
}
return re;
}
//离开车站释放缓存
this.uncache = function(uncachemodel){
if(uncachemodel){

View File

@ -179,33 +179,34 @@ export function StationStandListN() {
}
} );
let allClear = 0;
for(let j=0;j<standsdata.length;j++){
allClear = 0;
for(let i=0;i<psddata.length;i++){
for(let n=0;n<standsdata[j].stands.length;n++){
if(psddata[i].standCode == standsdata[j].stands[n].code){
allClear++;
standsdata[j].stands[n].position = psddata[i].position;
}
}
if(allClear == standsdata[j].stands.length){
standsdata[j].stands.sort(compare);
i = psddata.length;
}
}
}
console.log(standsdata);
console.log(psddata);
//新车门动画获取待定
// let allClear = 0;
// for(let j=0;j<standsdata.length;j++){
//
// allClear = 0;
// for(let i=0;i<psddata.length;i++){
//
// for(let n=0;n<standsdata[j].stands.length;n++){
// if(psddata[i].standCode == standsdata[j].stands[n].code){
// allClear++;
// standsdata[j].stands[n].position = psddata[i].position;
// }
// }
//
// if(allClear == standsdata[j].stands.length){
// standsdata[j].stands.sort(compare);
// i = psddata.length;
// }
// }
// }
//
//
// console.log(standsdata);
// console.log(psddata);
for(let i=0;i<standsdata.length;i++){
let newstationstand = new StationStandModel(standsdata[i]);
// console.log(standsdata[i]);
if(standsdata[i].code != "Station96090"){
console.log("3");
newstationstand.code = standsdata[i].code;
newstationstand.name = standsdata[i].name;
@ -327,7 +328,116 @@ export function StationStandListN() {
textt.dispose();
}
}
}else{
newstationstand.code = standsdata[i].code;
newstationstand.name = standsdata[i].name;
newstationstand.type = "station";
newstationstand.num = i;
newstationstand.stand = [];
// newstationstand.direction1.code = standsdata[i].direction1.code;
// newstationstand.direction1.name = standsdata[i].direction1.name;
// newstationstand.direction1.screenDoorOpenStatus = "01";
//
// newstationstand.direction2.code = standsdata[i].direction2.code;
// newstationstand.direction2.name = standsdata[i].direction2.name;
// newstationstand.direction2.screenDoorOpenStatus = "01";
let newstationmesh = null;
newstationmesh = selectmesh3.clone(true);
newstationmesh.code = standsdata[i].code;
newstationmesh.name = standsdata[i].code;
newstationmesh.position.x = standsdata[i].position.x;
newstationmesh.position.y = standsdata[i].position.y;
newstationmesh.position.z = standsdata[i].position.z;
// newstationmesh.rotation.x = standsdata[i].rotation._x;
// newstationmesh.rotation.y = standsdata[i].rotation._y;
// newstationmesh.rotation.z = standsdata[i].rotation._z;
newstationstand.mesh = newstationmesh;
scope.group.add(newstationmesh);
//
scope.list[standsdata[i].code] = newstationstand;
//
let newclip =null;
newclip = selectmesh3.animations[ 0 ];
for(let j=0;j<newstationmesh.children.length;j++){
if(newstationmesh.children[j].name == "top"){
newstationmesh.children[j].animations = [];
newstationmesh.children[j].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newstationmesh.children[j] );
for(let n=0;n<psddata.length;n++){
for(let m=0;m<newstationstand.stands.length;m++){
console.log("====================");
console.log(newstationstand.stands[m]);
console.log(psddata[n]);
if(psddata[n].standCode == newstationstand.stands[m].code && newstationstand.stands[m].right == false){
let key = psddata[n].code;
actionss[key] = {
status:"01",
action:mixer.clipAction( newstationmesh.children[j].animations[0])
};
actionss[key].action.setLoop(THREE.LoopOnce);
actionss[key].action.clampWhenFinished = true;
//actionss[key].play();
mixers.push(mixer);
n = psddata.length;
m = newstationstand.stands.length;
}
}
}
}
if(newstationmesh.children[j].name == "down"){
newstationmesh.children[j].animations = [];
newstationmesh.children[j].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newstationmesh.children[j] );
for(let n=0;n<psddata.length;n++){
for(let m=0;m<newstationstand.stands.length;m++){
console.log("====================");
console.log(newstationstand.stands[m]);
console.log(psddata[n]);
if(psddata[n].standCode == newstationstand.stands[m].code && newstationstand.stands[m].right == true){
let key = psddata[n].code;
actionss[key] = {
status:"01",
action:mixer.clipAction( newstationmesh.children[j].animations[0])
};
actionss[key].action.setLoop(THREE.LoopOnce);
actionss[key].action.clampWhenFinished = true;
//actionss[key].play();
mixers.push(mixer);
n = psddata.length;
m = newstationstand.stands.length;
}
}
}
}
}
if(mode){
if(mode == "02"){
let textgeometry = new THREE.PlaneBufferGeometry( 65, 90, 1 );
let textt = new THREE.CanvasTexture(getTextCanvas(standsdata[i]));
let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} );
let textplane = new THREE.Mesh( textgeometry, textmaterial );
textplane.name = standsdata[i].code;
textplane.position.y = 70;
textplane.rotation.x = Math.PI/2;
textplane.position.z = 50;
scope.textlist.push(textplane);
newstationmesh.add(textplane);
textgeometry.dispose();
textmaterial.dispose();
textt.dispose();
}
}
}
}
// scene.add(scope.textlist);

View File

@ -4,15 +4,9 @@ export function getBaseUrl() {
// BASE_API = 'https://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.8.107:9000'; // 袁琪
<<<<<<< HEAD
// BASE_API = 'http://192.168.8.129:9000'; // 旭强
// BASE_API = 'http://192.168.8.109:9000'; // 张赛
// BASE_API = 'http://192.168.8.110:9000'; // 杜康
=======
// BASE_API = 'http://192.168.8.114:9000'; // 旭强
// BASE_API = 'http://192.168.8.109:9000'; // 张赛
// BASE_API = 'http://192.168.8.110:9008'; // 杜康
>>>>>>> 009f7b57a22a8c59a26fe0b2be01d24377f37873
// BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛

View File

@ -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<this.takelist.length;i++){
this.allPassers = this.allPassers + this.takelist[i].num;
}
},
getnum(num,pnum){
let re = [];
let base = Math.floor(num/pnum);
@ -215,7 +226,7 @@ export default {
let nownum = base+(i<reset?1:0);
let newtraindata = {
num:nownum,
percent:parseInt(nownum/this.takelimit*100)+"%",
percent:parseInt(nownum/220*100)+"%",
}
re.push(newtraindata);
}

View File

@ -12,6 +12,9 @@
<el-button v-if="(isShowScheduling || isDriver)&&project !== 'bjd'" size="small" @click="jumpjlmap3d">{{ jl3dname }}</el-button>
<!-- cctv视图 -->
<el-button v-if="isShowScheduling || isStationSupervisor" size="small" @click="jumpjl3dpassflow">{{ $t('display.demon.passengerflow') }}</el-button>
<!-- 客流规划视图 -->
<el-button v-if="isShowScheduling || isStationSupervisor" size="small" @click="jumpjl3dtrafficplan">{{ $t('display.demon.trafficplantext') }}</el-button>
<el-button v-if="(isShowScheduling || isStationSupervisor)&&project !== 'bjd'" size="small" @click="jumpjl3dfaultdevice">{{ $t('display.demon.maintainer') }}</el-button>
<!-- <el-button v-if="isAdmin" size="small" @click="otherVrView">VR第三人称视角</el-button> -->
<el-button v-if="qrCodeShow" type="primary" size="small" @click="generateQrCode">生成二维码</el-button>
@ -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');
},