This commit is contained in:
joylink_cuiweidong 2020-08-04 14:02:54 +08:00
commit 01701479fd
12 changed files with 792 additions and 760 deletions

View File

@ -103,7 +103,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,sta
return; return;
} }
if(data.type == "Train_Hmi_3D"){ if(data.type == "Train_Hmi_3D"){
// console.log(data.body); console.log(data.body);
updatestatus(data.body); updatestatus(data.body);
// if(data.body.trust){ // if(data.body.trust){

View File

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

View File

@ -108,7 +108,6 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
getPublishMapDetail(skinCode).then(data => { getPublishMapDetail(skinCode).then(data => {
let mapnetdata = data.data; let mapnetdata = data.data;
getPublish3dMapDetail(skinCode).then(netdata => { getPublish3dMapDetail(skinCode).then(netdata => {
console.log(netdata);
let assetsdata = JSON.parse(netdata.data.sections); let assetsdata = JSON.parse(netdata.data.sections);
if(assetsdata.link){ if(assetsdata.link){
scope.datatype = "old"; scope.datatype = "old";

View File

@ -143,6 +143,13 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce
}); });
}) })
.then(function(data){ .then(function(data){
camera.position.x = stationstandlist.group.children[0].position.x;
camera.position.y = stationstandlist.group.children[0].position.y+500;
camera.position.z = stationstandlist.group.children[0].position.z+800;
//更新相机方向
controls.target = new THREE.Vector3(stationstandlist.group.children[0].position.x,stationstandlist.group.children[0].position.y,stationstandlist.group.children[0].position.z);
controls.upmodeldirect(stationstandlist,trainlisttest);
controls.update();
backdata.loaderdata(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails); backdata.loaderdata(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails);
scope.Subscribe.updatamap(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails,scope.materiallist,scope.actions,scope.sceneload); scope.Subscribe.updatamap(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails,scope.materiallist,scope.actions,scope.sceneload);

View File

@ -117,6 +117,7 @@ const training = {
}, },
over: (state) => { over: (state) => {
state.started = false; state.started = false;
state.switchcount += 1;
}, },
updateMapState: (state, deviceStatus) => { updateMapState: (state, deviceStatus) => {
Vue.prototype.$jlmap && Vue.prototype.$jlmap.update(deviceStatus); Vue.prototype.$jlmap && Vue.prototype.$jlmap.update(deviceStatus);

View File

@ -2,9 +2,9 @@ export function getBaseUrl() {
let BASE_API; let BASE_API;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud'; BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪 // BASE_API = 'http://192.168.3.5:9000'; // 袁琪
BASE_API = 'http://192.168.3.6:9000'; // 旭强 // BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 张赛 // BASE_API = 'http://192.168.3.41:9000'; // 张赛
// BASE_API = 'http://192.168.3.82:9000'; // 杜康 // BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://b29z135112.zicp.vip';

View File

@ -80,6 +80,11 @@ export default {
token:null token:null
}; };
}, },
watch: {
'$store.state.socket.simulationOver':function(val) {
this.back();
}
},
beforeDestroy() { beforeDestroy() {
// console.log("destroy"); // console.log("destroy");
if (this.jlmap3d) { if (this.jlmap3d) {
@ -183,7 +188,15 @@ export default {
}, },
back() { back() {
if (this.$route.query.projectDevice) {
this.$store.dispatch('training/over').then(() => {
this.$store.dispatch('LogOut').then(() => {
location.reload();
});
});
} else {
window.close(); window.close();
}
// this.$emit('showpanel'); // this.$emit('showpanel');
// this.jlmap3d.eventoff(); // this.jlmap3d.eventoff();
// this.jlmap3d.animateoff(); // this.jlmap3d.animateoff();

View File

@ -144,6 +144,7 @@ export default {
width:80%; width:80%;
height:30px; height:30px;
margin:0px 0px 50px 0px; margin:0px 0px 50px 0px;
cursor:pointer;
} }
.modelpic{ .modelpic{
left:0; left:0;

View File

@ -7,7 +7,6 @@
:element-loading-text="loadingText" :element-loading-text="loadingText"
element-loading-background="rgba(0, 0, 0, 0)" element-loading-background="rgba(0, 0, 0, 0)"
> >
<el-button v-if="syncLogin && loadingCode" type="text" style="font-size: 24px;font-weight: bold;" @click="loginRefresh">关联设备未登录,点击重新检测</el-button>
<div v-if="loginTitle && !syncLogin" :class="project.endsWith('heb')?'text-box':'left-logo-box'"> <div v-if="loginTitle && !syncLogin" :class="project.endsWith('heb')?'text-box':'left-logo-box'">
<img class="logo" :src="logoImg" :style="{width: logoWidth}"> <img class="logo" :src="logoImg" :style="{width: logoWidth}">
<span>{{ loginTitle==='空串'?'':loginTitle }}</span> <span>{{ loginTitle==='空串'?'':loginTitle }}</span>
@ -309,7 +308,8 @@ export default {
} }
}, },
loginRefresh() { loginRefresh() {
this.loadingCode = true; // this.loadingCode = true;
const self = this;
const params = LoginParams[this.loginClient]; const params = LoginParams[this.loginClient];
params.project = loginInfo[this.project].loginParam; params.project = loginInfo[this.project].loginParam;
if (this.$route.query.projectDevice) { if (this.$route.query.projectDevice) {
@ -321,8 +321,14 @@ export default {
this.loadingCode = false; this.loadingCode = false;
this.checkLoginStatus(); this.checkLoginStatus();
}).catch(() => { }).catch(() => {
if (this.syncLogin) {
setTimeout(() =>{
self.loginRefresh();
}, 3000);
} else {
this.loadingCode = false; this.loadingCode = false;
this.$messageBox(this.$t('login.getLoginQrCode')); this.$messageBox(this.$t('login.getLoginQrCode'));
}
}); });
}, },
checkLoginStatus() { checkLoginStatus() {
@ -344,8 +350,12 @@ export default {
}); });
}).catch(error => { }).catch(error => {
if ((error.data && error.data.status === 'EXPIRE') || error.code != 200) { if ((error.data && error.data.status === 'EXPIRE') || error.code != 200) {
if (this.syncLogin) {
self.loginRefresh();
} else {
this.loadingCode = true; this.loadingCode = true;
this.loginUrl = ''; this.loginUrl = '';
}
} else { } else {
self.checkLoginStatus(); self.checkLoginStatus();
} }
@ -475,7 +485,9 @@ export default {
mapid: query.mapId, mapid: query.mapId,
group: query.group, group: query.group,
project: getSessionStorage('project'), project: getSessionStorage('project'),
token: getToken() token: getToken(),
projectDevice: this.$route.query.projectDevice,
type: this.$route.query.type
}; };
this.$router.push({ path: `/jlmap3d/sandbox`, query: sandboxQuery }); this.$router.push({ path: `/jlmap3d/sandbox`, query: sandboxQuery });
} else { } else {

View File

@ -74,10 +74,11 @@ export default {
}); });
this.editModel.logicSectionCodeList.forEach(logicCode => { this.editModel.logicSectionCodeList.forEach(logicCode => {
const section = this.$store.getters['map/getDeviceByCode'](logicCode); const section = this.$store.getters['map/getDeviceByCode'](logicCode);
if (section) {
models.push(deepAssign(section, {_dispose: true})); models.push(deepAssign(section, {_dispose: true}));
const trainWindowModel = this.$store.getters['map/getDeviceByCode'](section.trainWindowCode); const trainWindowModel = this.$store.getters['map/getDeviceByCode'](section.trainWindowCode);
models.push(deepAssign(trainWindowModel, {_dispose: true})); trainWindowModel && models.push(deepAssign(trainWindowModel, {_dispose: true}));
}
}); });
if (this.logicNum === 0) { if (this.logicNum === 0) {
logicSectionCodeList = []; logicSectionCodeList = [];

View File

@ -175,8 +175,8 @@ export default {
width: data.width, width: data.width,
height: data.height height: data.height
}; };
}
data.offsetList.length = data.bigScreenSplitConfig.length + 1; data.offsetList.length = data.bigScreenSplitConfig.length + 1;
}
if (data.offsetList && data.offsetList.length) { if (data.offsetList && data.offsetList.length) {
this.list = []; this.list = [];
data.offsetList.forEach(item => { data.offsetList.forEach(item => {

View File

@ -721,6 +721,10 @@ function timedCount() {
postMessage(data); postMessage(data);
return; return;
} }
if (data.type == 'Simulation_Over') {
postMessage(data);
return;
}
if ( data.body.length > 300) { if ( data.body.length > 300) {
// console.log(data); // console.log(data);
postMessage(data); postMessage(data);