修改模型路径,修改轨迹判定

This commit is contained in:
sunzhenyu 2019-11-05 17:30:39 +08:00
parent 7de0ec6b4b
commit a340496eac
11 changed files with 51 additions and 50 deletions

View File

@ -120,7 +120,7 @@ export function Jlmap3ddata(mapid,scope){
} }
function init3d(mapid,netdata){ function init3d(mapid,netdata){
console.log(netdata) // console.log(netdata)
getMapDetail(mapid).then(data => { getMapDetail(mapid).then(data => {
jlmap3ddata.id = netdata.id; jlmap3ddata.id = netdata.id;
jlmap3ddata.mapId = mapid; jlmap3ddata.mapId = mapid;
@ -141,7 +141,7 @@ export function Jlmap3ddata(mapid,scope){
let switchdata = JSON.parse(netdata.switchs); let switchdata = JSON.parse(netdata.switchs);
let signaldata = JSON.parse(netdata.signals); let signaldata = JSON.parse(netdata.signals);
let standsdata = JSON.parse(netdata.stands); let standsdata = JSON.parse(netdata.stands);
console.log(mapdata); // console.log(mapdata);
assetloader.setmodellist(netdata.assets); assetloader.setmodellist(netdata.assets);
assetloader.assetpromise(scene) assetloader.assetpromise(scene)
.then(function(data){ .then(function(data){

View File

@ -48,7 +48,7 @@ export function SectionList() {
} }
} }
buildsuidao(linkdata,scope.sections,assetloader,scene); buildsuidao(linkdata,scope.sections,assetloader,scene);
console.log(scope.sections.datalist); // console.log(scope.sections.datalist);
//定义区分道岔组 //定义区分道岔组
let switchlist = []; let switchlist = [];
//遍历道岔数据 //遍历道岔数据
@ -105,7 +105,7 @@ export function SectionList() {
} }
} }
scope.switchs.datalist = switchlist; scope.switchs.datalist = switchlist;
console.log(switchlist); // console.log(switchlist);
//道岔贴图 //道岔贴图
let switchmesh1; let switchmesh1;
let switchmesh2; let switchmesh2;
@ -142,9 +142,9 @@ export function SectionList() {
let switchposz = sectionA.position.z; let switchposz = sectionA.position.z;
let switchposx; let switchposx;
if(switchlist[i].code == "Switch_135_0.16369"){ // if(switchlist[i].code == "Switch_135_0.16369"){
console.log(switchlist[i]); // console.log(switchlist[i]);
} // }
if(switchlist[i].pa[0].x>switchlist[i].pb[0].x){ if(switchlist[i].pa[0].x>switchlist[i].pb[0].x){
if(((switchlist[i].pc[0].y+switchlist[i].pc[1].y)/2) < switchlist[i].pa[0].y){ if(((switchlist[i].pc[0].y+switchlist[i].pc[1].y)/2) < switchlist[i].pa[0].y){
if(((switchlist[i].pc[0].x+switchlist[i].pc[1].x)/2)>switchlist[i].pa[0].x){ if(((switchlist[i].pc[0].x+switchlist[i].pc[1].x)/2)>switchlist[i].pa[0].x){
@ -270,7 +270,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(scope.sectiongroup); scene.add(scope.sectiongroup);
scene.add(scope.switchgroup); scene.add(scope.switchgroup);
let linkdata = jlmap3ddata.linklist; let linkdata = jlmap3ddata.linklist;

View File

@ -12,6 +12,7 @@ export function UpdateTrain(camera,traindata,control){
if(trainmodel.speeds > 0 && trainmodel.speeds){ if(trainmodel.speeds > 0 && trainmodel.speeds){
let speed = null; let speed = null;
// console.log(traindata.group.children[0].progress);
if(traindata.group.children[0].progress >=0&&traindata.group.children[0].progress<=1){ if(traindata.group.children[0].progress >=0&&traindata.group.children[0].progress<=1){
let movecurve = trainmodel.curve; let movecurve = trainmodel.curve;

View File

@ -34,7 +34,7 @@ let defaultstation = {
deviceType:"stand", deviceType:"stand",
type:"num4", type:"num4",
picUrl:"", picUrl:"",
assetUrl:"../../static/model/station/fuzhou.FBX" assetUrl:modelurl+"/models/station/fuzhou/fuzhou.FBX"
} }
//modelurl+"/models/station/fuzhou/fuzhou.FBX" //modelurl+"/models/station/fuzhou/fuzhou.FBX"
//https://test.joylink.club/oss/models/station/fuzhou/fuzhou.FBX //https://test.joylink.club/oss/models/station/fuzhou/fuzhou.FBX
@ -65,11 +65,12 @@ let defaultsuidao = {
deviceType:"suidao", deviceType:"suidao",
type:"suidao", type:"suidao",
picUrl:"", picUrl:"",
assetUrl:"../../static/model/suidao/suidao.FBX" assetUrl:modelurl+"/models/suidao/suidao.FBX"
} }
//modelurl+"/models/suidao/suidao.FBX"
//https://test.joylink.club/oss/models/suidao/suidao.FBX //https://test.joylink.club/oss/models/suidao/suidao.FBX
//https://joylink.club/oss/models/suidao/suidao.FBX //https://joylink.club/oss/models/suidao/suidao.FBX
//../../static/model/ //../../static/model/suidao/suidao.FBX
let defaultautorail = { let defaultautorail = {
id:"100", id:"100",

View File

@ -55,9 +55,20 @@ export function RailList(){
for(let i=0;i<linkdata.length;i++){ for(let i=0;i<linkdata.length;i++){
if(linkdata[i].rotation._z == 0){ if(linkdata[i].rotation._z == 0){
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(scope.linkrail[linkdata[i].code].lp.x+1.5,0,scope.linkrail[linkdata[i].code].lp.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(scope.linkrail[linkdata[i].code].rp.x-1.5,0,scope.linkrail[linkdata[i].code].rp.z));
scope.linkrail[linkdata[i].code].type = 0; scope.linkrail[linkdata[i].code].type = 0;
if(scope.linkrail[linkdata[i].code].lswitch){
let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].lswitch].position;
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
}
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(scope.linkrail[linkdata[i].code].lp.x,0,scope.linkrail[linkdata[i].code].lp.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(scope.linkrail[linkdata[i].code].rp.x,0,scope.linkrail[linkdata[i].code].rp.z));
if(scope.linkrail[linkdata[i].code].rswitch){
let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].rswitch].position;
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
}
}else{ }else{
if(linkdata[i].rotation._z>0){ if(linkdata[i].rotation._z>0){
@ -69,9 +80,10 @@ export function RailList(){
scope.linkrail[linkdata[i].code].type = 1; scope.linkrail[linkdata[i].code].type = 1;
if(scope.linkrail[linkdata[i].code].lswitch){ if(scope.linkrail[linkdata[i].code].lswitch){
let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].lswitch].position; let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].lswitch].position;
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+1.5,0,switchpoint.z)); scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+1.5,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+2,0,switchpoint.z)); scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+2,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+5,0,switchpoint.z-0.05)); scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+6,0,switchpoint.z-0.06));
} }
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.12)); scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.12));
@ -81,9 +93,10 @@ export function RailList(){
if(scope.linkrail[linkdata[i].code].rswitch){ if(scope.linkrail[linkdata[i].code].rswitch){
let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].rswitch].position; let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].rswitch].position;
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-5,0,switchpoint.z+0.05)); scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-6,0,switchpoint.z+0.06));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-2,0,switchpoint.z)); scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-2,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-1.5,0,switchpoint.z)); scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-1.5,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
} }
}else{ }else{
@ -94,9 +107,10 @@ export function RailList(){
scope.linkrail[linkdata[i].code].type = 2; scope.linkrail[linkdata[i].code].type = 2;
if(scope.linkrail[linkdata[i].code].lswitch){ if(scope.linkrail[linkdata[i].code].lswitch){
let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].lswitch].position; let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].lswitch].position;
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+1.5,0,switchpoint.z)); scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+1.5,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+2,0,switchpoint.z)); scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+2,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+5,0,switchpoint.z+0.05)); scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+6,0,switchpoint.z+0.06));
} }
scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.12)); scope.linkrail[linkdata[i].code].points.push(testline.getPointAt(0.12));
@ -106,9 +120,10 @@ export function RailList(){
if(scope.linkrail[linkdata[i].code].rswitch){ if(scope.linkrail[linkdata[i].code].rswitch){
let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].rswitch].position; let switchpoint = scope.switchrail[scope.linkrail[linkdata[i].code].rswitch].position;
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-5,0,switchpoint.z-0.05)); scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-6,0,switchpoint.z-0.06));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-2,0,switchpoint.z)); scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-2,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-1.5,0,switchpoint.z)); scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-1.5,0,switchpoint.z));
scope.linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z));
} }
} }
} }
@ -140,46 +155,30 @@ export function RailList(){
} }
if(scope.linkrail[switchdata[i].blink].lp.x < switchdata[i].position.x){ if(scope.linkrail[switchdata[i].blink].lp.x < switchdata[i].position.x){
scope.linkrail[switchdata[i].blink].points.push(new THREE.Vector3(switchdata[i].position.x-2,switchdata[i].position.y,switchdata[i].position.z)); // scope.linkrail[switchdata[i].blink].points.push(new THREE.Vector3(switchdata[i].position.x-2,switchdata[i].position.y,switchdata[i].position.z));
scope.linkrail[switchdata[i].blink].points.push(new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z)); // scope.linkrail[switchdata[i].blink].points.push(new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z));
scope.linkrail[switchdata[i].blink].points.push(new THREE.Vector3(switchdata[i].position.x+1.5,switchdata[i].position.y,switchdata[i].position.z)); // scope.linkrail[switchdata[i].blink].points.push(new THREE.Vector3(switchdata[i].position.x+1.5,switchdata[i].position.y,switchdata[i].position.z));
if(scope.linkrail[switchdata[i].alink].type == 1){ //
}else if(scope.linkrail[switchdata[i].alink].type == 2){
}else{
scope.linkrail[switchdata[i].blink].points.push(new THREE.Vector3(scope.linkrail[switchdata[i].alink].lp.x+1.5,0,scope.linkrail[switchdata[i].alink].lp.z));
}
scope.switchrail[switchdata[i].code].directtype = "1"; scope.switchrail[switchdata[i].code].directtype = "1";
}else{ }else{
scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x+2,switchdata[i].position.y,switchdata[i].position.z)); // scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x+2,switchdata[i].position.y,switchdata[i].position.z));
scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z)); // scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z));
scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x-1.5,switchdata[i].position.y,switchdata[i].position.z)); // scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x-1.5,switchdata[i].position.y,switchdata[i].position.z));
if(scope.linkrail[switchdata[i].alink].type == 1){ //
}else if(scope.linkrail[switchdata[i].alink].type == 2){
}else{
scope.linkrail[switchdata[i].blink].points.splice(0,0,new THREE.Vector3(scope.linkrail[switchdata[i].alink].rp.x-1.5,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-3.5,switchdata[i].position.y,switchdata[i].position.z+0.02)); // // scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(switchdata[i].position.x-3.5,switchdata[i].position.y,switchdata[i].position.z+0.02));
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(switchdata[i].position.x+1.5,switchdata[i].position.y,switchdata[i].position.z)); // scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(switchdata[i].position.x+1.5,switchdata[i].position.y,switchdata[i].position.z));
if(scope.linkrail[switchdata[i].alink].type == 1){ //
}else if(scope.linkrail[switchdata[i].alink].type == 2){
}else{
scope.linkrail[switchdata[i].clink].points.push(new THREE.Vector3(scope.linkrail[switchdata[i].alink].lp.x+1.5,0,scope.linkrail[switchdata[i].alink].lp.z));
}
scope.switchrail[switchdata[i].code].directtype = "1"; scope.switchrail[switchdata[i].code].directtype = "1";
}else{ }else{
// scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x+3.5,switchdata[i].position.y,switchdata[i].position.z-0.02)); // // scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x+3.5,switchdata[i].position.y,switchdata[i].position.z-0.02));
scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z)); // scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z));
scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x-1.5,switchdata[i].position.y,switchdata[i].position.z)); // scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(switchdata[i].position.x-1.5,switchdata[i].position.y,switchdata[i].position.z));
if(scope.linkrail[switchdata[i].alink].type == 1){ //
}else if(scope.linkrail[switchdata[i].alink].type == 2){
}else{
scope.linkrail[switchdata[i].clink].points.splice(0,0,new THREE.Vector3(scope.linkrail[switchdata[i].alink].rp.x-1.5,0,scope.linkrail[switchdata[i].alink].rp.z));
}
scope.switchrail[switchdata[i].code].directtype = "2"; scope.switchrail[switchdata[i].code].directtype = "2";
} }
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.