This commit is contained in:
zyy 2020-12-07 15:10:07 +08:00
commit a797f63e93
5 changed files with 4 additions and 191 deletions

View File

@ -1,179 +0,0 @@
//import request from '@/utils/request';
export function getmodels(data) {
let postmap = {
id:data.mapdata.id,
mapId:data.mapdata.mapId,
assets:"null",
sections:"null",
signals:"null",
trains:"null",
stands:"null",
switchs:"null"
};
if(data.mapdata.sectionlist.sections== undefined){
return postmap;
}
if(data == undefined){
return postmap;
}else{
//资源
let assets = [];
for(let i=0;i<data.assetloader.modellist.length;i++){
let asset = {
id:data.assetloader.modellist[i].id,
name:data.assetloader.modellist[i].name,
deviceType:data.assetloader.modellist[i].deviceType,
type:data.assetloader.modellist[i].type,
assetUrl:data.assetloader.modellist[i].assetUrl
}
assets.push(asset);
}
postmap.assets = JSON.stringify(assets);
//link轨道
let links = [];
for(let i=0;i<data.mapdata.linklist.linksgroup.children.length;i++){
let link = {
uuid:data.mapdata.linklist.linksgroup.children[i].uuid,
code:data.mapdata.linklist.linksgroup.children[i].code,
name:data.mapdata.linklist.linksgroup.children[i].name,
lengthfact:data.mapdata.linklist.linksgroup.children[i].lengthfact,
position:data.mapdata.linklist.linksgroup.children[i].position,
rotation:data.mapdata.linklist.linksgroup.children[i].rotation,
scale:data.mapdata.linklist.linksgroup.children[i].scale,
rightlist:data.mapdata.linklist.linksgroup.children[i].rightlist,
leftlist:data.mapdata.linklist.linksgroup.children[i].leftlist,
lp:data.mapdata.linklist.linksgroup.children[i].lp,
rp:data.mapdata.linklist.linksgroup.children[i].rp,
rail:data.mapdata.linklist.linksgroup.children[i].rail,
}
links.push(link);
}
// postmap.sections.link = JSON.stringify(links);
//section隧道
let sections = [];
for(let i=0;i<data.mapdata.sectionlist.sections.datalist.length;i++){
let section = {
uuid:data.mapdata.sectionlist.sections.modellist[i].uuid,
code:data.mapdata.sectionlist.sections.modellist[i].code,
name:data.mapdata.sectionlist.sections.modellist[i].name,
lengthfact:data.mapdata.sectionlist.sections.modellist[i].lengthfact,
isStandTrack:data.mapdata.sectionlist.sections.modellist[i].isStandTrack,
relStandCode:data.mapdata.sectionlist.sections.datalist[i].relStandCode,
linkCode:data.mapdata.sectionlist.sections.datalist[i].linkCode,
rightlist:data.mapdata.sectionlist.sections.modellist[i].rightlist,
leftlist:data.mapdata.sectionlist.sections.modellist[i].leftlist,
rightpoint:data.mapdata.sectionlist.sections.modellist[i].rightpoint,
leftpoint:data.mapdata.sectionlist.sections.modellist[i].leftpoint,
rail:data.mapdata.sectionlist.sections.modellist[i].rail,
position:data.mapdata.sectionlist.sections.modellist[i].position,
rotation:data.mapdata.sectionlist.sections.modellist[i].rotation,
scale:data.mapdata.sectionlist.sections.modellist[i].scale
}
// testmesh1.position.z = link.position.z;
sections.push(section);
}
console.log(links);
let arrray = {
link:links,
section:sections,
};
postmap.sections = JSON.stringify(arrray);
//道岔
let switchs = [];
for(let i=0;i<data.mapdata.sectionlist.switchs.modellist.length;i++){
let switcha = {
uuid:data.mapdata.sectionlist.switchs.modellist[i].uuid,
code:data.mapdata.sectionlist.switchs.datalist[i].code,
name:data.mapdata.sectionlist.switchs.datalist[i].name,
alink:data.mapdata.sectionlist.switchs.datalist[i].alink,
blink:data.mapdata.sectionlist.switchs.datalist[i].blink,
clink:data.mapdata.sectionlist.switchs.datalist[i].clink,
paname:data.mapdata.sectionlist.switchs.datalist[i].paname,
pbname:data.mapdata.sectionlist.switchs.datalist[i].pbname,
pcname:data.mapdata.sectionlist.switchs.datalist[i].pcname,
pa:data.mapdata.sectionlist.switchs.datalist[i].pa,
pb:data.mapdata.sectionlist.switchs.datalist[i].pb,
pc:data.mapdata.sectionlist.switchs.datalist[i].pc,
position:data.mapdata.sectionlist.switchs.modellist[i].position,
rotation:data.mapdata.sectionlist.switchs.modellist[i].rotation,
scale:data.mapdata.sectionlist.switchs.modellist[i].scale
}
switchs.push(switcha);
}
postmap.switchs = JSON.stringify(switchs);
//信号
let signals = [];
for(let i=0;i<data.mapdata.signallist.list.length;i++){
let signal = {
uuid:data.mapdata.signallist.list[i].mesh.uuid,
name:data.mapdata.signallist.list[i].mesh.name,
modelid:data.mapdata.signallist.list[i].mesh.modelid,
code:data.mapdata.signallist.list[i].mesh.code,
position:data.mapdata.signallist.list[i].mesh.position,
rotation:data.mapdata.signallist.list[i].mesh.rotation,
scale:data.mapdata.signallist.list[i].mesh.scale,
virtual:data.mapdata.signallist.list[i].mesh.virtual
}
signals.push(signal);
}
postmap.signals = JSON.stringify(signals);
//车站
let stands = [];
for(let i=0;i<data.mapdata.stationstandlist.list.length;i++){
let station = {
uuid:data.mapdata.stationstandlist.list[i].uuid,
code:data.mapdata.stationstandlist.list[i].code,
name:data.mapdata.stationstandlist.list[i].name,
modelid:data.mapdata.stationstandlist.list[i].modelid,
position:data.mapdata.stationstandlist.list[i].mesh.position,
rotation:data.mapdata.stationstandlist.list[i].mesh.rotation,
scale:data.mapdata.stationstandlist.list[i].mesh.scale,
direction1:{
name:data.mapdata.stationstandlist.list[i].direction1.name,
code:null
},
direction2:{
name:data.mapdata.stationstandlist.list[i].direction2.name,
code:null
}
}
stands.push(station);
}
postmap.stands = JSON.stringify(stands);
//列车
let trains = [];
for(let i=0;i<data.assetloader.modellist.length;i++){
if(data.assetloader.modellist[i].deviceType == "train"){
let train = {
id:data.assetloader.modellist[i].id,
name:data.assetloader.modellist[i].name,
deviceType:data.assetloader.modellist[i].deviceType,
type:data.assetloader.modellist[i].type,
assetUrl:data.assetloader.modellist[i].assetUrl
}
trains.push(train);
}
}
postmap.trains = JSON.stringify(trains);
return postmap;
}
}

View File

@ -1,10 +0,0 @@
import request from '@/utils/request';
/** 获取路径单元列表*/
export function getmodels(data) {
return request({
url: 'http://192.168.3.23:1337/model_load',
method: 'get',
params: data
});
}

View File

@ -10,7 +10,6 @@ import {SwitchList} from '@/jlmap3d/edit/testEditorModel/SwitchList.js';
import {RailList} from '@/jlmap3d/edit/testEditorModel/RailList.js';
import axios from 'axios';
import {getmodels} from '@/jlmap3d/edit/connect/getmodels';
import { Loading } from 'element-ui';
// import {SwitchModel} from '@/jlmap3d/model/SwitchModel.js';

View File

@ -53,6 +53,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
// console.log(data);
if(data.type == "Train_Position"){
nowTrainRun(data.body);
return;
}

View File

@ -171,6 +171,8 @@ export function PasserHuman() {
// console.log(inPasser);
// console.log(outPasser);
// let outPassers = inNum[scope.nowTrunk].num;
console.log(inNum);
console.log(leaveNum);
let created = 0;
for(let i=0;i<outPasser.length;i++){
for(let j=0;j<outPasser[i];j++){
@ -187,7 +189,7 @@ export function PasserHuman() {
for(let j=0;j<inPasser[i];j++){
setTimeout(function(){
scope.createInPasser(humanlist,direct);
}, Math.random()*1000*i);
}, 2000+Math.random()*1000*j);
}
}