修改行车逻辑

This commit is contained in:
sunzhenyu 2019-10-14 18:18:11 +08:00
parent 8b71f08de0
commit 1ddb55091a
6 changed files with 74 additions and 48 deletions

View File

@ -271,7 +271,7 @@ export function SectionList() {
this.loadpromise = function(jlmap3ddata,assetloader,sectiondata,switchdata,scene){
return new Promise(function(resolve, reject){
console.log(sectiondata);
// scene.add(sectiongroup);
scene.add(scope.sectiongroup);
scene.add(scope.switchgroup);
let linkdata = jlmap3ddata.linklist;
@ -347,7 +347,7 @@ export function SectionList() {
if(testmesh1.isStandTrack == false){
scope.sectiongroup.add(testmesh1);
// scope.sectiongroup.add(testmesh1);
}else{
scope.standtrack.push(testmesh1);

View File

@ -207,9 +207,9 @@ export function Jl3dDriving(updatemmi,sound) {
} else {
syncdata.percent = 1 - trainlisttest.list[code].progress;
}
console.log(syncdata);
console.log(trainlisttest.list[code].nextcurve);
console.log("=============");
// console.log(syncdata);
// console.log(trainlisttest.list[code].nextcurve);
// console.log("=============");
scope.teststomp.send('/app/topic/simulation/client/drive', syncdata);
}
}
@ -230,8 +230,6 @@ export function Jl3dDriving(updatemmi,sound) {
//更新车组号
updatemmi.updatetrainnum(data.body[i].groupNumber);
//更新列车
if (data.body[i].parkRemainTime>0) {
updatemmi.updatestoptime('停站时间:'+parseInt(data.body[i].parkRemainTime));
} else {
@ -418,8 +416,9 @@ export function Jl3dDriving(updatemmi,sound) {
trainlisttest.list[code].nowcode = data.body[i].linkCode;
trainlisttest.list[code].nextcode = rails.linkrail[data.body[i].linkCode].next;
if (data.body[i].directionType == '02') { // 向右
trainlisttest.list[code].progress = 0;
if (trainlisttest.list[code].status != data.body[i].directionType) {
trainlisttest.list[code].progress = 0;
const rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
const rotaposz = trainlisttest.list[code].children[0].matrixWorld.elements[14];
trainlisttest.list[code].rotation.y = 0;
@ -429,12 +428,14 @@ export function Jl3dDriving(updatemmi,sound) {
}
trainlisttest.list[code].progress = (rotaposx-rails.linkrail[data.body[i].linkCode].lp.x)/rails.linkrail[data.body[i].linkCode].lengthfact;
trainlisttest.list[code].status = '02';
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineleft;
}
trainlisttest.list[code].status = '02';
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineleft;
} else if (data.body[i].directionType == '03') { // 向左
trainlisttest.list[code].progress = 1;
if (trainlisttest.list[code].status != data.body[i].directionType) {
trainlisttest.list[code].progress = 0;
const rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
const rotaposz = Math.abs(trainlisttest.list[code].children[0].matrixWorld.elements[14]);
trainlisttest.list[code].rotation.y = Math.PI;
@ -443,10 +444,11 @@ export function Jl3dDriving(updatemmi,sound) {
trainlisttest.list[code].children[tl].position.z = -rotaposz;
}
trainlisttest.list[code].progress = 1-(rotaposx-rails.linkrail[data.body[i].linkCode].lp.x)/rails.linkrail[data.body[i].linkCode].lengthfact;
trainlisttest.list[code].status = '03';
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineright;
}
trainlisttest.list[code].status = '03';
trainlisttest.list[code].curve = rails.linkrail[data.body[i].linkCode].lineright;
}
@ -457,24 +459,36 @@ export function Jl3dDriving(updatemmi,sound) {
trainlisttest.list[code].len = rails.linkrail[data.body[i].linkCode].lengthfact;
}else{
if(data.body[i].directionType == '02'){
trainlisttest.list[code].status = '02';
let nextcode = rails.linkrail[data.body[i].linkCode].rconnect;
if(nextcode){
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineleft;
trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact;
}
}else if(data.body[i].directionType == '03'){
trainlisttest.list[code].status = '03';
let nextcode = rails.linkrail[data.body[i].linkCode].lconnect;
if(nextcode){
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineright;
trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact;
}
}
}
if(data.body[i].directionType == '02'){
let nextcode = rails.linkrail[data.body[i].linkCode].rconnect;
if(nextcode){
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineleft;
trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact;
}
}else if(data.body[i].directionType == '03'){
let nextcode = rails.linkrail[data.body[i].linkCode].lconnect;
if(nextcode){
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineright;
trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact;
}
}
console.log(data.body[i].directionType);
console.log(data.body[i].linkCode);
console.log(data.body[i].linkOffsetPercent);
// console.log(trainlisttest.list[code].curve.points);
// console.log(trainlisttest.list[code].nextcurve.points);
// console.log(trainlisttest.list[code].len);
// console.log(trainlisttest.list[code].nextlen);
console.log("===========================================");
}
}
}

View File

@ -4,7 +4,7 @@ export function UpdateTrain(camera,traindata,control){
for(let j=traindata.group.children.length-1;j>=0;j--){
//判断是否有移动事件
//if(traindata.group.children[j].dispose == false){
if(traindata.group.children[j].dispose == false){
if(traindata.group.children[j].progress != null){
@ -137,17 +137,24 @@ export function UpdateTrain(camera,traindata,control){
trainmodel.progress += trainmodel.speeds;
}
}
console.log(trainmodel.progress);
}else{
if(trainmodel.status == '02'){
trainmodel.curve = trainmodel.nextcurve;
trainmodel.progress = 0;
trainmodel.len = trainmodel.nextlen;
}else if(trainmodel.status == '03'){
trainmodel.curve = trainmodel.nextcurve;
trainmodel.progress = 0;
trainmodel.len = trainmodel.nextlen;
console.log(trainmodel.nextcurve.pointss);
console.log("-----------------");
if(trainmodel.nextcurve){
if(trainmodel.status == '02'){
trainmodel.curve = trainmodel.nextcurve;
trainmodel.progress = 0;
trainmodel.len = trainmodel.nextlen;
trainmodel.nextcurve = null;
}else if(trainmodel.status == '03'){
trainmodel.curve = trainmodel.nextcurve;
trainmodel.progress = 0;
trainmodel.len = trainmodel.nextlen;
trainmodel.nextcurve = null;
}
}
// console.log(trainmodel.name);
// console.log(trainmodel.progress);
// console.log(trainmodel.nextcurve);
@ -299,7 +306,7 @@ export function UpdateTrain(camera,traindata,control){
}
//}
}
}

View File

@ -155,6 +155,7 @@ export function Jlmap3dSubscribe(jlmap3d) {
if ( trainlisttest.list[code]) {
if (code == drivingcode) {
driverswitch = data.body[i].runMode;
//更新车组号
jlmap3d.updatetrainnum(data.body[i].groupNumber);
//更新列车
let syncdata = {

View File

@ -44,7 +44,7 @@ export function RailList(){
scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(scope.linkrail[switchdata[i].alink].rp.x,0,scope.linkrail[switchdata[i].alink].rp.z));
scope.switchrail[switchdata[i].code].directtype = "2";
}
//
if(scope.linkrail[switchdata[i].clink].lp.x < switchdata[i].position.x){
scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z));
scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(scope.linkrail[switchdata[i].alink].lp.x,0,scope.linkrail[switchdata[i].alink].lp.z));
@ -58,22 +58,23 @@ export function RailList(){
const ddd = storemod.getters['map/getDeviceByCode'](switchdata[i].code);
scope.switchrail[switchdata[i].code].locateType = ddd.locateType;
if(ddd.locateType == "01"){
//1--向右 2--向左
//1--向左 2--向右
//__\__ __/__
if(scope.switchrail[switchdata[i].code].directtype == "1"){
scope.linkrail[switchdata[i].alink].rconnect = switchdata[i].blink;
scope.linkrail[switchdata[i].blink].lconnect = switchdata[i].alink;
}else if(scope.switchrail[switchdata[i].code].directtype == "2"){
scope.linkrail[switchdata[i].alink].lconnect = switchdata[i].blink;
scope.linkrail[switchdata[i].blink].rconnect = switchdata[i].alink;
}else if(scope.switchrail[switchdata[i].code].directtype == "2"){
scope.linkrail[switchdata[i].alink].rconnect = switchdata[i].blink;
scope.linkrail[switchdata[i].blink].lconnect = switchdata[i].alink;
}
}else if(ddd.locateType == "02"){
if(switchdata[i].directtype == "1"){
scope.linkrail[switchdata[i].alink].rconnect = switchdata[i].clink;
scope.linkrail[switchdata[i].clink].lconnect = switchdata[i].alink;
}else if(switchdata[i].directtype == "2"){
scope.linkrail[switchdata[i].alink].lconnect = switchdata[i].clink;
scope.linkrail[switchdata[i].clink].rconnect = switchdata[i].alink;
}else if(switchdata[i].directtype == "2"){
scope.linkrail[switchdata[i].alink].rconnect = switchdata[i].clink;
scope.linkrail[switchdata[i].clink].lconnect = switchdata[i].alink;
}
}
}
@ -94,6 +95,9 @@ export function RailList(){
// Create the final object to add to the scene
var curveObject = new THREE.Line( geometry, material );
scene.add(curveObject);
console.log(scope.linkrail[linkdata[i].code].lineleft.points);
console.log(scope.linkrail[linkdata[i].code].lineright.points);
console.log("**********************");
}
// console.log(linkdata);

View File

@ -3,9 +3,9 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// 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.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 王兴杰
} else {
BASE_API = process.env.VUE_APP_BASE_API;