Merge branch 'dev' of https://git.cloud.tencent.com/joylink/jl-nclient into dev
@ -2,12 +2,12 @@ export function SetScene() {
|
||||
var scene = new THREE.Scene();
|
||||
var cubeTextureLoader = new THREE.CubeTextureLoader();
|
||||
|
||||
cubeTextureLoader.setPath( '../../static/skybox/city/' );
|
||||
cubeTextureLoader.setPath( '../../static/skybox/star/' );
|
||||
|
||||
var cubeTexture = cubeTextureLoader.load( [
|
||||
'px.jpg', 'nx.jpg',
|
||||
'py.jpg', 'ny.jpg',
|
||||
'pz.jpg', 'nz.jpg',
|
||||
'px.png', 'nx.png',
|
||||
'py.png', 'ny.png',
|
||||
'pz.png', 'nz.png',
|
||||
] );
|
||||
|
||||
scene.background = cubeTexture;
|
||||
|
@ -41,9 +41,13 @@ var clock = new THREE.Clock();
|
||||
export function JLmapDriving(dom, data, skinCode) {
|
||||
|
||||
const scope = this;
|
||||
|
||||
//界面更新函数
|
||||
let updatemmi = {};
|
||||
this.dom = dom;
|
||||
// 渲染循环开关
|
||||
this.animateswitch = false;
|
||||
this.cctvswitch = false;
|
||||
// 初始化webgl渲染
|
||||
const renderer = SetRender(dom);
|
||||
renderer.domElement.style.position = 'absolute';
|
||||
@ -57,7 +61,7 @@ export function JLmapDriving(dom, data, skinCode) {
|
||||
document.getElementById('jlsimulation').appendChild(renderer.domElement);
|
||||
document.getElementById('jlcctv').appendChild(renderercctv.domElement);
|
||||
// 定义相机
|
||||
// let camera = SetCamera(dom);
|
||||
//let camera = SetCamera(dom);
|
||||
// 定义场景(渲染容器)
|
||||
const scene = SetScene();
|
||||
|
||||
@ -78,7 +82,7 @@ export function JLmapDriving(dom, data, skinCode) {
|
||||
// 选中物体描边方框
|
||||
this.helpbox = null;
|
||||
// 车门,站台门道岔动画构造器
|
||||
this.mixers = [];
|
||||
let mixers = [];
|
||||
// 模型操作命令组
|
||||
this.actions = {};
|
||||
this.nowspeed = null;
|
||||
@ -103,21 +107,20 @@ export function JLmapDriving(dom, data, skinCode) {
|
||||
controls3.enabled = true;
|
||||
scene.add(controls3.getObject());
|
||||
|
||||
const cameracctv = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 150);
|
||||
cameracctv.position.set( 5, -3, 27 );
|
||||
let cameracctv = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 120);
|
||||
cameracctv.position.set( 5, -3,27 );
|
||||
|
||||
cameracctv.rotation.y = Math.PI/5*3;
|
||||
camera.add(cameracctv);
|
||||
// 订阅仿真socket
|
||||
this.Subscribe = new Jl3dDriving(scope);
|
||||
this.Subscribe = new Jl3dDriving(updatemmi);
|
||||
|
||||
this.Subscribe.socketon(scope.Subscribe.topic);
|
||||
|
||||
// 初始化加载数据和模型
|
||||
getPublish3dMapDetail(skinCode).then(netdata => {
|
||||
ModelLoad(data, scope, netdata.data, mapdata, camera, controls3, scene);
|
||||
ModelLoad(data, scope, netdata.data, mapdata, camera, controls3, scene,mixers);
|
||||
});
|
||||
|
||||
// let stats = new Stats();
|
||||
// dom.appendChild( stats.dom );
|
||||
// 开启渲染
|
||||
@ -135,12 +138,19 @@ export function JLmapDriving(dom, data, skinCode) {
|
||||
if (scope.animateswitch == true) {
|
||||
// 根据相机渲染场景
|
||||
renderer.render(scene, camera);
|
||||
renderercctv.render(scene, cameracctv);
|
||||
// updatcontrols();
|
||||
// renderercctv
|
||||
controls3.update();
|
||||
// 检测动画构造器播放动画
|
||||
//cctv渲染
|
||||
|
||||
|
||||
if(scope.cctvswitch == true){
|
||||
renderercctv.render(scene,cameracctv);
|
||||
}
|
||||
//相机按键位移
|
||||
//controls3.update();
|
||||
delta = clock.getDelta();
|
||||
for (let i=mixers.length-1; i>=0; i--) {
|
||||
mixers[i].update( delta );
|
||||
}
|
||||
// stats.update();
|
||||
}
|
||||
|
||||
}
|
||||
@ -160,43 +170,36 @@ export function JLmapDriving(dom, data, skinCode) {
|
||||
|
||||
scope.webwork.onmessage = function (event) {
|
||||
// 更新列车位置
|
||||
// stats.update();
|
||||
UpdateTrain(camera, mapdata.trainlisttest);
|
||||
delta = clock.getDelta();
|
||||
for (let i=scope.mixers.length-1; i>=0; i--) {
|
||||
if ( scope.mixers[i] ) {
|
||||
scope.mixers[i].update( delta );
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
this.updatenowspeed = function(speed) {
|
||||
updatemmi.updatenowspeed = function(speed) {
|
||||
scope.nowspeed = speed;
|
||||
};
|
||||
this.updatenowlen = function(maLen) {
|
||||
updatemmi.updatenowlen = function(maLen) {
|
||||
scope.nowmxlen = maLen;
|
||||
};
|
||||
this.updateatpspeed = function(atpspeed) {
|
||||
updatemmi.updateatpspeed = function(atpspeed) {
|
||||
scope.atpspeed = atpspeed;
|
||||
};
|
||||
this.updateatospeed = function(atospeed) {
|
||||
updatemmi.updateatospeed = function(atospeed) {
|
||||
scope.atospeed = atospeed;
|
||||
};
|
||||
this.updatetrainnum = function(trainnum) {
|
||||
updatemmi.updatetrainnum = function(trainnum) {
|
||||
scope.trainnum = trainnum;
|
||||
};
|
||||
this.updatestoptime = function(stime) {
|
||||
updatemmi.updatestoptime = function(stime) {
|
||||
scope.stime = stime;
|
||||
};
|
||||
this.updatedrivedata = function(drivedata) {
|
||||
updatemmi.updatedrivedata = function(drivedata) {
|
||||
scope.drivecount += 1;
|
||||
scope.drivedata = drivedata;
|
||||
};
|
||||
|
||||
this.updatedrivingcode = function(code) {
|
||||
updatemmi.updatedrivingcode = function(code) {
|
||||
drivingcode = code;
|
||||
mapdata.trainlisttest.list[drivingcode].children[0].add(controls3.getObject());
|
||||
mapdata.trainlisttest.list[drivingcode].children[0].add(scope.assetloader.modellist[4].mesh);
|
||||
@ -221,7 +224,7 @@ export function JLmapDriving(dom, data, skinCode) {
|
||||
scope.materiallist = null;
|
||||
scope.selectmodel = null;
|
||||
scope.helpbox = null;
|
||||
scope.mixers = null;
|
||||
mixers = null;
|
||||
scope.actions = null;
|
||||
scope.Subscribe = null;
|
||||
// console.log(scope);
|
||||
@ -274,6 +277,14 @@ export function JLmapDriving(dom, data, skinCode) {
|
||||
scope.animateswitch = false;
|
||||
};
|
||||
|
||||
this.cctvon = function() {
|
||||
scope.cctvswitch = true;
|
||||
};
|
||||
|
||||
this.cctvoff = function() {
|
||||
scope.cctvswitch = false;
|
||||
};
|
||||
|
||||
this.endsocket = function() {
|
||||
scope.Subscribe.socketoff(scope.Subscribe.topic);
|
||||
};
|
||||
|
@ -7,9 +7,9 @@ import { handleToken } from '@/utils/auth';
|
||||
import router from '@/router';
|
||||
|
||||
// 定于仿真socket接口
|
||||
export function Jl3dDriving(jlmap3d) {
|
||||
export function Jl3dDriving(updatemmi) {
|
||||
|
||||
const scope = this;
|
||||
let scope = this;
|
||||
this.map = null;
|
||||
|
||||
var trainlisttest = null;
|
||||
@ -29,16 +29,16 @@ export function Jl3dDriving(jlmap3d) {
|
||||
|
||||
let driverswitch = false;
|
||||
|
||||
const stoptimer = null;
|
||||
const num = 30;
|
||||
const pointstand = null;
|
||||
let stoptimer = null;
|
||||
let num = 30;
|
||||
let pointstand = null;
|
||||
|
||||
// run as plane = 01;
|
||||
// reset = 02;
|
||||
var datatype = '00';
|
||||
this.teststomp = new StompClient();
|
||||
this.topic = '/user/queue/simulation/jl3d';
|
||||
const header = {'X-Token': handleToken() };
|
||||
let header = {'X-Token': handleToken() };
|
||||
|
||||
this.updatamap = function(mapdata, materiallist, nowaction, scene) {
|
||||
// console.log(mapdata);
|
||||
@ -85,7 +85,7 @@ export function Jl3dDriving(jlmap3d) {
|
||||
// 仿真socket接口回调函数
|
||||
function callback(Response) {
|
||||
// 对象化数据
|
||||
const data = JSON.parse(Response.body);
|
||||
let data = JSON.parse(Response.body);
|
||||
// 遍历后台数据
|
||||
|
||||
// 判断消息类型
|
||||
@ -93,26 +93,63 @@ export function Jl3dDriving(jlmap3d) {
|
||||
//
|
||||
//
|
||||
// }
|
||||
if (data.type == 'Simulation_Driver_Change') {
|
||||
drivingcode = data.body.code;
|
||||
jlmap3d.updatedrivingcode( data.body.code);
|
||||
}
|
||||
if(data.type == 'Simulation_Drive_Data_Routing'){
|
||||
jlmap3d.updatedrivedata(data.body);
|
||||
}
|
||||
if (data.type == 'Simulation_TrainSpeed') {
|
||||
switch (data.type) {
|
||||
case 'Simulation_TrainSpeed':
|
||||
trainspeed(data);
|
||||
break;
|
||||
case 'Simulation_Drive_Data_Routing':
|
||||
updatemmi.updatedrivedata(data.body);
|
||||
break;
|
||||
case 'Simulation_Driver_Change':
|
||||
drivingcode = data.body.code;
|
||||
updatemmi.updatedrivingcode( data.body.code);
|
||||
break;
|
||||
case 'SJL3D_TrainStatus':
|
||||
trainstatus(data);
|
||||
break;
|
||||
case 'Simulation_DeviceStatus':
|
||||
devicestatus(data);
|
||||
break;
|
||||
default :
|
||||
//TODO
|
||||
}
|
||||
|
||||
if (trainlisttest) {
|
||||
// if(data.type == 'Simulation_Drive_Data_Routing'){
|
||||
// updatemmi.updatedrivedata(data.body);
|
||||
// }
|
||||
//
|
||||
// if (data.type == 'Simulation_Driver_Change') {
|
||||
// drivingcode = data.body.code;
|
||||
// updatemmi.updatedrivingcode( data.body.code);
|
||||
// }
|
||||
//
|
||||
// if (data.type == 'Simulation_TrainSpeed') {
|
||||
// trainspeed(data);
|
||||
// }
|
||||
//
|
||||
// if (data.type == 'SJL3D_TrainStatus') {
|
||||
// trainstatus(data);
|
||||
// }
|
||||
//
|
||||
// if (data.type == 'Simulation_DeviceStatus') {
|
||||
// devicestatus(data);
|
||||
// }
|
||||
|
||||
for (let tl = 0; tl<data.body.length; tl++) {
|
||||
code = data.body[tl].id;
|
||||
}
|
||||
|
||||
function trainspeed(data){
|
||||
if (trainlisttest) {
|
||||
for (let tl = 0; tl<data.body.length; tl++) {
|
||||
code = data.body[tl].id;
|
||||
if(trainlisttest.list[code].speed != data.body[tl].v){
|
||||
trainlisttest.list[code].speed = data.body[tl].v;
|
||||
|
||||
if (trainlisttest.list[code].runMode == '02') {
|
||||
|
||||
if (trainlisttest.list[code].isStandTrack == true) {
|
||||
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/19/trainlisttest.list[code].len);
|
||||
} else {
|
||||
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/20/trainlisttest.list[code].len);
|
||||
trainlisttest.list[code].speeds = parseFloat(data.body[tl].v*10/36/19/trainlisttest.list[code].len);
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -120,429 +157,414 @@ export function Jl3dDriving(jlmap3d) {
|
||||
}
|
||||
|
||||
if (code == drivingcode) {
|
||||
if (data.body[tl].v >0) {
|
||||
jlmap3d.updatenowspeed(data.body[tl].v);
|
||||
} else {
|
||||
jlmap3d.updatenowspeed(Math.abs(data.body[tl].v));
|
||||
}
|
||||
// if (data.body[tl].v >0) {
|
||||
// updatemmi.updatenowspeed(data.body[tl].v);
|
||||
// } else {
|
||||
updatemmi.updatenowspeed(Math.abs(data.body[tl].v));
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
if (data.body[tl].atpv) {
|
||||
jlmap3d.updateatpspeed(data.body[tl].atpv);
|
||||
} else {
|
||||
jlmap3d.updateatpspeed(-1);
|
||||
}
|
||||
if (data.body[tl].atov) {
|
||||
jlmap3d.updateatospeed(data.body[tl].atov);
|
||||
} else {
|
||||
jlmap3d.updateatospeed(-1);
|
||||
}
|
||||
|
||||
|
||||
if (code == drivingcode) {
|
||||
if (data.body[tl].atpv) {
|
||||
updatemmi.updateatpspeed(data.body[tl].atpv);
|
||||
} else {
|
||||
updatemmi.updateatpspeed(-1);
|
||||
}
|
||||
if (data.body[tl].atov) {
|
||||
updatemmi.updateatospeed(data.body[tl].atov);
|
||||
} else {
|
||||
updatemmi.updateatospeed(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (data.type == 'SJL3D_TrainStatus') {
|
||||
for (let i=data.body.length-1; i>=0; i--) {
|
||||
if (data.body[i]._type == 'Train') {
|
||||
// 遍历列车对象组
|
||||
if (trainlisttest) {
|
||||
code = data.body[i].code;
|
||||
// 剔除不显示的车
|
||||
// 找到对应列车
|
||||
function trainstatus(data){
|
||||
for (let i=data.body.length-1; i>=0; i--) {
|
||||
// 遍历列车对象组
|
||||
if (trainlisttest) {
|
||||
code = data.body[i].code;
|
||||
// 剔除不显示的车
|
||||
// 找到对应列车
|
||||
|
||||
if ( trainlisttest.list[code]) {
|
||||
if (code == drivingcode) {
|
||||
driverswitch = data.body[i].runMode;
|
||||
jlmap3d.updatetrainnum(data.body[i].groupNumber);
|
||||
// console.log(trainlisttest.list[code].progress);
|
||||
const syncdata = {
|
||||
type: 'Train',
|
||||
code: code,
|
||||
sectionCode: data.body[i].sectionCode,
|
||||
percent: 0
|
||||
};
|
||||
if ( trainlisttest.list[code]) {
|
||||
if (code == drivingcode) {
|
||||
driverswitch = data.body[i].runMode;
|
||||
//更新车组号
|
||||
updatemmi.updatetrainnum(data.body[i].groupNumber);
|
||||
//更新列车
|
||||
let syncdata = {
|
||||
type: 'Train',
|
||||
code: code,
|
||||
sectionCode: data.body[i].sectionCode,
|
||||
percent: 0
|
||||
};
|
||||
|
||||
if (trainlisttest.list[code].isStandTrack == true && trainlisttest.list[code].progress>0.95 && trainlisttest.list[code].speed<=0) {
|
||||
if (data.body[i].directionType == '02') {
|
||||
syncdata.percent = 1-(sectionlist.sections.datalist[data.body[i].sectionCode].rstop/trainlisttest.list[code].len);
|
||||
} else {
|
||||
syncdata.percent = sectionlist.sections.datalist[data.body[i].sectionCode].lstop/trainlisttest.list[code].len;
|
||||
}
|
||||
//scope.teststomp.send('/app/topic/simulation/wgu3d', syncdata);
|
||||
if (trainlisttest.list[code].isStandTrack == true && trainlisttest.list[code].progress>0.95 && trainlisttest.list[code].speed<=0) {
|
||||
if (data.body[i].directionType == '02') {
|
||||
syncdata.percent = 1-(sectionlist.sections.datalist[data.body[i].sectionCode].rstop/trainlisttest.list[code].len);
|
||||
} else {
|
||||
if (data.body[i].directionType == '02') {
|
||||
syncdata.percent = trainlisttest.list[code].progress;
|
||||
} else {
|
||||
syncdata.percent = 1 - trainlisttest.list[code].progress;
|
||||
}
|
||||
//scope.teststomp.send('/app/topic/simulation/wgu3d', syncdata);
|
||||
syncdata.percent = sectionlist.sections.datalist[data.body[i].sectionCode].lstop/trainlisttest.list[code].len;
|
||||
}
|
||||
|
||||
if (data.body[i].parkRemainTime>0) {
|
||||
jlmap3d.updatestoptime('停站时间:'+parseInt(data.body[i].parkRemainTime));
|
||||
//scope.teststomp.send('/app/topic/simulation/wgu3d', syncdata);
|
||||
} else {
|
||||
if (data.body[i].directionType == '02') {
|
||||
syncdata.percent = trainlisttest.list[code].progress;
|
||||
} else {
|
||||
if (data.body[i].runMode == '02') {
|
||||
jlmap3d.updatestoptime('列车自动驾驶中');
|
||||
} else {
|
||||
if (trainlisttest.list[code].isStandTrack == true && trainlisttest.list[code].progress>0.95 && trainlisttest.list[code].speed<=0) {
|
||||
// if(stoptimer){
|
||||
//
|
||||
// }else{
|
||||
// stoptimer = setInterval(function(){
|
||||
// if(num >=0){
|
||||
// jlmap3d.updatestoptime("停站时间:"+num);
|
||||
// num --;
|
||||
// }
|
||||
// },1000);
|
||||
// }
|
||||
|
||||
} else {
|
||||
jlmap3d.updatestoptime('列车人工驾驶中');
|
||||
}
|
||||
|
||||
}
|
||||
syncdata.percent = 1 - trainlisttest.list[code].progress;
|
||||
}
|
||||
// if(trainlisttest.list[code].speed > 0){
|
||||
// if(stoptimer){
|
||||
// clearInterval( stoptimer );
|
||||
// stoptimer = null;
|
||||
// num = 30;
|
||||
// }
|
||||
// }
|
||||
|
||||
//scope.teststomp.send('/app/topic/simulation/wgu3d', syncdata);
|
||||
}
|
||||
trainlisttest.list[code].runMode = data.body[i].runMode;
|
||||
// 车门开关验证
|
||||
if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '01') {
|
||||
// console.log("close");
|
||||
trainlisttest.list[code].doorStatus = '01';
|
||||
for (let an=actions[code].top.length-1; an>=0; an--) {
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = actions[code].top[an]._clip.duration;
|
||||
actions[code].top[an].timeScale = -1;
|
||||
actions[code].top[an].play();
|
||||
}
|
||||
} else if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '02') {
|
||||
// console.log("open");
|
||||
trainlisttest.list[code].doorStatus = '02';
|
||||
for (let an=actions[code].top.length-1; an>=0; an--) {
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = 0;
|
||||
actions[code].top[an].timeScale = 1;
|
||||
actions[code].top[an].play();
|
||||
|
||||
if (data.body[i].parkRemainTime>0) {
|
||||
updatemmi.updatestoptime('停站时间:'+parseInt(data.body[i].parkRemainTime));
|
||||
} else {
|
||||
if (data.body[i].runMode == '02') {
|
||||
updatemmi.updatestoptime('列车自动驾驶中');
|
||||
} else {
|
||||
if (trainlisttest.list[code].isStandTrack == true && trainlisttest.list[code].progress>0.95 && trainlisttest.list[code].speed<=0) {
|
||||
// if(stoptimer){
|
||||
//
|
||||
// }else{
|
||||
// stoptimer = setInterval(function(){
|
||||
// if(num >=0){
|
||||
// updatemmi.updatestoptime("停站时间:"+num);
|
||||
// num --;
|
||||
// }
|
||||
// },1000);
|
||||
// }
|
||||
|
||||
} else {
|
||||
updatemmi.updatestoptime('列车人工驾驶中');
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (data.body[i].directionType == '02') {
|
||||
//
|
||||
// } else {
|
||||
// if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '01') {
|
||||
// // console.log("close");
|
||||
// trainlisttest.list[code].doorStatus = '01';
|
||||
// for (let an=actions[code].down.length-1; an>=0; an--) {
|
||||
// actions[code].down[an].reset();
|
||||
// actions[code].down[an].time = actions[code].top[an]._clip.duration;
|
||||
// actions[code].down[an].timeScale = -1;
|
||||
// actions[code].down[an].play();
|
||||
// }
|
||||
// } else if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '02') {
|
||||
// // console.log("open");
|
||||
// trainlisttest.list[code].doorStatus = '02';
|
||||
// for (let an=actions[code].down.length-1; an>=0; an--) {
|
||||
// actions[code].down[an].reset();
|
||||
// actions[code].down[an].time = 0;
|
||||
// actions[code].down[an].timeScale = 1;
|
||||
// actions[code].down[an].play();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// 遍历获取所在轨道
|
||||
}
|
||||
trainlisttest.list[code].runMode = data.body[i].runMode;
|
||||
|
||||
if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == false) {
|
||||
// 车门开关验证
|
||||
if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '01') {
|
||||
// console.log("close");
|
||||
trainlisttest.list[code].doorStatus = '01';
|
||||
for (let an=actions[code].top.length-1; an>=0; an--) {
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = actions[code].top[an]._clip.duration;
|
||||
actions[code].top[an].timeScale = -1;
|
||||
actions[code].top[an].play();
|
||||
}
|
||||
} else if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '02') {
|
||||
// console.log("open");
|
||||
trainlisttest.list[code].doorStatus = '02';
|
||||
for (let an=actions[code].top.length-1; an>=0; an--) {
|
||||
actions[code].top[an].reset();
|
||||
actions[code].top[an].time = 0;
|
||||
actions[code].top[an].timeScale = 1;
|
||||
actions[code].top[an].play();
|
||||
}
|
||||
}
|
||||
// if (data.body[i].directionType == '02') {
|
||||
//
|
||||
// } else {
|
||||
// if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '01') {
|
||||
// // console.log("close");
|
||||
// trainlisttest.list[code].doorStatus = '01';
|
||||
// for (let an=actions[code].down.length-1; an>=0; an--) {
|
||||
// actions[code].down[an].reset();
|
||||
// actions[code].down[an].time = actions[code].top[an]._clip.duration;
|
||||
// actions[code].down[an].timeScale = -1;
|
||||
// actions[code].down[an].play();
|
||||
// }
|
||||
// } else if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '02') {
|
||||
// // console.log("open");
|
||||
// trainlisttest.list[code].doorStatus = '02';
|
||||
// for (let an=actions[code].down.length-1; an>=0; an--) {
|
||||
// actions[code].down[an].reset();
|
||||
// actions[code].down[an].time = 0;
|
||||
// actions[code].down[an].timeScale = 1;
|
||||
// actions[code].down[an].play();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// 遍历获取所在轨道
|
||||
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].code) {
|
||||
trainlisttest.group.add(trainlisttest.list[code]);
|
||||
if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == false) {
|
||||
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].code) {
|
||||
trainlisttest.group.add(trainlisttest.list[code]);
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
trainlisttest.list[code].progress = 0;
|
||||
trainlisttest.list[code].oldoffset = data.body[i].sectionOffsetPercent;
|
||||
trainlisttest.list[code].dispose = false;
|
||||
trainlisttest.list[code].nowcode = data.body[i].sectionCode;
|
||||
trainlisttest.list[code].nextcode = data.body[i].nextSectionCode;
|
||||
let vexlist = [];
|
||||
let endrotation = null;
|
||||
|
||||
if (data.body[i].directionType == '02') { // 向右
|
||||
let offset = null;
|
||||
let rotaposx = null;
|
||||
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
offset = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x-sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x;
|
||||
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x+offset*data.body[i].sectionOffsetPercent;
|
||||
} else {
|
||||
offset = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x-sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x;
|
||||
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x+offset*data.body[i].sectionOffsetPercent;
|
||||
}
|
||||
|
||||
let rotaposz = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].z;
|
||||
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].position.x = rotaposx;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
trainlisttest.list[code].progress = 0;
|
||||
trainlisttest.list[code].oldoffset = data.body[i].sectionOffsetPercent;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = rotaposz;
|
||||
}
|
||||
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz));
|
||||
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x>rotaposx) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz));
|
||||
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x>rotaposx) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
trainlisttest.list[code].status = '02';
|
||||
|
||||
} else if (data.body[i].directionType == '03') { // 向左
|
||||
|
||||
trainlisttest.list[code].dispose = false;
|
||||
trainlisttest.group.add(trainlisttest.list[code]);
|
||||
let offset = null;
|
||||
let rotaposx = null;
|
||||
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
|
||||
offset = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x-sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x;
|
||||
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x+offset*data.body[i].sectionOffsetPercent;
|
||||
} else {
|
||||
|
||||
offset = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x-sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x;
|
||||
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x+offset*data.body[i].sectionOffsetPercent;
|
||||
}
|
||||
let rotaposz = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].z;
|
||||
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
trainlisttest.list[code].position.x = rotaposx;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = -rotaposz;
|
||||
}
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz));
|
||||
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x<rotaposx) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz));
|
||||
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x<rotaposx) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
trainlisttest.list[code].status = '03';
|
||||
}
|
||||
|
||||
trainlisttest.list[code].curve = new THREE.CatmullRomCurve3(vexlist);
|
||||
trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.body[i].sectionCode].isStandTrack;
|
||||
trainlisttest.list[code].progress = 0;
|
||||
trainlisttest.list[code].len = sectionlist.sections.datalist[data.body[i].sectionCode].distance;
|
||||
|
||||
|
||||
if(data.body[i].speed == 0){
|
||||
trainlisttest.list[code].speeds = data.body[i].speed;
|
||||
trainlisttest.list[code].speeds = 0;
|
||||
// trainlisttest.list[code].startmark = 1;
|
||||
}else{
|
||||
trainlisttest.list[code].speeds = data.body[i].speed;
|
||||
trainlisttest.list[code].speeds = parseFloat(data.body[i].speed*10/36/20/trainlisttest.list[code].len);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == true) {
|
||||
trainlisttest.group.remove(trainlisttest.list[code]);
|
||||
trainlisttest.list[code].progress = null;
|
||||
trainlisttest.list[code].dispose = true;
|
||||
code = trainlisttest.group.children[i].name;
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].doorStatus = '01';
|
||||
trainlisttest.list[code].speed = 0;
|
||||
trainlisttest.list[code].position.x = -50000;
|
||||
trainlisttest.list[code].position.y = -50000;
|
||||
|
||||
} else if (trainlisttest.list[code].dispose == data.body[i].dispose && data.body[i].dispose == false) {
|
||||
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].code) {
|
||||
if (driverswitch == '02' && code == drivingcode) {
|
||||
// updatemmi.updatenowspeed(data.body[i].speed);
|
||||
// if (data.body[i].atpSpeed) {
|
||||
// updatemmi.updateatpspeed(data.body[i].atpSpeed);
|
||||
// } else {
|
||||
// updatemmi.updateatpspeed(-1);
|
||||
// }
|
||||
// if (data.body[i].targetSpeed) {
|
||||
// updatemmi.updateatospeed(data.body[i].targetSpeed);
|
||||
// } else {
|
||||
// updatemmi.updateatospeed(-1);
|
||||
// }
|
||||
if (data.body[i].maLen) {
|
||||
updatemmi.updatenowlen(data.body[i].maLen);
|
||||
} else {
|
||||
updatemmi.updatenowlen(0);
|
||||
}
|
||||
}
|
||||
if (driverswitch == '05' && code == drivingcode) {
|
||||
if (data.body[i].maLen) {
|
||||
updatemmi.updatenowlen(data.body[i].maLen);
|
||||
} else {
|
||||
updatemmi.updatenowlen(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (trainlisttest.list[code].nowcode != data.body[i].sectionCode || trainlisttest.list[code].nextcode != data.body[i].nextSectionCode) {
|
||||
trainlisttest.list[code].nowcode = data.body[i].sectionCode;
|
||||
trainlisttest.list[code].nextcode = data.body[i].nextSectionCode;
|
||||
const vexlist = [];
|
||||
const endrotation = null;
|
||||
|
||||
let vexlist = [];
|
||||
let endrotation = null;
|
||||
if (data.body[i].directionType == '02') { // 向右
|
||||
let offset = null;
|
||||
let rotaposx = null;
|
||||
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
offset = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x-sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x;
|
||||
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x+offset*data.body[i].sectionOffsetPercent;
|
||||
} else {
|
||||
offset = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x-sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x;
|
||||
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x+offset*data.body[i].sectionOffsetPercent;
|
||||
}
|
||||
|
||||
const rotaposz = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].z;
|
||||
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].position.x = rotaposx;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = rotaposz;
|
||||
}
|
||||
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz));
|
||||
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x>rotaposx) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
//转向
|
||||
if (trainlisttest.list[code].status != data.body[i].directionType) {
|
||||
let rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||
let rotaposz = trainlisttest.list[code].children[0].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].position.x = rotaposx;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = rotaposz;
|
||||
}
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
|
||||
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x>trainlisttest.list[code].position.x) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
|
||||
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x>trainlisttest.list[code].position.x) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz));
|
||||
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x>rotaposx) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
} else {
|
||||
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
}
|
||||
trainlisttest.list[code].status = '02';
|
||||
|
||||
} else if (data.body[i].directionType == '03') { // 向左
|
||||
|
||||
trainlisttest.list[code].dispose = false;
|
||||
trainlisttest.group.add(trainlisttest.list[code]);
|
||||
let offset = null;
|
||||
let rotaposx = null;
|
||||
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
|
||||
offset = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x-sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x;
|
||||
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x+offset*data.body[i].sectionOffsetPercent;
|
||||
} else {
|
||||
|
||||
offset = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x-sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x;
|
||||
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x+offset*data.body[i].sectionOffsetPercent;
|
||||
}
|
||||
const rotaposz = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].z;
|
||||
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
trainlisttest.list[code].position.x = rotaposx;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = -rotaposz;
|
||||
}
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz));
|
||||
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x<rotaposx) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
//转向
|
||||
if (trainlisttest.list[code].status != data.body[i].directionType) {
|
||||
let rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||
let rotaposz = Math.abs(trainlisttest.list[code].children[0].matrixWorld.elements[14]);
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
trainlisttest.list[code].position.x = rotaposx;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = rotaposz;
|
||||
}
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
|
||||
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x<trainlisttest.list[code].position.x) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
|
||||
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x<trainlisttest.list[code].position.x) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz));
|
||||
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x<rotaposx) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
|
||||
} else {
|
||||
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
}
|
||||
trainlisttest.list[code].status = '03';
|
||||
}
|
||||
|
||||
trainlisttest.list[code].curve = new THREE.CatmullRomCurve3(vexlist);
|
||||
trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.body[i].sectionCode].isStandTrack;
|
||||
trainlisttest.list[code].progress = 0;
|
||||
trainlisttest.list[code].len = sectionlist.sections.datalist[data.body[i].sectionCode].distance;
|
||||
trainlisttest.list[code].progress = 0;
|
||||
trainlisttest.list[code].speed = data.body[i].speed;
|
||||
trainlisttest.list[code].speeds = parseFloat(data.body[i].speed*10/36/20/trainlisttest.list[code].len);
|
||||
|
||||
|
||||
if(data.body[i].speed == 0){
|
||||
trainlisttest.list[code].speeds = data.body[i].speed;
|
||||
trainlisttest.list[code].speeds = 0;
|
||||
// trainlisttest.list[code].startmark = 1;
|
||||
}else{
|
||||
trainlisttest.list[code].speeds = data.body[i].speed;
|
||||
trainlisttest.list[code].speeds = parseFloat(data.body[i].speed*10/36/20/trainlisttest.list[code].len);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == true) {
|
||||
trainlisttest.group.remove(trainlisttest.list[code]);
|
||||
trainlisttest.list[code].progress = null;
|
||||
trainlisttest.list[code].dispose = true;
|
||||
code = trainlisttest.group.children[i].name;
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].doorStatus = '01';
|
||||
trainlisttest.list[code].speed = 0;
|
||||
trainlisttest.list[code].position.x = -50000;
|
||||
trainlisttest.list[code].position.y = -50000;
|
||||
|
||||
} else if (trainlisttest.list[code].dispose == data.body[i].dispose && data.body[i].dispose == false) {
|
||||
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].code) {
|
||||
if (driverswitch == '02' && code == drivingcode) {
|
||||
jlmap3d.updatenowspeed(data.body[i].speed);
|
||||
if (data.body[i].atpSpeed) {
|
||||
jlmap3d.updateatpspeed(data.body[i].atpSpeed);
|
||||
} else {
|
||||
jlmap3d.updateatpspeed(-1);
|
||||
}
|
||||
if (data.body[i].targetSpeed) {
|
||||
jlmap3d.updateatospeed(data.body[i].targetSpeed);
|
||||
} else {
|
||||
jlmap3d.updateatospeed(-1);
|
||||
}
|
||||
if (data.body[i].maLen) {
|
||||
jlmap3d.updatenowlen(data.body[i].maLen);
|
||||
} else {
|
||||
jlmap3d.updatenowlen(0);
|
||||
}
|
||||
// if(trainlisttest.list[code].isStandTrack == true){
|
||||
// pointstand = null;
|
||||
// if(data.body[i].directionType == "02"){
|
||||
// pointstand = trainlisttest.list[code].curve.getPointAt(data.body[i].sectionOffsetPercent);
|
||||
// }else{
|
||||
// pointstand = trainlisttest.list[code].curve.getPointAt(1-data.body[i].sectionOffsetPercent);
|
||||
// }
|
||||
// console.log(data.body[i].sectionOffsetPercent)
|
||||
// console.log(pointstand.x);
|
||||
//
|
||||
// trainlisttest.list[code].position.x = pointstand.x;
|
||||
// }
|
||||
}
|
||||
if (driverswitch == '05' && code == drivingcode) {
|
||||
if (data.body[i].maLen) {
|
||||
jlmap3d.updatenowlen(data.body[i].maLen);
|
||||
} else {
|
||||
jlmap3d.updatenowlen(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (trainlisttest.list[code].nowcode != data.body[i].sectionCode || trainlisttest.list[code].nextcode != data.body[i].nextSectionCode) {
|
||||
trainlisttest.list[code].nowcode = data.body[i].sectionCode;
|
||||
trainlisttest.list[code].nextcode = data.body[i].nextSectionCode;
|
||||
const vexlist = [];
|
||||
const endrotation = null;
|
||||
if (data.body[i].directionType == '02') { // 向右
|
||||
if (trainlisttest.list[code].status != data.body[i].directionType) {
|
||||
const rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||
const rotaposz = trainlisttest.list[code].children[0].matrixWorld.elements[14];
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].position.x = rotaposx;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = rotaposz;
|
||||
}
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
|
||||
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x>trainlisttest.list[code].position.x) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
|
||||
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x>trainlisttest.list[code].position.x) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
} else {
|
||||
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
}
|
||||
trainlisttest.list[code].status = '02';
|
||||
} else if (data.body[i].directionType == '03') { // 向左
|
||||
if (trainlisttest.list[code].status != data.body[i].directionType) {
|
||||
const rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||
const rotaposz = Math.abs(trainlisttest.list[code].children[0].matrixWorld.elements[14]);
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
trainlisttest.list[code].position.x = rotaposx;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = rotaposz;
|
||||
}
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
|
||||
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x<trainlisttest.list[code].position.x) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
vexlist.push(new THREE.Vector3(trainlisttest.list[code].position.x, 0, trainlisttest.list[code].children[0].matrixWorld.elements[14]));
|
||||
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[m].x<trainlisttest.list[code].position.x) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
|
||||
} else {
|
||||
for (let m=0; m<sectionlist.sections.datalist[data.body[i].sectionCode].rail.length; m++) {
|
||||
vexlist.push(sectionlist.sections.datalist[data.body[i].sectionCode].rail[m]);
|
||||
}
|
||||
}
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
}
|
||||
trainlisttest.list[code].status = '03';
|
||||
}
|
||||
trainlisttest.list[code].curve = new THREE.CatmullRomCurve3(vexlist);
|
||||
trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.body[i].sectionCode].isStandTrack;
|
||||
trainlisttest.list[code].len = sectionlist.sections.datalist[data.body[i].sectionCode].distance;
|
||||
trainlisttest.list[code].progress = 0;
|
||||
trainlisttest.list[code].speed = data.body[i].speed;
|
||||
trainlisttest.list[code].speeds = parseFloat(data.body[i].speed*10/36/20/trainlisttest.list[code].len);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (data.type == 'Simulation_DeviceStatus') {
|
||||
for (let i=data.body.length-1; i>=0; i--) {
|
||||
// 0xFFFFFF
|
||||
// 0xCD0000 红
|
||||
// 0xEEEE00 黄
|
||||
// 0x32CD32 绿
|
||||
if (data.body[i]._type == 'Signal') {
|
||||
if (signallist) {
|
||||
signalupdate(data.body[i]);
|
||||
}
|
||||
function devicestatus(data){
|
||||
for (let i=data.body.length-1; i>=0; i--) {
|
||||
// 0xFFFFFF
|
||||
// 0xCD0000 红
|
||||
// 0xEEEE00 黄
|
||||
// 0x32CD32 绿
|
||||
if (data.body[i]._type == 'Signal') {
|
||||
if (signallist) {
|
||||
signalupdate(data.body[i]);
|
||||
}
|
||||
|
||||
if (data.body[i]._type == 'StationStand') {
|
||||
if (actions) {
|
||||
standupdate(data.body[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (data.body[i]._type == 'Switch') {
|
||||
if (sectionlist) {
|
||||
switchupdate(data.body[i]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (data.body[i]._type == 'StationStand') {
|
||||
if (actions) {
|
||||
standupdate(data.body[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (data.body[i]._type == 'Switch') {
|
||||
if (sectionlist) {
|
||||
switchupdate(data.body[i]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -263,8 +263,8 @@ export function Jlmap3dSubscribe(jlmap3d) {
|
||||
trainlisttest.list[code].dispose = false;
|
||||
trainlisttest.list[code].nowcode = data.body[i].sectionCode;
|
||||
trainlisttest.list[code].nextcode = data.body[i].nextSectionCode;
|
||||
const vexlist = [];
|
||||
const endrotation = null;
|
||||
let vexlist = [];
|
||||
let endrotation = null;
|
||||
|
||||
if (data.body[i].directionType == '02') { // 向右
|
||||
let offset = null;
|
||||
@ -278,13 +278,15 @@ export function Jlmap3dSubscribe(jlmap3d) {
|
||||
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x+offset*data.body[i].sectionOffsetPercent;
|
||||
}
|
||||
|
||||
const rotaposz = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].z;
|
||||
let rotaposz = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].z;
|
||||
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
trainlisttest.list[code].position.x = rotaposx;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = rotaposz;
|
||||
}
|
||||
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x>sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz));
|
||||
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
|
||||
@ -319,16 +321,15 @@ export function Jlmap3dSubscribe(jlmap3d) {
|
||||
offset = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x-sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x;
|
||||
rotaposx = sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x+offset*data.body[i].sectionOffsetPercent;
|
||||
}
|
||||
const rotaposz = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].z;
|
||||
let rotaposz = sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].z;
|
||||
|
||||
trainlisttest.list[code].rotation.y = Math.PI;
|
||||
trainlisttest.list[code].position.x = rotaposx;
|
||||
trainlisttest.list[code].position.y = 0;
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = rotaposz;
|
||||
}
|
||||
if (data.body[i].groupNumber == '001') {
|
||||
}
|
||||
|
||||
for (let tl=0; tl<6; tl++) {
|
||||
trainlisttest.list[code].children[tl].position.z = -rotaposz;
|
||||
}
|
||||
if (sectionlist.sections.datalist[data.body[i].sectionCode].rail[0].x<sectionlist.sections.datalist[data.body[i].sectionCode].rail[1].x) {
|
||||
vexlist.push(new THREE.Vector3(rotaposx, 0, rotaposz));
|
||||
for (let m=sectionlist.sections.datalist[data.body[i].sectionCode].rail.length-1; m>=0; m--) {
|
||||
@ -344,17 +345,25 @@ export function Jlmap3dSubscribe(jlmap3d) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
trainlisttest.list[code].status = '03';
|
||||
}
|
||||
|
||||
trainlisttest.list[code].curve = new THREE.CatmullRomCurve3(vexlist);
|
||||
trainlisttest.list[code].isStandTrack = sectionlist.sections.datalist[data.body[i].sectionCode].isStandTrack;
|
||||
trainlisttest.list[code].progress = 0;
|
||||
trainlisttest.list[code].len = sectionlist.sections.datalist[data.body[i].sectionCode].distance;
|
||||
trainlisttest.list[code].speed = data.body[i].speed;
|
||||
trainlisttest.list[code].speeds = parseFloat(data.body[i].speed*10/36/20/trainlisttest.list[code].len);
|
||||
}
|
||||
|
||||
|
||||
if(data.body[i].speed == 0){
|
||||
trainlisttest.list[code].speeds = data.body[i].speed;
|
||||
trainlisttest.list[code].speeds = 0;
|
||||
// trainlisttest.list[code].startmark = 1;
|
||||
}else{
|
||||
trainlisttest.list[code].speeds = data.body[i].speed;
|
||||
trainlisttest.list[code].speeds = parseFloat(data.body[i].speed*10/36/20/trainlisttest.list[code].len);
|
||||
}
|
||||
|
||||
}
|
||||
} else if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == true) {
|
||||
trainlisttest.group.remove(trainlisttest.list[code]);
|
||||
trainlisttest.list[code].progress = null;
|
||||
|
@ -10,7 +10,7 @@ import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
|
||||
import { Loading } from 'element-ui';
|
||||
// import {SwitchModel} from '@/jlmap3d/model/SwitchModel.js';
|
||||
|
||||
export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene){
|
||||
export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixerss){
|
||||
//console.log(mapdata);
|
||||
Materialload(scope);
|
||||
//console.log(data);
|
||||
@ -20,7 +20,7 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene){
|
||||
let assetloader = scope.assetloader;
|
||||
let animateswitch = scope.animateswitch;
|
||||
|
||||
let mixers = scope.mixers;
|
||||
let mixers = mixerss;
|
||||
let actions = scope.actions;
|
||||
|
||||
let loadingInstance = Loading.service({ fullscreen: true });
|
||||
|
@ -340,33 +340,33 @@ stationcanvas.src = "../../static/texture/msgt.png";
|
||||
function getTextCanvas(text){
|
||||
let canvas = document.getElementById('canvastexture');
|
||||
|
||||
canvas.width = 300;
|
||||
canvas.height = 374;
|
||||
canvas.width = 256;
|
||||
canvas.height = 512;
|
||||
// canvas.style.width = width;
|
||||
// canvas.style.height = height;
|
||||
|
||||
let ctx = canvas.getContext('2d');
|
||||
//ctx.fillStyle = '#FFFFFF';
|
||||
ctx.fillRect(0, 0,300,374);
|
||||
ctx.fillRect(0, 0,256,512);
|
||||
|
||||
ctx.fillStyle = '#FFFFFF';
|
||||
// ctx.textAlign = 'center';
|
||||
// ctx.textBaseline = 'middle';
|
||||
ctx.clearRect(0,0,300,374);
|
||||
ctx.clearRect(0,0,256,512);
|
||||
|
||||
ctx.drawImage(stationcanvas,0,0,300,374);
|
||||
ctx.drawImage(stationcanvas,0,0,256,512);
|
||||
|
||||
ctx.font = "20px Verdana";
|
||||
ctx.fillText("车站名称: "+text.runPlanName, 40,58);
|
||||
ctx.fillText("车站名称: "+text.runPlanName, 20,58);
|
||||
|
||||
ctx.fillText("漫游", 40,110);
|
||||
ctx.fillText("信息", 124,110);
|
||||
ctx.fillText("备忘", 210,110);
|
||||
ctx.fillText("漫游", 30,100);
|
||||
ctx.fillText("信息", 114,100);
|
||||
ctx.fillText("备忘", 190,100);
|
||||
|
||||
ctx.fillText("车站序号: "+text.name, 40,155);
|
||||
|
||||
ctx.fillText("公里标记:"+text.kmPost,40 ,256*3/4);
|
||||
|
||||
let data = ctx.getImageData(0, 0,300,374);
|
||||
let data = ctx.getImageData(0, 0,256,512);
|
||||
return data;
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
<div class="display-draft">
|
||||
<el-button-group>
|
||||
<!-- <el-button type="primary" @click="raystand">站台选择</el-button> -->
|
||||
<el-button type="primary" @click="cctvplane">{{ cctvbuttonmsg }}</el-button>
|
||||
<el-button type="primary" @click="showplane">{{ showbuttonmsg }}</el-button>
|
||||
<el-button type="primary" @click="back">返回</el-button>
|
||||
</el-button-group>
|
||||
@ -19,7 +20,7 @@
|
||||
<div id="jlsimulation" class="jlmap3ddraw">
|
||||
<canvas id="canvastexture" />
|
||||
</div>
|
||||
<div id="jlcctv" class="jlmap3cctv">
|
||||
<div id="jlcctv" v-show="cctvshow" class="jlmap3cctv">
|
||||
</div>
|
||||
|
||||
<Drive-Mmi v-if="mmishow" ref="mmiui" />
|
||||
@ -70,6 +71,8 @@ export default {
|
||||
mapdata: null,
|
||||
jlmap3d: null,
|
||||
selectmodel: null,
|
||||
cctvshow:true,
|
||||
cctvbuttonmsg: '车内监控——隐藏',
|
||||
mmishow: false,
|
||||
showbuttonmsg: '列车仪表——显示',
|
||||
trainnum: '',
|
||||
@ -171,6 +174,7 @@ export default {
|
||||
const dom = document.getElementById('app');
|
||||
this.jlmap3d = new JLmapDriving(dom, mapdata, skinCode);
|
||||
this.jlmap3d.eventon();
|
||||
this.cctvshow = false;
|
||||
|
||||
},
|
||||
raystand() {
|
||||
@ -213,6 +217,18 @@ export default {
|
||||
this.mmishow = true;
|
||||
}
|
||||
|
||||
},
|
||||
cctvplane() {
|
||||
if (this.cctvshow == true) {
|
||||
this.cctvbuttonmsg = '车内监控——隐藏';
|
||||
this.cctvshow = false;
|
||||
this.jlmap3d.cctvoff();
|
||||
} else {
|
||||
this.cctvbuttonmsg = '车内监控——显示';
|
||||
this.cctvshow = true;
|
||||
this.jlmap3d.cctvon();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -283,7 +299,7 @@ export default {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top:0;
|
||||
z-index: 3000;
|
||||
z-index: 1500;
|
||||
}
|
||||
|
||||
.jlmap3ddraw {
|
||||
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
BIN
static/skybox/star/nx.png
Normal file
After Width: | Height: | Size: 338 KiB |
BIN
static/skybox/star/ny.png
Normal file
After Width: | Height: | Size: 445 KiB |
BIN
static/skybox/star/nz.png
Normal file
After Width: | Height: | Size: 350 KiB |
BIN
static/skybox/star/px.png
Normal file
After Width: | Height: | Size: 400 KiB |
BIN
static/skybox/star/py.png
Normal file
After Width: | Height: | Size: 438 KiB |
BIN
static/skybox/star/pz.png
Normal file
After Width: | Height: | Size: 338 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 14 KiB |
BIN
static/texture/msgfo.png
Normal file
After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 16 KiB |
BIN
static/texture/msgto.png
Normal file
After Width: | Height: | Size: 11 KiB |