修改行车逻辑
This commit is contained in:
parent
8b71f08de0
commit
1ddb55091a
@ -271,7 +271,7 @@ export function SectionList() {
|
|||||||
this.loadpromise = function(jlmap3ddata,assetloader,sectiondata,switchdata,scene){
|
this.loadpromise = function(jlmap3ddata,assetloader,sectiondata,switchdata,scene){
|
||||||
return new Promise(function(resolve, reject){
|
return new Promise(function(resolve, reject){
|
||||||
console.log(sectiondata);
|
console.log(sectiondata);
|
||||||
// scene.add(sectiongroup);
|
scene.add(scope.sectiongroup);
|
||||||
scene.add(scope.switchgroup);
|
scene.add(scope.switchgroup);
|
||||||
let linkdata = jlmap3ddata.linklist;
|
let linkdata = jlmap3ddata.linklist;
|
||||||
|
|
||||||
@ -347,7 +347,7 @@ export function SectionList() {
|
|||||||
|
|
||||||
|
|
||||||
if(testmesh1.isStandTrack == false){
|
if(testmesh1.isStandTrack == false){
|
||||||
scope.sectiongroup.add(testmesh1);
|
// scope.sectiongroup.add(testmesh1);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
scope.standtrack.push(testmesh1);
|
scope.standtrack.push(testmesh1);
|
||||||
|
@ -207,9 +207,9 @@ export function Jl3dDriving(updatemmi,sound) {
|
|||||||
} else {
|
} else {
|
||||||
syncdata.percent = 1 - trainlisttest.list[code].progress;
|
syncdata.percent = 1 - trainlisttest.list[code].progress;
|
||||||
}
|
}
|
||||||
console.log(syncdata);
|
// console.log(syncdata);
|
||||||
console.log(trainlisttest.list[code].nextcurve);
|
// console.log(trainlisttest.list[code].nextcurve);
|
||||||
console.log("=============");
|
// console.log("=============");
|
||||||
scope.teststomp.send('/app/topic/simulation/client/drive', syncdata);
|
scope.teststomp.send('/app/topic/simulation/client/drive', syncdata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -230,8 +230,6 @@ export function Jl3dDriving(updatemmi,sound) {
|
|||||||
//更新车组号
|
//更新车组号
|
||||||
updatemmi.updatetrainnum(data.body[i].groupNumber);
|
updatemmi.updatetrainnum(data.body[i].groupNumber);
|
||||||
//更新列车
|
//更新列车
|
||||||
|
|
||||||
|
|
||||||
if (data.body[i].parkRemainTime>0) {
|
if (data.body[i].parkRemainTime>0) {
|
||||||
updatemmi.updatestoptime('停站时间:'+parseInt(data.body[i].parkRemainTime));
|
updatemmi.updatestoptime('停站时间:'+parseInt(data.body[i].parkRemainTime));
|
||||||
} else {
|
} else {
|
||||||
@ -418,8 +416,9 @@ export function Jl3dDriving(updatemmi,sound) {
|
|||||||
trainlisttest.list[code].nowcode = data.body[i].linkCode;
|
trainlisttest.list[code].nowcode = data.body[i].linkCode;
|
||||||
trainlisttest.list[code].nextcode = rails.linkrail[data.body[i].linkCode].next;
|
trainlisttest.list[code].nextcode = rails.linkrail[data.body[i].linkCode].next;
|
||||||
if (data.body[i].directionType == '02') { // 向右
|
if (data.body[i].directionType == '02') { // 向右
|
||||||
trainlisttest.list[code].progress = 0;
|
|
||||||
if (trainlisttest.list[code].status != data.body[i].directionType) {
|
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 rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||||
const rotaposz = trainlisttest.list[code].children[0].matrixWorld.elements[14];
|
const rotaposz = trainlisttest.list[code].children[0].matrixWorld.elements[14];
|
||||||
trainlisttest.list[code].rotation.y = 0;
|
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].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') { // 向左
|
} else if (data.body[i].directionType == '03') { // 向左
|
||||||
trainlisttest.list[code].progress = 1;
|
|
||||||
if (trainlisttest.list[code].status != data.body[i].directionType) {
|
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 rotaposx = trainlisttest.list[code].children[5].matrixWorld.elements[12];
|
||||||
const rotaposz = Math.abs(trainlisttest.list[code].children[0].matrixWorld.elements[14]);
|
const rotaposz = Math.abs(trainlisttest.list[code].children[0].matrixWorld.elements[14]);
|
||||||
trainlisttest.list[code].rotation.y = Math.PI;
|
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].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].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;
|
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'){
|
console.log(data.body[i].directionType);
|
||||||
let nextcode = rails.linkrail[data.body[i].linkCode].lconnect;
|
console.log(data.body[i].linkCode);
|
||||||
if(nextcode){
|
console.log(data.body[i].linkOffsetPercent);
|
||||||
trainlisttest.list[code].nextcurve = rails.linkrail[nextcode].lineright;
|
// console.log(trainlisttest.list[code].curve.points);
|
||||||
trainlisttest.list[code].nextlen = rails.linkrail[nextcode].lengthfact;
|
// console.log(trainlisttest.list[code].nextcurve.points);
|
||||||
}
|
// console.log(trainlisttest.list[code].len);
|
||||||
|
// console.log(trainlisttest.list[code].nextlen);
|
||||||
}
|
console.log("===========================================");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ export function UpdateTrain(camera,traindata,control){
|
|||||||
|
|
||||||
for(let j=traindata.group.children.length-1;j>=0;j--){
|
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){
|
if(traindata.group.children[j].progress != null){
|
||||||
|
|
||||||
@ -137,17 +137,24 @@ export function UpdateTrain(camera,traindata,control){
|
|||||||
trainmodel.progress += trainmodel.speeds;
|
trainmodel.progress += trainmodel.speeds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log(trainmodel.progress);
|
||||||
}else{
|
}else{
|
||||||
if(trainmodel.status == '02'){
|
console.log(trainmodel.nextcurve.pointss);
|
||||||
trainmodel.curve = trainmodel.nextcurve;
|
console.log("-----------------");
|
||||||
trainmodel.progress = 0;
|
if(trainmodel.nextcurve){
|
||||||
trainmodel.len = trainmodel.nextlen;
|
if(trainmodel.status == '02'){
|
||||||
}else if(trainmodel.status == '03'){
|
trainmodel.curve = trainmodel.nextcurve;
|
||||||
trainmodel.curve = trainmodel.nextcurve;
|
trainmodel.progress = 0;
|
||||||
trainmodel.progress = 0;
|
trainmodel.len = trainmodel.nextlen;
|
||||||
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.name);
|
||||||
// console.log(trainmodel.progress);
|
// console.log(trainmodel.progress);
|
||||||
// console.log(trainmodel.nextcurve);
|
// console.log(trainmodel.nextcurve);
|
||||||
@ -299,7 +306,7 @@ export function UpdateTrain(camera,traindata,control){
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,6 +155,7 @@ export function Jlmap3dSubscribe(jlmap3d) {
|
|||||||
if ( trainlisttest.list[code]) {
|
if ( trainlisttest.list[code]) {
|
||||||
if (code == drivingcode) {
|
if (code == drivingcode) {
|
||||||
driverswitch = data.body[i].runMode;
|
driverswitch = data.body[i].runMode;
|
||||||
|
//更新车组号
|
||||||
jlmap3d.updatetrainnum(data.body[i].groupNumber);
|
jlmap3d.updatetrainnum(data.body[i].groupNumber);
|
||||||
//更新列车
|
//更新列车
|
||||||
let syncdata = {
|
let syncdata = {
|
||||||
|
@ -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.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";
|
scope.switchrail[switchdata[i].code].directtype = "2";
|
||||||
}
|
}
|
||||||
|
//
|
||||||
if(scope.linkrail[switchdata[i].clink].lp.x < switchdata[i].position.x){
|
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(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));
|
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);
|
const ddd = storemod.getters['map/getDeviceByCode'](switchdata[i].code);
|
||||||
scope.switchrail[switchdata[i].code].locateType = ddd.locateType;
|
scope.switchrail[switchdata[i].code].locateType = ddd.locateType;
|
||||||
if(ddd.locateType == "01"){
|
if(ddd.locateType == "01"){
|
||||||
//1--向右 2--向左
|
//1--向左 2--向右
|
||||||
|
//__\__ __/__
|
||||||
if(scope.switchrail[switchdata[i].code].directtype == "1"){
|
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].alink].lconnect = switchdata[i].blink;
|
||||||
scope.linkrail[switchdata[i].blink].rconnect = switchdata[i].alink;
|
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"){
|
}else if(ddd.locateType == "02"){
|
||||||
if(switchdata[i].directtype == "1"){
|
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].alink].lconnect = switchdata[i].clink;
|
||||||
scope.linkrail[switchdata[i].clink].rconnect = switchdata[i].alink;
|
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
|
// Create the final object to add to the scene
|
||||||
var curveObject = new THREE.Line( geometry, material );
|
var curveObject = new THREE.Line( geometry, material );
|
||||||
scene.add(curveObject);
|
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);
|
// console.log(linkdata);
|
||||||
|
@ -3,9 +3,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'; // 王兴杰
|
||||||
} else {
|
} else {
|
||||||
BASE_API = process.env.VUE_APP_BASE_API;
|
BASE_API = process.env.VUE_APP_BASE_API;
|
||||||
|
Loading…
Reference in New Issue
Block a user