减少合并三维行车判断逻辑,分拆三维行车数据对象
This commit is contained in:
parent
1cda6fcd49
commit
3138187c07
@ -1,16 +1,17 @@
|
||||
export function SetScene() {
|
||||
var scene = new THREE.Scene();
|
||||
var cubeTextureLoader = new THREE.CubeTextureLoader();
|
||||
|
||||
cubeTextureLoader.setPath( '../../static/skybox/star/' );
|
||||
|
||||
var cubeTexture = cubeTextureLoader.load( [
|
||||
'px.png', 'nx.png',
|
||||
'py.png', 'ny.png',
|
||||
'pz.png', 'nz.png',
|
||||
] );
|
||||
|
||||
scene.background = cubeTexture;
|
||||
cubeTexture.dispose();
|
||||
// var cubeTextureLoader = new THREE.CubeTextureLoader();
|
||||
//
|
||||
// cubeTextureLoader.setPath( '../../static/skybox/star/' );
|
||||
//
|
||||
// var cubeTexture = cubeTextureLoader.load( [
|
||||
// 'px.png', 'nx.png',
|
||||
// 'py.png', 'ny.png',
|
||||
// 'pz.png', 'nz.png',
|
||||
// ] );
|
||||
//
|
||||
var bgTexture = new THREE.TextureLoader().load("../../static/background/background.jpg");
|
||||
scene.background = bgTexture;
|
||||
// cubeTexture.dispose();
|
||||
return scene;
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ export function Jlmap3ddata(mapid,scope){
|
||||
assetloader.assetpromise(scene)
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return jlmap3ddata.linklist.loadpromise(loaderdata.link,scene,assetloader);
|
||||
return jlmap3ddata.linklist.loadpromise(loaderdata.link,mapdata.linkList,scene,assetloader);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
|
@ -50,7 +50,8 @@ export function Signalaction(){
|
||||
for(let i=0;i<data.mapdata.signallist.list.length;i++){
|
||||
intersects1 = raycaster.intersectObjects( data.mapdata.signallist.list[i].mesh.children);
|
||||
if(intersects1[0]){
|
||||
if(intersects1[0].object.code == data.mapdata.signallist.list[i].mesh.code){
|
||||
console.log(intersects1[0].object);
|
||||
if(intersects1[0].object.parent.code == data.mapdata.signallist.list[i].mesh.code){
|
||||
return data.mapdata.signallist.list[i].mesh;
|
||||
}
|
||||
}
|
||||
|
@ -20,10 +20,10 @@ export function LinkList(data){
|
||||
});
|
||||
};
|
||||
|
||||
this.loadpromise = function(linkdata,scene,assetloader){
|
||||
this.loadpromise = function(linkdata,netlink,scene,assetloader){
|
||||
return new Promise(function(resolve, reject){
|
||||
scene.add(scope.linksgroup);
|
||||
loadlink(linkdata,scene,assetloader);
|
||||
loadlink(linkdata,netlink,scene,assetloader);
|
||||
resolve("loadedrealsection");
|
||||
});
|
||||
};
|
||||
@ -57,7 +57,7 @@ function linkhelp(data,scene){
|
||||
|
||||
|
||||
|
||||
function loadlink(data,scene,assetloader){
|
||||
function loadlink(data,netlink,scene,assetloader){
|
||||
let autorail;
|
||||
for(let i=0;i<assetloader.modellist.length;i++){
|
||||
if(assetloader.modellist[i].deviceType == "autorail"){
|
||||
@ -87,6 +87,12 @@ function linkhelp(data,scene){
|
||||
testmesh2.rp = data[i].rp;
|
||||
testmesh2.lp = data[i].lp;
|
||||
testmesh2.lengthfact = data[i].lengthfact;
|
||||
for(let num=0,lennum=netlink.length;num<lennum;num++){
|
||||
if(netlink[num].code == data[i].code){
|
||||
testmesh2.oldlength = netlink[num].lengthFact;
|
||||
num = lennum;
|
||||
}
|
||||
}
|
||||
|
||||
for(let i=0;i<testmesh2.rightlist.length;i++){
|
||||
testmesh2.geometry.attributes.position.array[testmesh2.rightlist[i]*3] = testmesh2.lengthfact-25;
|
||||
|
@ -23,7 +23,7 @@ export function SectionList() {
|
||||
this.standtrack = [];
|
||||
|
||||
this.initpromise = function(jlmap3ddata,assetloader,sectiondata,switchdata,scene){
|
||||
console.log(sectiondata);
|
||||
// console.log(sectiondata);
|
||||
return new Promise(function(resolve, reject){
|
||||
scene.add(scope.sectiongroup);
|
||||
scene.add(scope.switchgroup);
|
||||
@ -48,7 +48,7 @@ export function SectionList() {
|
||||
// sections.modellist.push("");
|
||||
}
|
||||
}
|
||||
buildsuidao(linkdata,sections,assetloader,scene);
|
||||
// buildsuidao(linkdata,sections,assetloader,scene);
|
||||
// console.log(sections.datalist);
|
||||
//定义区分道岔组
|
||||
let switchlist = [];
|
||||
@ -365,7 +365,7 @@ export function SectionList() {
|
||||
}
|
||||
}
|
||||
|
||||
console.log(standsections);
|
||||
// console.log(standsections);
|
||||
for(let i=0,leni=standsections.length;i<leni;i++){
|
||||
for(let j=0,lenj=linklist.length;j<lenj;j++){
|
||||
if(standsections[i].linkCode == linklist[j].code){
|
||||
@ -373,13 +373,13 @@ export function SectionList() {
|
||||
if(standsections[i].relStandCode == standsdata[n].direction1.name){
|
||||
let geometry = new THREE.CircleGeometry( 2, 16 );
|
||||
let material = new THREE.MeshBasicMaterial( { color: 0x00ffff } );
|
||||
console.log(standsections[i].stationCode);
|
||||
console.log(standsdata[n].code);
|
||||
console.log(standsdata[n].position.x);
|
||||
console.log("position.z");
|
||||
console.log(linkrail[linklist[j].code].points[0].z);
|
||||
console.log(standsdata[n].position.z);
|
||||
console.log("........................................");
|
||||
// console.log(standsections[i].stationCode);
|
||||
// console.log(standsdata[n].code);
|
||||
// console.log(standsdata[n].position.x);
|
||||
// console.log("position.z");
|
||||
// console.log(linkrail[linklist[j].code].points[0].z);
|
||||
// console.log(standsdata[n].position.z);
|
||||
// console.log("........................................");
|
||||
let circle1 = new THREE.Mesh( geometry, material );
|
||||
let circle2 = new THREE.Mesh( geometry, material );
|
||||
if(linkrail[linklist[j].code].points[0].z>standsdata[n].position.z){
|
||||
@ -712,7 +712,7 @@ export function SectionList() {
|
||||
autosuidao = assetloader.modellist[i].mesh.children[0];
|
||||
}
|
||||
}
|
||||
console.log(suidaodata);
|
||||
// console.log(suidaodata);
|
||||
let rightlist = [];
|
||||
let leftlist = [];
|
||||
let rightpoint = 0;
|
||||
|
@ -140,27 +140,30 @@ export function SignalList() {
|
||||
});
|
||||
};
|
||||
this.resetsignal = function(jlmap3ddata){
|
||||
console.log(jlmap3ddata.linksgroup);
|
||||
console.log(scope);
|
||||
let linkdata = jlmap3ddata.linksgroup;
|
||||
// console.log(jlmap3ddata.linksgroup);
|
||||
// console.log(jlmap3ddata);
|
||||
let linkdata = jlmap3ddata.linkdata;
|
||||
for(let i=0;i<scope.group.children.length;i++){
|
||||
let signaldata = scope.group.children[i];
|
||||
let link = linkdata.getObjectByProperty("code",signaldata.linkCode);
|
||||
let posx = null;
|
||||
for(let j=0,lenj=linkdata.length;j<lenj;j++){
|
||||
if(linkdata[j].code == signaldata.linkCode){
|
||||
let posx = linkdata[j].lp.x + (signaldata.offset/linkdata[j].oldlength)*linkdata[j].lengthfact;
|
||||
|
||||
if(signaldata.offset > link.lengthfact/2){
|
||||
posx = link.position.x + signaldata.offset - link.lengthfact/2-10;
|
||||
}else{
|
||||
posx = link.position.x - (link.lengthfact/2 - signaldata.offset)+10;
|
||||
}
|
||||
//根据线路方向修改信号灯位置
|
||||
if(signaldata.directionType == "01"){
|
||||
signaldata.position.set(posx,0,link.position.z-3);
|
||||
signaldata.rotation.z = ( Math.PI / 2 );
|
||||
}else if(signaldata.directionType == "02"){
|
||||
signaldata.position.set(posx,0,link.position.z+3);
|
||||
signaldata.rotation.z = ( - Math.PI / 2 );
|
||||
//根据线路方向修改信号灯位置
|
||||
// console.log(posx);
|
||||
if(signaldata.directionType == "01"){
|
||||
signaldata.position.set(posx,0,linkdata[j].position.z-2.4);
|
||||
signaldata.rotation.z = ( Math.PI / 2 );
|
||||
// signaldata.scale.set(1,1,1);
|
||||
}else if(signaldata.directionType == "02"){
|
||||
signaldata.position.set(posx,0,linkdata[j].position.z+2.4);
|
||||
signaldata.rotation.z = ( - Math.PI / 2 );
|
||||
// signaldata.scale.set(1,1,1);
|
||||
}
|
||||
j = lenj;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
this.init = function(data,realsectionlist,scene,assetloader){
|
||||
|
@ -187,13 +187,19 @@ export function JLmap3dEdit(dom, data, mapid) {
|
||||
scope.eventon();
|
||||
}
|
||||
|
||||
if(changedata == "signalreplace"){
|
||||
scope.editmode = "signaledit";
|
||||
scope.eventon();
|
||||
}
|
||||
// if(scope.editmode == "trackedit"){
|
||||
// scope.selectmodel = scope.action.sectionaction.changemodel(scope,changedata);
|
||||
// }
|
||||
|
||||
|
||||
if(scope.actionmode == "signaledit"){
|
||||
scope.selectmodel = scope.action.signalaction.changemodel(scope,changedata);
|
||||
// scope.editmode == "signaledit";
|
||||
// scope.eventon();
|
||||
// scope.selectmodel = scope.action.signalaction.changemodel(scope,changedata);
|
||||
}
|
||||
|
||||
|
||||
@ -279,7 +285,8 @@ export function JLmap3dEdit(dom, data, mapid) {
|
||||
}
|
||||
|
||||
if(scope.editmode == "signaledit"){
|
||||
scope.selectmodel = scope.action.signalaction.raycaster(scope);
|
||||
console.log("==========signal=========");
|
||||
scope.selectmodel = scope.action.signalaction.raycaster(scope,"signal");
|
||||
}
|
||||
|
||||
if(scope.editmode == "stationedit"){
|
||||
|
@ -92,6 +92,15 @@ export function JLmapDriving(dom,data,mapId,storemod,translation) {
|
||||
this.drivecount = 0;
|
||||
this.drivedata = null;
|
||||
|
||||
var sectionlist = null;
|
||||
var linklist = null;
|
||||
var signallist = null;
|
||||
var stationstandlist = null;
|
||||
var trainlisttest = null;
|
||||
var realsectionlist = null;
|
||||
var rails = null;
|
||||
|
||||
|
||||
this.webwork=new Worker('../../static/workertest/trainworker.js');
|
||||
// 地图模型数据
|
||||
let mapdata = new Jl3ddata();
|
||||
@ -152,34 +161,34 @@ export function JLmapDriving(dom,data,mapId,storemod,translation) {
|
||||
|
||||
this.Subscribe.socketon(scope.Subscribe.topic);
|
||||
var timer = setInterval(function() {
|
||||
if(mapdata.trainlisttest){
|
||||
if(mapdata.trainlisttest.group){
|
||||
if(mapdata.trainlisttest.group.children[0]){
|
||||
updatemmi.updatedrivingcode(mapdata.trainlisttest.group.children[0].name);
|
||||
scope.Subscribe.initdrivercode(mapdata.trainlisttest.group.children[0].name);
|
||||
for(let k in mapdata.rails.switchrail){
|
||||
if(trainlisttest){
|
||||
if(trainlisttest.group){
|
||||
if(trainlisttest.group.children[0]){
|
||||
// updatemmi.updatedrivingcode(trainlisttest.group.children[0].name);
|
||||
scope.Subscribe.initdrivercode(trainlisttest.group.children[0].name);
|
||||
for(let k in rails.switchrail){
|
||||
const ddd = storemod.getters['map/getDeviceByCode'](k);
|
||||
let switchdata = mapdata.rails.switchrail[k];
|
||||
mapdata.rails.switchrail[k].locateType = ddd.locateType;
|
||||
let switchdata = rails.switchrail[k];
|
||||
rails.switchrail[k].locateType = ddd.locateType;
|
||||
|
||||
if(ddd.locateType == "01"){
|
||||
//1--向左 2--向右
|
||||
//__\__ __/__
|
||||
if(mapdata.rails.switchrail[k].directtype == "1"){
|
||||
mapdata.rails.linkrail[switchdata.alink].lconnect = switchdata.blink;
|
||||
mapdata.rails.linkrail[switchdata.blink].rconnect = switchdata.alink;
|
||||
}else if(mapdata.rails.switchrail[k].directtype == "2"){
|
||||
mapdata.rails.linkrail[switchdata.alink].rconnect = switchdata.blink;
|
||||
mapdata.rails.linkrail[switchdata.blink].lconnect = switchdata.alink;
|
||||
if(rails.switchrail[k].directtype == "1"){
|
||||
rails.linkrail[switchdata.alink].lconnect = switchdata.blink;
|
||||
rails.linkrail[switchdata.blink].rconnect = switchdata.alink;
|
||||
}else if(rails.switchrail[k].directtype == "2"){
|
||||
rails.linkrail[switchdata.alink].rconnect = switchdata.blink;
|
||||
rails.linkrail[switchdata.blink].lconnect = switchdata.alink;
|
||||
}
|
||||
|
||||
}else if(ddd.locateType == "02"){
|
||||
if(mapdata.rails.switchrail[k].directtype == "1"){
|
||||
mapdata.rails.linkrail[switchdata.alink].lconnect = switchdata.clink;
|
||||
mapdata.rails.linkrail[switchdata.clink].rconnect = switchdata.alink;
|
||||
}else if(mapdata.rails.switchrail[k].directtype == "2"){
|
||||
mapdata.rails.linkrail[switchdata.alink].rconnect = switchdata.clink;
|
||||
mapdata.rails.linkrail[switchdata.clink].lconnect = switchdata.alink;
|
||||
if(rails.switchrail[k].directtype == "1"){
|
||||
rails.linkrail[switchdata.alink].lconnect = switchdata.clink;
|
||||
rails.linkrail[switchdata.clink].rconnect = switchdata.alink;
|
||||
}else if(rails.switchrail[k].directtype == "2"){
|
||||
rails.linkrail[switchdata.alink].rconnect = switchdata.clink;
|
||||
rails.linkrail[switchdata.clink].lconnect = switchdata.alink;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -191,7 +200,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation) {
|
||||
}, 2000);
|
||||
// 初始化加载数据和模型
|
||||
getPublish3dMapDetail(mapId).then(netdata => {
|
||||
ModelLoad(data, scope, netdata.data, mapdata, camera, controls3, scene,mixers,storemod);
|
||||
ModelLoad(data, scope, netdata.data, sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails, camera, controls3, scene,mixers,storemod);
|
||||
});
|
||||
// let stats = new Stats();
|
||||
// dom.appendChild( stats.dom );
|
||||
@ -217,7 +226,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation) {
|
||||
renderercctv.render(scene,cameracctv);
|
||||
}
|
||||
//相机按键位移
|
||||
controls3.update();
|
||||
// controls3.update();
|
||||
delta = clock.getDelta();
|
||||
for (let i=mixers.length-1; i>=0; i--) {
|
||||
mixers[i].update( delta );
|
||||
@ -229,9 +238,9 @@ export function JLmapDriving(dom,data,mapId,storemod,translation) {
|
||||
|
||||
function updatcontrols() {
|
||||
if (drivingcode) {
|
||||
controls3.getObject().position.x = mapdata.trainlisttest.list[drivingcode].matrixWorld.elements[12]-27;
|
||||
controls3.getObject().position.x = trainlisttest.list[drivingcode].matrixWorld.elements[12]-27;
|
||||
controls3.getObject().position.y=5;
|
||||
controls3.getObject().position.z = mapdata.trainlisttest.list[drivingcode].children[0].matrixWorld.elements[14];
|
||||
controls3.getObject().position.z = trainlisttest.list[drivingcode].children[0].matrixWorld.elements[14];
|
||||
|
||||
// console.log(controls3);
|
||||
|
||||
@ -244,7 +253,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation) {
|
||||
|
||||
scope.webwork.onmessage = function (event) {
|
||||
// 更新列车位置
|
||||
UpdateTrain(camera, mapdata.trainlisttest);
|
||||
UpdateTrain(camera, trainlisttest);
|
||||
|
||||
};
|
||||
}
|
||||
@ -274,8 +283,9 @@ export function JLmapDriving(dom,data,mapId,storemod,translation) {
|
||||
};
|
||||
|
||||
updatemmi.updatedrivingcode = function(code) {
|
||||
console.log(trainlisttest);
|
||||
drivingcode = code;
|
||||
mapdata.trainlisttest.list[drivingcode].children[0].add(controls3.getObject());
|
||||
trainlisttest.list[drivingcode].children[0].add(controls3.getObject());
|
||||
controls3.getObject().position.x = 10;
|
||||
controls3.getObject().position.y = 0;
|
||||
controls3.getObject().position.z = 1.5;
|
||||
@ -316,24 +326,24 @@ export function JLmapDriving(dom,data,mapId,storemod,translation) {
|
||||
|
||||
this.showstationmsg = function(showtype) {
|
||||
if (showtype == 'show') {
|
||||
for (let st=0; st<mapdata.stationstandlist.group.children.length; st++) {
|
||||
mapdata.stationstandlist.group.children[st].add(mapdata.stationstandlist.textlist[st]);
|
||||
for (let st=0; st<stationstandlist.group.children.length; st++) {
|
||||
stationstandlist.group.children[st].add(stationstandlist.textlist[st]);
|
||||
}
|
||||
} else {
|
||||
for (let st=0; st<mapdata.stationstandlist.group.children.length; st++) {
|
||||
mapdata.stationstandlist.group.children[st].remove(mapdata.stationstandlist.textlist[st]);
|
||||
for (let st=0; st<stationstandlist.group.children.length; st++) {
|
||||
stationstandlist.group.children[st].remove(stationstandlist.textlist[st]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.showtrainmsg = function(showtype) {
|
||||
if (showtype == 'show') {
|
||||
for (let st=0; st<mapdata.trainlisttest.textlist.length; st++) {
|
||||
mapdata.trainlisttest.list[mapdata.trainlisttest.textlist[st].tcode].children[0].add(mapdata.trainlisttest.textlist[st]);
|
||||
for (let st=0; st<trainlisttest.textlist.length; st++) {
|
||||
trainlisttest.list[trainlisttest.textlist[st].tcode].children[0].add(trainlisttest.textlist[st]);
|
||||
}
|
||||
} else {
|
||||
for (let st=0; st<mapdata.trainlisttest.textlist.length; st++) {
|
||||
mapdata.trainlisttest.list[mapdata.trainlisttest.textlist[st].tcode].children[0].remove(mapdata.trainlisttest.textlist[st]);
|
||||
for (let st=0; st<trainlisttest.textlist.length; st++) {
|
||||
trainlisttest.list[trainlisttest.textlist[st].tcode].children[0].remove(trainlisttest.textlist[st]);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -364,6 +374,17 @@ export function JLmapDriving(dom,data,mapId,storemod,translation) {
|
||||
scope.Subscribe.socketoff(scope.Subscribe.topic);
|
||||
};
|
||||
|
||||
this.loaderdata = function(loadsectionlist,loadlinklist,loadsignallist,loadstationstandlist,loadtrainlisttest,loadrealsectionlist,loadrails){
|
||||
|
||||
sectionlist = loadsectionlist;
|
||||
linklist = loadlinklist;
|
||||
signallist = loadsignallist;
|
||||
stationstandlist = loadstationstandlist;
|
||||
trainlisttest = loadtrainlisttest;
|
||||
realsectionlist = loadrealsectionlist;
|
||||
rails = loadrails;
|
||||
}
|
||||
|
||||
this.eventon = function() {
|
||||
// raycaster交互模型点击事件
|
||||
document.getElementById('jlsimulation').addEventListener( 'mousedown', onselect, false );
|
||||
@ -436,17 +457,17 @@ export function JLmapDriving(dom,data,mapId,storemod,translation) {
|
||||
|
||||
if (scope.raycasterswitch == 'stand') {
|
||||
// 从站台对象组获取点击目标
|
||||
let intersects1 = raycaster.intersectObjects( mapdata.stationstandlist.textlist);
|
||||
let intersects1 = raycaster.intersectObjects( stationstandlist.textlist);
|
||||
// 获取最近处点击到的模型对象
|
||||
if (intersects1[0]) {
|
||||
// 遍历对象组获取对象坐标更新相机数据
|
||||
for (let j=0; j<mapdata.stationstandlist.list.length; j++) {
|
||||
if (intersects1[0].object.name == mapdata.stationstandlist.list[j].mesh.code) {
|
||||
camera.position.x = mapdata.stationstandlist.list[j].mesh.position.x;
|
||||
camera.position.y = mapdata.stationstandlist.list[j].mesh.position.y+200;
|
||||
camera.position.z = mapdata.stationstandlist.list[j].mesh.position.z+300;
|
||||
for (let j=0; j<stationstandlist.list.length; j++) {
|
||||
if (intersects1[0].object.name == stationstandlist.list[j].mesh.code) {
|
||||
camera.position.x = stationstandlist.list[j].mesh.position.x;
|
||||
camera.position.y = stationstandlist.list[j].mesh.position.y+200;
|
||||
camera.position.z = stationstandlist.list[j].mesh.position.z+300;
|
||||
// 更新相机方向
|
||||
// controls.target = new THREE.Vector3(mapdata.stationstandlist.list[j].mesh.position.x,mapdata.stationstandlist.list[j].mesh.position.y,mapdata.stationstandlist.list[j].mesh.position.z);
|
||||
// controls.target = new THREE.Vector3(stationstandlist.list[j].mesh.position.x,stationstandlist.list[j].mesh.position.y,stationstandlist.list[j].mesh.position.z);
|
||||
// controls.update();
|
||||
}
|
||||
}
|
||||
@ -454,21 +475,21 @@ export function JLmapDriving(dom,data,mapId,storemod,translation) {
|
||||
}
|
||||
|
||||
if (scope.raycasterswitch == 'train') {
|
||||
let intersects = raycaster.intersectObjects( mapdata.trainlisttest.textlist);
|
||||
let intersects = raycaster.intersectObjects( trainlisttest.textlist);
|
||||
if (intersects[0]) {
|
||||
for (let j=0; j<mapdata.trainlisttest.list.length; j++) {
|
||||
if (intersects[0].object.name == mapdata.trainlisttest.list[j].name) {
|
||||
camera.position.x = mapdata.trainlisttest.list[j].position.x;
|
||||
for (let j=0; j<trainlisttest.list.length; j++) {
|
||||
if (intersects[0].object.name == trainlisttest.list[j].name) {
|
||||
camera.position.x = trainlisttest.list[j].position.x;
|
||||
camera.position.y = 200;
|
||||
camera.position.z = mapdata.trainlisttest.list[j].children[2].matrixWorld.elements[14]+300;
|
||||
camera.position.z = trainlisttest.list[j].children[2].matrixWorld.elements[14]+300;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (scope.raycasterswitch == 'section') {
|
||||
// console.log(mapdata.sectionlist.sections.modellist);
|
||||
let intersects = raycaster.intersectObjects( mapdata.sectionlist.sections.modellist, true);
|
||||
// console.log(sectionlist.sections.modellist);
|
||||
let intersects = raycaster.intersectObjects( sectionlist.sections.modellist, true);
|
||||
if (intersects[0]) {
|
||||
|
||||
scope.helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );
|
||||
@ -478,7 +499,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation) {
|
||||
|
||||
if (scope.raycasterswitch == 'signal') {
|
||||
|
||||
let intersects = raycaster.intersectObjects( mapdata.signallist.group.children, true);
|
||||
let intersects = raycaster.intersectObjects( signallist.group.children, true);
|
||||
|
||||
if (intersects[0]) {
|
||||
scope.helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );
|
||||
@ -487,7 +508,7 @@ export function JLmapDriving(dom,data,mapId,storemod,translation) {
|
||||
}
|
||||
|
||||
if (scope.raycasterswitch == 'switch') {
|
||||
let intersects = raycaster.intersectObjects( mapdata.sectionlist.switchs.modellist, true);
|
||||
let intersects = raycaster.intersectObjects( sectionlist.switchs.modellist, true);
|
||||
|
||||
if (intersects[0]) {
|
||||
scope.helpbox = new THREE.BoxHelper( intersects[0].object, 0xff0000 );
|
||||
|
@ -43,20 +43,18 @@ export function Jl3dDriving(updatemmi,sound,translation) {
|
||||
this.topic = '/user/queue/simulation/jl3d';
|
||||
let header = {'X-Token': handleToken() };
|
||||
|
||||
this.updatamap = function(mapdata, materiallist, nowaction, scene) {
|
||||
this.updatamap = function(newsectionlist,newlinklist,newsignallist,newstationstandlist,newtrainlisttest,newrealsectionlist,newrails, materiallist, nowaction, scene) {
|
||||
// console.log(mapdata);
|
||||
|
||||
scope.map = mapdata;
|
||||
trainlisttest = this.map.trainlisttest;
|
||||
sectionlist = this.map.sectionlist;
|
||||
signallist = this.map.signallist;
|
||||
stationstandlist = this.map.stationstandlist;
|
||||
sectionlist = this.map.sectionlist;
|
||||
console.log(newtrainlisttest);
|
||||
trainlisttest = newtrainlisttest;
|
||||
sectionlist = newsectionlist;
|
||||
signallist = newsignallist;
|
||||
stationstandlist = newstationstandlist;
|
||||
materials = materiallist;
|
||||
scenes = scene;
|
||||
actions = nowaction;
|
||||
links = this.map.linklist;
|
||||
rails = this.map.rails;
|
||||
links = newlinklist;
|
||||
rails = newrails;
|
||||
};
|
||||
|
||||
this.initdrivercode = function(code) {
|
||||
@ -224,7 +222,7 @@ export function Jl3dDriving(updatemmi,sound,translation) {
|
||||
|
||||
} else {
|
||||
if(trainlisttest.list[code].targetLink == trainlisttest.list[code].nowcode){
|
||||
if(trainlisttest.list[code].progress<=trainlisttest.list[code].targetpercent){
|
||||
if((trainlisttest.list[code].linkOffsetPercent/trainlisttest.list[code].pc)<=trainlisttest.list[code].targetpercent){
|
||||
syncdata.percent = (1 - trainlisttest.list[code].progress);
|
||||
}else{
|
||||
syncdata.percent = (1 - trainlisttest.list[code].progress)*trainlisttest.list[code].pc;
|
||||
@ -233,12 +231,11 @@ export function Jl3dDriving(updatemmi,sound,translation) {
|
||||
syncdata.percent = (1 - trainlisttest.list[code].progress);
|
||||
}
|
||||
}
|
||||
|
||||
// console.log(syncdata);
|
||||
// console.log(trainlisttest.list[code].nextcurve);
|
||||
// console.log("=============");
|
||||
// console.log("send");
|
||||
// console.log(trainlisttest.list[code]);
|
||||
//
|
||||
// console.log(syncdata);
|
||||
// console.log("=============");
|
||||
scope.teststomp.send('/app/topic/simulation/client/drive', syncdata);
|
||||
}
|
||||
|
||||
@ -248,8 +245,10 @@ export function Jl3dDriving(updatemmi,sound,translation) {
|
||||
}
|
||||
|
||||
function trainstatus(data){
|
||||
// console.log(data.body);
|
||||
for (let i=data.body.length-1; i>=0; i--) {
|
||||
// 遍历列车对象组
|
||||
// console.log(trainlisttest);
|
||||
if (trainlisttest) {
|
||||
|
||||
code = data.body[i].code;
|
||||
@ -351,7 +350,7 @@ export function Jl3dDriving(updatemmi,sound,translation) {
|
||||
let vexlist = [];
|
||||
let endrotation = null;
|
||||
trainlisttest.list[code].pc = 1;
|
||||
|
||||
console.log(data.body[i]);
|
||||
if (data.body[i].directionType == '02') { // 向右
|
||||
let point = rails.linkrail[data.body[i].linkCode].lineleft.getPointAt(data.body[i].linkOffsetPercent);
|
||||
trainlisttest.list[code].rotation.y = 0;
|
||||
@ -362,9 +361,10 @@ export function Jl3dDriving(updatemmi,sound,translation) {
|
||||
}
|
||||
if(data.body[i].targetStation){
|
||||
trainlisttest.list[code].stopstation = data.body[i].targetStation;
|
||||
console.log(rails.stops[data.body[i].targetStation].direct2.percent);
|
||||
trainlisttest.list[code].pc = data.body[i].targetLinkPercent/rails.stops[data.body[i].targetStation].direct2.percent;
|
||||
trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct2.percent;
|
||||
trainlisttest.list[code].progress = data.body[i].linkOffsetPercent/trainlisttest.list[code].pc;
|
||||
trainlisttest.list[code].progress = data.body[i].linkOffsetPercent*trainlisttest.list[code].pc;
|
||||
trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent;
|
||||
trainlisttest.list[code].targetLink = data.body[i].targetLink;
|
||||
}else{
|
||||
@ -387,11 +387,16 @@ export function Jl3dDriving(updatemmi,sound,translation) {
|
||||
// console.log("0000000000000000");
|
||||
// console.log(data.body[i].linkOffsetPercent);
|
||||
// }
|
||||
console.log(data.body[i].targetLinkPercent);
|
||||
if(data.body[i].targetStation){
|
||||
|
||||
trainlisttest.list[code].stopstation = data.body[i].targetStation;
|
||||
trainlisttest.list[code].pc = data.body[i].targetLinkPercent/rails.stops[data.body[i].targetStation].direct1.percent;
|
||||
trainlisttest.list[code].pc = parseFloat(data.body[i].targetLinkPercent)/parseFloat(rails.stops[data.body[i].targetStation].direct1.percent);
|
||||
console.log(data.body[i].targetLinkPercent);
|
||||
console.log(rails.stops[data.body[i].targetStation].direct1.percent);
|
||||
console.log(trainlisttest.list[code].pc);
|
||||
trainlisttest.list[code].targetpercent = rails.stops[data.body[i].targetStation].direct1.percent;
|
||||
trainlisttest.list[code].progress = (1-data.body[i].linkOffsetPercent)/trainlisttest.list[code].pc;
|
||||
trainlisttest.list[code].progress = (1-data.body[i].linkOffsetPercent)*trainlisttest.list[code].pc;
|
||||
trainlisttest.list[code].linkOffsetPercent = data.body[i].linkOffsetPercent;
|
||||
trainlisttest.list[code].targetLink = data.body[i].targetLink;
|
||||
}else{
|
||||
@ -651,7 +656,7 @@ export function Jl3dDriving(updatemmi,sound,translation) {
|
||||
}
|
||||
}
|
||||
|
||||
if (data.body[i]._type == 'StationStand') {
|
||||
if (data.body[i]._type == 'StationStand' ) {
|
||||
if (actions) {
|
||||
standupdate(data.body[i]);
|
||||
}
|
||||
@ -705,72 +710,72 @@ export function Jl3dDriving(updatemmi,sound,translation) {
|
||||
// 77
|
||||
// 关闭
|
||||
if (data.status == '01') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map = materials[0];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[0];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[3].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[3].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// 开放
|
||||
if (data.status == '02') {
|
||||
|
||||
if (data.switchLocateType == '01') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[2];
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[3].material.map = materials[2];
|
||||
signallist.list[code].mesh.children[3].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
if (data.switchLocateType == '02') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[1];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[3].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[3].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// 引导
|
||||
if (data.status == '03') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map = materials[0];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[0];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[1];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[3].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[3].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// 封锁
|
||||
if (data.status == '04') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[3].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[3].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// 故障
|
||||
if (data.status == '05') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[3].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[3].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (data.lightType == '01') {
|
||||
} else if (data.lightType == '02') {
|
||||
if (signallist.list[code].mesh.code) {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
|
@ -13,8 +13,8 @@ export function UpdateTrain(camera,traindata,control){
|
||||
|
||||
let movecurve = trainmodel.curve;
|
||||
|
||||
if(trainmodel.status == "03"){
|
||||
if(movecurve.points.length>1){
|
||||
if(trainmodel.status == "03" && movecurve.points.length>1){
|
||||
|
||||
let point = movecurve.getPointAt(traindata.group.children[0].progress);
|
||||
trainmodel.position.x = point.x;
|
||||
trainmodel.position.y = 0;
|
||||
@ -71,11 +71,10 @@ export function UpdateTrain(camera,traindata,control){
|
||||
}
|
||||
}
|
||||
trainmodel.progress += trainmodel.speeds;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(trainmodel.status == "02"){
|
||||
if(movecurve.points.length>1){
|
||||
if(trainmodel.status == "02" && mmovecurve.points.length>1){
|
||||
let point = movecurve.getPointAt(trainmodel.progress);
|
||||
trainmodel.position.x = point.x;
|
||||
trainmodel.position.y = 0;
|
||||
@ -137,25 +136,20 @@ export function UpdateTrain(camera,traindata,control){
|
||||
}
|
||||
trainmodel.progress += trainmodel.speeds;
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
if(trainmodel.nextcurve){
|
||||
// if(trainmodel.status == '02'){
|
||||
// }else if(trainmodel.status == '03'){
|
||||
// }
|
||||
|
||||
trainmodel.progress = 0;
|
||||
trainmodel.len = trainmodel.nextlen;
|
||||
trainmodel.nowcode = trainmodel.nextcode;
|
||||
trainmodel.speeds = parseFloat(trainmodel.speed*10/36/25/trainmodel.len);
|
||||
trainmodel.curve = trainmodel.nextcurve;
|
||||
|
||||
trainmodel.nextcurve = null;
|
||||
trainmodel.nextlen = null;
|
||||
trainmodel.nextcode = null;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// console.log(trainmodel.name);
|
||||
@ -176,8 +170,7 @@ export function UpdateTrain(camera,traindata,control){
|
||||
|
||||
let movecurve = trainmodel.curve;
|
||||
|
||||
if(trainmodel.status == "03" && trainmodel.progress>0){
|
||||
if(movecurve.points.length>1){
|
||||
if(trainmodel.status == "03" && trainmodel.progress>0 && movecurve.points.length>1){
|
||||
let point = movecurve.getPointAt(traindata.group.children[0].progress);
|
||||
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.005){
|
||||
trainmodel.children[0].up = new THREE.Vector3(-1,0,0);
|
||||
@ -235,10 +228,8 @@ export function UpdateTrain(camera,traindata,control){
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(trainmodel.status == "02"){
|
||||
if(movecurve.points.length>1 && trainmodel.progress>0){
|
||||
if(trainmodel.status == "02" && movecurve.points.length>1 && trainmodel.progress>0){
|
||||
|
||||
let point = movecurve.getPointAt(trainmodel.progress);
|
||||
if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.005){
|
||||
@ -302,7 +293,7 @@ export function UpdateTrain(camera,traindata,control){
|
||||
trainmodel.progress += trainmodel.speeds;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -442,19 +442,20 @@ export function Jlmap3dSubscribe(jlmap3d) {
|
||||
// 0xCD0000 红
|
||||
// 0xEEEE00 黄
|
||||
// 0x32CD32 绿
|
||||
if (data.body[i]._type == 'Signal') {
|
||||
if (data.body[i]._type == 'Signal' && signallist) {
|
||||
if (signallist) {
|
||||
console.log(data.body[i]);
|
||||
signalupdate(data.body[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (data.body[i]._type == 'StationStand') {
|
||||
if (data.body[i]._type == 'StationStand' && actions) {
|
||||
if (actions) {
|
||||
standupdate(data.body[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (data.body[i]._type == 'Switch') {
|
||||
if (data.body[i]._type == 'Switch' && sectionlist) {
|
||||
if (sectionlist) {
|
||||
switchupdate(data.body[i]);
|
||||
}
|
||||
@ -494,6 +495,7 @@ export function Jlmap3dSubscribe(jlmap3d) {
|
||||
|
||||
function signalupdate(data) {
|
||||
code = data.code;
|
||||
|
||||
if (data.lightType == '01') {
|
||||
if (signallist.list[code].mesh.code) {
|
||||
signallist.list[code].mesh.status = data.status;
|
||||
@ -503,66 +505,66 @@ export function Jlmap3dSubscribe(jlmap3d) {
|
||||
// 77
|
||||
// 关闭
|
||||
if (data.status == '01') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map = materials[0];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[0];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[3].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[3].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// 开放
|
||||
if (data.status == '02') {
|
||||
|
||||
if (data.switchLocateType == '01') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[2];
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[3].material.map = materials[2];
|
||||
signallist.list[code].mesh.children[3].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
if (data.switchLocateType == '02') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[1];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[3].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[3].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// 引导
|
||||
if (data.status == '03') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map = materials[0];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[0];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[1];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[3].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[3].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// 封锁
|
||||
if (data.status == '04') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[3].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[3].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
// 故障
|
||||
if (data.status == '05') {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[3].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[3].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
@ -572,10 +574,10 @@ export function Jlmap3dSubscribe(jlmap3d) {
|
||||
if (signallist.list[code].mesh.code) {
|
||||
signallist.list[code].mesh.children[0].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[0].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[1].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[1].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[2].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[2].material.map.needsUpdate = true;
|
||||
signallist.list[code].mesh.children[3].material.map = materials[3];
|
||||
signallist.list[code].mesh.children[3].material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,7 @@ export function JLmap3d(dom, data,skinCode,storemod) {
|
||||
let camera = SetCamera(dom);
|
||||
//定义场景(渲染容器)
|
||||
let scene = SetScene();
|
||||
|
||||
//定义镜头操作
|
||||
let controls = new THREE.OrbitControls(camera);
|
||||
controls.maxPolarAngle = Math.PI/2;
|
||||
|
@ -65,7 +65,7 @@ let defaultsuidao = {
|
||||
deviceType:"suidao",
|
||||
type:"suidao",
|
||||
picUrl:"",
|
||||
assetUrl:modelurl+"/models/suidao/suidao.FBX"
|
||||
assetUrl:"../../static/model/suidao/suidao.FBX"
|
||||
}
|
||||
//modelurl+"/models/suidao/suidao.FBX"
|
||||
//https://test.joylink.club/oss/models/suidao/suidao.FBX
|
||||
|
@ -12,13 +12,14 @@ import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
|
||||
import { Loading } from 'element-ui';
|
||||
// import {SwitchModel} from '@/jlmap3d/model/SwitchModel.js';
|
||||
|
||||
export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixerss,storemod){
|
||||
export function ModelLoad(data,scope,netdata,sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails,camera,controls,scene,mixerss,storemod){
|
||||
//console.log(mapdata);
|
||||
Materialload(scope);
|
||||
//console.log(data);
|
||||
//console.log(scope);
|
||||
let sceneload = scene;
|
||||
let jlmap3ddata = mapdata;
|
||||
// let jlmap3ddata = mapdata;
|
||||
let backdata = scope;
|
||||
let assetloader = scope.assetloader;
|
||||
let animateswitch = scope.animateswitch;
|
||||
|
||||
@ -50,39 +51,41 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixer
|
||||
// console.log(data);
|
||||
//初始化轨道和道岔 暂时
|
||||
lengthfact(data);
|
||||
jlmap3ddata.linklist = new LinkList();
|
||||
jlmap3ddata.sectionlist = new SectionList();
|
||||
jlmap3ddata.signallist = new SignalList();
|
||||
//初始化站台
|
||||
jlmap3ddata.stationstandlist = new StationStandList();
|
||||
//初始化测试列车
|
||||
jlmap3ddata.trainlisttest = new TrainList();
|
||||
|
||||
jlmap3ddata.realsectionlist = new RealSectionList();
|
||||
jlmap3ddata.rails = new RailList();
|
||||
linklist = new LinkList();
|
||||
sectionlist = new SectionList();
|
||||
signallist = new SignalList();
|
||||
//初始化站台
|
||||
stationstandlist = new StationStandList();
|
||||
//初始化测试列车
|
||||
trainlisttest = new TrainList();
|
||||
realsectionlist = new RealSectionList();
|
||||
|
||||
rails = new RailList();
|
||||
|
||||
let loaderdata = JSON.parse(netdata.sections);
|
||||
let switchdata = JSON.parse(netdata.switchs);
|
||||
let signaldata = JSON.parse(netdata.signals);
|
||||
let standsdata = JSON.parse(netdata.stands);
|
||||
|
||||
assetloader.setmodellist(netdata.assets);
|
||||
|
||||
assetloader.assetpromise(sceneload)
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return jlmap3ddata.linklist.loadpromise(loaderdata.link,scene,assetloader);
|
||||
return linklist.loadpromise(loaderdata.link,sceneload,assetloader);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return jlmap3ddata.stationstandlist.initpromise(mapdata.stationList,mapdata.stationStandList,sceneload,assetloader,netdata.stands,mixers,actions,"0");
|
||||
return stationstandlist.initpromise(mapdata.stationList,mapdata.stationStandList,sceneload,assetloader,netdata.stands,mixers,actions,"0");
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
//console.log(assetloader);
|
||||
return jlmap3ddata.trainlisttest.initpromise(mapdata.trainList,sceneload,assetloader,mixers,actions,"0");
|
||||
return trainlisttest.initpromise(mapdata.trainList,sceneload,assetloader,mixers,actions,"0");
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return jlmap3ddata.sectionlist.loadpromise(jlmap3ddata,assetloader,loaderdata.section,switchdata,sceneload);
|
||||
return sectionlist.loadpromise(linklist,assetloader,loaderdata.section,switchdata,sceneload);
|
||||
})
|
||||
// .then(function(data){
|
||||
// //console.log(data);
|
||||
@ -90,11 +93,12 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixer
|
||||
// })
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return jlmap3ddata.signallist.initpromise(mapdata.signalList,sceneload,assetloader,netdata.signals);
|
||||
return signallist.initpromise(mapdata.signalList,sceneload,assetloader,netdata.signals);
|
||||
})
|
||||
.then(function(data){
|
||||
return new Promise(function(resolve, reject){
|
||||
jlmap3ddata.rails.init(loaderdata.link,mapdata.linkList,mapdata.sectionList,switchdata,jlmap3ddata.stationstandlist.list,sceneload,storemod);
|
||||
rails.init(loaderdata.link,mapdata.linkList,mapdata.sectionList,switchdata,
|
||||
stationstandlist.list,sceneload,storemod);
|
||||
resolve("loadrail");
|
||||
|
||||
});
|
||||
@ -113,9 +117,9 @@ export function ModelLoad(data,scope,netdata,mapdata,camera,controls,scene,mixer
|
||||
|
||||
scope.animateswitch = true;
|
||||
|
||||
mapdata = jlmap3ddata;
|
||||
|
||||
scope.Subscribe.updatamap(mapdata,scope.materiallist,scope.actions,scope.sceneload);
|
||||
// mapdata = jlmap3ddata;
|
||||
backdata.loaderdata(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails);
|
||||
scope.Subscribe.updatamap(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails,scope.materiallist,scope.actions,scope.sceneload);
|
||||
scope.webwork.postMessage("on");
|
||||
loadingInstance.close();
|
||||
});
|
||||
|
@ -21,6 +21,7 @@ export function LinkList(data){
|
||||
};
|
||||
|
||||
this.loadpromise = function(linkdata,scene,assetloader){
|
||||
// console.log(linkdata);
|
||||
return new Promise(function(resolve, reject){
|
||||
scene.add(scope.linksgroup);
|
||||
loadlink(linkdata,scene,assetloader);
|
||||
|
@ -104,11 +104,11 @@ export function SectionList() {
|
||||
});
|
||||
|
||||
};
|
||||
this.loadpromise = function(jlmap3ddata,assetloader,sectiondata,switchdata,scene){
|
||||
this.loadpromise = function(linklist,assetloader,sectiondata,switchdata,scene){
|
||||
return new Promise(function(resolve, reject){
|
||||
// scene.add(sectiongroup);
|
||||
scene.add(switchgroup);
|
||||
let linkdata = jlmap3ddata.linklist;
|
||||
let linkdata = linklist;
|
||||
|
||||
for(let i=0;i<sectiondata.length;i++){
|
||||
if(sectiondata[i].type == "01"){
|
||||
|
@ -67,10 +67,11 @@ export function SignalList() {
|
||||
}
|
||||
|
||||
let newmesh = assetloader.modellist[num].mesh.clone(true);
|
||||
|
||||
|
||||
for(let j=0;j<newmesh.children.length;j++){
|
||||
let newmaterial = new THREE.MeshPhongMaterial();
|
||||
newmaterial.copy(newmesh.children[j].material);
|
||||
|
||||
newmesh.children[j].material = newmaterial;
|
||||
newmesh.children[j].material.needsUpdate = true;
|
||||
newmaterial.dispose();
|
||||
|
@ -9,6 +9,5 @@ export function Jl3ddata() {
|
||||
this.stationstandlist = null;
|
||||
this.trainlisttest = null;
|
||||
this.realsectionlist = null;
|
||||
this.path = [];
|
||||
|
||||
}
|
||||
|
@ -33,11 +33,11 @@
|
||||
|
||||
<el-tab-pane label="信号灯编辑" name="signaledit">
|
||||
<el-row>
|
||||
<el-button id="trackreplace" class="editbutton" @click="actionevent">信号灯模型设置</el-button>
|
||||
<el-button id="signalreplace" class="editbutton" @click="actionevent">信号灯模型设置</el-button>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-button id="tracktexture" class="editbutton" @click="actionevent">信号灯模型调整</el-button>
|
||||
<el-button id="signaltexture" class="editbutton" @click="actionevent">信号灯模型调整</el-button>
|
||||
</el-row>
|
||||
|
||||
</el-tab-pane>
|
||||
|
BIN
static/background/background.jpeg
Normal file
BIN
static/background/background.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 111 KiB |
BIN
static/background/background.jpg
Normal file
BIN
static/background/background.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 72 KiB |
Binary file not shown.
BIN
static/model/suidao/suidao2.FBX
Normal file
BIN
static/model/suidao/suidao2.FBX
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user