修改三维仿真停车点
This commit is contained in:
parent
a64e2e0880
commit
a87d551751
@ -52,7 +52,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|||||||
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.type == 'Simulation_DeviceStatus'){
|
if(event.data.type == 'Simulation_DeviceStatus'){
|
||||||
// console.log(event.data);
|
// console.log(event.data);
|
||||||
initall(event.data.body);
|
initall(event.data.body);
|
||||||
@ -137,6 +137,10 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|||||||
if (data.right == '1') { // 向右
|
if (data.right == '1') { // 向右
|
||||||
|
|
||||||
trainlisttest.list[code].progress = data.offset;
|
trainlisttest.list[code].progress = 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].lineleft.getPointAt(trainlisttest.list[code].progress);
|
let 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;
|
||||||
@ -157,6 +161,10 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|||||||
|
|
||||||
} else if (data.right == '0') { // 向左
|
} else if (data.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);
|
let 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;
|
||||||
@ -186,19 +194,20 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
|||||||
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;
|
||||||
|
trainlisttest.list[code].nextissection = rails.sectionrail[data.next].standTrack;
|
||||||
} else if (data.right == '0') { // 向左
|
} else if (data.right == '0') { // 向左
|
||||||
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;
|
||||||
|
trainlisttest.list[code].nextissection = rails.sectionrail[data.next].standTrack;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(data.speed == 0){
|
if(data.speed == 0){
|
||||||
trainlisttest.list[code].speeds = data.speed;
|
trainlisttest.list[code].speeds = data.speed;
|
||||||
trainlisttest.list[code].speeds = 0;
|
trainlisttest.list[code].speeds = 0;
|
||||||
|
trainlisttest.list[code].statsstop = 0;
|
||||||
}else{
|
}else{
|
||||||
// console.log(data.speed);
|
// console.log(data.speed);
|
||||||
// console.log(trainlisttest.list[code]);
|
// console.log(trainlisttest.list[code]);
|
||||||
|
@ -67,7 +67,15 @@ export function UpdateTrainNew(camera,traindata){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
trainmodel.progress += trainmodel.speeds;
|
if(trainmodel.statsstop == 0){
|
||||||
|
if((1-trainmodel.progress) > 0.95){
|
||||||
|
|
||||||
|
trainmodel.progress += trainmodel.speeds;
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
trainmodel.progress += trainmodel.speeds;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +127,13 @@ export function UpdateTrainNew(camera,traindata){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
trainmodel.progress += trainmodel.speeds;
|
if(trainmodel.statsstop == 0){
|
||||||
|
if(trainmodel.progress < 0.95){
|
||||||
|
trainmodel.progress += trainmodel.speeds;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
trainmodel.progress += trainmodel.speeds;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -129,7 +143,14 @@ export function UpdateTrainNew(camera,traindata){
|
|||||||
trainmodel.len = trainmodel.nextlen;
|
trainmodel.len = trainmodel.nextlen;
|
||||||
if(trainmodel.nextcode){
|
if(trainmodel.nextcode){
|
||||||
trainmodel.nowcode = trainmodel.nextcode;
|
trainmodel.nowcode = trainmodel.nextcode;
|
||||||
|
trainmodel.isstandsection = trainmodel.nextissection;
|
||||||
|
if(trainmodel.isstandsection){
|
||||||
|
trainmodel.statsstop = 0;
|
||||||
|
}else{
|
||||||
|
trainmodel.statsstop = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
trainmodel.speeds = parseFloat(trainmodel.speed*10/36/25/trainmodel.len);
|
trainmodel.speeds = parseFloat(trainmodel.speed*10/36/25/trainmodel.len);
|
||||||
trainmodel.curve = trainmodel.nextcurve;
|
trainmodel.curve = trainmodel.nextcurve;
|
||||||
trainmodel.nextcurve = null;
|
trainmodel.nextcurve = null;
|
||||||
|
@ -145,6 +145,7 @@ export function RailListN(){
|
|||||||
//
|
//
|
||||||
|
|
||||||
for(let i=0;i<section.length;i++){
|
for(let i=0;i<section.length;i++){
|
||||||
|
|
||||||
scope.sectionrail[section[i].code].lineleft = new THREE.CatmullRomCurve3(scope.sectionrail[section[i].code].points);
|
scope.sectionrail[section[i].code].lineleft = new THREE.CatmullRomCurve3(scope.sectionrail[section[i].code].points);
|
||||||
scope.sectionrail[section[i].code].lineleft.curveType = "centripetal";
|
scope.sectionrail[section[i].code].lineleft.curveType = "centripetal";
|
||||||
// scope.sectionrail[section[i].code].lineleft.tension = 0.2;
|
// scope.sectionrail[section[i].code].lineleft.tension = 0.2;
|
||||||
@ -156,6 +157,12 @@ export function RailListN(){
|
|||||||
rightpoints.reverse();
|
rightpoints.reverse();
|
||||||
scope.sectionrail[section[i].code].lineright = new THREE.CatmullRomCurve3(rightpoints);
|
scope.sectionrail[section[i].code].lineright = new THREE.CatmullRomCurve3(rightpoints);
|
||||||
scope.sectionrail[section[i].code].lineright.curveType = "centripetal";
|
scope.sectionrail[section[i].code].lineright.curveType = "centripetal";
|
||||||
|
|
||||||
|
if(section[i].standTrack == true){
|
||||||
|
scope.sectionrail[section[i].code].standTrack = true;
|
||||||
|
}else{
|
||||||
|
scope.sectionrail[section[i].code].standTrack = false;
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// for(let n=0,nm=scope.sectionrail[section[i].code].lineleft.points.length;n<nm;n++){
|
// for(let n=0,nm=scope.sectionrail[section[i].code].lineleft.points.length;n<nm;n++){
|
||||||
// var geometry = new THREE.CircleGeometry( 0.05, 16 );
|
// var geometry = new THREE.CircleGeometry( 0.05, 16 );
|
||||||
|
@ -182,6 +182,7 @@ export function TrainListN() {
|
|||||||
newmesh.speeds = 0;
|
newmesh.speeds = 0;
|
||||||
newmesh.progress = null;
|
newmesh.progress = null;
|
||||||
newmesh.startmark = 0;
|
newmesh.startmark = 0;
|
||||||
|
newmesh.statsstop = 0;
|
||||||
|
|
||||||
|
|
||||||
scope.list[data[i].code] = newmesh;
|
scope.list[data[i].code] = newmesh;
|
||||||
|
@ -698,7 +698,7 @@ function timedCount(){
|
|||||||
function callback(Response) {
|
function callback(Response) {
|
||||||
|
|
||||||
data = JSON.parse(Response.body);
|
data = JSON.parse(Response.body);
|
||||||
console.log(data);
|
// console.log(data);
|
||||||
if(data.type == 'TrainRun_3D'){
|
if(data.type == 'TrainRun_3D'){
|
||||||
for (let i=0,leni = data.body.length; i<leni; i++) {
|
for (let i=0,leni = data.body.length; i<leni; i++) {
|
||||||
data.body[i].type = "TRAIN";
|
data.body[i].type = "TRAIN";
|
||||||
|
Loading…
Reference in New Issue
Block a user