|
|
|
@ -1,12 +1,12 @@
|
|
|
|
|
import StompClient from '@/utils/sock';
|
|
|
|
|
|
|
|
|
|
import store from '@/store/index_APP_TARGET';
|
|
|
|
|
// import { getTrainingCbtcDemon, runDiagramStart, runDiagramOver, setTrainingCbtcInitTime } from '@/api/simulation';
|
|
|
|
|
// import { creatSubscribe, clearSubscribe, displayTopic, screenTopic } from '@/utils/stomp';
|
|
|
|
|
import { getBaseUrl } from '@/utils/baseUrl'
|
|
|
|
|
import { getBaseUrl } from '@/utils/baseUrl';
|
|
|
|
|
import { getToken } from '@/utils/auth';
|
|
|
|
|
|
|
|
|
|
// 定于仿真socket接口
|
|
|
|
|
export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|
|
|
|
export function Jlmap3dSubscribeNew(jlmap3d, routegroup, jsonwebwork) {
|
|
|
|
|
|
|
|
|
|
const scope = this;
|
|
|
|
|
this.map = null;
|
|
|
|
@ -29,44 +29,43 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|
|
|
|
var drivingspeed = null;
|
|
|
|
|
var drivingaptspeed = null;
|
|
|
|
|
|
|
|
|
|
let driverswitch = false;
|
|
|
|
|
const driverswitch = false;
|
|
|
|
|
|
|
|
|
|
let stoptimer = null;
|
|
|
|
|
let num = 30;
|
|
|
|
|
let pointstand = null;
|
|
|
|
|
const stoptimer = null;
|
|
|
|
|
const num = 30;
|
|
|
|
|
const pointstand = null;
|
|
|
|
|
|
|
|
|
|
let data = null;
|
|
|
|
|
const data = null;
|
|
|
|
|
// run as plane = 01;
|
|
|
|
|
// reset = 02;
|
|
|
|
|
|
|
|
|
|
var datatype = '00';
|
|
|
|
|
this.teststomp = new StompClient();
|
|
|
|
|
this.topic = '/user/queue/simulation/jl3d/'+routegroup;
|
|
|
|
|
let header = {'X-Token': getToken() };
|
|
|
|
|
let connectmsg = {
|
|
|
|
|
this.topic = '/user/queue/simulation/jl3d/' + routegroup;
|
|
|
|
|
const header = {'X-Token': getToken() };
|
|
|
|
|
const connectmsg = {
|
|
|
|
|
type:'init',
|
|
|
|
|
baseurl:getBaseUrl(),
|
|
|
|
|
topic:this.topic,
|
|
|
|
|
token:getToken(),
|
|
|
|
|
token:getToken()
|
|
|
|
|
};
|
|
|
|
|
jsonwebwork.postMessage(connectmsg);
|
|
|
|
|
jsonwebwork.onmessage = function (event) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// console.log(event.data);
|
|
|
|
|
// if(event.data.deviceType == "TRAIN"){
|
|
|
|
|
// // console.log(event.data);
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// console.log(event.data);
|
|
|
|
|
if(event.data.type == "Device_Load_Destroy_3D"){
|
|
|
|
|
if (event.data.type == 'Device_Load_Destroy_3D') {
|
|
|
|
|
DeviceDestroy(event.data);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(event.data.type == 'TrainRun_3D'){
|
|
|
|
|
if (event.data.type == 'TrainRun_3D') {
|
|
|
|
|
|
|
|
|
|
for(let i=0,leni=event.data.body.length;i<leni;i++){
|
|
|
|
|
for (let i = 0, leni = event.data.body.length; i < leni; i++) {
|
|
|
|
|
// console.log(event.data.body[i]);
|
|
|
|
|
trainrunnew(event.data.body[i]);
|
|
|
|
|
}
|
|
|
|
@ -77,17 +76,17 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|
|
|
|
// console.log(event.data);
|
|
|
|
|
// trainrun(event.data);
|
|
|
|
|
// }
|
|
|
|
|
if (event.data.type== 'SIGNAL' && signallist) {
|
|
|
|
|
if (event.data.type == 'SIGNAL' && signallist) {
|
|
|
|
|
signalupdate(event.data);
|
|
|
|
|
// console.log(event.data);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (event.data.type== "PSD" && actions) {
|
|
|
|
|
if (event.data.type == 'PSD' && actions) {
|
|
|
|
|
standupdate(event.data);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (event.data.type == "SWITCH") {
|
|
|
|
|
if (event.data.type == 'SWITCH') {
|
|
|
|
|
switchupdate(event.data);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -96,17 +95,21 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(event.data.type == 'Simulation_Reset'){
|
|
|
|
|
if (event.data.type == 'Simulation_Reset') {
|
|
|
|
|
simulationreset(event.data);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(event.data.type == 'Simulation_DeviceStatus'){
|
|
|
|
|
if (event.data.type == 'Simulation_DeviceStatus') {
|
|
|
|
|
initall(event.data.body);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (event.data.type == 'Simulation_Over') {
|
|
|
|
|
store.dispatch('socket/setStomp', event.data);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.updatamap = function(newsectionlist,newlinklist,newsignallist,newstationstandlist,newtrainlisttest,newrealsectionlist,newrails, materiallist, nowaction, scene) {
|
|
|
|
|
this.updatamap = function(newsectionlist, newlinklist, newsignallist, newstationstandlist, newtrainlisttest, newrealsectionlist, newrails, materiallist, nowaction, scene) {
|
|
|
|
|
trainlisttest = newtrainlisttest;
|
|
|
|
|
sectionlist = newsectionlist;
|
|
|
|
|
signallist = newsignallist;
|
|
|
|
@ -130,7 +133,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|
|
|
|
|
|
|
|
|
this.socketoff = function(topic) {
|
|
|
|
|
scope.teststomp.unsubscribe(topic);
|
|
|
|
|
for (let i=0; i<trainlisttest.group.children.length; i++) {
|
|
|
|
|
for (let i = 0; i < trainlisttest.group.children.length; i++) {
|
|
|
|
|
if (trainlisttest.group.children[i].dispose == false) {
|
|
|
|
|
code = trainlisttest.group.children[i].name;
|
|
|
|
|
trainlisttest.list[code].rotation.y = 0;
|
|
|
|
@ -146,24 +149,24 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function trainrunnew(data){
|
|
|
|
|
let code = data.code;
|
|
|
|
|
function trainrunnew(data) {
|
|
|
|
|
const code = data.code;
|
|
|
|
|
|
|
|
|
|
if(trainlisttest.list[code].right != data.right){
|
|
|
|
|
if(data.right == "0"){
|
|
|
|
|
trainlisttest.list[code].right = "0";
|
|
|
|
|
if (trainlisttest.list[code].right != data.right) {
|
|
|
|
|
if (data.right == '0') {
|
|
|
|
|
trainlisttest.list[code].right = '0';
|
|
|
|
|
trainlisttest.list[code].rotation.y = Math.PI;
|
|
|
|
|
let point = rails.sectionrail[data.section].lineleft.getPointAt(data.offset);
|
|
|
|
|
const point = rails.sectionrail[data.section].lineleft.getPointAt(data.offset);
|
|
|
|
|
trainlisttest.list[code].position.x = point.x;
|
|
|
|
|
for (let tl=0; tl<6; tl++) {
|
|
|
|
|
for (let tl = 0; tl < 6; tl++) {
|
|
|
|
|
trainlisttest.list[code].children[tl].position.z = point.z;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
trainlisttest.list[code].right = "1";
|
|
|
|
|
} else {
|
|
|
|
|
trainlisttest.list[code].right = '1';
|
|
|
|
|
trainlisttest.list[code].rotation.y = 0;
|
|
|
|
|
let point = rails.sectionrail[data.section].lineleft.getPointAt(data.offset);
|
|
|
|
|
const point = rails.sectionrail[data.section].lineleft.getPointAt(data.offset);
|
|
|
|
|
trainlisttest.list[code].position.x = point.x;
|
|
|
|
|
for (let tl=0; tl<6; tl++) {
|
|
|
|
|
for (let tl = 0; tl < 6; tl++) {
|
|
|
|
|
trainlisttest.list[code].children[tl].position.z = point.z;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -171,7 +174,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|
|
|
|
|
|
|
|
|
// console.log(data);
|
|
|
|
|
|
|
|
|
|
if(trainlisttest.list[code].dispose == "0"){
|
|
|
|
|
if (trainlisttest.list[code].dispose == '0') {
|
|
|
|
|
if (data.right == '1') { // 向右
|
|
|
|
|
trainlisttest.list[code].right = '1';
|
|
|
|
|
trainlisttest.list[code].progress = data.offset;
|
|
|
|
@ -179,7 +182,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|
|
|
|
// if(rails.sectionrail[data.section].standTrack){
|
|
|
|
|
// trainlisttest.list[code].statsstop = 0;
|
|
|
|
|
// }
|
|
|
|
|
let point = rails.sectionrail[data.section].lineleft.getPointAt(trainlisttest.list[code].progress);
|
|
|
|
|
const point = rails.sectionrail[data.section].lineleft.getPointAt(trainlisttest.list[code].progress);
|
|
|
|
|
trainlisttest.list[code].rotation.y = 0;
|
|
|
|
|
trainlisttest.list[code].position.x = point.x;
|
|
|
|
|
trainlisttest.list[code].position.y = 0;
|
|
|
|
@ -198,68 +201,65 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|
|
|
|
// trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
|
|
|
|
|
trainlisttest.list[code].status = '1';
|
|
|
|
|
|
|
|
|
|
if(trainlisttest.list[code].children[0].position.z != point.z){
|
|
|
|
|
trainlisttest.list[code].children[0].up = new THREE.Vector3(1,0,0);
|
|
|
|
|
let tangent = rails.sectionrail[data.section].lineleft.getTangentAt(data.offset).normalize();
|
|
|
|
|
if (trainlisttest.list[code].children[0].position.z != point.z) {
|
|
|
|
|
trainlisttest.list[code].children[0].up = new THREE.Vector3(1, 0, 0);
|
|
|
|
|
const tangent = rails.sectionrail[data.section].lineleft.getTangentAt(data.offset).normalize();
|
|
|
|
|
trainlisttest.list[code].children[0].axis.crossVectors(trainlisttest.list[code].children[0].up, tangent).normalize();
|
|
|
|
|
let radians = Math.acos(trainlisttest.list[code].children[0].up.dot(tangent));
|
|
|
|
|
const radians = Math.acos(trainlisttest.list[code].children[0].up.dot(tangent));
|
|
|
|
|
trainlisttest.list[code].children[0].quaternion.setFromAxisAngle(trainlisttest.list[code].children[0].axis, radians);
|
|
|
|
|
trainlisttest.list[code].children[0].rotation.x = -Math.PI/2;
|
|
|
|
|
trainlisttest.list[code].children[0].rotation.x = -Math.PI / 2;
|
|
|
|
|
trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y;
|
|
|
|
|
trainlisttest.list[code].children[0].rotation.y = 0;
|
|
|
|
|
let rotas = {
|
|
|
|
|
const rotas = {
|
|
|
|
|
posr:point,
|
|
|
|
|
rota:trainlisttest.list[code].children[0].rotation.z
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
trainlisttest.list[code].children[1].rotalist.push(rotas);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let offsetz = parseFloat(point.z) - parseFloat(trainlisttest.list[code].children[0].position.z);
|
|
|
|
|
const offsetz = parseFloat(point.z) - parseFloat(trainlisttest.list[code].children[0].position.z);
|
|
|
|
|
trainlisttest.list[code].children[0].position.z += offsetz;
|
|
|
|
|
}
|
|
|
|
|
if(trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){
|
|
|
|
|
for(let rs = 1;rs<6;rs++){
|
|
|
|
|
//console.log(rs);
|
|
|
|
|
if(trainlisttest.list[code].children[rs].rotalist[0]){
|
|
|
|
|
let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[14]);
|
|
|
|
|
if (trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0 || trainlisttest.list[code].children[5].rotalist.length > 0) {
|
|
|
|
|
for (let rs = 1; rs < 6; rs++) {
|
|
|
|
|
// console.log(rs);
|
|
|
|
|
if (trainlisttest.list[code].children[rs].rotalist[0]) {
|
|
|
|
|
const offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) - parseFloat(trainlisttest.list[code].children[rs].matrixWorld.elements[14]);
|
|
|
|
|
|
|
|
|
|
trainlisttest.list[code].children[rs].position.z += offsetz;
|
|
|
|
|
|
|
|
|
|
for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){
|
|
|
|
|
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])>=trainlisttest.list[code].children[rs].rotalist[0].posr.x){
|
|
|
|
|
for (let xh = 0; xh < trainlisttest.list[code].children[rs].rotalist.length; xh++) {
|
|
|
|
|
if ((trainlisttest.list[code].children[rs].matrixWorld.elements[12]) >= trainlisttest.list[code].children[rs].rotalist[0].posr.x) {
|
|
|
|
|
// if(trainlisttest.list[code].groupNumber == "005"){
|
|
|
|
|
// console.log("rs:"+rs);
|
|
|
|
|
// console.log(trainlisttest.list[code].children[rs].matrixWorld.elements[12]);
|
|
|
|
|
// console.log(trainlisttest.list[code].children[rs].rotalist[0].posr.x);
|
|
|
|
|
// }
|
|
|
|
|
if(rs != 5){
|
|
|
|
|
let asd = trainlisttest.list[code].children[rs].rotalist[0];
|
|
|
|
|
trainlisttest.list[code].children[rs+1].rotalist.push(asd);
|
|
|
|
|
if (rs != 5) {
|
|
|
|
|
const asd = trainlisttest.list[code].children[rs].rotalist[0];
|
|
|
|
|
trainlisttest.list[code].children[rs + 1].rotalist.push(asd);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rota;
|
|
|
|
|
trainlisttest.list[code].children[rs].rotalist.splice(0,1)
|
|
|
|
|
trainlisttest.list[code].children[rs].rotalist.splice(0, 1);
|
|
|
|
|
xh--;
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
xh = trainlisttest.list[code].children[rs].rotalist.length;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//console.log(trainlisttest.list[code].children[rs].rotalist.length);
|
|
|
|
|
// console.log(trainlisttest.list[code].children[rs].rotalist.length);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (data.right == '0') { // 向左
|
|
|
|
|
trainlisttest.list[code].right = '0';
|
|
|
|
|
trainlisttest.list[code].progress = 1-data.offset;
|
|
|
|
|
trainlisttest.list[code].progress = 1 - data.offset;
|
|
|
|
|
// trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack;
|
|
|
|
|
// if(rails.sectionrail[data.section].standTrack){
|
|
|
|
|
// trainlisttest.list[code].statsstop = 0;
|
|
|
|
|
// }
|
|
|
|
|
let point = rails.sectionrail[data.section].lineright.getPointAt(trainlisttest.list[code].progress);
|
|
|
|
|
const point = rails.sectionrail[data.section].lineright.getPointAt(trainlisttest.list[code].progress);
|
|
|
|
|
|
|
|
|
|
trainlisttest.list[code].rotation.y = Math.PI;
|
|
|
|
|
trainlisttest.list[code].position.x = point.x;
|
|
|
|
@ -277,59 +277,57 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|
|
|
|
// }
|
|
|
|
|
// trainlisttest.list[code].len = rails.sectionrail[data.section].lengthfact;
|
|
|
|
|
trainlisttest.list[code].status = '0';
|
|
|
|
|
if(-trainlisttest.list[code].children[0].position.z != point.z){
|
|
|
|
|
if (-trainlisttest.list[code].children[0].position.z != point.z) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trainlisttest.list[code].children[0].up = new THREE.Vector3(-1,0,0);
|
|
|
|
|
let tangent = rails.sectionrail[data.section].lineright.getTangentAt(data.offset).normalize();
|
|
|
|
|
trainlisttest.list[code].children[0].up = new THREE.Vector3(-1, 0, 0);
|
|
|
|
|
const tangent = rails.sectionrail[data.section].lineright.getTangentAt(data.offset).normalize();
|
|
|
|
|
trainlisttest.list[code].children[0].axis.crossVectors(trainlisttest.list[code].children[0].up, tangent).normalize();
|
|
|
|
|
let radians = Math.acos(trainlisttest.list[code].children[0].up.dot(tangent));
|
|
|
|
|
const radians = Math.acos(trainlisttest.list[code].children[0].up.dot(tangent));
|
|
|
|
|
trainlisttest.list[code].children[0].quaternion.setFromAxisAngle(trainlisttest.list[code].children[0].axis, radians);
|
|
|
|
|
trainlisttest.list[code].children[0].rotation.x = -Math.PI/2;
|
|
|
|
|
trainlisttest.list[code].children[0].rotation.x = -Math.PI / 2;
|
|
|
|
|
trainlisttest.list[code].children[0].rotation.z = trainlisttest.list[code].children[0].rotation.y;
|
|
|
|
|
trainlisttest.list[code].children[0].rotation.y = 0;
|
|
|
|
|
|
|
|
|
|
let rotas = {
|
|
|
|
|
const rotas = {
|
|
|
|
|
posr:point,
|
|
|
|
|
rota:trainlisttest.list[code].children[0].rotation.z
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
trainlisttest.list[code].children[1].rotalist.push(rotas);
|
|
|
|
|
let offsetz = point.z + trainlisttest.list[code].children[0].position.z;
|
|
|
|
|
const offsetz = point.z + trainlisttest.list[code].children[0].position.z;
|
|
|
|
|
trainlisttest.list[code].children[0].position.z -= offsetz;
|
|
|
|
|
// trainlisttest.list[code].position.z = point.z;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if(trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0|| trainlisttest.list[code].children[5].rotalist.length > 0){
|
|
|
|
|
if (trainlisttest.list[code].children[1].rotalist.length > 0 || trainlisttest.list[code].children[2].rotalist.length > 0 || trainlisttest.list[code].children[3].rotalist.length > 0 || trainlisttest.list[code].children[4].rotalist.length > 0 || trainlisttest.list[code].children[5].rotalist.length > 0) {
|
|
|
|
|
|
|
|
|
|
for(let rs = 1;rs<6;rs++){
|
|
|
|
|
//console.log(rs);
|
|
|
|
|
if(trainlisttest.list[code].children[rs].rotalist[0]){
|
|
|
|
|
for (let rs = 1; rs < 6; rs++) {
|
|
|
|
|
// console.log(rs);
|
|
|
|
|
if (trainlisttest.list[code].children[rs].rotalist[0]) {
|
|
|
|
|
|
|
|
|
|
let offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) + parseFloat(trainlisttest.list[code].children[rs].position.z);
|
|
|
|
|
const offsetz = parseFloat(trainlisttest.list[code].children[rs].rotalist[0].posr.z) + parseFloat(trainlisttest.list[code].children[rs].position.z);
|
|
|
|
|
trainlisttest.list[code].children[rs].position.z -= offsetz;
|
|
|
|
|
|
|
|
|
|
for(let xh=0;xh<trainlisttest.list[code].children[rs].rotalist.length;xh++){
|
|
|
|
|
if((trainlisttest.list[code].children[rs].matrixWorld.elements[12])<=trainlisttest.list[code].children[rs].rotalist[0].posr.x){
|
|
|
|
|
for (let xh = 0; xh < trainlisttest.list[code].children[rs].rotalist.length; xh++) {
|
|
|
|
|
if ((trainlisttest.list[code].children[rs].matrixWorld.elements[12]) <= trainlisttest.list[code].children[rs].rotalist[0].posr.x) {
|
|
|
|
|
|
|
|
|
|
if(rs != 5){
|
|
|
|
|
let asd = trainlisttest.list[code].children[rs].rotalist[0];
|
|
|
|
|
trainlisttest.list[code].children[rs+1].rotalist.push(asd);
|
|
|
|
|
if (rs != 5) {
|
|
|
|
|
const asd = trainlisttest.list[code].children[rs].rotalist[0];
|
|
|
|
|
trainlisttest.list[code].children[rs + 1].rotalist.push(asd);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//let offsetx = trainlisttest.list[code].children[1].matrixWorld.elements[12]-trainlisttest.list[code].children[0].children[3].matrixWorld.elements[12];
|
|
|
|
|
// let offsetx = trainlisttest.list[code].children[1].matrixWorld.elements[12]-trainlisttest.list[code].children[0].children[3].matrixWorld.elements[12];
|
|
|
|
|
|
|
|
|
|
trainlisttest.list[code].children[rs].rotation.z = trainlisttest.list[code].children[rs].rotalist[0].rota;
|
|
|
|
|
trainlisttest.list[code].children[rs].rotalist.splice(0,1)
|
|
|
|
|
trainlisttest.list[code].children[rs].rotalist.splice(0, 1);
|
|
|
|
|
xh--;
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
xh = trainlisttest.list[code].children[rs].rotalist.length;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//console.log(trainlisttest.list[code].children[rs].rotalist.length);
|
|
|
|
|
// console.log(trainlisttest.list[code].children[rs].rotalist.length);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// console.log(trainlisttest.list[code].rotalist);
|
|
|
|
|
}
|
|
|
|
@ -338,29 +336,29 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function trainrun(data){
|
|
|
|
|
let code = data.code;
|
|
|
|
|
function trainrun(data) {
|
|
|
|
|
const code = data.code;
|
|
|
|
|
// console.log(data);
|
|
|
|
|
if(trainlisttest.list[code].dispose == "0"){
|
|
|
|
|
if(trainlisttest.list[code].curve == null){
|
|
|
|
|
if (trainlisttest.list[code].dispose == '0') {
|
|
|
|
|
if (trainlisttest.list[code].curve == null) {
|
|
|
|
|
if (data.right == '1') { // 向右
|
|
|
|
|
trainlisttest.list[code].right = '1';
|
|
|
|
|
trainlisttest.list[code].progress = data.offset;
|
|
|
|
|
trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack;
|
|
|
|
|
if(rails.sectionrail[data.section].standTrack){
|
|
|
|
|
if (rails.sectionrail[data.section].standTrack) {
|
|
|
|
|
trainlisttest.list[code].statsstop = 0;
|
|
|
|
|
}
|
|
|
|
|
let point = rails.sectionrail[data.section].lineleft.getPointAt(trainlisttest.list[code].progress);
|
|
|
|
|
const point = rails.sectionrail[data.section].lineleft.getPointAt(trainlisttest.list[code].progress);
|
|
|
|
|
trainlisttest.list[code].rotation.y = 0;
|
|
|
|
|
trainlisttest.list[code].position.x = point.x;
|
|
|
|
|
trainlisttest.list[code].position.y = 0;
|
|
|
|
|
for (let tl=0; tl<6; tl++) {
|
|
|
|
|
for (let tl = 0; tl < 6; tl++) {
|
|
|
|
|
trainlisttest.list[code].children[tl].position.z = parseFloat(point.z);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
trainlisttest.list[code].curve = rails.sectionrail[data.section].lineleft;
|
|
|
|
|
|
|
|
|
|
if(data.next){
|
|
|
|
|
if (data.next) {
|
|
|
|
|
trainlisttest.list[code].nextcode = data.next;
|
|
|
|
|
trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineleft;
|
|
|
|
|
trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
|
|
|
|
@ -370,23 +368,23 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|
|
|
|
|
|
|
|
|
} else if (data.right == '0') { // 向左
|
|
|
|
|
trainlisttest.list[code].right = '0';
|
|
|
|
|
trainlisttest.list[code].progress = 1-data.offset;
|
|
|
|
|
trainlisttest.list[code].progress = 1 - data.offset;
|
|
|
|
|
trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack;
|
|
|
|
|
if(rails.sectionrail[data.section].standTrack){
|
|
|
|
|
if (rails.sectionrail[data.section].standTrack) {
|
|
|
|
|
trainlisttest.list[code].statsstop = 0;
|
|
|
|
|
}
|
|
|
|
|
let point = rails.sectionrail[data.section].lineright.getPointAt(trainlisttest.list[code].progress);
|
|
|
|
|
const point = rails.sectionrail[data.section].lineright.getPointAt(trainlisttest.list[code].progress);
|
|
|
|
|
|
|
|
|
|
trainlisttest.list[code].rotation.y = Math.PI;
|
|
|
|
|
trainlisttest.list[code].position.x = point.x;
|
|
|
|
|
trainlisttest.list[code].position.y = 0;
|
|
|
|
|
|
|
|
|
|
for (let tl=0; tl<6; tl++) {
|
|
|
|
|
for (let tl = 0; tl < 6; tl++) {
|
|
|
|
|
trainlisttest.list[code].children[tl].position.z = parseFloat(-point.z);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
trainlisttest.list[code].curve = rails.sectionrail[data.section].lineright;
|
|
|
|
|
if(data.next){
|
|
|
|
|
if (data.next) {
|
|
|
|
|
trainlisttest.list[code].nextcode = data.next;
|
|
|
|
|
trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineright;
|
|
|
|
|
trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
|
|
|
|
@ -395,11 +393,10 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|
|
|
|
trainlisttest.list[code].status = '0';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
// 后端数据驱动车的位置更新与代码驱动车的移动相结合
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
//后端数据驱动车的位置更新与代码驱动车的移动相结合
|
|
|
|
|
|
|
|
|
|
if(data.code != trainlisttest.list[code].code){
|
|
|
|
|
if (data.code != trainlisttest.list[code].code) {
|
|
|
|
|
if (data.right == '1') { // 向右
|
|
|
|
|
trainlisttest.list[code].right = '1';
|
|
|
|
|
trainlisttest.list[code].nowcode = data.code;
|
|
|
|
@ -413,7 +410,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|
|
|
|
trainlisttest.list[code].right = '0';
|
|
|
|
|
trainlisttest.list[code].nowcode = data.code;
|
|
|
|
|
trainlisttest.list[code].curve = rails.sectionrail[data.section].lineright;
|
|
|
|
|
trainlisttest.list[code].progress = 1-data.offset;
|
|
|
|
|
trainlisttest.list[code].progress = 1 - data.offset;
|
|
|
|
|
trainlisttest.list[code].nextcode = data.next;
|
|
|
|
|
trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineright;
|
|
|
|
|
trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
|
|
|
|
@ -421,13 +418,13 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(data.speed == 0){
|
|
|
|
|
if (data.speed == 0) {
|
|
|
|
|
trainlisttest.list[code].speeds = 0;
|
|
|
|
|
trainlisttest.list[code].statsstop = 0;
|
|
|
|
|
}else{
|
|
|
|
|
trainlisttest.list[code].speeds = parseFloat(data.speed*10/36/18/trainlisttest.list[code].len);
|
|
|
|
|
} else {
|
|
|
|
|
trainlisttest.list[code].speeds = parseFloat(data.speed * 10 / 36 / 18 / trainlisttest.list[code].len);
|
|
|
|
|
}
|
|
|
|
|
if(data.right != trainlisttest.list[code].status){
|
|
|
|
|
if (data.right != trainlisttest.list[code].status) {
|
|
|
|
|
|
|
|
|
|
trainlisttest.list[code].status = data.right;
|
|
|
|
|
trainlisttest.list[code].curve = null;
|
|
|
|
@ -437,50 +434,50 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function initall(data){
|
|
|
|
|
for(let i=0,leni=data.length;i<leni;i++){
|
|
|
|
|
if(data[i].deviceType == "SWITCH"){
|
|
|
|
|
function initall(data) {
|
|
|
|
|
for (let i = 0, leni = data.length; i < leni; i++) {
|
|
|
|
|
if (data[i].deviceType == 'SWITCH') {
|
|
|
|
|
initswitch(data[i]);
|
|
|
|
|
}else if(data[i].deviceType == "PSD"){
|
|
|
|
|
} else if (data[i].deviceType == 'PSD') {
|
|
|
|
|
initstand(data[i]);
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
console.log(data[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function DeviceDestroy(data){
|
|
|
|
|
for(let i=0,leni=data.body.deviceList.length;i<leni;i++){
|
|
|
|
|
function DeviceDestroy(data) {
|
|
|
|
|
for (let i = 0, leni = data.body.deviceList.length; i < leni; i++) {
|
|
|
|
|
|
|
|
|
|
if(data.body.deviceList[i].type == "TRAIN"){
|
|
|
|
|
code =data.body.deviceList[i].code;
|
|
|
|
|
if (trainlisttest.list[code].dispose != data.body.deviceList[i].dispose && data.body.deviceList[i].dispose == "0") {
|
|
|
|
|
if (data.body.deviceList[i].type == 'TRAIN') {
|
|
|
|
|
code = data.body.deviceList[i].code;
|
|
|
|
|
if (trainlisttest.list[code].dispose != data.body.deviceList[i].dispose && data.body.deviceList[i].dispose == '0') {
|
|
|
|
|
|
|
|
|
|
if (rails.sectionrail[data.body.deviceList[i].section]) {
|
|
|
|
|
|
|
|
|
|
trainlisttest.group.add(trainlisttest.list[code]);
|
|
|
|
|
trainlisttest.list[code].position.y = 0;
|
|
|
|
|
// trainlisttest.list[code].progress = 0;
|
|
|
|
|
trainlisttest.list[code].dispose = "0";
|
|
|
|
|
trainlisttest.list[code].dispose = '0';
|
|
|
|
|
trainlisttest.list[code].nowcode = data.body.deviceList[i].section;
|
|
|
|
|
trainlisttest.list[code].nextcode = null;
|
|
|
|
|
trainlisttest.list[code].curve = null;
|
|
|
|
|
trainlisttest.list[code].nextcurve = null;
|
|
|
|
|
trainlisttest.list[code].pc = 1;
|
|
|
|
|
|
|
|
|
|
if(trainlisttest.list[code].mixerpush == false){
|
|
|
|
|
if (trainlisttest.list[code].mixerpush == false) {
|
|
|
|
|
|
|
|
|
|
for(let mi=0,lenmi=trainlisttest.list[code].mixer.length;mi<lenmi;mi++){
|
|
|
|
|
for (let mi = 0, lenmi = trainlisttest.list[code].mixer.length; mi < lenmi; mi++) {
|
|
|
|
|
jlmap3d.mixers.push(trainlisttest.list[code].mixer[mi]);
|
|
|
|
|
}
|
|
|
|
|
trainlisttest.list[code].mixerpush = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (trainlisttest.list[code].dispose != data.body.deviceList[i].dispose && data.body.deviceList[i].dispose == "1") {
|
|
|
|
|
} else if (trainlisttest.list[code].dispose != data.body.deviceList[i].dispose && data.body.deviceList[i].dispose == '1') {
|
|
|
|
|
trainlisttest.list[code].status = 1;
|
|
|
|
|
trainlisttest.group.remove(trainlisttest.list[code]);
|
|
|
|
|
trainlisttest.list[code].progress = null;
|
|
|
|
|
trainlisttest.list[code].dispose = "1";
|
|
|
|
|
trainlisttest.list[code].dispose = '1';
|
|
|
|
|
code = trainlisttest.group.children[i].name;
|
|
|
|
|
trainlisttest.list[code].rotation.y = 0;
|
|
|
|
|
trainlisttest.list[code].open = '1';
|
|
|
|
@ -493,57 +490,56 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(data.body.deviceList[i].type == "SIGNAL"){
|
|
|
|
|
if (data.body.deviceList[i].type == 'SIGNAL') {
|
|
|
|
|
signalupdate(data.body.deviceList[i]);
|
|
|
|
|
}
|
|
|
|
|
if(data.body.deviceList[i].type == "SWITCH"){
|
|
|
|
|
if (data.body.deviceList[i].type == 'SWITCH') {
|
|
|
|
|
switchupdate(data.body.deviceList[i]);
|
|
|
|
|
}
|
|
|
|
|
if(data.body.deviceList[i].type == "PSD"){
|
|
|
|
|
if (data.body.deviceList[i].type == 'PSD') {
|
|
|
|
|
standupdate(data.body.deviceList[i]);
|
|
|
|
|
}
|
|
|
|
|
if(data.body.deviceList[i].type == "TRAIN_DOOR"){
|
|
|
|
|
if (data.body.deviceList[i].type == 'TRAIN_DOOR') {
|
|
|
|
|
traindoorupdate(data.body.deviceList[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function traindoorupdate(data){
|
|
|
|
|
let code = data.code;
|
|
|
|
|
if(trainlisttest.list[code].right == "0"){
|
|
|
|
|
if(data.doorCode == "2"){
|
|
|
|
|
function traindoorupdate(data) {
|
|
|
|
|
const code = data.code;
|
|
|
|
|
if (trainlisttest.list[code].right == '0') {
|
|
|
|
|
if (data.doorCode == '2') {
|
|
|
|
|
|
|
|
|
|
if(trainlisttest.list[code].open != data.open && data.open == "0"){
|
|
|
|
|
trainlisttest.list[code].open = "0";
|
|
|
|
|
for(let an=actions[code].top.length-1;an>=0;an--){
|
|
|
|
|
if (trainlisttest.list[code].open != data.open && data.open == '0') {
|
|
|
|
|
trainlisttest.list[code].open = '0';
|
|
|
|
|
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].open != data.open && data.open == "1"){
|
|
|
|
|
trainlisttest.list[code].open = "1";
|
|
|
|
|
for(let an=actions[code].top.length-1;an>=0;an--){
|
|
|
|
|
} else if (trainlisttest.list[code].open != data.open && data.open == '1') {
|
|
|
|
|
trainlisttest.list[code].open = '1';
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
if (trainlisttest.list[code].open != data.open && data.open == '0') {
|
|
|
|
|
trainlisttest.list[code].open = '0';
|
|
|
|
|
for (let an=actions[code].down.length-1; an>=0; an--) {
|
|
|
|
|
for (let an = actions[code].down.length - 1; an >= 0; an--) {
|
|
|
|
|
actions[code].down[an].reset();
|
|
|
|
|
actions[code].down[an].time = actions[code].down[an]._clip.duration;
|
|
|
|
|
actions[code].down[an].timeScale = -1;
|
|
|
|
|
actions[code].down[an].play();
|
|
|
|
|
}
|
|
|
|
|
} else if (trainlisttest.list[code].open != data.open && data.open == '1') {
|
|
|
|
|
trainlisttest.list[code].open = "1";
|
|
|
|
|
for(let an=actions[code].down.length-1;an>=0;an--){
|
|
|
|
|
trainlisttest.list[code].open = '1';
|
|
|
|
|
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;
|
|
|
|
@ -552,40 +548,39 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
if(data.doorCode == "1"){
|
|
|
|
|
} else {
|
|
|
|
|
if (data.doorCode == '1') {
|
|
|
|
|
|
|
|
|
|
if(trainlisttest.list[code].open != data.open && data.open == "0"){
|
|
|
|
|
trainlisttest.list[code].open = "0";
|
|
|
|
|
for(let an=actions[code].top.length-1;an>=0;an--){
|
|
|
|
|
if (trainlisttest.list[code].open != data.open && data.open == '0') {
|
|
|
|
|
trainlisttest.list[code].open = '0';
|
|
|
|
|
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].open != data.open && data.open == "1"){
|
|
|
|
|
trainlisttest.list[code].open = "1";
|
|
|
|
|
for(let an=actions[code].top.length-1;an>=0;an--){
|
|
|
|
|
} else if (trainlisttest.list[code].open != data.open && data.open == '1') {
|
|
|
|
|
trainlisttest.list[code].open = '1';
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
if (trainlisttest.list[code].open != data.open && data.open == '0') {
|
|
|
|
|
trainlisttest.list[code].open = '0';
|
|
|
|
|
for (let an=actions[code].down.length-1; an>=0; an--) {
|
|
|
|
|
for (let an = actions[code].down.length - 1; an >= 0; an--) {
|
|
|
|
|
actions[code].down[an].reset();
|
|
|
|
|
actions[code].down[an].time = actions[code].down[an]._clip.duration;
|
|
|
|
|
actions[code].down[an].timeScale = -1;
|
|
|
|
|
actions[code].down[an].play();
|
|
|
|
|
}
|
|
|
|
|
} else if (trainlisttest.list[code].open != data.open && data.open == '1') {
|
|
|
|
|
trainlisttest.list[code].open = "1";
|
|
|
|
|
for(let an=actions[code].down.length-1;an>=0;an--){
|
|
|
|
|
trainlisttest.list[code].open = '1';
|
|
|
|
|
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;
|
|
|
|
@ -598,7 +593,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function trainstatus(data){
|
|
|
|
|
function trainstatus(data) {
|
|
|
|
|
// 遍历列车对象组
|
|
|
|
|
if (trainlisttest) {
|
|
|
|
|
|
|
|
|
@ -611,33 +606,32 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|
|
|
|
trainlisttest.list[code].status = data.right;
|
|
|
|
|
// 车门开关验证
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 遍历获取所在轨道
|
|
|
|
|
if (trainlisttest.list[code].dispose != data.dispose && data.dispose == "0") {
|
|
|
|
|
if (trainlisttest.list[code].dispose != data.dispose && data.dispose == '0') {
|
|
|
|
|
if (rails.sectionrail[data.sectionCode]) {
|
|
|
|
|
|
|
|
|
|
trainlisttest.group.add(trainlisttest.list[code]);
|
|
|
|
|
trainlisttest.list[code].position.y = 0;
|
|
|
|
|
// trainlisttest.list[code].progress = 0;
|
|
|
|
|
trainlisttest.list[code].dispose = "0";
|
|
|
|
|
trainlisttest.list[code].dispose = '0';
|
|
|
|
|
trainlisttest.list[code].nowcode = data.sectionCode;
|
|
|
|
|
trainlisttest.list[code].nextcode = null;
|
|
|
|
|
trainlisttest.list[code].curve = null;
|
|
|
|
|
trainlisttest.list[code].nextcurve = null;
|
|
|
|
|
trainlisttest.list[code].pc = 1;
|
|
|
|
|
|
|
|
|
|
if(trainlisttest.list[code].mixerpush == false){
|
|
|
|
|
for(let mi=0,lenmi=trainlisttest.list[code].mixer.length;mi<lenmi;mi++){
|
|
|
|
|
if (trainlisttest.list[code].mixerpush == false) {
|
|
|
|
|
for (let mi = 0, lenmi = trainlisttest.list[code].mixer.length; mi < lenmi; mi++) {
|
|
|
|
|
jlmap3d.mixers.push(trainlisttest.list[code].mixer[mi]);
|
|
|
|
|
}
|
|
|
|
|
trainlisttest.list[code].mixerpush = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (trainlisttest.list[code].dispose != data.dispose && data.dispose == "1") {
|
|
|
|
|
} else if (trainlisttest.list[code].dispose != data.dispose && data.dispose == '1') {
|
|
|
|
|
trainlisttest.list[code].status = 1;
|
|
|
|
|
trainlisttest.group.remove(trainlisttest.list[code]);
|
|
|
|
|
trainlisttest.list[code].progress = null;
|
|
|
|
|
trainlisttest.list[code].dispose = "1";
|
|
|
|
|
trainlisttest.list[code].dispose = '1';
|
|
|
|
|
code = trainlisttest.group.children[i].name;
|
|
|
|
|
trainlisttest.list[code].rotation.y = 0;
|
|
|
|
|
trainlisttest.list[code].open = '1';
|
|
|
|
@ -692,31 +686,31 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|
|
|
|
}
|
|
|
|
|
function signalupdate(data) {
|
|
|
|
|
code = data.code;
|
|
|
|
|
if(data.red == 1){
|
|
|
|
|
signallist.list[code].mesh.getObjectByName("red").material.map = materials[0];
|
|
|
|
|
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
|
|
|
|
}else{
|
|
|
|
|
signallist.list[code].mesh.getObjectByName("red").material.map = materials[3];
|
|
|
|
|
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
|
|
|
|
|
if (data.red == 1) {
|
|
|
|
|
signallist.list[code].mesh.getObjectByName('red').material.map = materials[0];
|
|
|
|
|
signallist.list[code].mesh.getObjectByName('red').material.map.needsUpdate = true;
|
|
|
|
|
} else {
|
|
|
|
|
signallist.list[code].mesh.getObjectByName('red').material.map = materials[3];
|
|
|
|
|
signallist.list[code].mesh.getObjectByName('red').material.map.needsUpdate = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(data.yellow == 1){
|
|
|
|
|
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[1];
|
|
|
|
|
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
|
|
|
|
if (data.yellow == 1) {
|
|
|
|
|
signallist.list[code].mesh.getObjectByName('yellow').material.map = materials[1];
|
|
|
|
|
signallist.list[code].mesh.getObjectByName('yellow').material.map.needsUpdate = true;
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[3];
|
|
|
|
|
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
|
|
|
|
|
} else {
|
|
|
|
|
signallist.list[code].mesh.getObjectByName('yellow').material.map = materials[3];
|
|
|
|
|
signallist.list[code].mesh.getObjectByName('yellow').material.map.needsUpdate = true;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(data.green == 1){
|
|
|
|
|
signallist.list[code].mesh.getObjectByName("green").material.map = materials[2];
|
|
|
|
|
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
|
|
|
|
if (data.green == 1) {
|
|
|
|
|
signallist.list[code].mesh.getObjectByName('green').material.map = materials[2];
|
|
|
|
|
signallist.list[code].mesh.getObjectByName('green').material.map.needsUpdate = true;
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
signallist.list[code].mesh.getObjectByName("green").material.map = materials[3];
|
|
|
|
|
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
|
|
|
|
|
} else {
|
|
|
|
|
signallist.list[code].mesh.getObjectByName('green').material.map = materials[3];
|
|
|
|
|
signallist.list[code].mesh.getObjectByName('green').material.map.needsUpdate = true;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -730,14 +724,14 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|
|
|
|
actions[code].action.time = 0;
|
|
|
|
|
actions[code].action.timeScale = 1;
|
|
|
|
|
actions[code].action.play();
|
|
|
|
|
actions[code].normal = "02";
|
|
|
|
|
actions[code].normal = '02';
|
|
|
|
|
} else if (data.routeLock == '1') {
|
|
|
|
|
// sectionlist.switchs.modellist[j].normal = data.normal;
|
|
|
|
|
actions[code].action.reset();
|
|
|
|
|
actions[code].action.time = actions[code].action._clip.duration;
|
|
|
|
|
actions[code].action.timeScale = -1;
|
|
|
|
|
actions[code].action.play();
|
|
|
|
|
actions[code].normal = "01";
|
|
|
|
|
actions[code].normal = '01';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -750,19 +744,19 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|
|
|
|
actions[code].action.time = 0;
|
|
|
|
|
actions[code].action.timeScale = 1;
|
|
|
|
|
actions[code].action.play();
|
|
|
|
|
actions[code].normal = "02";
|
|
|
|
|
actions[code].normal = '02';
|
|
|
|
|
} else if (data.normal == '01') {
|
|
|
|
|
// sectionlist.switchs.modellist[j].normal = data.normal;
|
|
|
|
|
actions[code].action.reset();
|
|
|
|
|
actions[code].action.time = actions[code].action._clip.duration;
|
|
|
|
|
actions[code].action.timeScale = -1;
|
|
|
|
|
actions[code].action.play();
|
|
|
|
|
actions[code].normal = "01";
|
|
|
|
|
actions[code].normal = '01';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function simulationreset(data){
|
|
|
|
|
for(let i=0;i<trainlisttest.group.children.length;i++){
|
|
|
|
|
function simulationreset(data) {
|
|
|
|
|
for (let i = 0; i < trainlisttest.group.children.length; i++) {
|
|
|
|
|
trainlisttest.group.children[i].dispose = true;
|
|
|
|
|
trainlisttest.group.children[i].stopstation = null;
|
|
|
|
|
trainlisttest.group.children[i].pc = null;
|
|
|
|
|