This commit is contained in:
joylink_cuiweidong 2020-06-01 17:38:44 +08:00
commit 8eefd599b5
20 changed files with 1690 additions and 1473 deletions

View File

@ -154,6 +154,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
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";
// datanew();
// scope.jsonwebwork = new Worker("../../static/workertest/jsonworker.js"); // scope.jsonwebwork = new Worker("../../static/workertest/jsonworker.js");
// scope.Subscribe = new Jlmap3dSubscribe(scope,routegroup,scope.jsonwebwork); // scope.Subscribe = new Jlmap3dSubscribe(scope,routegroup,scope.jsonwebwork);
// scope.Subscribe.socketon(scope.Subscribe.topic); // scope.Subscribe.socketon(scope.Subscribe.topic);
@ -165,7 +166,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
if(trainlisttest){ if(trainlisttest){
if(trainlisttest.group){ if(trainlisttest.group){
if(trainlisttest.group.children[0]){ if(trainlisttest.group.children[0]){
console.log(trainlisttest.group.children[0].name); // console.log(trainlisttest.group.children[0].name);
updatemmi.updatedrivingcode(trainlisttest.group.children[0].name); updatemmi.updatedrivingcode(trainlisttest.group.children[0].name);
scope.Subscribe.initdrivercode(trainlisttest.group.children[0].name); scope.Subscribe.initdrivercode(trainlisttest.group.children[0].name);
for(let k in rails.switchrail){ for(let k in rails.switchrail){

View File

@ -100,6 +100,7 @@ export function Jl3dDriving(mixers, updatemmi, sound, translation, routegroup) {
// //
// } // }
// console.log(data); // console.log(data);
// console.log(data);
switch (data.type) { switch (data.type) {
case 'Simulation_Driver_Change': case 'Simulation_Driver_Change':
@ -113,6 +114,7 @@ export function Jl3dDriving(mixers, updatemmi, sound, translation, routegroup) {
updatemmi.updatedrivingcode( data.body.code); updatemmi.updatedrivingcode( data.body.code);
break; break;
case 'Simulation_TrainSpeed': case 'Simulation_TrainSpeed':
trainspeed(data); trainspeed(data);
break; break;
case 'SJL3D_TrainStatus': case 'SJL3D_TrainStatus':

View File

@ -98,6 +98,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,sta
// console.log(data); // console.log(data);
if(data.type == "Train_Position"){ if(data.type == "Train_Position"){
// stats.update(); // stats.update();
trainrun(data.body); trainrun(data.body);
return; return;
} }

View File

@ -48,6 +48,22 @@ var Staticmodel = {
picUrl: "", picUrl: "",
assetUrl: "../../static/model/passflow/monitor.FBX" assetUrl: "../../static/model/passflow/monitor.FBX"
}, },
train: {
id: "7",
name: "列车",
deviceType: "train",
type: "hrb",
picUrl: "",
assetUrl: "../../static/model/train/train.FBX"
},
section: {
id: "8",
name: "区段",
deviceType: "section",
type: "hrb",
picUrl: "",
assetUrl: "../../static/model/passflow/section.FBX"
},
} }

View File

@ -12,6 +12,8 @@ import { Pathfinding } from '@/jlmap3d/jl3dpassflow/utils/Pathfinding.js';
// const Pathfinding = window.threePathfinding.Pathfinding; // const Pathfinding = window.threePathfinding.Pathfinding;
import { ZoneManager } from '@/jlmap3d/jl3dpassflow/model/zonemanager.js'; import { ZoneManager } from '@/jlmap3d/jl3dpassflow/model/zonemanager.js';
import { getPublishMapVersion, getPublishMapDetail,getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata';
import StompClient from '@/utils/sock'; import StompClient from '@/utils/sock';
import { Loading } from 'element-ui'; import { Loading } from 'element-ui';
@ -38,7 +40,6 @@ let originhuman1 = null;
let originhuman2 = null; let originhuman2 = null;
let originanima1 = null; let originanima1 = null;
let originanima2 = null; let originanima2 = null;
let moveanimatelist = [];
let zhajiin = []; let zhajiin = [];
let zhajiout = []; let zhajiout = [];
@ -144,7 +145,7 @@ var views = [
]; ];
export function Jl3dpassflow(dom) { export function Jl3dpassflow(dom,skinCode) {
var scope = this; var scope = this;
this.dom = dom; this.dom = dom;
@ -218,10 +219,6 @@ export function Jl3dpassflow(dom) {
this.selectmodel = null; this.selectmodel = null;
const Color = {
GROUND: new THREE.Color( 0x606060 ).convertGammaToLinear( 2.2 ).getHex(),
NAVMESH: new THREE.Color( 0xFFFFFF ).convertGammaToLinear( 2.2 ).getHex(),
};
const ZONE = 'level'; const ZONE = 'level';
const SPEED = 10; const SPEED = 10;
@ -233,12 +230,35 @@ export function Jl3dpassflow(dom) {
let groupID, path; let groupID, path;
const playerPosition = new THREE.Vector3( -3.5, 0.5, 5.5 ); let playerPosition = new THREE.Vector3( -3.5, 0.5, 5.5 );
const targetPosition = new THREE.Vector3(); let targetPosition = new THREE.Vector3();
let pathfinder = new THREE.Pathfinding();
let mouse = new THREE.Vector2();
let raycaster = new THREE.Raycaster();
getPublishMapDetail(skinCode).then(netdata => {
// let assetsdata = JSON.parse(netdata.data.sections);
console.log(netdata);
// if(assetsdata.link){
// scope.datatype = "old";
// scope.jsonwebwork = new Worker("../../static/workertest/jsonworker.js");
// scope.Subscribe = new Jlmap3dSubscribe(scope,routegroup,scope.jsonwebwork);
// scope.Subscribe.socketon(scope.Subscribe.topic);
// SimulationLoad(mapnetdata,scope,netdata.data,mapdata,camera,controls,scenesimulation,storemod);
//
// }else{
// scope.datatype = "new";
// scope.jsonwebworknew = new Worker("../../static/workertest/jsonworkernew.js");
// scope.Subscribe = new Jlmap3dSubscribeNew(scope,routegroup,scope.jsonwebworknew);
// scope.Subscribe.socketon(scope.Subscribe.topic);
// SimulationLoadNew(mapnetdata,scope,netdata.data,mapdata,camera,controls,scenesimulation,storemod);
// }
});
const pathfinder = new THREE.Pathfinding();
const mouse = new THREE.Vector2();
const raycaster = new THREE.Raycaster();
var loader = new THREE.OBJLoader(); var loader = new THREE.OBJLoader();
@ -250,9 +270,9 @@ export function Jl3dpassflow(dom) {
function ( object ) { function ( object ) {
console.time('createZone()'); // console.time('createZone()');
const zone = THREE.Pathfinding.createZone(object.children[0].geometry); const zone = THREE.Pathfinding.createZone(object.children[0].geometry);
console.timeEnd('createZone()'); // console.timeEnd('createZone()');
pathfinder.setZoneData( ZONE, zone ); pathfinder.setZoneData( ZONE, zone );
@ -301,7 +321,6 @@ export function Jl3dpassflow(dom) {
console.log(intersects[0].point); console.log(intersects[0].point);
targetPosition.copy( intersects[0].point ); targetPosition.copy( intersects[0].point );
originhuman1.position.copy( playerPosition );
// Teleport on ctrl/cmd click or RMB. // Teleport on ctrl/cmd click or RMB.
if (event.metaKey || event.ctrlKey || event.button === 2) { if (event.metaKey || event.ctrlKey || event.button === 2) {
@ -320,28 +339,14 @@ export function Jl3dpassflow(dom) {
points.push(path[i]); points.push(path[i]);
} }
originhuman1.curve = new THREE.CatmullRomCurve3(points); originhuman1.curve = new THREE.CatmullRomCurve3(points);
originhuman1.curve.curvrtype = "chordal"; originhuman1.curve.curvrtype = "centripetal";
originhuman1.progress = 0; originhuman1.progress = 0;
console.log(path); console.log(path);
} }
function tick ( dt ) { function tick ( dt ) {
// if ( !level || !(path||[]).length ) return
//
// let targetPosition = path[ 0 ];
// const velocity = targetPosition.clone().sub( playerPosition );
//
// if (velocity.lengthSq() > 0.05 * 0.05) {
// velocity.normalize();
// // Move player to target
// playerPosition.add( velocity.multiplyScalar( dt * SPEED ) );
// // originhuman1.lookAt();
// originhuman1.position.copy( playerPosition );
// } else {
// // Remove node from the path we calculated
// path.shift();
// }
if(originhuman1.curve){ if(originhuman1.curve){
if(originhuman1.progress<1){ if(originhuman1.progress<1){
let point = originhuman1.curve.getPointAt(originhuman1.progress); let point = originhuman1.curve.getPointAt(originhuman1.progress);
@ -383,7 +388,8 @@ export function Jl3dpassflow(dom) {
initstationanimation(scope.modelmanager.station.mesh); initstationanimation(scope.modelmanager.station.mesh);
initzhajiinaimation(scope.modelmanager.zhajiin.mesh); initzhajiinaimation(scope.modelmanager.zhajiin.mesh);
initzhajioutanimation(scope.modelmanager.zhajiout.mesh); initzhajioutanimation(scope.modelmanager.zhajiout.mesh);
scene.add(scope.modelmanager.section.mesh);
// scene.add(scope.modelmanager.train.mesh);
level = scope.modelmanager.station.mesh; level = scope.modelmanager.station.mesh;
monitor = scope.modelmanager.monitor.mesh; monitor = scope.modelmanager.monitor.mesh;
@ -415,45 +421,6 @@ export function Jl3dpassflow(dom) {
scene.add(humanlist); scene.add(humanlist);
scene.add(scope.modelmanager.man1.mesh); scene.add(scope.modelmanager.man1.mesh);
for(let i=0;i<200;i++){
var mantype = Math.floor(Math.random()*(3-1+1))+1;
let newhuman;
if(mantype == 1){
newhuman = THREE.SkeletonUtils.clone( originhuman1 );
newhuman.animations = [];
newhuman.animations.push(originanima1.clone());
}else{
newhuman = THREE.SkeletonUtils.clone( originhuman2 );
newhuman.animations = [];
newhuman.animations.push(originanima2.clone());
}
// zhajiin[j].waiting = 1;
let mixer = new THREE.AnimationMixer( newhuman );
mixer.runplay = false;
let action = mixer.clipAction( newhuman.animations[ 0 ] );
newhuman.status = 1;
newhuman.stage = 0;
let newone = {
id:i,
mesh:newhuman,
direct:null,
doorstatus:null,
doors:null,
action:action,
mixer:mixer,
runrail:null
};
humans.push(newone);
mixers.push(mixer);
humanlist.add(newhuman);
}
} }
@ -466,8 +433,8 @@ export function Jl3dpassflow(dom) {
clearInterval(checkobject); clearInterval(checkobject);
//进站控制 //进站控制
startWorker(); startWorker();
// stationwebwork.postMessage("on"); stationwebwork.postMessage("on");
// passerwebwork.postMessage("on"); passerwebwork.postMessage("on");
}; };
},1000); },1000);
@ -488,123 +455,40 @@ export function Jl3dpassflow(dom) {
} }
} }
function initpasser(){
for(let i=0;i<3;i++){
newhumancreate(stationzon.getinitposition("enter1"),0);
}
for(let i=0;i<3;i++){
newhumancreate(stationzon.getinitposition("enter2"),0);
}
for(let i=0;i<3;i++){
newhumancreate(stationzon.getinitposition("security"),1);
}
for(let i=0;i<2;i++){
newhumancreate(stationzon.getinitposition("entergate"),2);
}
for(let i=0;i<6;i++){
newhumancreate(stationzon.getinitposition("standtop"),3);
}
for(let i=0;i<6;i++){
newhumancreate(stationzon.getinitposition("standdown"),3);
}
for(let i=0;i<5;i++){
newhumancreate(stationzon.getinitposition("exitgate"),4);
}
console.log(humanlist);
}
function startWorker(){ function startWorker(){
initpasser();
passerwebwork.onmessage = function (event) { passerwebwork.onmessage = function (event) {
if(humans){
// console.log(humans.length);
// console.log(humans.length);
for(let i=0;i<humans.length;i++){
// console.log(humans[i]);
if(humans[i].status == 0){
if(humans[i].stage == 1){
let points = [];
points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z));
points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z-5));
zhajicontrol("in",humans[i].doors);
moveanimateinit(humans[i],i,points,i,0.02);
}
if(humans[i].stage == 2){
let points = [];
points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z));
points.push(new THREE.Vector3(12,10,12.9));
points.push(new THREE.Vector3(28,1.7,12.9));
points.push(new THREE.Vector3(34,1.7,12.9));
//1--left
//2-- right
if(humans[i].direct == 1){
points.push(new THREE.Vector3(34,1.7,16));
for(let j =0;j<22;j++){
if(stationleft[j].waiting == 0){
points.push(new THREE.Vector3(51-j*5,1.7,22));
points.push(new THREE.Vector3(51-j*5,1.7,23));
humans[i].doors = j;
stationright[j].waiting = 1;
moveanimateinit(humans[i],i,points,i,0.002);
j =22;
}
}
}else{
points.push(new THREE.Vector3(34,1.7,16));
points.push(new THREE.Vector3(14,1.7,17));
points.push(new THREE.Vector3(14,1.7,3));
for(let j =0;j<22;j++){
if(stationright[j].waiting == 0){
points.push(new THREE.Vector3(51-j*5,1.7,3));
points.push(new THREE.Vector3(51-j*5,1.7,2));
humans[i].doors = j;
stationright[j].waiting = 1;
moveanimateinit(humans[i],i,points,i,0.002);
j =22;
}
}
}
moveanimateinit(humans[i],i,points,i,0.002);
}
//出站
if(humans[i].stage == 3){
let points = [];
points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z));
if(humans[i].doors<11){
if(humans[i].direct == 1){
points.push(new THREE.Vector3(10,1.7,17));
}else{
points.push(new THREE.Vector3(8,1.7,5));
}
points.push(new THREE.Vector3(8,1.7,13));
points.push(new THREE.Vector3(5,1.7,13));
points.push(new THREE.Vector3(-4,6,13));
}else{
if(humans[i].direct == 1){
points.push(new THREE.Vector3(-19,1.7,17));
}else{
points.push(new THREE.Vector3(-18,1.7,6.4));
}
points.push(new THREE.Vector3(-18,1.7,13));
points.push(new THREE.Vector3(-12,1.7,13));
points.push(new THREE.Vector3(-7,6.8,12));
}
points.push(new THREE.Vector3(-5,10,4));
points.push(new THREE.Vector3(14,10,3));
var j = Math.floor(Math.random()*(4-1+1))+1;
points.push(new THREE.Vector3(19,10,-2+j*1.4));
humans[i].doors = j;
moveanimateinit(humans[i],i,points,i,0.002);
}
if(humans[i].stage == 4){
let points = [];
points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z));
points.push(new THREE.Vector3(humans[i].mesh.position.x+4,humans[i].mesh.position.y,humans[i].mesh.position.z));
if(humans[i].direct == 1){
points.push(new THREE.Vector3(33,10,25));
}else{
points.push(new THREE.Vector3(33.5,10,-5));
}
zhajicontrol("out",humans[i].doors);
moveanimateinit(humans[i],i,points,i,0.002);
}
}
}
}
moveanimateupdate(); moveanimateupdate();
// delta = clock.getDelta(); passerai();
// tick(delta);
if(mixers[i]._actions[0].isRunning()){ delta = clock.getDelta();
mixers[i].update( delta ); // tick(delta);
}
for(let i=mixers.length-1;i>=0;i--){ for(let i=mixers.length-1;i>=0;i--){
if(mixers[i]._actions[0].isRunning()){ if(mixers[i]._actions[0].isRunning()){
@ -615,9 +499,17 @@ export function Jl3dpassflow(dom) {
}; };
stationwebwork.onmessage = function (event) { stationwebwork.onmessage = function (event) {
// console.log("stationwebwork"); // console.log("stationwebwork");
if(humans.length<200){ // if(humans.length<200){
newhumancreate(); var direct = Math.floor(Math.random()*(3-1+1))+1;
//1--top
//2-- down
if(direct == 1){
newhumancreate(stationzon.getzoneposition("enter1"),0);
}else{
newhumancreate(stationzon.getzoneposition("enter2"),0);
} }
// }
}; };
} }
@ -632,125 +524,272 @@ export function Jl3dpassflow(dom) {
monitorrender(); monitorrender();
} }
delta = clock.getDelta(); // delta = clock.getDelta();
tick(delta); // tick(delta);
requestAnimationFrame(animate); requestAnimationFrame(animate);
} }
function moveanimateinit(model,name,points,index,speed){ function passerai(){
for(let i=0;i<humanlist.children.length;i++){
// console.log(humans[i]);
if(humanlist.children[i].status == 0){
if(humanlist.children[i].stage == 0){
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
groupID = pathfinder.getGroup( ZONE, points[0] );
targetPosition = stationzon.getzoneposition("security");
path = pathfinder.findPath( points[0], targetPosition, ZONE, groupID );
for(let i=0;i<path.length;i++){
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
}
moveanimateinit(humanlist.children[i],i,points,i);
// console.log(path);
}
if(humanlist.children[i].stage == 1){
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
groupID = pathfinder.getGroup( ZONE, points[0] );
targetPosition = stationzon.getzoneposition("entergate");
path = pathfinder.findPath( points[0], targetPosition, ZONE, groupID );
for(let i=0;i<path.length;i++){
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
}
moveanimateinit(humanlist.children[i],i,points,i);
}
if(humanlist.children[i].stage == 2){
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z-5));
// zhajicontrol("in",humans[i].doors);
moveanimateinit(humanlist.children[i],i,points,i);
}
if(humanlist.children[i].stage == 3){
var direct = Math.floor(Math.random()*(3-1+1))+1;
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
//1--top
//2-- down
if(direct == 1){
groupID = pathfinder.getGroup( ZONE, points[0] );
targetPosition = stationzon.getzoneposition("standtop");
path = pathfinder.findPath( points[0], targetPosition, ZONE, groupID );
}else{
groupID = pathfinder.getGroup( ZONE, points[0] );
targetPosition = stationzon.getzoneposition("standdown");
path = pathfinder.findPath( points[0], targetPosition, ZONE, groupID );
}
if(path == null){
console.log(points);
console.log(path);
}
for(let i=0;i<path.length;i++){
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
}
moveanimateinit(humanlist.children[i],i,points,i);
}
// //出站
// if(humanlist.children[i].stage == 3){
// // let points = [];
// // points.push(new THREE.Vector3(humans[i].mesh.position.x,humans[i].mesh.position.y,humans[i].mesh.position.z));
// // if(humans[i].doors<11){
// // if(humans[i].direct == 1){
// // points.push(new THREE.Vector3(10,1.7,17));
// // }else{
// // points.push(new THREE.Vector3(8,1.7,5));
// // }
// // points.push(new THREE.Vector3(8,1.7,13));
// // points.push(new THREE.Vector3(5,1.7,13));
// // points.push(new THREE.Vector3(-4,6,13));
// // }else{
// // if(humans[i].direct == 1){
// // points.push(new THREE.Vector3(-19,1.7,17));
// // }else{
// // points.push(new THREE.Vector3(-18,1.7,6.4));
// // }
// // points.push(new THREE.Vector3(-18,1.7,13));
// // points.push(new THREE.Vector3(-12,1.7,13));
// // points.push(new THREE.Vector3(-7,6.8,12));
// // }
// // points.push(new THREE.Vector3(-5,10,4));
// // points.push(new THREE.Vector3(14,10,3));
// // var j = Math.floor(Math.random()*(4-1+1))+1;
// // points.push(new THREE.Vector3(19,10,-2+j*1.4));
// //
// // humans[i].doors = j;
// // moveanimateinit(humans[i],i,points,i,0.002);
// }
if(humanlist.children[i].stage == 4){
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
groupID = pathfinder.getGroup( ZONE, points[0] );
targetPosition = stationzon.getzoneposition("exitgate");
path = pathfinder.findPath( points[0], targetPosition, ZONE, groupID );
if(path == null){
console.log(points[0]);
console.log(targetPosition);
}
for(let i=0;i<path.length;i++){
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
}
moveanimateinit(humanlist.children[i],i,points,i);
}
if(humanlist.children[i].stage == 5){
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
points.push(new THREE.Vector3(humanlist.children[i].position.x+5,humanlist.children[i].position.y,humanlist.children[i].position.z));
// zhajicontrol("in",humans[i].doors);
moveanimateinit(humanlist.children[i],i,points,i);
}
if(humanlist.children[i].stage == 6){
var direct = Math.floor(Math.random()*(3-1+1))+1;
let points = [];
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
//1--top
//2-- down
if(direct == 1){
groupID = pathfinder.getGroup( ZONE, points[0] );
targetPosition = stationzon.getzoneposition("exit1");
path = pathfinder.findPath( points[0], targetPosition, ZONE, groupID );
}else{
groupID = pathfinder.getGroup( ZONE, points[0] );
targetPosition = stationzon.getzoneposition("exit2");
path = pathfinder.findPath( points[0], targetPosition, ZONE, groupID );
}
if(path == null){
console.log(points[0]);
console.log(targetPosition);
}
for(let i=0;i<path.length;i++){
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
}
moveanimateinit(humanlist.children[i],i,points,i);
}
}
}
}
function moveanimateinit(model,name,points,index){
model.status = 1;
let curve = new THREE.CatmullRomCurve3(points); let curve = new THREE.CatmullRomCurve3(points);
curve.curvrtype = "chordal"; curve.curvrtype = "centripetal";
// curve.getLength(); // curve.getLength();
// curve动画轨迹 // curve动画轨迹
// progress动画进度 // progress动画进度
// enable当前动画开关 // enable当前动画开关
// speed动画速度 // speed动画速度
// console.log(curve); // console.log(curve);
let animate = {
name:index, model.action.play();
index:index, model.progress = 0;
curve:curve, model.runrail = curve;
progress:0, model.speed = 0.1/curve.getLength();
directchange:false,
enable:true,
status:"start",
speed:speed,
};
humans[index].runrail = animate;
humans[index].status = 1;
humans[index].action.play();
humans[index].mixer.runplay = true;
moveanimatelist.push(animate);
} }
function moveanimateupdate(){ function moveanimateupdate(){
if(humans.length>0){ for(let i=0;i<humanlist.children.length;i++){
for(let i=0;i<humans.length;i++){ if(humanlist.children[i].status == 1){
if(humans[i].runrail.enable){ if(humanlist.children[i].progress>=1){
// 动画播放结束 // let point = humans[i].runrail.curve.getPointAt(1);
if(humans[i].runrail.progress>=1){ //更新模型坐标
// let point = humans[i].runrail.curve.getPointAt(1); if(humanlist.children[i].status == 1){
//更新模型坐标 // humanlist.children[i].runrail.enable = false;
// console.log(moveanimatelist);
if(humans[i].status == 1){
humans[i].runrail.enable = false;
humans[i].runrail.progress = 1;
humans[i].mixer.runplay = false;
humans[i].action.stop();
humans[i].status = 0;
if(humans[i].stage == 4){
humanlist.remove(humans[i].mesh);
// humans.splice(i,1);
}
if(humans[i].stage == 3){
if(humans[i].direct == 1){
stationleft[humans[i].doors].waiting = 0;
}else{
stationright[humans[i].doors].waiting = 0;
}
humans[i].stage = 4;
}
if(humans[i].stage == 2){
humans[i].stage = 3;
}
if(humans[i].stage == 1){
humans[i].stage = 2; // if(humanlist.children[i].stage == 4){
//
// humanlist.remove(humanlist.children[i].mesh);
// // humans.splice(i,1);
// }
//
} humanlist.children[i].progress = 1;
// humanlist.children[i].mixer.runplay = false;
humanlist.children[i].action.stop();
humanlist.children[i].status = 0;
if(humans[i].stage == 0){ if(humanlist.children[i].stage == 6){
// console.log(humans[i].doors); humanlist.remove(humanlist.children[i]);
zhajiin[humans[i].doors].waiting = 0; // humanlist.children[i].stage = 7;
humans[i].stage = 1;
}
moveanimatelist.splice(i,1);
}
}else{
//根据动画进度获取动画轨迹上点
let point = humans[i].runrail.curve.getPointAt(humans[i].runrail.progress);
//更新模型坐标
humans[i].mesh.position.x = point.x;
humans[i].mesh.position.y = point.y;
humans[i].mesh.position.z = point.z;
if((humans[i].runrail.progress+0.001)<1){
let tangent = humans[i].runrail.curve.getPointAt(humans[i].runrail.progress+0.001);
humans[i].mesh.lookAt(new THREE.Vector3(tangent.x,humans[i].mesh.position.y,tangent.z));
}
humans[i].runrail.progress += humans[i].runrail.speed;
point = null;
}
}
} }
if(humanlist.children[i].stage == 5){
humanlist.children[i].stage = 6;
}
if(humanlist.children[i].stage == 4){
humanlist.children[i].stage = 5;
}
if(humanlist.children[i].stage == 3){
humanlist.children[i].stage = 4;
}
//
if(humanlist.children[i].stage == 2){
humanlist.children[i].stage = 3;
}
if(humanlist.children[i].stage == 1){
humanlist.children[i].stage = 2;
}
if(humanlist.children[i].stage == 0){
// // console.log(humans[i].doors);
// zhajiin[humanlist.children[i].doors].waiting = 0;
humanlist.children[i].stage = 1;
}
}
}else{
//根据动画进度获取动画轨迹上点
// console.log(i);
// console.log(humanlist.children[i].runrail);
// console.log(humanlist.children[i].progress);
let point = humanlist.children[i].runrail.getPointAt(humanlist.children[i].progress);
//更新模型坐标
humanlist.children[i].position.x = point.x;
humanlist.children[i].position.y = point.y;
humanlist.children[i].position.z = point.z;
if((humanlist.children[i].progress+0.001)<1){
let tangent = humanlist.children[i].runrail.getPointAt(humanlist.children[i].progress+0.001);
humanlist.children[i].lookAt(new THREE.Vector3(tangent.x,humanlist.children[i].position.y,tangent.z));
}
humanlist.children[i].progress += humanlist.children[i].speed;
point = null;
}
} }
} }
}
function newhumancreate(){ function newhumancreate(position,stage,){
var direct = Math.floor(Math.random()*(3-1+1))+1;
var mantype = Math.floor(Math.random()*(3-1+1))+1; var mantype = Math.floor(Math.random()*(3-1+1))+1;
// console.log(direct);
let points = [];
let newhuman; let newhuman;
if(mantype == 1){ if(mantype == 1){
newhuman = THREE.SkeletonUtils.clone( originhuman1 ); newhuman = THREE.SkeletonUtils.clone( originhuman1 );
@ -762,51 +801,21 @@ export function Jl3dpassflow(dom) {
newhuman.animations.push(originanima2.clone()); newhuman.animations.push(originanima2.clone());
} }
if(direct == 1|| direct == 2){
let testposition = stationzon.getzoneposition("enter1");
newhuman.position.set(32,10,25);
points.push(testposition);
points.push(new THREE.Vector3(26,10,21));
points.push(new THREE.Vector3(18,10,18));
}else{
let testposition = stationzon.getzoneposition("enter2");
newhuman.position.set(32,10,-5);
points.push(testposition);
points.push(new THREE.Vector3(26,10,12));
points.push(new THREE.Vector3(24,10,17));
points.push(new THREE.Vector3(18,10,18));
}
let j = Math.floor(Math.random()*(4-1+1))+1;
points.push(new THREE.Vector3(-0.5+j*1.4,10,18.5));
// zhajiin[j].waiting = 1;
let mixer = new THREE.AnimationMixer( newhuman ); let mixer = new THREE.AnimationMixer( newhuman );
mixer.runplay = false; newhuman.position.copy(position);
let action = mixer.clipAction( newhuman.animations[ 0 ] ); newhuman.status = 0;
var stationdirection = Math.floor(Math.random()*(2-1+1))+1; newhuman.stage = stage;
let newone = { newhuman.direct = null;
id:humans.length, newhuman.doorstatus = null;
mesh:newhuman, newhuman.doors = null;
status:1, newhuman.action = mixer.clipAction( newhuman.animations[ 0 ] );
stage:0, newhuman.mixer = mixer;
direct:stationdirection, newhuman.runrail = null;
doorstatus:null, newhuman.speed = 0;
doors:j,
action:action,
mixer:mixer,
runrail:null
};
humans.push(newone);
mixers.push(mixer); mixers.push(mixer);
humanlist.add(newhuman); humanlist.add(newhuman);
moveanimateinit(newone,humans.length,points,newone.id,0.002);
// return newone;
} }
function initstationanimation(object){ function initstationanimation(object){

View File

@ -44,6 +44,22 @@ export function ModelManager(){
action:null action:null
}; };
this.train = {
code:null,
screenDoorOpenStatus:"01",
mesh:null,
action:null
};
this.section = {
code:null,
screenDoorOpenStatus:"01",
mesh:null,
action:null
};
this.loadpromise = function (data,mixers){ this.loadpromise = function (data,mixers){
let initlist = []; let initlist = [];
initlist.push(fbxpromise(data.man1,mixers,scope.man1)); initlist.push(fbxpromise(data.man1,mixers,scope.man1));
@ -52,6 +68,8 @@ export function ModelManager(){
initlist.push(fbxpromise(data.zhajiin,mixers,scope.zhajiin)); initlist.push(fbxpromise(data.zhajiin,mixers,scope.zhajiin));
initlist.push(fbxpromise(data.zhajiout,mixers,scope.zhajiout)); initlist.push(fbxpromise(data.zhajiout,mixers,scope.zhajiout));
initlist.push(fbxpromise(data.monitor,mixers,scope.monitor)); initlist.push(fbxpromise(data.monitor,mixers,scope.monitor));
initlist.push(fbxpromise(data.train,mixers,scope.train));
initlist.push(fbxpromise(data.section,mixers,scope.section));
return new Promise(function(resolve, reject){ return new Promise(function(resolve, reject){

View File

@ -5,6 +5,7 @@ let enter1 = {
name : "enter1", name : "enter1",
type : "normal", type : "normal",
stage : "0", stage : "0",
randompoint : new THREE.Vector3(26.6,9.8,-2.7),
railpoints : [ railpoints : [
new THREE.Vector3(34,9.8,-6), new THREE.Vector3(34,9.8,-6),
new THREE.Vector3(32,9.8,-6) new THREE.Vector3(32,9.8,-6)
@ -16,9 +17,10 @@ let enter2 = {
name : "enter2", name : "enter2",
type : "normal", type : "normal",
stage : "0", stage : "0",
randompoint : new THREE.Vector3(27,9.8,16),
railpoints : [ railpoints : [
new THREE.Vector3(35,9.8,31.5), new THREE.Vector3(34,9.8,31.5),
new THREE.Vector3(31,9.8,31.5) new THREE.Vector3(32,9.8,31.5)
] ]
}; };
@ -27,6 +29,7 @@ let security = {
name : "security", name : "security",
type : "device", type : "device",
stage : "1", stage : "1",
randompoint : new THREE.Vector3(8.8,9.8,18),
railpoints : [ railpoints : [
new THREE.Vector3(20.5,9.8,18), new THREE.Vector3(20.5,9.8,18),
new THREE.Vector3(21,9.8,21) new THREE.Vector3(21,9.8,21)
@ -38,12 +41,13 @@ let entergate = {
name : "entergate", name : "entergate",
type : "device", type : "device",
stage : "2", stage : "2",
randompoint : new THREE.Vector3(2.3,9.8,13),
railpoints : [ railpoints : [
new THREE.Vector3(6.3,9.8,17.4), new THREE.Vector3(6.3,9.8,18.1),
new THREE.Vector3(4.8,9.8,17.4), new THREE.Vector3(4.8,9.8,18.1),
new THREE.Vector3(3.4,9.8,17.4), new THREE.Vector3(3.4,9.8,18.1),
new THREE.Vector3(2.1,9.8,17.4), new THREE.Vector3(2.1,9.8,18.1),
new THREE.Vector3(0.7,9.8,17.4) new THREE.Vector3(0.7,9.8,18.1)
] ]
}; };
@ -52,6 +56,7 @@ let standtop = {
name : "standtop", name : "standtop",
type : "stand", type : "stand",
stage : "3", stage : "3",
randompoint : new THREE.Vector3(-64,1.77,0.38),
railpoints : [ railpoints : [
new THREE.Vector3(52.1,1.77,-1.8), new THREE.Vector3(52.1,1.77,-1.8),
new THREE.Vector3(-63.5,1.77,-1.8) new THREE.Vector3(-63.5,1.77,-1.8)
@ -63,6 +68,7 @@ let standdown = {
name : "standdown", name : "standdown",
type : "stand", type : "stand",
stage : "3", stage : "3",
randompoint : new THREE.Vector3(-64,1.77,21),
railpoints : [ railpoints : [
new THREE.Vector3(52.1,1.77,24), new THREE.Vector3(52.1,1.77,24),
new THREE.Vector3(-64,1.77,24) new THREE.Vector3(-64,1.77,24)
@ -74,12 +80,13 @@ let exitgate = {
name : "exitgate", name : "exitgate",
type : "device", type : "device",
stage : "5", stage : "5",
randompoint : new THREE.Vector3(-16,9.8,-0.4),
railpoints : [ railpoints : [
new THREE.Vector3(18.8,9.8,-0.27), new THREE.Vector3(18,9.8,-0.27),
new THREE.Vector3(18.8,9.8,1.18), new THREE.Vector3(18,9.8,1.18),
new THREE.Vector3(18.8,9.8,2.64), new THREE.Vector3(18,9.8,2.64),
new THREE.Vector3(18.8,9.8,4.1), new THREE.Vector3(18,9.8,4.1),
new THREE.Vector3(18.8,9.8,5.4) new THREE.Vector3(18,9.8,5.4)
] ]
}; };
@ -88,6 +95,7 @@ let exit1 = {
name : "exit1", name : "exit1",
type : "normal", type : "normal",
stage : "6", stage : "6",
randompoint : new THREE.Vector3(),
railpoints : [ railpoints : [
new THREE.Vector3(28.2,9.8,-7), new THREE.Vector3(28.2,9.8,-7),
new THREE.Vector3(30.5,9.8,-7.4) new THREE.Vector3(30.5,9.8,-7.4)
@ -99,9 +107,10 @@ let exit2 = {
name : "exit2", name : "exit2",
type : "normal", type : "normal",
stage : "6", stage : "6",
randompoint : new THREE.Vector3(),
railpoints : [ railpoints : [
new THREE.Vector3(28.3,9.8,28.8), new THREE.Vector3(28.3,9.8,28),
new THREE.Vector3(31.2,9.8,28.8) new THREE.Vector3(30.2,9.8,28)
] ]
}; };
@ -127,6 +136,44 @@ export function ZoneManager() {
scope.list[exit2.name] = new ZoneModel(exit2); scope.list[exit2.name] = new ZoneModel(exit2);
} }
this.getinitposition = function(name){
// console.log(scope.list[name]);
let randompoint = new THREE.Vector3(0,scope.list[name].randompoint.y,0);
// console.log(randompoint);
if(name == "enter1"){
randompoint.x = scope.list[name].randompoint.x + Math.random()*8;
randompoint.z = scope.list[name].randompoint.z + Math.random()*8;
}
if(name == "enter2"){
randompoint.x = scope.list[name].randompoint.x + Math.random()*8;
randompoint.z = scope.list[name].randompoint.z + Math.random()*8;
}
if(name == "security"){
randompoint.x = scope.list[name].randompoint.x + Math.random()*10;
randompoint.z = scope.list[name].randompoint.z + Math.random()*2;
}
if(name == "entergate"){
randompoint.x = scope.list[name].randompoint.x + Math.random()*5;
randompoint.z = scope.list[name].randompoint.z - Math.random()*2;
}
if(name == "standtop"){
randompoint.x = scope.list[name].randompoint.x + Math.random()*100;
randompoint.z = scope.list[name].randompoint.z + Math.random();
}
if(name == "standdown"){
randompoint.x = scope.list[name].randompoint.x + Math.random()*100;
randompoint.z = scope.list[name].randompoint.z ;
}
if(name == "exitgate"){
randompoint.x = scope.list[name].randompoint.x + Math.random()*30;
randompoint.z = scope.list[name].randompoint.z + Math.random()*5;
}
// let random = Math.random();
return randompoint;
}
this.getzoneposition = function(name){ this.getzoneposition = function(name){
// let random = Math.random(); // let random = Math.random();
let position = scope.list[name].railline.getPointAt(Math.random()); let position = scope.list[name].railline.getPointAt(Math.random());

View File

@ -7,6 +7,7 @@ export function ZoneModel(data) {
this.type = data.type; this.type = data.type;
this.stage = data.stage; this.stage = data.stage;
this.status = 0; this.status = 0;
this.randompoint = data.randompoint;
//轨迹点 //轨迹点
this.railpoints = data.railpoints; this.railpoints = data.railpoints;

View File

@ -66,12 +66,12 @@ export function Jlmap3dSubscribe(jlmap3d,routegroup,jsonwebwork) {
// if(event.data.type == 'Simulation_DeviceStatus'){ // if(event.data.type == 'Simulation_DeviceStatus'){
// devicestatus(event.data); // devicestatus(event.data);
// } // }
// console.log(data);
if(event.data._type == 'Simulation_Driver_Change'){ if(event.data._type == 'Simulation_Driver_Change'){
drivingcode = event.data.body.code; drivingcode = event.data.body.code;
jlmap3d.updatedrivingcode( event.data.body.code); jlmap3d.updatedrivingcode( event.data.body.code);
} }
if(event.data._type == 'Train'){ if(event.data._type == 'Train'){
// console.log(event.data);
trainstatus(event.data); trainstatus(event.data);
} }
if (event.data._type== 'Signal' && signallist) { if (event.data._type== 'Signal' && signallist) {

View File

@ -191,12 +191,12 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
scope.webwork.onmessage = function (event) { scope.webwork.onmessage = function (event) {
//更新列车位置 //更新列车位置
// if(scope.datatype == "new"){ if(scope.datatype == "new"){
//
// UpdateTrainNew(camera,trainlisttest); // UpdateTrainNew(camera,trainlisttest);
// }else{ }else{
// UpdateTrain(camera,trainlisttest); UpdateTrain(camera,trainlisttest);
// } }
if(camerarail.moveswitch == true){ if(camerarail.moveswitch == true){
// console.log(camerarail.progress); // console.log(camerarail.progress);

View File

@ -8,65 +8,68 @@ export function Materialload(jlmap3dedit,assettype){
settexture( jlmap3dedit.materiallist,"black",'../../static/material/signal/5.jpg'); settexture( jlmap3dedit.materiallist,"black",'../../static/material/signal/5.jpg');
if(assettype.stationtexture == "xian3"){ if(assettype){
if(jlmap3dedit.stationtexture){ if(assettype.stationtexture == "xian3"){
setstationtexture(jlmap3dedit.stationtexture,"stationlist",'../../static/texture/xian3/xian3list.jpg'); if(jlmap3dedit.stationtexture){
setstationtexture(jlmap3dedit.stationtexture,"Station18000",'../../static/texture/xian3/Station18000.jpg'); setstationtexture(jlmap3dedit.stationtexture,"stationlist",'../../static/texture/xian3/xian3list.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station61238",'../../static/texture/xian3/Station61238.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station18000",'../../static/texture/xian3/Station18000.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station41790",'../../static/texture/xian3/Station41790.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station61238",'../../static/texture/xian3/Station61238.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station67945",'../../static/texture/xian3/Station67945.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station41790",'../../static/texture/xian3/Station41790.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station85598",'../../static/texture/xian3/Station85598.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station67945",'../../static/texture/xian3/Station67945.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station4324",'../../static/texture/xian3/Station4324.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station85598",'../../static/texture/xian3/Station85598.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station55755",'../../static/texture/xian3/Station55755.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station4324",'../../static/texture/xian3/Station4324.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station53597",'../../static/texture/xian3/Station53597.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station55755",'../../static/texture/xian3/Station55755.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station68029",'../../static/texture/xian3/Station68029.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station53597",'../../static/texture/xian3/Station53597.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station17596",'../../static/texture/xian3/Station17596.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station68029",'../../static/texture/xian3/Station68029.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station66742",'../../static/texture/xian3/Station66742.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station17596",'../../static/texture/xian3/Station17596.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station90701",'../../static/texture/xian3/Station90701.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station66742",'../../static/texture/xian3/Station66742.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station90652",'../../static/texture/xian3/Station90652.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station90701",'../../static/texture/xian3/Station90701.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station54200",'../../static/texture/xian3/Station54200.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station90652",'../../static/texture/xian3/Station90652.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station19253",'../../static/texture/xian3/Station19253.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station54200",'../../static/texture/xian3/Station54200.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station37821",'../../static/texture/xian3/Station37821.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station19253",'../../static/texture/xian3/Station19253.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station47557",'../../static/texture/xian3/Station47557.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station37821",'../../static/texture/xian3/Station37821.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station78551",'../../static/texture/xian3/Station78551.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station47557",'../../static/texture/xian3/Station47557.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station64474",'../../static/texture/xian3/Station64474.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station78551",'../../static/texture/xian3/Station78551.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station21203",'../../static/texture/xian3/Station21203.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station64474",'../../static/texture/xian3/Station64474.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station34499",'../../static/texture/xian3/Station34499.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station21203",'../../static/texture/xian3/Station21203.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station571",'../../static/texture/xian3/Station571.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station34499",'../../static/texture/xian3/Station34499.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station99903",'../../static/texture/xian3/Station99903.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station571",'../../static/texture/xian3/Station571.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station43447",'../../static/texture/xian3/Station43447.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station99903",'../../static/texture/xian3/Station99903.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station67917",'../../static/texture/xian3/Station67917.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station43447",'../../static/texture/xian3/Station43447.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station60649",'../../static/texture/xian3/Station60649.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station67917",'../../static/texture/xian3/Station67917.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station60649",'../../static/texture/xian3/Station60649.jpg');
}
} }
} if(assettype.stationtexture == "haerbin1"){
if(assettype.stationtexture == "haerbin1"){ if(jlmap3dedit.stationtexture){
if(jlmap3dedit.stationtexture){ setstationtexture(jlmap3dedit.stationtexture,"stationlist",'../../static/texture/heb/haerbinlist.jpg');
setstationtexture(jlmap3dedit.stationtexture,"stationlist",'../../static/texture/heb/haerbinlist.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station5361",'../../static/texture/heb/Station5361.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station5361",'../../static/texture/heb/Station5361.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station11094",'../../static/texture/heb/Station11094.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station11094",'../../static/texture/heb/Station11094.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station11136",'../../static/texture/heb/Station11136.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station11136",'../../static/texture/heb/Station11136.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station17293",'../../static/texture/heb/Station17293.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station17293",'../../static/texture/heb/Station17293.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station18398",'../../static/texture/heb/Station18398.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station18398",'../../static/texture/heb/Station18398.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station22163",'../../static/texture/heb/Station22163.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station22163",'../../static/texture/heb/Station22163.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station25464",'../../static/texture/heb/Station25464.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station25464",'../../static/texture/heb/Station25464.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station28090",'../../static/texture/heb/Station28090.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station28090",'../../static/texture/heb/Station28090.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station41999",'../../static/texture/heb/Station41999.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station41999",'../../static/texture/heb/Station41999.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station44338",'../../static/texture/heb/Station44338.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station44338",'../../static/texture/heb/Station44338.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station46464",'../../static/texture/heb/Station46464.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station46464",'../../static/texture/heb/Station46464.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station50565",'../../static/texture/heb/Station50565.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station50565",'../../static/texture/heb/Station50565.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station60068",'../../static/texture/heb/Station60068.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station60068",'../../static/texture/heb/Station60068.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station62429",'../../static/texture/heb/Station62429.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station62429",'../../static/texture/heb/Station62429.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station64444",'../../static/texture/heb/Station64444.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station64444",'../../static/texture/heb/Station64444.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station71700",'../../static/texture/heb/Station71700.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station71700",'../../static/texture/heb/Station71700.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station72132",'../../static/texture/heb/Station72132.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station72132",'../../static/texture/heb/Station72132.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station78164",'../../static/texture/heb/Station78164.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station78164",'../../static/texture/heb/Station78164.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station79537",'../../static/texture/heb/Station79537.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station79537",'../../static/texture/heb/Station79537.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station82618",'../../static/texture/heb/Station82618.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station82618",'../../static/texture/heb/Station82618.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station85520",'../../static/texture/heb/Station85520.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station85520",'../../static/texture/heb/Station85520.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station89483",'../../static/texture/heb/Station89483.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station89483",'../../static/texture/heb/Station89483.jpg');
setstationtexture(jlmap3dedit.stationtexture,"Station96090",'../../static/texture/heb/Station96090.jpg'); setstationtexture(jlmap3dedit.stationtexture,"Station96090",'../../static/texture/heb/Station96090.jpg');
}
} }
} }
//console.log(jlmap3dedit.materiallist); //console.log(jlmap3dedit.materiallist);

View File

@ -15,84 +15,84 @@ import DataTable from '../menusPlan/components/dataTable';
import { formatTime, formatName } from '@/utils/runPlan'; import { formatTime, formatName } from '@/utils/runPlan';
export default { export default {
name: 'PlanStatusBar', name: 'PlanStatusBar',
components: { components: {
DataTable DataTable
}, },
props: { props: {
maxTop: { maxTop: {
type: Number, type: Number,
required: true required: true
} }
}, },
data() { data() {
return { return {
maxmini: true, maxmini: true,
height: 100, height: 100,
stationListConfig: { stationListConfig: {
data: [], data: [],
showClose: true, showClose: true,
highlightCurrentRow: true, highlightCurrentRow: true,
columns: [ columns: [
{ {
prop: 'stationName', prop: 'stationName',
label: '站台', label: '站台',
width: 400 width: 400
}, },
{ {
prop: 'startTime', prop: 'startTime',
label: '到点' label: '到点'
}, },
{ {
prop: 'stopTime', prop: 'stopTime',
label: '停站时间' label: '停站时间'
}, },
{ {
prop: 'endTime', prop: 'endTime',
label: '发点' label: '发点'
}, },
{ {
prop: 'level', prop: 'level',
label: '运行等级' label: '运行等级'
} }
] ]
} }
}; };
}, },
watch: { watch: {
'$store.state.runPlan.selected': function (select) { '$store.state.runPlan.selected': function (select) {
this.stationListConfig.data = []; this.stationListConfig.data = [];
const serviceObj = this.$store.state.runPlan.editData[select.serviceNumber]; const serviceObj = this.$store.state.runPlan.editData[select.serviceNumber];
if (serviceObj) { if (serviceObj) {
const trainMap = serviceObj.trainMap; const trainMap = serviceObj.trainMap;
if (trainMap) { if (trainMap) {
const trainObj = trainMap[select.tripNumber]; const trainObj = trainMap[select.tripNumber];
if (trainObj) { if (trainObj) {
const stationTimeList = trainObj.stationTimeList; const stationTimeList = trainObj.stationTimeList;
if (stationTimeList && stationTimeList.length) { if (stationTimeList && stationTimeList.length) {
stationTimeList.forEach((elem, index) => { stationTimeList.forEach((elem, index) => {
const stationObj = { const stationObj = {
stationName: formatName(elem.stationCode), stationName: formatName(elem.stationCode),
startTime: formatTime(index == 0 ? null : stationTimeList[index - 1].secondTime), startTime: formatTime(index == 0 ? null : stationTimeList[index - 1].secondTime),
stopTime: formatTime(index == 0 ? null : elem.secondTime - stationTimeList[index - 1].secondTime), stopTime: formatTime(index == 0 ? null : elem.secondTime - stationTimeList[index - 1].secondTime),
endTime: formatTime(elem.secondTime), endTime: formatTime(elem.secondTime),
level: '' level: ''
}; };
this.stationListConfig.data.push(stationObj); this.stationListConfig.data.push(stationObj);
}); });
} }
} }
} }
} }
} }
}, },
methods: { methods: {
touch(maxmini) { touch(maxmini) {
this.maxmini = maxmini; this.maxmini = maxmini;
this.$emit('setPosition'); this.$emit('setPosition');
} }
} }
}; };
</script> </script>

View File

@ -138,6 +138,7 @@ import axios from 'axios';
} }
}, },
updatetrainlist(){ updatetrainlist(){
console.log(this.group);
getSimulationTrainlistNew(this.group).then(netdata => { getSimulationTrainlistNew(this.group).then(netdata => {
this.options = []; this.options = [];
this.trainlist = netdata.data; this.trainlist = netdata.data;

View File

@ -3,11 +3,11 @@
<div id="jl3d" class="jl3ddraw"> <div id="jl3d" class="jl3ddraw">
</div> </div>
<!-- <div class="menutop"> <div class="menutop">
<el-button-group> <el-button-group>
<el-button type="primary" @click="switchrender">{{rendermode}}</el-button> <el-button type="primary" @click="switchrender">{{rendermode}}</el-button>
</el-button-group> </el-button-group>
</div> --> </div>
<div class="menudown"> <div class="menudown">
<el-button-group> <el-button-group>
<el-button type="primary" @click="back">退出</el-button> <el-button type="primary" @click="back">退出</el-button>
@ -18,7 +18,7 @@
</template> </template>
<script> <script>
import Vue from 'vue'; import Vue from 'vue';
import { Jl3dpassflow } from '@/jlmap3d/jl3dpassflow/jl3dpassflow.js'; import { Jl3dpassflow } from '@/jlmap3d/jl3dpassflow/jl3dpassflownew.js';
import { ProjectIcon } from '@/scripts/ProjectConfig'; import { ProjectIcon } from '@/scripts/ProjectConfig';
export default { export default {
@ -54,7 +54,7 @@ export default {
init: function () { init: function () {
// let mapdata = this.$store.state.socket.device; // let mapdata = this.$store.state.socket.device;
const dom = document.getElementById('jl3d'); const dom = document.getElementById('jl3d');
this.jl3d = new Jl3dpassflow(dom); this.jl3d = new Jl3dpassflow(dom,this.$route.query.mapid);
}, },
switchrender() { switchrender() {
if (this.renderswitch == true) { if (this.renderswitch == true) {

View File

@ -152,7 +152,9 @@ export default {
} }
}, },
'$store.state.map.showCentralizedStationNum': function (val) { '$store.state.map.showCentralizedStationNum': function (val) {
this.setShowStation(this.$store.state.map.showCentralizedStationCode); if (this.$store.state.map.showCentralizedStationCode) {
this.setShowStation(this.$store.state.map.showCentralizedStationCode);
}
}, },
'$store.state.training.offsetStationCode': function(code) { '$store.state.training.offsetStationCode': function(code) {
if (code && this.localStationShow && this.$store.state.training.prdType === '01') { if (code && this.localStationShow && this.$store.state.training.prdType === '01') {

View File

@ -28,44 +28,44 @@
<script> <script>
export default { export default {
name: 'DataTable', name: 'DataTable',
props: { props: {
height: { height: {
type: Number, type: Number,
required: true required: true
}, },
config: { config: {
type: Object, type: Object,
required: true required: true
} }
}, },
data() { data() {
return { return {
show: true, show: true,
maxmini: true, maxmini: true,
touchStrategy: { touchStrategy: {
'Close': [false, true], 'Close': [false, true],
'Minim': [true, false], 'Minim': [true, false],
'Maxim': [true, true] 'Maxim': [true, true]
} }
}; };
}, },
methods: { methods: {
handleChange(row) { handleChange(row) {
if (this.config.handleChange) { if (this.config.handleChange) {
this.config.handleChange(row); this.config.handleChange(row);
} }
}, },
setCurrentRow(row) { setCurrentRow(row) {
this.$refs.table.setCurrentRow(row); this.$refs.table.setCurrentRow(row);
}, },
touch(operate) { touch(operate) {
this.$nextTick(() => { this.$nextTick(() => {
[this.show, this.maxmini] = this.touchStrategy[operate]; [this.show, this.maxmini] = this.touchStrategy[operate];
this.$emit('touch', this.maxmini); this.$emit('touch', this.maxmini);
}); });
} }
} }
}; };
</script> </script>

View File

@ -45,7 +45,7 @@ export default {
}, },
maxWidth: { maxWidth: {
type: Number, type: Number,
require: true default: 0
}, },
maxHeight: { maxHeight: {
type: Number, type: Number,
@ -205,6 +205,11 @@ export default {
indexKmRangeMap: {} indexKmRangeMap: {}
}; };
}, },
computed: {
...mapGetters('runPlan', [
'stations'
])
},
watch: { watch: {
maxWidth() { maxWidth() {
this.setPosition(); this.setPosition();
@ -232,11 +237,6 @@ export default {
this.$refs.tripTable.setCurrentRow(this.tripNumberConfig.data[index]); this.$refs.tripTable.setCurrentRow(this.tripNumberConfig.data[index]);
} }
}, },
computed: {
...mapGetters('runPlan', [
'stations'
])
},
mounted() { mounted() {
this.PlanConvert = this.$theme.loadPlanConvert(this.lineCode); this.PlanConvert = this.$theme.loadPlanConvert(this.lineCode);
}, },
@ -247,6 +247,7 @@ export default {
serviceNumberChange(row) { serviceNumberChange(row) {
if (row) { if (row) {
this.$store.dispatch('runPlan/setSelected', { serviceNumber: row.serviceNumber, tripNumber: null }); this.$store.dispatch('runPlan/setSelected', { serviceNumber: row.serviceNumber, tripNumber: null });
this.renderTripNumber({ serviceNumber: row.serviceNumber, tripNumber: null });
const serviceObj = this.$store.state.runPlan.editData[row.serviceNumber]; const serviceObj = this.$store.state.runPlan.editData[row.serviceNumber];
if (serviceObj) { if (serviceObj) {
this.analyticalTripNumber(serviceObj.trainMap); this.analyticalTripNumber(serviceObj.trainMap);
@ -256,6 +257,7 @@ export default {
tripNumberChange(row) { tripNumberChange(row) {
if (row) { if (row) {
this.$store.dispatch('runPlan/setSelected', { serviceNumber: this.$store.state.runPlan.selected.serviceNumber, tripNumber: row.tripNumber }); this.$store.dispatch('runPlan/setSelected', { serviceNumber: this.$store.state.runPlan.selected.serviceNumber, tripNumber: row.tripNumber });
this.renderTripNumber({ serviceNumber: this.$store.state.runPlan.selected.serviceNumber, tripNumber: row.tripNumber });
} }
}, },
async analyticalServiceNumber(data) { async analyticalServiceNumber(data) {
@ -426,6 +428,39 @@ export default {
`到站时间: ${timeFormat(param.data[0] + this.PlanConvert.TranslationTime)} (${param.data[0]})<br>` `到站时间: ${timeFormat(param.data[0] + this.PlanConvert.TranslationTime)} (${param.data[0]})<br>`
].join(''); ].join('');
}, },
renderTripNumber(params) {
const tripNumber = params.tripNumber; //
const serviceNumber = params.serviceNumber; //
let data;
const op = this.myChart.getOption();
op.series.forEach((item, index) => {
if (item.name == serviceNumber && item.data) {
const temp = item.data.filter(elem => elem[3] == tripNumber);
if (temp.length) {
data = temp;
}
}
if (item.name == 'trainLabel') {
op.series.pop();
this.myChart && this.myChart.setOption(op, true);
}
});
op.series.push({
name: 'trainLabel',
lineStyle: {
color: '#000',
width: 2,
type: 'solid'
},
z: 10,
type: 'line',
data: data
});
setTimeout(() => {
this.myChart && this.myChart.setOption(op, true);
}, 50);
},
mouseClick(params) { mouseClick(params) {
const model = { const model = {
serviceNumber: params.seriesName serviceNumber: params.seriesName

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -675,7 +675,7 @@ function timedCount(){
// postMessage(data); // postMessage(data);
// } // }
// //
console.log(e.data); // console.log(e.data);
if(e.data.type == "init"){ if(e.data.type == "init"){
topic = e.data.topic; topic = e.data.topic;
@ -695,7 +695,7 @@ function timedCount(){
function callback(Response) { function callback(Response) {
// console.log(Response); // console.log(Response);
data = JSON.parse(Response.body); data = JSON.parse(Response.body);
console.log(data); // console.log(data);
if(data.type == 'SJL3D_TrainStatus'){ if(data.type == 'SJL3D_TrainStatus'){
for (let i=0,leni = data.body.length; i<leni; i++) { for (let i=0,leni = data.body.length; i<leni; i++) {
postMessage(data.body[i]); postMessage(data.body[i]);