增加三维大铁驾驶界面更新,增加三维大铁信号机,修改大铁三维加载和大铁信号模块

This commit is contained in:
sunzhenyu 2021-06-04 17:26:41 +08:00
parent 9ae1cf2ead
commit 23ad69529a
34 changed files with 2565 additions and 123 deletions

View File

@ -1,7 +1,7 @@
import Vue from 'vue';
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
// 模型loader
import { AssetLoader } from '@/jlmap3d/main/loaders/AssetLoader.js';
import { AssetLoader } from '@/jlmap3d/jl3drailwaydrive/loader/AssetLoader.js';
import {DDSLoader} from '@/jlmap3d/main/loaders/DDSLoader.js';
import {OBJLoader} from '@/jlmap3d/main/loaders/OBJLoader.js';
import {MTLLoader} from '@/jlmap3d/main/loaders/MTLLoader.js';
@ -135,6 +135,8 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj
// sound.play();
// });
let controls3 = new MouseControls(camera, 1.6);
controls3.enabled = false;
// controls3.getObject().rotation.x = Math.PI/2;

View File

@ -0,0 +1,486 @@
import { AssetModel } from '@/jlmap3d/main/loaders/model/Assetmodel';
import { Assetmaterial } from '@/jlmap3d/main/loaders/model/Assetmaterial';
import { getBaseUrl } from '@/utils/baseUrl';
import { Loading } from 'element-ui';
const BASE_API = getBaseUrl();
import { JL3D_LOCAL_STATIC,BASE_ASSET_API } from '@/api/jlmap3d/assets3d.js';
let signal5 = {
id:"s1",
name:"竖5灯",
deviceType:"signal5",
type:"static",
mesh:"",
url:JL3D_LOCAL_STATIC+"/jl3d/railway/model/signal5.FBX"
}
let signal32 = {
id:"s2",
name:"32灯",
deviceType:"signal32",
type:"static",
mesh:"",
url:JL3D_LOCAL_STATIC+"/jl3d/railway/model/signal32.FBX"
}
let signal3 = {
id:"s3",
name:"3灯",
deviceType:"signal3",
type:"static",
mesh:"",
url:JL3D_LOCAL_STATIC+"/jl3d/railway/model/signal3.FBX"
}
let signal2 = {
id:"s4",
name:"2灯",
deviceType:"signal2",
type:"static",
mesh:"",
url:JL3D_LOCAL_STATIC+"/jl3d/railway/model/signal2.FBX"
}
export function AssetLoader(){
let scope = this;
this.name = null;
this.trainoffset = 0;
this.modellist = [];
this.modelgroup = [];
this.materiallist = [];
this.setModelListOver = function (data,trainoffset,others){
if(trainoffset){
scope.trainoffset = trainoffset;
}
let signal5model = new AssetModel(signal5);
scope.modellist.push(signal5);
let signal32model = new AssetModel(signal32);
scope.modellist.push(signal32);
let signal3model = new AssetModel(signal3);
scope.modellist.push(signal3);
let signal2model = new AssetModel(signal2);
scope.modellist.push(signal2);
let modeldata = data;
for(let j=0;j<modeldata.length;j++){
let had = false;
for(let i=0;i<scope.modellist.length;i++){
if(scope.modellist[i].id == modeldata[j].id){
had = true;
i = scope.modellist.length;
}
}
if(had == false){
if(modeldata[j].url != ""){
let model = new AssetModel(modeldata[j]);
scope.modellist.push(modeldata[j]);
}
}
}
}
this.assetPromiseOver = function (scene){
let initlist = [];
for(let i=0;i<scope.modellist.length;i++){
initlist.push(fbxPromiseOver(scope.modellist[i]));
}
return new Promise(function(resolve, reject){
Promise.all(initlist).then((result) => {
resolve("loaderassets"); //['成功了', 'success']
}).catch((error) => {
//console.log(error);
});
});
}
this.assetpromise = function (scene){
let initlist = [];
for(let i=0;i<scope.modellist.length;i++){
initlist.push(fbxpromiseold(scope.modellist[i]));
}
return new Promise(function(resolve, reject){
Promise.all(initlist).then((result) => {
resolve("loaderassets"); //['成功了', 'success']
}).catch((error) => {
//console.log(error);
});
});
}
this.assetinit = function(scene){
return new Promise(function(resolve, reject){
let signal = new AssetModel(defaultsignal);
scope.modellist.push(signal);
let train = new AssetModel(defaulttrain);
scope.modellist.push(train);
let station = new AssetModel(defaultstation);
scope.modellist.push(station);
let wstation = new AssetModel(waicestation);
scope.modellist.push(wstation);
let autorail = new AssetModel(defaultautorail);
scope.modellist.push(autorail);
let defaultswitch1 = new AssetModel(autoswitch1);
scope.modellist.push(defaultswitch1);
let defaultswitch2 = new AssetModel(autoswitch2);
scope.modellist.push(defaultswitch2);
let autoswitchs = new AssetModel(autoswitch);
scope.modellist.push(autoswitchs);
fbxpromise(signal)
.then(function(data){
////console.log(data);
// console.log("test");
return fbxpromise(train);
})
.then(function(data){
////console.log(data);
// console.log("test");
return fbxpromise(station);
})
.then(function(data){
////console.log(data);
// console.log("test");
return fbxpromise(wstation);
})
// .then(function(data){
// ////console.log(data);
// return fbxpromise(autorail);
// })
// .then(function(data){
// ////console.log(data);
// return fbxpromise(autosuidao);
// })
.then(function(data){
////console.log(data);
// console.log("defaultswitch1");
return fbxpromise(defaultswitch1);
})
.then(function(data){
// console.log("defaultswitch2");
////console.log(data);
return fbxpromise(defaultswitch2);
})
.then(function(data){
////console.log(data);
// console.log("autoswitchs");
return fbxpromise(autoswitchs);
})
.then(function(data){
////console.log(scope.modellist);
resolve("loaderassets");
});
});
}
this.loadnewsection = function(newdata,jlmap3dedit){
let loadingInstance = Loading.service({ fullscreen: true });
let scene = jlmap3dedit.scene;
let newmodel = new AssetModel(newdata);
let jlmap3ddata = jlmap3dedit.mapdata;
scope.modellist.push(newmodel);
scene.remove(jlmap3dedit.exportmodel);
var loader = new THREE.FBXLoader();
loader.load( newdata.assetUrl, function ( object ) {
let newmesh = object;
//let mixer = new THREE.AnimationMixer( newmesh );
////console.log(jlmap3ddata.sectionlist);
for(let i=0;i<newmesh.children.length;i++){
let name = newmesh.children[i].name.split("_");
let newmeshname = name[0]+"_"+name[1]+"_"+name[2]+"."+name[3];
if(name[0] == "Switch"){
for(let j=0;j<jlmap3ddata.sectionlist.switchs.datalist.length;j++){
if(jlmap3ddata.sectionlist.switchs.datalist[j].name == newmeshname){
//绿色道岔
var box = new THREE.BoxHelper( newmesh.children[i], 0x00EE00 );
scene.add(box);
let nowname = jlmap3ddata.sectionlist.switchs.datalist[j].name;
let nowcode = jlmap3ddata.sectionlist.switchs.datalist[j].code;
newmesh.children[i].name = nowname;
newmesh.children[i].code = nowcode;
for(let n=0;n<newmesh.children[i].children.length;n++){
newmesh.children[i].children[n].code = nowcode;
}
jlmap3ddata.sectionlist.switchs.modellist[j] = newmesh.children[i];
j = jlmap3ddata.sectionlist.switchs.datalist.length;
}
}
}
if(name[0] == "Section"){
//物理区段
for(let j=0;j<jlmap3ddata.sectionlist.sections.datalist.length;j++){
if(jlmap3ddata.sectionlist.sections.datalist[j].name == newmeshname){
if(jlmap3ddata.sectionlist.sections.datalist[j].isStandTrack == true){
//红色站台区段
var box = new THREE.BoxHelper( newmesh.children[i], 0xff0000 );
}else{
//蓝色其他区段
var box = new THREE.BoxHelper( newmesh.children[i], 0x0000ff );
}
scene.add( box );
let nowname = jlmap3ddata.sectionlist.sections.datalist[j].name;
let nowcode = jlmap3ddata.sectionlist.sections.datalist[j].code;
newmesh.children[i].name = nowname;
newmesh.children[i].code = nowcode;
jlmap3ddata.sectionlist.sections.modellist[j] = newmesh.children[i];
j = jlmap3ddata.sectionlist.sections.datalist.length;
}
}
}
if(name[0] == "Singal"){
for(let j=0;j<jlmap3ddata.signallist.list.length;j++){
if(jlmap3ddata.signallist.list[j].mesh.code == newmeshname){
jlmap3ddata.signallist.list[j].mesh.position.x = newmesh.children[i].position.x;
jlmap3ddata.signallist.list[j].mesh.position.y = newmesh.children[i].position.y;
jlmap3ddata.signallist.list[j].mesh.position.z = newmesh.children[i].position.z;
j = jlmap3ddata.signallist.list.length;
}
}
}
if(name[0] == "Station"){
for(let j=0;j<jlmap3ddata.stationstandlist.list.length;j++){
if(jlmap3ddata.stationstandlist.list[j].mesh.code == newmeshname){
jlmap3ddata.stationstandlist.list[j].mesh.position.x = newmesh.children[i].position.x;
jlmap3ddata.stationstandlist.list[j].mesh.position.y = newmesh.children[i].position.y;
jlmap3ddata.stationstandlist.list[j].mesh.position.z = newmesh.children[i].position.z;
j = jlmap3ddata.stationstandlist.list.length;
}
}
}
}
scene.add(newmesh);
loadingInstance.close();
//console.log("add");
} );
}
//新载入资源
this.loadnewasset = function(jlmap3dedit,newdata,num){
let newmodel = new AssetModel(newdata);
scope.modellist.push(newmodel);
fbxload(newmodel);
var loader = new THREE.FBXLoader();
loader.load( newdata.assetUrl, function ( object ) {
jlmap3dedit.transcontrol.detach();
jlmap3dedit.mapdata.signallist.group.remove(jlmap3dedit.mapdata.signallist.list[num].mesh);
object.name = newdata.uuid;
object.code = jlmap3dedit.mapdata.signallist.list[num].mesh.code;
for(let j=0;j<object.children.length;j++){
object.children[j].code = jlmap3dedit.mapdata.signallist.list[num].mesh.code;
}
object.position.x = jlmap3dedit.mapdata.signallist.list[num].mesh.position.x;
object.position.y = jlmap3dedit.mapdata.signallist.list[num].mesh.position.y;
object.position.z = jlmap3dedit.mapdata.signallist.list[num].mesh.position.z;
object.rotation.x = jlmap3dedit.mapdata.signallist.list[num].mesh.rotation.x;
object.rotation.y = jlmap3dedit.mapdata.signallist.list[num].mesh.rotation.y;
object.rotation.z = jlmap3dedit.mapdata.signallist.list[num].mesh.rotation.z;
object.scale.x = jlmap3dedit.mapdata.signallist.list[num].mesh.scale.x;
object.scale.y = jlmap3dedit.mapdata.signallist.list[num].mesh.scale.y;
object.scale.z = jlmap3dedit.mapdata.signallist.list[num].mesh.scale.z;
//object.scale.set(0.1,0.1,0.1);
jlmap3dedit.mapdata.signallist.list[num].mesh = null;
jlmap3dedit.mapdata.signallist.list[num].mesh = object;
jlmap3dedit.mapdata.signallist.group.add( object );
jlmap3dedit.transcontrol.attach(jlmap3dedit.selectmodel);
jlmap3dedit.selectmodel = jlmap3dedit.mapdata.signallist.list[num].mesh;
return jlmap3dedit.selectmodel;
} );
}
this.loadoldasset = function(jlmap3dedit,newdata,num){
let assetnum = null;
for(let i=0;i<scope.modellist.length;i++){
if(newdata.uuid == scope.modellist[i].uuid){
assetnum = i;
}
}
jlmap3dedit.transcontrol.detach();
jlmap3dedit.mapdata.signallist.group.remove(jlmap3dedit.mapdata.signallist.list[num].mesh);
let newmesh = scope.modellist[assetnum].mesh.clone(true);
newmesh.name = scope.modellist[assetnum].uuid;
newmesh.code = jlmap3dedit.mapdata.signallist.list[num].mesh.code;
for(let j=0;j<newmesh.children.length;j++){
newmesh.children[j].code = jlmap3dedit.mapdata.signallist.list[num].mesh.code;
}
newmesh.position.x = jlmap3dedit.mapdata.signallist.list[num].mesh.position.x;
newmesh.position.y = jlmap3dedit.mapdata.signallist.list[num].mesh.position.y;
newmesh.position.z = jlmap3dedit.mapdata.signallist.list[num].mesh.position.z;
newmesh.rotation.x = jlmap3dedit.mapdata.signallist.list[num].mesh.rotation.x;
newmesh.rotation.y = jlmap3dedit.mapdata.signallist.list[num].mesh.rotation.y;
newmesh.rotation.z = jlmap3dedit.mapdata.signallist.list[num].mesh.rotation.z;
jlmap3dedit.mapdata.signallist.list[num].mesh = null;
jlmap3dedit.mapdata.signallist.list[num].mesh = newmesh;
jlmap3dedit.mapdata.signallist.group.add( jlmap3dedit.mapdata.signallist.list[num].mesh );
jlmap3dedit.transcontrol.attach(jlmap3dedit.mapdata.signallist.list[num].mesh);
jlmap3dedit.selectmodel = jlmap3dedit.mapdata.signallist.list[num].mesh;
return jlmap3dedit.selectmodel;
}
//去除未加载资源并释放内存
this.updatelist = function(){
}
//创建新模型
this.createmodel = function(){
}
//创建新材质
this.creatematerial = function(){
}
function fbxPromiseOver(asset){
return new Promise(function(resolve, reject){
var loader = new THREE.FBXLoader();
console.log(asset);
if(asset.type == "static"){
loader.load(asset.url, function ( object ) {
let mixer = new THREE.AnimationMixer( object );
//object.traverse(function (node) {//获取其中对象
// node.frustumCulled = true;
//});
if(asset.code){
scope.modelgroup[asset.code] = object;
}else{
asset.mesh = object;
}
//object.scale.set(0.1,0.1,0.1);
resolve("fbxload");
} );
}else{
loader.load( BASE_ASSET_API+asset.url, function ( object ) {
let mixer = new THREE.AnimationMixer( object );
//object.traverse(function (node) {//获取其中对象
// node.frustumCulled = true;
//});
if(asset.code){
scope.modelgroup[asset.code] = object;
}else{
if(asset.type == "train" && object.children.length>4){
let realtrain = new THREE.Group();
let j = object.children.length;
for(j;j>0;j--){
let name = "C"+j;
for(let i=0;i<object.children.length;i++){
if(object.children[i].name == name){
object.children[i].position.x = object.children[i].position.x+scope.trainoffset;
//object.children[i].position.y = j*10;
realtrain.add(object.children[i]);
i--;
}
}
}
asset.mesh = realtrain;
asset.animations = object.animations[0].tracks;
}else if(asset.type == "train" && object.name == "C6"){
let realtrain = new THREE.Group();
object.position.x = object.position.x+scope.trainoffset;
realtrain.add(object);
asset.mesh = realtrain;
}else{
asset.mesh = object;
}
}
//object.scale.set(0.1,0.1,0.1);
resolve("fbxload");
} );
}
});
}
}

View File

@ -1,15 +1,15 @@
//componnent
import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
import {Materialload} from '@/jlmap3d/jl3drailwaydrive/loader/Materialload.js';
import {SectionListN} from '@/jlmap3d/main/newmodel/SectionListN';
import {SignalListN} from '@/jlmap3d/main/newmodel/SignalListN';
import {StationStandListN} from '@/jlmap3d/main/newmodel/StationStandListN';
import {SwitchListN} from '@/jlmap3d/main/newmodel/SwitchListN';
import {RailListN} from '@/jlmap3d/main/newmodel/RailListN.js';
import {TrainListN} from '@/jlmap3d/main/newmodel/TrainListN.js';
import {TdtList} from '@/jlmap3d/main/newmodel/TdtList.js';
import {SectionListN} from '@/jlmap3d/jl3drailwaydrive/model/SectionListN';
import {SignalListN} from '@/jlmap3d/jl3drailwaydrive/model/SignalListN';
import {StationStandListN} from '@/jlmap3d/jl3drailwaydrive/model/StationStandListN';
import {SwitchListN} from '@/jlmap3d/jl3drailwaydrive/model/SwitchListN';
import {RailListN} from '@/jlmap3d/jl3drailwaydrive/model/RailListN.js';
import {TrainListN} from '@/jlmap3d/jl3drailwaydrive/model/TrainListN.js';
import {TdtList} from '@/jlmap3d/jl3drailwaydrive/model/TdtList.js';
import { Loading } from 'element-ui';
// import {SwitchModel} from '@/jlmap3d/model/SwitchModel.js';
@ -111,6 +111,7 @@ export function DriverLoadNew(data,scope,netdata,mapdata,sectionlist,signallist,
for(let mn=0;mn<scope.assetloader.modellist.length;mn++){
if(scope.assetloader.modellist[mn].deviceType && scope.assetloader.modellist[mn].type == "suidao"){
// scope.assetloader.modellist[mn].mesh.deviceType = "suidaobg";
scope.Subscribe.updatamap(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails,tdt,scope.materiallist,scope.actions,scope.sceneload);
// scope.assetloader.modellist[mn].mesh.position.y = 10;
scene.add(scope.assetloader.modellist[mn].mesh);

View File

@ -0,0 +1,74 @@
import { BASE_ASSET_API } from '@/api/jlmap3d/assets3d.js';
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
export function Materialload(jlmap3dedit,standTextureData){
if(jlmap3dedit.materiallist){
settexture(jlmap3dedit.materiallist,"red",JL3D_LOCAL_STATIC+'/jl3d/railway/texture/1.jpg');
settexture(jlmap3dedit.materiallist,"yellow",JL3D_LOCAL_STATIC+'/jl3d/railway/texture/2.jpg');
settexture( jlmap3dedit.materiallist,"green",JL3D_LOCAL_STATIC+'/jl3d/railway/texture/3.jpg');
settexture( jlmap3dedit.materiallist,"white",JL3D_LOCAL_STATIC+'/jl3d/railway/texture/4.jpg');
settexture( jlmap3dedit.materiallist,"blue",JL3D_LOCAL_STATIC+'/jl3d/railway/texture/5.jpg');
settexture( jlmap3dedit.materiallist,"black",JL3D_LOCAL_STATIC+'/jl3d/railway/texture/6.jpg');
}
if(standTextureData){
if(standTextureData.urls.length > 1){
for(let i=0,leni=standTextureData.urls.length;i<leni;i++){
setstationtexture(jlmap3dedit.stationtexture,standTextureData.urls[i].name,BASE_ASSET_API + standTextureData.urls[i].url);
}
}
}
}
function settexture(materiallist,name,textureurl){
var loader = new THREE.TextureLoader();
// 加载一个资源
loader.load(
// 资源URL
textureurl,
// onLoad回调
function ( texture ) {
texture.name = name;
materiallist[name] = texture;
},
// 目前暂不支持onProgress的回调
undefined,
// onError回调
function ( err ) {
console.error( 'An error happened.' );
}
);
}
function setstationtexture(stationtexture,name,textureurl){
var loader = new THREE.TextureLoader();
// 加载一个资源
loader.load(
// 资源URL
textureurl,
// onLoad回调
function ( texture ) {
texture.name = name;
stationtexture[name] = texture;
},
// 目前暂不支持onProgress的回调
undefined,
// onError回调
function ( err ) {
console.error( 'An error happened.' );
}
);
}

View File

@ -0,0 +1,277 @@
export function RailListN(){
let scope = this;
this.sectionrail = [];
this.switchrail = [];
this.stops = [];
this.setrail = function(){
};
// this.init = function(section,linklist,scene){
this.init = function(section,sectionList,switchdata,scene){
// console.log(section);
// console.log(switchdata);
for(let i=0;i<section.length;i++){
scope.sectionrail[section[i].code] = {
lp:section[i].lp,
rp:section[i].rp,
lconnect:null,
rconnect:null,
lengthfact:section[i].lengthFact,
lineleft:null,
lineright:null,
points:[],
type:null
};
}
for(let i=0;i<switchdata.length;i++){
if(scope.sectionrail[switchdata[i].pb].lp.x < switchdata[i].position.x){
scope.sectionrail[switchdata[i].pa].lswitch = switchdata[i].code;
scope.sectionrail[switchdata[i].pa].type = "a";
scope.sectionrail[switchdata[i].pb].rswitch = switchdata[i].code;
scope.sectionrail[switchdata[i].pb].type = "b";
}else{
scope.sectionrail[switchdata[i].pa].rswitch = switchdata[i].code;
scope.sectionrail[switchdata[i].pa].type = "a";
scope.sectionrail[switchdata[i].pb].lswitch = switchdata[i].code;
scope.sectionrail[switchdata[i].pb].type = "b";
}
//
if(scope.sectionrail[switchdata[i].pc].lp.x < switchdata[i].position.x){
scope.sectionrail[switchdata[i].pa].lswitch = switchdata[i].code;
scope.sectionrail[switchdata[i].pa].type = "a";
scope.sectionrail[switchdata[i].pc].rswitch = switchdata[i].code;
scope.sectionrail[switchdata[i].pc].type = "c";
}else{
scope.sectionrail[switchdata[i].pa].rswitch = switchdata[i].code;
scope.sectionrail[switchdata[i].pa].type = "a";
scope.sectionrail[switchdata[i].pc].lswitch = switchdata[i].code;
scope.sectionrail[switchdata[i].pc].type = "c";
}
}
for(let i=0;i<section.length;i++){
// if(scope.sectionrail[section[i].code].type == "a" || scope.sectionrail[section[i].code].type == "b" || ){
// }
if(scope.sectionrail[section[i].code].type == "c" ){
scope.sectionrail[section[i].code].points.push(new THREE.Vector3(scope.sectionrail[section[i].code].lp.x,0,scope.sectionrail[section[i].code].lp.z));
scope.sectionrail[section[i].code].points.push(new THREE.Vector3(scope.sectionrail[section[i].code].rp.x,0,scope.sectionrail[section[i].code].rp.z));
}else{
scope.sectionrail[section[i].code].points.push(new THREE.Vector3(scope.sectionrail[section[i].code].lp.x,0,scope.sectionrail[section[i].code].lp.z));
scope.sectionrail[section[i].code].points.push(new THREE.Vector3(scope.sectionrail[section[i].code].rp.x,0,scope.sectionrail[section[i].code].rp.z));
}
}
// for(let i=0;i<section.length;i++){
//
//
// if(section[i].rotation._z == 0){
// scope.sectionrail[section[i].code].type = "a";
//
// scope.sectionrail[section[i].code].points.push(new THREE.Vector3(scope.sectionrail[section[i].code].lp.x,0,scope.sectionrail[section[i].code].lp.z));
// scope.sectionrail[section[i].code].points.push(new THREE.Vector3(scope.sectionrail[section[i].code].rp.x,0,scope.sectionrail[section[i].code].rp.z));
//
// }else{
//
// if(section[i].rotation._z>0){
// let testline = new THREE.CatmullRomCurve3([
// new THREE.Vector3(scope.sectionrail[section[i].code].lp.x,0,scope.sectionrail[section[i].code].lp.z),
// new THREE.Vector3(scope.sectionrail[section[i].code].rp.x,0,scope.sectionrail[section[i].code].rp.z)
// ]);
//
// scope.sectionrail[section[i].code].type = "b";
// if(scope.sectionrail[section[i].code].lswitch){
// let switchpoint1 = scope.sectionrail[section[i].code].lp;
// scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint1.x,0,switchpoint1.z));
// scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint1.x+0.5,0,switchpoint1.z));
// scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint1.x+1,0,switchpoint1.z-0.02));
// scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint1.x+1.5,0,switchpoint1.z-0.09));
// // scope.sectionrail[section[i].code].points.push(testline.getPointAt(0.7));
// scope.sectionrail[section[i].code].points.push(testline.getPointAt(1));
// }
//
//
//
// if(scope.sectionrail[section[i].code].rswitch){
// let switchpoint2 = scope.sectionrail[section[i].code].rp;
// scope.sectionrail[section[i].code].points.push(testline.getPointAt(0));
// // scope.sectionrail[section[i].code].points.push(testline.getPointAt(0.3));
// scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint2.x-1.5,0,switchpoint2.z+0.09));
// scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint2.x-1,0,switchpoint2.z+0.02));
// scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint2.x-0.5,0,switchpoint2.z));
// scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint2.x,0,switchpoint2.z));
//
// }
//
// }else{
// let testline = new THREE.CatmullRomCurve3([
// new THREE.Vector3(scope.sectionrail[section[i].code].lp.x,0,scope.sectionrail[section[i].code].lp.z),
// new THREE.Vector3(scope.sectionrail[section[i].code].rp.x,0,scope.sectionrail[section[i].code].rp.z)
// ]);
// scope.sectionrail[section[i].code].type = "c";
//
// if(scope.sectionrail[section[i].code].lswitch){
// let switchpoint1 = scope.sectionrail[section[i].code].lp;
// scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint1.x,0,switchpoint1.z));
// scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint1.x+0.5,0,switchpoint1.z));
// scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint1.x+1,0,switchpoint1.z+0.02));
// scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint1.x+1.5,0,switchpoint1.z+0.09));
// // scope.sectionrail[section[i].code].points.push(testline.getPointAt(0.7));
// scope.sectionrail[section[i].code].points.push(testline.getPointAt(1));
// }
//
//
//
// if(scope.sectionrail[section[i].code].rswitch){
// let switchpoint2 = scope.sectionrail[section[i].code].rp;
// scope.sectionrail[section[i].code].points.push(testline.getPointAt(0));
// // scope.sectionrail[section[i].code].points.push(testline.getPointAt(0.3));
// scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint2.x-1.5,0,switchpoint2.z-0.09));
// scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint2.x-1,0,switchpoint2.z-0.02));
// scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint2.x-0.5,0,switchpoint2.z));
// scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint2.x,0,switchpoint2.z));
//
// }
//
// }
// }
//
// }
//
for(let i=0;i<section.length;i++){
scope.sectionrail[section[i].code].lineleft = new THREE.CatmullRomCurve3(scope.sectionrail[section[i].code].points);
scope.sectionrail[section[i].code].lineleft.curveType = "chordal";
scope.sectionrail[section[i].code].lineleft.tension = 0.15;
scope.sectionrail[section[i].code].lineleft.name = section[i].code;
let rightpoints = [];
scope.sectionrail[section[i].code].points.forEach(item=>{
rightpoints.push(item);
}
);
rightpoints.reverse();
scope.sectionrail[section[i].code].lineright = new THREE.CatmullRomCurve3(rightpoints);
scope.sectionrail[section[i].code].lineright.curveType = "chordal";
scope.sectionrail[section[i].code].lineright.tension = 0.15;
scope.sectionrail[section[i].code].lineright.name = section[i].code;
if(section[i].standTrack == true){
scope.sectionrail[section[i].code].standTrack = true;
// var geometry = new THREE.CircleGeometry( 5, 16 );
// var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
// var circle1 = new THREE.Mesh( geometry, material );
// var circle2 = new THREE.Mesh( geometry, material );
// circle1.position.x = scope.sectionrail[section[i].code].points[0].x;
// circle1.position.y = 5;
// circle1.position.z = scope.sectionrail[section[i].code].points[0].z;
// circle1.rotation.x = -Math.PI/2;
// circle2.position.x = scope.sectionrail[section[i].code].points[1].x;
// circle2.position.y = 5;
// circle2.position.z = scope.sectionrail[section[i].code].points[1].z;
// circle2.rotation.x = -Math.PI/2;
// scene.add( circle1 );
// scene.add( circle2 );
// console.log(scope.sectionrail[section[i].code]);
}else{
scope.sectionrail[section[i].code].standTrack = false;
}
//
// for(let n=0,nm=scope.sectionrail[section[i].code].lineleft.points.length;n<nm;n++){
// var geometry = new THREE.CircleGeometry( 0.05, 16 );
// var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
// var circle = new THREE.Mesh( geometry, material );
// // console.log(n);
// // console.log(scope.sectionrail[section[i].code].lineleft.points[n]);
// circle.position.x = scope.sectionrail[section[i].code].lineleft.points[n].x;
// circle.position.y = scope.sectionrail[section[i].code].lineleft.points[n].y;
// circle.position.z = scope.sectionrail[section[i].code].lineleft.points[n].z;
// circle.rotation.x = -Math.PI/2;
// scene.add( circle );
// }
// // scope.sectionrail[section[i].code].lineright.tension = 0.11;
// var points = scope.sectionrail[section[i].code].lineleft.getPoints( 50 );
// var geometry = new THREE.BufferGeometry().setFromPoints( points );
// var material;
// if(scope.sectionrail[section[i].code].type == "a"){
// material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
// }
// if(scope.sectionrail[section[i].code].type == "b"){
// material = new THREE.LineBasicMaterial( { color : 0x00ff00 } );
// }
// if(scope.sectionrail[section[i].code].type == "c"){
// material = new THREE.LineBasicMaterial( { color : 0x0000ff } );
// }
//
//
// // Create the final object to add to the scene
// var curveObject = new THREE.Line( geometry, material );
//
// curveObject.position.y = Math.random();
// scene.add(curveObject);
}
}
this.setrails = function(sectioncode,points,standtrack,lengthfact,scene){
scope.sectionrail[sectioncode] = {
lengthfact:lengthfact,
lineleft:null,
lineright:null,
standTrack:standtrack,
};
let leftpoints = [];
let rightpoints = [];
for(let i=0;i<points.length;i++){
leftpoints.push(points[i]);
rightpoints.push(points[points.length-i-1]);
}
scope.sectionrail[sectioncode].lineleft = new THREE.CatmullRomCurve3(leftpoints);
scope.sectionrail[sectioncode].lineleft.type = "catmullrom";
scope.sectionrail[sectioncode].lineleft.closed = false;
scope.sectionrail[sectioncode].lineleft.name = sectioncode;
scope.sectionrail[sectioncode].lineright = new THREE.CatmullRomCurve3(rightpoints);
scope.sectionrail[sectioncode].lineright.type = "catmullrom";
scope.sectionrail[sectioncode].lineright.closed = false;
scope.sectionrail[sectioncode].lineright.name = sectioncode;
// for(let n=0,nm=scope.sectionrail[sectioncode].lineleft.points.length;n<nm;n++){
// var geometry = new THREE.CircleGeometry( 0.05, 16 );
// var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
// var circle = new THREE.Mesh( geometry, material );
// // console.log(n);
// // console.log(scope.sectionrail[section[i].code].lineleft.points[n]);
// circle.position.x = scope.sectionrail[sectioncode].lineleft.points[n].x;
// circle.position.y = scope.sectionrail[sectioncode].lineleft.points[n].y;
// circle.position.z = scope.sectionrail[sectioncode].lineleft.points[n].z;
// circle.rotation.x = -Math.PI/2;
// scene.add( circle );
// }
// // scope.sectionrail[section[i].code].lineright.tension = 0.11;
// var points = scope.sectionrail[sectioncode].lineleft.getPoints( 50 );
// var geometry = new THREE.BufferGeometry().setFromPoints( points );
// var material;
// if(scope.sectionrail[sectioncode].type == "a"){
// material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
// }
// if(scope.sectionrail[sectioncode].type == "b"){
// material = new THREE.LineBasicMaterial( { color : 0x00ff00 } );
// }
// if(scope.sectionrail[sectioncode].type == "c"){
// material = new THREE.LineBasicMaterial( { color : 0x0000ff } );
// }
//
//
// // Create the final object to add to the scene
// var curveObject = new THREE.Line( geometry, material );
//
// curveObject.position.y = Math.random();
// scene.add(curveObject);
}
}

View File

@ -0,0 +1,240 @@
import {SectionModel} from '@/jlmap3d/main/newmodel/SectionModel.js';
import {SwitchModel} from '@/jlmap3d/main/newmodel/SwitchModel.js';
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
export function SectionListN() {
let scope = this;
this.type = "sectionlist";
this.sectiongroup = new THREE.Group();
this.sectiongroup.name = "section";
this.sections = {
datalist:[],
modellist:[]
};
this.stopsection = [];
this.standtrack = [];
var autorail;
this.loadpromise = function(sectionList,sectiondata,rails,scene,assetloader){
var texture = new THREE.TextureLoader().load( JL3D_LOCAL_STATIC+'/test/z0251.png' );
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
texture.anisotropy = 0;
texture.magFilter = THREE.NearestFilter;
texture.minFilter = THREE.NearestFilter;
texture.repeat.set( 1,1);
var selectmaterial = new THREE.MeshPhongMaterial( { map: texture,transparent:true,alphaTest:0.1 } );
// for(let i=0;i<assetloader.modellist.length;i++){
// if(assetloader.modellist[i].deviceType == "autorail"){
// autorail = assetloader.modellist[i].mesh.children[0];
// }
// }
// let count = autorail.geometry.attributes.position.count;
// let rightlist = [];
// let leftlist = [];
// for(let i=0;i<count;i++){
// if(autorail.geometry.attributes.position.array[i*3] >0.49){
// rightlist.push(i);
// }
// if(autorail.geometry.attributes.position.array[i*3] <-0.49){
// leftlist.push(i);
// }
// }
// autorail.rightlist = rightlist;
// autorail.leftlist = leftlist;
scene.add(scope.sectiongroup);
return new Promise(function(resolve, reject){
// console.log(sectiondata);
let mergegeometry = new THREE.Geometry();
for(let i=0,leni = sectiondata.length;i<leni;i++){
let newsection = {
code:sectiondata[i].code,
name:sectiondata[i].name,
standTrack:sectiondata[i].standTrack,
rail:sectiondata[i].rail,
railpoint:sectiondata[i].railpoint,
lengthFact:sectiondata[i].lengthFact,
lconnect:null,
rconnect:null,
lineleft:null,
lineright:null,
points:[],
type:null,
rp:sectiondata[i].rp,
lp:sectiondata[i].lp,
mesh:null
};
// newsection.railpoint.length>2
let len = newsection.lengthFact;
// let testmesh2 = autorail.clone(true);
// for(let i=0;i<autorail.rightlist.length;i++){
// testmesh2.geometry.attributes.position.array[autorail.rightlist[i]*3] = len;
// testmesh2.geometry.attributes.uv.array[autorail.rightlist[i]*2] = testmesh2.geometry.attributes.position.array[0]-testmesh2.geometry.attributes.position.array[3];
// }
// let newrail = new THREE.BufferGeometry();
// newrail.copy(testmesh2.geometry);
// testmesh2.geometry = newrail;
// testmesh2.geometry.attributes.position.needsUpdate = true;
// testmesh2.geometry.attributes.uv.needsUpdate = true;
// testmesh2.geometry.computeBoundingSphere();
// testmesh2.geometry.center();
// testmesh2.position.set(sectiondata[i].position.x,sectiondata[i].position.y,sectiondata[i].position.z);
// testmesh2.rotation.set(sectiondata[i].rotation._x,sectiondata[i].rotation._y,sectiondata[i].rotation._z);
// testmesh2.matrixAutoUpdate = false;
// scope.sections.datalist[newsection.code] = newsection;
// testmesh2.updateMatrix();
// mergegeometry.merge(new THREE.Geometry().fromBufferGeometry(testmesh2.geometry),testmesh2.matrix);
// testmesh2.geometry.dispose();
// for(let j in testmesh2.material){
// testmesh2.material[j].map.dispose();
// testmesh2.material[j].dispose();
// }
// testmesh2 = null;
if(newsection.railpoint.length>=3){
// console.log(newsection);
let height = Math.random()/1000;
var closedSpline;
if(Math.abs(newsection.railpoint[0].y-newsection.railpoint[2].y)>0.01){
closedSpline = new THREE.CatmullRomCurve3( [
new THREE.Vector3(newsection.railpoint[0].x,newsection.railpoint[0].y,newsection.railpoint[0].z),
new THREE.Vector3(newsection.railpoint[1].x,newsection.railpoint[1].y,newsection.railpoint[1].z+0.0001),
new THREE.Vector3(newsection.railpoint[2].x,newsection.railpoint[2].y,newsection.railpoint[2].z)
] );
}else{
closedSpline = new THREE.CatmullRomCurve3( [
new THREE.Vector3(newsection.railpoint[0].x,newsection.railpoint[2].y,newsection.railpoint[0].z),
new THREE.Vector3(newsection.railpoint[1].x,newsection.railpoint[2].y,newsection.railpoint[1].z+0.0001),
new THREE.Vector3(newsection.railpoint[2].x,newsection.railpoint[2].y,newsection.railpoint[2].z)
] );
}
// closedSpline.type = 'catmullrom';
closedSpline.curveType = "chordal";
closedSpline.tension = 0.15;
closedSpline.closed = false;
var extrudeSettings = {
steps : 6,
curveSegments : 1,
bevelSegments : 1,
bevelEnabled : false,
extrudePath : closedSpline,
};
var shape = new THREE.Shape();
len = closedSpline.getLength();
if(Math.abs(newsection.railpoint[0].y - newsection.railpoint[2].y)>0.01){
shape.moveTo( -2, 0 );
shape.lineTo( 2, 0 );
}else{
shape.moveTo( 0,-2 );
shape.lineTo( 0, 2 );
}
var geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings );
var mesh = new THREE.Mesh( geometry, selectmaterial );
let count = mesh.geometry.attributes.position.count/3;
for(let i=0;i<count;i++){
let ui=i*6;
if(i%2 != 0){
mesh.geometry.attributes.uv.array[ui] = 0;
mesh.geometry.attributes.uv.array[ui+1] = 1;
mesh.geometry.attributes.uv.array[ui+2] = len/6;
mesh.geometry.attributes.uv.array[ui+3] = 1;
mesh.geometry.attributes.uv.array[ui+4] = len/6;
mesh.geometry.attributes.uv.array[ui+5] = 0;
}else{
mesh.geometry.attributes.uv.array[ui] = 0;
mesh.geometry.attributes.uv.array[ui+1] = 0;
mesh.geometry.attributes.uv.array[ui+2] = 0;
mesh.geometry.attributes.uv.array[ui+3] = 1;
mesh.geometry.attributes.uv.array[ui+4] = len/6;
mesh.geometry.attributes.uv.array[ui+5] = 0;
}
}
mergegeometry.merge(new THREE.Geometry().fromBufferGeometry(mesh.geometry),mesh.matrix);
mesh.geometry.dispose();
mesh.material.map.dispose();
mesh.material.dispose();
rails.setrails(sectiondata[i].code,closedSpline.points,sectiondata[i].standTrack,len,scene);
}else{
let height = Math.random()/1000;
var closedSpline = new THREE.CatmullRomCurve3( [
new THREE.Vector3(newsection.railpoint[0].x,height,newsection.railpoint[0].z),
new THREE.Vector3(newsection.railpoint[1].x,height,newsection.railpoint[0].z),
] );
// closedSpline.type = 'catmullrom';
closedSpline.curveType = "chordal";
closedSpline.tension = 0.15;
closedSpline.closed = false;
// Set up settings for later extrusion
var extrudeSettings = {
steps : 5,
curveSegments : 1,
bevelSegments : 1,
bevelEnabled : false,
extrudePath : closedSpline,
};
var shape = new THREE.Shape();
// Extrude the triangle along the CatmullRom curve
var geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings );
var mesh = new THREE.Mesh( geometry, selectmaterial );
let count = mesh.geometry.attributes.position.count/3;
for(let i=0;i<count;i++){
let ui=i*6;
if(i%2 != 0){
mesh.geometry.attributes.uv.array[ui] = 0;
mesh.geometry.attributes.uv.array[ui+1] = 1;
mesh.geometry.attributes.uv.array[ui+2] = len;
mesh.geometry.attributes.uv.array[ui+3] = 1;
mesh.geometry.attributes.uv.array[ui+4] = len;
mesh.geometry.attributes.uv.array[ui+5] = 0;
}else{
mesh.geometry.attributes.uv.array[ui] = 0;
mesh.geometry.attributes.uv.array[ui+1] = 0;
mesh.geometry.attributes.uv.array[ui+2] = 0;
mesh.geometry.attributes.uv.array[ui+3] = 1;
mesh.geometry.attributes.uv.array[ui+4] = len;
mesh.geometry.attributes.uv.array[ui+5] = 0;
}
}
mergegeometry.merge(new THREE.Geometry().fromBufferGeometry(mesh.geometry),mesh.matrix);
mesh.geometry.dispose();
mesh.material.map.dispose();
mesh.material.dispose();
rails.setrails(sectiondata[i].code,closedSpline.points,sectiondata[i].standTrack,len,scene);
}
}
// let mergemesh = new THREE.Mesh( mergegeometry, autorail.material );
let mergemesh = new THREE.Mesh( mergegeometry, selectmaterial );
mergemesh.matrixAutoUpdate = false;
scope.sectiongroup.add(mergemesh);
resolve("loadersection");
});
}
this.resetsection = function(scene){
scene.remove(scope.sectiongroup);
};
}

View File

@ -0,0 +1,30 @@
export function SectionModel(data) {
var scope = this;
//命名
this.name = null;
//code
this.code = null;
//索引位置
this.index = null;
//轨迹点
this.rail = [];
this.railline = null;
//长度
this.distance = [];
this.isStandTrack = null;
this.rsection = null;
this.lsection = null;
this.type = null;
//指向模型
this.mesh = null;
// //模型地址
// this.meshurl = null;
// //贴图地址
// this.picurl = null;
}

View File

@ -0,0 +1,100 @@
import {SignalModel} from '@/jlmap3d/main/newmodel/SignalModel.js';
export function SignalListN() {
let scope = this;
this.type = "signallist";
this.list = [];
this.group = new THREE.Group();
this.group.name = "signallist";
this.loadpromise = function(data,signaldata,scene,assetloader){
return new Promise(function(resolve, reject){
let signal5 = null;
let signal32 = null;
let signal3 = null;
let signal2 = null;
for(let j=0;j<assetloader.modellist.length;j++){
if(assetloader.modellist[j].deviceType == "signal5"){
signal5 = assetloader.modellist[j].mesh;
}
if(assetloader.modellist[j].deviceType == "signal32"){
signal32 = assetloader.modellist[j].mesh;
}
if(assetloader.modellist[j].deviceType == "signal3"){
signal3 = assetloader.modellist[j].mesh;
}
if(assetloader.modellist[j].deviceType == "signal2"){
signal2 = assetloader.modellist[j].mesh;
}
}
for(let i=0;i<signaldata.length;i++){
for(let j=0,lenj = data.length;j<lenj;j++){
if(data[j].code == signaldata[i].code){
if(data[j].virtual == false){
// console.log(signaldata[i]);
let newsignal = new SignalModel(signaldata[i]);
let newmesh;
if(data[j].type == "ARRIVAL"){
newmesh = signal5.clone();
}else if(data[j].type == "EXIT"){
newmesh = signal32.clone(true);
}else if(data[j].type == "PASSING"){
newmesh = signal3.clone(true);
}else if(data[j].type == "SHUNTING"){
newmesh = signal2.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();
// newmesh.children[j].material.map
}
// newmesh.uuid = signaldata[i].id;
for(let j=0;j<newmesh.children.length;j++){
newmesh.children[j].code = signaldata[i].code;
}
newmesh.name = signaldata[i].name;
newmesh.code = signaldata[i].code;
newmesh.deviceType = data[j].type;
newmesh.lightType = 0;
newmesh.position.x = signaldata[i].position.x;
newmesh.position.y = signaldata[i].position.y;
newmesh.position.z = signaldata[i].position.z;
newmesh.rotation.x = signaldata[i].rotation._x;
newmesh.rotation.y = signaldata[i].rotation._y;
newmesh.rotation.z = signaldata[i].rotation._z;
// newmesh.scale.x = signaldata[i].scale.x;
// newmesh.scale.y = signaldata[i].scale.y;
// newmesh.scale.z = signaldata[i].scale.z;
// newmesh.matrixAutoUpdate = false;
newsignal.mesh = newmesh;
newsignal.mesh.status = "01";
scope.group.add(newsignal.mesh);
scope.list[signaldata[i].code] = newsignal;
}
}
}
}
data = null;
signaldata = null;
scene.add(scope.group);
resolve("loadedsignal");
});
};
}

View File

@ -0,0 +1,5 @@
export function SignalModel(data) {
this.uuid = null;
this.mesh = null;
}

View File

@ -0,0 +1,395 @@
import {StationStandModel} from '@/jlmap3d/main/newmodel/StationStandModel.js';
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
export function StationStandListN() {
let scope = this;
this.type = "stationstandlist";
this.list = [];
this.group = new THREE.Group();
this.group.name = "station";
this.textlist = [];
this.initpromise = function(stationdata,standsdata,psddata,scene,assetloader,mixers,actionss,mode){
return new Promise(function(resolve, reject){
let stations = stationdata;
let selectmesh1;
for(let j=0;j<assetloader.modellist.length;j++){
if(assetloader.modellist[j].deviceType == "stand"){
selectmesh1 = assetloader.modellist[j].mesh;
}
}
for(let i=0;i<standsdata.length;i++){
let newstationstand = new StationStandModel(standsdata[i]);
newstationstand.code = standsdata[i].code;
newstationstand.name = standsdata[i].name;
newstationstand.type = "station";
newstationstand.num = i;
newstationstand.direction1.code = standsdata[i].direction1.code;
newstationstand.direction1.name = standsdata[i].direction1.name;
newstationstand.direction1.screenDoorOpenStatus = "01";
newstationstand.direction2.code = standsdata[i].direction2.code;
newstationstand.direction2.name = standsdata[i].direction2.name;
newstationstand.direction2.screenDoorOpenStatus = "01";
let newstationmesh = selectmesh1.clone(true);
newstationmesh.position.x = standsdata[i].position.x;
newstationmesh.position.y = standsdata[i].position.y;
newstationmesh.position.z = standsdata[i].position.z;
// newstationmesh.rotation.x = standsdata[i].rotation._x;
// newstationmesh.rotation.y = standsdata[i].rotation._y;
// newstationmesh.rotation.z = standsdata[i].rotation._z;
newstationstand.mesh = newstationmesh;
scope.group.add(newstationmesh);
scope.list[standsdata[i].code] = newstationstand;
let newclip = selectmesh1.animations[ 0 ];
for(let j=0;j<newstationmesh.children.length;j++){
if(newstationmesh.children[j].name == "top"){
newstationmesh.children[j].animations = [];
newstationmesh.children[j].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newstationmesh.children[j] );
for(let n=0;n<psddata.length;n++){
if(psddata[n].standCode == newstationstand.direction2.code){
let key = psddata[n].code;
actionss[key] = {
status:"01",
action:mixer.clipAction( newstationmesh.children[j].animations[0])
};
actionss[key].action.setLoop(THREE.LoopOnce);
actionss[key].action.clampWhenFinished = true;
//actionss[key].play();
mixers.push(mixer);
n = psddata.length;
}
}
}
if(newstationmesh.children[j].name == "down"){
newstationmesh.children[j].animations = [];
newstationmesh.children[j].animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newstationmesh.children[j] );
for(let n=0;n<psddata.length;n++){
if(psddata[n].standCode == newstationstand.direction1.code){
let key = psddata[n].code;
actionss[key] = {
status:"01",
action:mixer.clipAction( newstationmesh.children[j].animations[0])
};
actionss[key].action.setLoop(THREE.LoopOnce);
actionss[key].action.clampWhenFinished = true;
//actionss[key].play();
mixers.push(mixer);
n = psddata.length;
}
}
}
}
if(mode){
if(mode == "02"){
let textgeometry = new THREE.PlaneBufferGeometry( 65, 90, 1 );
let textt = new THREE.CanvasTexture(getTextCanvas(stationdata[i]));
let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} );
let textplane = new THREE.Mesh( textgeometry, textmaterial );
textplane.name = stationdata[i].code;
textplane.position.y = 80;
textplane.rotation.x = Math.PI/2;
//textplane.position.x = -30;
scope.textlist.push(textplane);
newstationmesh.add(textplane);
textgeometry.dispose();
textmaterial.dispose();
textt.dispose();
// let newtopstation = topstationmesh.clone(true);
// newtopstation.position.x = map[k].mesh.position.x;
// newtopstation.position.z = map[k].mesh.position.z;
// scene.add(newtopstation);
}
}
}
// scene.add(scope.textlist);
stationdata = null;
psddata = null;
scene.add(scope.group);
resolve("loadedstation");
});
}
this.loadpromise = function(stationdata,standsdata,psddata,scene,assetloader,mixers,actionss,mode,otherStation){
return new Promise(function(resolve, reject){
// console.log(standsdata);
let stations = stationdata;
let selectmesh1;
let selectmesh2;
let selectmesh3;
let specilmesh;
for(let j=0;j<assetloader.modellist.length;j++){
// console.log(assetloader.modellist[j].type);
if(assetloader.modellist[j].type == "stationInside"){
selectmesh1 = assetloader.modellist[j].mesh;
}
if(assetloader.modellist[j].type == "stationOutside"){
selectmesh2 = assetloader.modellist[j].mesh;
// assetloader.modellist[num2].mesh.rotation.y = Math.PI/2;
}
if(assetloader.modellist[j].type == "stationThree"){
selectmesh3 = assetloader.modellist[j].mesh;
// assetloader.modellist[num2].mesh.rotation.y = Math.PI/2;
}
if(assetloader.modellist[j].type == "spmxa"){
specilmesh = assetloader.modellist[j].mesh;
}
}
selectmesh1.traverse( function ( child ) {
if ( child.isMesh ) {
child.renderOrder = 9;
}
} );
selectmesh2.traverse( function ( child ) {
if ( child.isMesh ) {
child.renderOrder = 9;
}
} );
// selectmesh3.traverse( function ( child ) {
//
// if ( child.isMesh ) {
// child.renderOrder = 9;
// }
//
// } );
//新车门动画获取待定
let allClear = 0;
for(let j=0;j<standsdata.length;j++){
allClear = 0;
for(let i=0;i<psddata.length;i++){
for(let n=0;n<standsdata[j].stands.length;n++){
if(psddata[i].standCode == standsdata[j].stands[n].code){
allClear++;
standsdata[j].stands[n].position = psddata[i].position;
}
}
if(allClear == standsdata[j].stands.length){
standsdata[j].stands.sort(compare);
i = psddata.length;
}
}
}
//
//
// console.log(psddata);
for(let i=0;i<standsdata.length;i++){
let newstationstand = new StationStandModel(standsdata[i]);
newstationstand.code = standsdata[i].code;
newstationstand.name = standsdata[i].name;
newstationstand.type = "station";
newstationstand.num = i;
newstationstand.stands = standsdata[i].stands;
// newstationstand.direction1.code = standsdata[i].direction1.code;
// newstationstand.direction1.name = standsdata[i].direction1.name;
// newstationstand.direction1.screenDoorOpenStatus = "01";
//
// newstationstand.direction2.code = standsdata[i].direction2.code;
// newstationstand.direction2.name = standsdata[i].direction2.name;
// newstationstand.direction2.screenDoorOpenStatus = "01";
let newstationmesh = null;
let newclip =null;
let nowModelType = "normal";
if(otherStation){
for(let o=0;o<otherStation.length;o++){
if(standsdata[i].code == otherStation[o].code){
let selectmeshother = assetloader.modelgroup[ otherStation[o].code];
newstationmesh = selectmeshother;
newclip = selectmeshother.animations[ 0 ];
nowModelType = "specil";
newstationmesh.traverse( function ( child ) {
if ( child.isMesh ) {
child.renderOrder = 9;
}
} );
}
}
}
if(nowModelType == "normal"){
if(standsdata[i].stands.length<=2){
if(standsdata[i].inside == undefined){
newstationmesh = selectmesh1.clone(true);
newclip = selectmesh1.animations[ 0 ];
}else if(standsdata[i].inside == true){
newstationmesh = selectmesh1.clone(true);
newclip = selectmesh1.animations[ 0 ];
}else{
newstationmesh = selectmesh2.clone(true);
newclip = selectmesh2.animations[ 0 ];
}
}else{
newstationmesh = selectmesh3.clone(true);
newclip = selectmesh3.animations[ 0 ];
}
if(standsdata[i].code == "Station17596"){
newstationmesh = specilmesh.clone(true);
newclip = specilmesh.animations[ 0 ];
}
}
newstationmesh.code = standsdata[i].code;
newstationmesh.name = standsdata[i].code;
// console.log(newstationmesh.name);
// console.log(standsdata[i].inside);
newstationmesh.inside = standsdata[i].inside;
newstationmesh.position.x = standsdata[i].position.x;
newstationmesh.position.y = standsdata[i].position.y;
newstationmesh.position.z = standsdata[i].position.z;
// newstationmesh.rotation.x = standsdata[i].rotation._x;
// newstationmesh.rotation.y = standsdata[i].rotation._y;
// newstationmesh.rotation.z = standsdata[i].rotation._z;
newstationstand.mesh = newstationmesh;
scope.group.add(newstationmesh);
//
scope.list[standsdata[i].code] = newstationstand;
//
for(let j=0;j<standsdata[i].stands.length;j++){
let num = j+1;
let addAnimaMesh = newstationmesh.getObjectByName('door'+num);
if(addAnimaMesh){
newstationmesh.getObjectByName('door'+num).animations = [];
newstationmesh.getObjectByName('door'+num).animations.push(newclip.clone());
let mixer = new THREE.AnimationMixer( newstationmesh.getObjectByName('door'+num) );
for(let n=0;n<psddata.length;n++){
if(psddata[n].standCode == standsdata[i].stands[j].code){
let key = psddata[n].code;
actionss[key] = {
status:"01",
action:mixer.clipAction( newstationmesh.getObjectByName('door'+num).animations[0])
};
actionss[key].action.setLoop(THREE.LoopOnce);
actionss[key].action.clampWhenFinished = true;
//actionss[key].play();
n = psddata.length;
}
}
mixers.push(mixer);
}
}
if(mode){
if(mode == "02"){
let textgeometry = new THREE.PlaneBufferGeometry( 65, 90, 1 );
let textt = new THREE.CanvasTexture(getTextCanvas(standsdata[i]));
let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} );
let textplane = new THREE.Mesh( textgeometry, textmaterial );
textplane.name = standsdata[i].code;
textplane.position.y = 70;
textplane.rotation.x = Math.PI/2;
textplane.position.z = 80;
scope.textlist.push(textplane);
newstationmesh.add(textplane);
textgeometry.dispose();
textmaterial.dispose();
textt.dispose();
}
}
}
// scene.add(scope.textlist);
stationdata = null;
psddata = null;
scene.add(scope.group);
resolve("loadedstation");
});
}
}
var compare = function (obj1, obj2) {
var val1 = obj1.position.y;
var val2 = obj2.position.y;
if (val1 < val2) {
return -1;
} else if (val1 > val2) {
return 1;
} else {
return 0;
}
}
//canvas文字贴图方法
//PS:待提炼 增强功能
var stationcanvas = new Image();
stationcanvas.src = JL3D_LOCAL_STATIC+"/texture/msgtnew.png";
function getTextCanvas(text){
let canvas = document.getElementById('canvastexture');
canvas.width = 128;
canvas.height = 256;
// canvas.style.width = width;
// canvas.style.height = height;
let ctx = canvas.getContext('2d');
//ctx.fillStyle = '#FFFFFF';
ctx.fillRect(0, 0,128,256);
ctx.fillStyle = '#FFFFFF';
// ctx.textAlign = 'center';
// ctx.textBaseline = 'middle';
ctx.clearRect(0,0,128,256);
ctx.drawImage(stationcanvas,0,0,128,256);
ctx.font = "10px";
ctx.fillText("车站: "+text.name, 15,25);
ctx.fillText("漫游", 18,48);
ctx.fillText("信息", 54,48);
ctx.fillText("备忘", 93,48);
ctx.fillText("车站序号: "+text.name, 10,115);
ctx.fillText("公里标记:",10 ,135);
ctx.fillText(text.kmPost,10 ,155);
let data = ctx.getImageData(0, 0,128,256);
return data;
}

View File

@ -0,0 +1,35 @@
export function StationStandModel(opts) {
var scope = this;
this.uuid = null;
this.code = null;
this.name = null;
this.modelid = null;
this.type = null;
this.inside = null;
this.ismodel = false;
this.istexture = false;
this.modelurl = null;
this.stands = [];
this.direction1= {
position:null,
name:null,
screenDoorOpenStatus:null,
mesh:null,
openpos:[],
closepos:[]
}
this.direction2= {
position:null,
name:null,
screenDoorOpenStatus:null,
mesh:null,
openpos:[],
closepos:[]
}
this.mesh = null;
this.meshurl = null;
this.picurl = null;
}

View File

@ -0,0 +1,67 @@
import {SwitchModel} from '@/jlmap3d/main/newmodel/SwitchModel.js';
export function SwitchListN() {
let scope = this;
this.type = "switchlist";
this.switchgroup = new THREE.Group();
this.switchgroup.name = "switch";
this.switchs = {
datalist:[],
modellist:[]
};
this.loadpromise = function(jlmap3ddata,switchdata,scene,assetloader,mixers,actions){
return new Promise(function(resolve, reject){
scene.add( scope.switchgroup );
// let sectiondata = jlmap3ddata.sectionlist.sections.datalist;
// console.log(sectiondata);
let num;
for(let j=0;j<assetloader.modellist.length;j++){
if(assetloader.modellist[j].type == "switch"){
num = j;
}
};
for(let i=0,leni = switchdata.length;i<leni;i++){
// console.log(switchdata[i]);
let newswitch = {
code:switchdata[i].code,
name:switchdata[i].name,
pa:switchdata[i].pa,
pb:switchdata[i].pb,
pc:switchdata[i].pc,
directtype:null,
locateType:0
};
let autoswitch = assetloader.modellist[num].mesh.clone(true);
autoswitch.code = switchdata[i].code;
for(let j=0;j<autoswitch.children.length;j++){
autoswitch.children[j].code = switchdata[i].code;
}
scope.switchs.datalist.push(newswitch);
scope.switchgroup.add(autoswitch);
autoswitch.position.set(switchdata[i].position.x,switchdata[i].position.y,switchdata[i].position.z);
autoswitch.rotation.x = switchdata[i].rotation._x;
autoswitch.rotation.y = switchdata[i].rotation._y;
autoswitch.rotation.z = switchdata[i].rotation._z;
// autoswitch.matrixAutoUpdate = false;
autoswitch.animations = assetloader.modellist[num].mesh.animations;
let mixer = new THREE.AnimationMixer( autoswitch );
actions[autoswitch.code] = {
normal:"00",
action:mixer.clipAction( autoswitch.animations[0])
};
actions[autoswitch.code].action.setLoop(THREE.LoopOnce);
actions[autoswitch.code].action.clampWhenFinished = true;
mixers.push(mixer);
}
// console.log(scope.switchs.modellist);
resolve("loadedswitch");
});
}
}

View File

@ -0,0 +1,22 @@
export function SwitchModel() {
var scope = this;
//命名
this.name = null;
//code
this.code = null;
//索引位置
this.index = null;
//轨迹点
this.rail = [];
//长度
this.distance = null;
this.action = null;
//指向模型
this.mesh = null;
// //模型地址
// this.meshurl = null;
// //贴图地址
// this.picurl = null;
}

View File

@ -0,0 +1,100 @@
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
export function TdtList() {
let scope = this;
let materialList = [];
this.initTdt = function(stationData,sectionData,railData,scene){
return new Promise(function(resolve, reject){
var loader = new THREE.FBXLoader();
loader.load( JL3D_LOCAL_STATIC+"/test/TDTModel.FBX" , function ( object ) {
let stopSections = [];
for(let i=0;i<sectionData.length;i++){
if(sectionData[i].standTrack == true){
stopSections[sectionData[i].code] = sectionData[i];
}
}
// console.log(stationData);
for(let k in stationData){
for(let i=0;i<stationData[k].stands.length;i++){
let newmesh = object.clone(true);
newmesh.canvas = document.createElement("canvas");
newmesh.canvas.width = 128;
newmesh.canvas.height = 64;
newmesh.getObjectByName("TDT").material = new THREE.MeshPhongMaterial();
let newImg = new THREE.CanvasTexture(getTextCanvas(newmesh.canvas,"",30));
newmesh.getObjectByName("TDT").material.map = newImg;
newmesh.getObjectByName("TDT").material.needsUpdate = true;
materialList[stationData[k].stands[i].code] = newmesh;
let sectionCode = stationData[k].stands[i].section;
let pos = stationData[k].mesh.position;
if(stationData[k].stands[i].right == true){
newmesh.rotation.y = -Math.PI/2;
newmesh.position.set(pos.x+75,0,pos.z+14.8);
}else{
newmesh.rotation.y = Math.PI/2;
newmesh.position.set(pos.x-75,0,pos.z-14.8);
}
scene.add(newmesh);
}
}
resolve("TdtLoad");
} );
});
}
this.updateTdt = function(data){
for(let i=0;i<data.length;i++){
let newImg = null;
if(data[i].hold == true){
newImg = new THREE.CanvasTexture(getTextCanvas(materialList[data[i].standCode].canvas,"H",30));
}else if(data[i].jump == true){
newImg = new THREE.CanvasTexture(getTextCanvas(materialList[data[i].standCode].canvas,"=",30));
}else{
newImg = new THREE.CanvasTexture(getTextCanvas(materialList[data[i].standCode].canvas,data[i].remain,30));
}
materialList[data[i].standCode].getObjectByName("TDT").material.map = newImg;
materialList[data[i].standCode].getObjectByName("TDT").material.map.needsUpdate = true;
}
}
var beauty = new Image();
beauty.src = JL3D_LOCAL_STATIC+"/test/tdttexture.jpg";
//canvas文字贴图方法
//PS:待提炼 增强功能
function getTextCanvas(canvas,text,font){
// let canvas = document.getElementById('canvastexture');
let ctx = canvas.getContext('2d');
ctx.fillRect(0, 0,128,64);
ctx.font = font+"px Verdana";
ctx.fillStyle = '#e9a26a';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.clearRect(0,0,128,64);
//console.log(text.groupNumber);
ctx.drawImage(beauty,0,0,128, 64);
ctx.fillText(text, 64,32);
return canvas;
}
}

View File

@ -0,0 +1,400 @@
import {TrainModel} from '@/jlmap3d/edit/testEditorModel/TrainModel.js';
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
export function TrainListN() {
let scope = this;
this.type = "trainlist";
this.list = {};
this.updatStatus = false;
this.otherTrainmodels = [];
this.otherTrainList = {};
this.group = new THREE.Group();
this.group.name = "train";
this.textlist = [];
this.trainmesh = null;
this.addDriveTrain = function(data){
this.updatStatus = true;
let leni = data.length-scope.otherTrainmodels.length;
for(let i=0;i<leni;i++){
let newmesh = scope.trainmesh.clone(true);
for(let j=0;j<newmesh.children.length;j++){
newmesh.children[j].axis = new THREE.Vector3();
newmesh.children[j].up = new THREE.Vector3(1, 0, 0);
newmesh.children[j].rotalist = [];
}
newmesh.first = false;
newmesh.name = "othertrain";
newmesh.code = "";
newmesh.groupNumber = "";
newmesh.right = "3";
newmesh.position.set(0,0,0);
newmesh.status = "00";
newmesh.nowcode = null;
newmesh.nowsection = "";
newmesh.curve = null;
newmesh.doorStatus = "01";
newmesh.speed = 0;
newmesh.speeds = 0;
newmesh.offset = null;
newmesh.openleft = '0';
newmesh.openright = '0';
scope.group.add(newmesh);
scope.otherTrainmodels.push(newmesh);
}
scope.otherTrainList = [];
for(let j=0,lenj = data.length;j<lenj;j++){
scope.otherTrainmodels[j].code = data[j].code;
scope.otherTrainList[data[j].code] = this.otherTrainmodels[j];
}
this.updatStatus = false;
}
this.removeDriveTrain = function(removeLength){
console.log(removeLength);
scope.group.remove(scope.otherTrainmodels[0]);
scope.otherTrainmodels.splice(0,removeLength);
}
this.drivertrain = function(data,scene,assetloader,mixers,actionss,mode){
return new Promise(function(resolve, reject){
// console.log(data);
let selectmesh,ntracks1,ntracks2,tclip,fclip;
for(let n=assetloader.modellist.length-1;n>=0;n--){
if(assetloader.modellist[n].type == "train"){
selectmesh = assetloader.modellist[n].mesh;
scope.trainmesh = assetloader.modellist[n].mesh;
// ntracks1 = assetloader.modellist[n].animations.slice(16,27);
//
// tclip = new THREE.AnimationClip("three",2,ntracks1);
//
// ntracks2 = assetloader.modellist[n].animations.slice(0,15);
//
// fclip = new THREE.AnimationClip("four",2,ntracks2);
// ntracks2 = assetloader.modellist[n].animations.slice(6,14);
//
// fclip = new THREE.AnimationClip("four",2,ntracks2);
//
// ntracks1 = assetloader.modellist[n].animations.slice(0,6);
tclip = new THREE.AnimationClip("three",2,assetloader.modellist[n].animations);
n = 0;
}
}
actionss["traindoor"] = {
top:[],
down:[]
};
let newmesh = selectmesh.clone(true);
newmesh.mixer = [];
for(let j=0;j<newmesh.children.length;j++){
// console.log("===================");
for(let n=0,lenn = newmesh.children[j].children.length;n<lenn;n++){
if(newmesh.children[j].children[n].name == "top"){
newmesh.children[j].children[n].animations = [];
newmesh.children[j].children[n].animations.push(tclip.clone());
let mixer = new THREE.AnimationMixer( newmesh.children[j].children[n] );
// console.log(n);
// console.log(newmesh.children[j].children[n]);
newmesh.mixer.push(mixer);
newmesh.mixerpush = false;
let action = mixer.clipAction( newmesh.children[j].children[n].animations[ 0 ] );
//action.play();
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
actionss["traindoor"].top.push(action);
mixers.push(mixer);
}
if(newmesh.children[j].children[n].name == "down"){
newmesh.children[j].children[n].animations = [];
newmesh.children[j].children[n].animations.push(tclip.clone());
let mixer = new THREE.AnimationMixer( newmesh.children[j].children[n] );
newmesh.mixer.push(mixer);
newmesh.mixerpush = false;
let action = mixer.clipAction( newmesh.children[j].children[n].animations[ 0 ] );
//action.play();
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
actionss["traindoor"].down.push(action);
mixers.push(mixer);
}
}
newmesh.children[j].axis = new THREE.Vector3();
newmesh.children[j].up = new THREE.Vector3(1, 0, 0);
// newmesh.axis = new THREE.Vector3();
// newmesh.up = new THREE.Vector3(1, 0, 0);
// var pos = new THREE.Mesh( geometryp, materialp);
// pos.position.x = -73.5;
// newmesh.children[j].add( pos );
newmesh.children[j].rotalist = [];
// console.log(newmesh);
}
newmesh.first = false;
newmesh.name = "drivetrain";
newmesh.code = "";
newmesh.groupNumber = "";
newmesh.right = "3";
newmesh.position.set(0,0,0);
newmesh.status = "00";
newmesh.nowcode = null;
newmesh.nowsection = null;
newmesh.curve = null;
newmesh.doorStatus = "01";
newmesh.speed = 0;
newmesh.speeds = 0;
newmesh.offset = null;
newmesh.openleft = '0';
newmesh.openright = '0';
scope.group.add(newmesh);
scope.list[0] = newmesh;
scene.add(scope.group);
resolve("loadedtrain");
});
}
this.initpromise = function(data,scene,assetloader,mixers,actionss,mode){
return new Promise(function(resolve, reject){
let selectmesh,ntracks1,ntracks2,tclip,fclip;
for(let n=assetloader.modellist.length-1;n>=0;n--){
if(assetloader.modellist[n].type == "train"){
selectmesh = assetloader.modellist[n].mesh;
// ntracks1 = assetloader.modellist[n].animations.slice(16,27);
//
// tclip = new THREE.AnimationClip("three",2,ntracks1);
//
// ntracks2 = assetloader.modellist[n].animations.slice(0,15);
//
// fclip = new THREE.AnimationClip("four",2,ntracks2);
// ntracks2 = assetloader.modellist[n].animations.slice(6,14);
//
// fclip = new THREE.AnimationClip("four",2,ntracks2);
//
// ntracks1 = assetloader.modellist[n].animations.slice(0,6);
tclip = new THREE.AnimationClip("three",2,assetloader.modellist[n].animations);
n = 0;
}
}
selectmesh.traverse( function ( child ) {
if ( child.isMesh ) {
child.renderOrder = 8;
}
} );
//遍历列车数据
// console.log(data.length);
for(let i=0;i<data.length;i++){
actionss[data[i].groupNumber] = {
top:[],
down:[]
};
let newmesh = selectmesh.clone(true);
newmesh.mixer = [];
// console.log("-------------------------");
// console.log(data[i]);
for(let j=0;j<newmesh.children.length;j++){
// console.log("===================");
for(let n=0,lenn = newmesh.children[j].children.length;n<lenn;n++){
if(newmesh.children[j].children[n].name == "top"){
newmesh.children[j].children[n].animations = [];
newmesh.children[j].children[n].animations.push(tclip.clone());
let mixer = new THREE.AnimationMixer( newmesh.children[j].children[n] );
// console.log(n);
// console.log(newmesh.children[j].children[n]);
newmesh.mixer.push(mixer);
newmesh.mixerpush = false;
// mixers.push(mixer);
let action = mixer.clipAction( newmesh.children[j].children[n].animations[ 0 ] );
//action.play();
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
actionss[data[i].groupNumber].top.push(action);
}
if(newmesh.children[j].children[n].name == "down"){
newmesh.children[j].children[n].animations = [];
newmesh.children[j].children[n].animations.push(tclip.clone());
let mixer = new THREE.AnimationMixer( newmesh.children[j].children[n] );
newmesh.mixer.push(mixer);
newmesh.mixerpush = false;
// mixers.push(mixer);
let action = mixer.clipAction( newmesh.children[j].children[n].animations[ 0 ] );
//action.play();
action.setLoop(THREE.LoopOnce);
action.clampWhenFinished = true;
actionss[data[i].groupNumber].down.push(action);
}
}
//newmesh.children[j].name = data[i].code;
newmesh.children[j].groupNumber = data[i].groupNumber;
newmesh.children[j].axis = new THREE.Vector3();
newmesh.children[j].up = new THREE.Vector3(1, 0, 0);
// newmesh.axis = new THREE.Vector3();
// newmesh.up = new THREE.Vector3(1, 0, 0);
// var pos = new THREE.Mesh( geometryp, materialp);
// pos.position.x = -73.5;
// newmesh.children[j].add( pos );
newmesh.children[j].rotalist = [];
// console.log(newmesh);
}
//
// // newmesh.children[4].add(newmesh.children[5]);
// // newmesh.children[3].add(newmesh.children[4]);
// // newmesh.children[2].add(newmesh.children[3]);
// // newmesh.children[1].add(newmesh.children[2]);
// // newmesh.children[0].add(newmesh.children[1]);
// for(let n=newmesh.children.length-1;n>=1;n--){
// newmesh.children[n].position.x = -76;
// newmesh.children[n-1].add(newmesh.children[n]);
// }
//创建列车字牌
if(mode){
if(mode == "02"){
let textgeometry = new THREE.PlaneBufferGeometry( 64, 32, 1 );
let textt = new THREE.CanvasTexture(getTextCanvas(data[i]));
let textmaterial = new THREE.MeshBasicMaterial( {
side: THREE.DoubleSide,
map:textt ,transparent: true,
alphaTest:0.1
} );
let textplane = new THREE.Mesh( textgeometry, textmaterial );
textplane.name = data[i].groupNumber;
textplane.position.x = 0;
textplane.position.y = 0;
textplane.position.z = 20;
textplane.rotation.x = Math.PI/2;
textplane.tcode = data[i].code;
//textplane.rotation.x = Math.PI;
scope.textlist.push(textplane);
newmesh.children[0].add(textplane);
textgeometry.dispose();
textmaterial.dispose();
textt.dispose();
}
}
//group.add(textplane);
newmesh.first = false;
newmesh.name = data[i].groupNumber;
newmesh.rname = data[i].groupNumber;
newmesh.groupNumber = data[i].groupNumber;
newmesh.position.set(0,-50000,0);
// newmesh.children[0].position.y = 0;
//newmesh.rotation.y = Math.PI/2;
newmesh.status = "00";
newmesh.nowcode = null;
newmesh.curve = null;
newmesh.doorStatus = "01";
newmesh.dispose = 1;
newmesh.nowsection = null;
newmesh.nextsection = null;
newmesh.speed = 0;
newmesh.speeds = 0;
newmesh.progress = null;
newmesh.startmark = 0;
newmesh.open = null;
newmesh.statsstop = 0;
newmesh.openleft = '0';
newmesh.openright = '0';
scope.list[data[i].groupNumber] = newmesh;
//scene.add(newmesh);
}
// console.log(selectmesh);
// for(let i=0,leni=selectmesh.children.length;i<leni;i++){
// selectmesh.children[i].geometry.dispose();
// selectmesh.children[i].material.dispose();
// }
data = null;
scene.add(scope.group);
resolve("loadedtrain");
});
}
}
let onProgress = function ( xhr ) {
if ( xhr.lengthComputable ) {
let percentComplete = xhr.loaded / xhr.total * 100;
console.log( Math.round( percentComplete, 2 ) + '% downloaded' );
}
};
let onError = function () { };
var beauty = new Image();
beauty.src = JL3D_LOCAL_STATIC+"/texture/guidenew.png";
//canvas文字贴图方法
//PS:待提炼 增强功能
function getTextCanvas(text){
var canvas = document.getElementById('canvastexture');
canvas.width = 128;
canvas.height = 64;
var ctx = canvas.getContext('2d');
//var bg = canvas.createPattern(img, "no-repeat");
//ctx.fillStyle = bg;
ctx.fillRect(0, 0,128,64);
ctx.font = "8px Verdana";
ctx.fillStyle = '#000000';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.clearRect(0,0,128,64);
//console.log(text.groupNumber);
ctx.drawImage(beauty,0,0,128, 64);
ctx.fillText("车组号:"+text.groupNumber, 40,10);
ctx.fillText("车组人员:XXX", 40,20);
// ctx.fillText("速度:XXX.XXX", 40,30);
//ctx.fillText(text.trainModel.name, width/2,height*3/4);
let data = ctx.getImageData(0, 0,128,64);
return data;
}

View File

@ -0,0 +1,5 @@
export function TrainModel(opts) {
var scope = this;
this.mesh = null;
}

View File

@ -0,0 +1,13 @@
export function Jl3ddata() {
let scope = this;
this.id = null;
this.mapId = null;
this.sectionlist = null;
this.linklist = null;
this.signallist = null;
this.stationstandlist = null;
this.trainlisttest = null;
this.realsectionlist = null;
}

View File

@ -40,6 +40,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,sta
// let toppic = '/app/topic/simulation/client/'+routegroup+'/drive';
console.log(routegroup);
this.topic = '/queue/simulation/'+routegroup+'/trainPosition';
let allDeviceTopic = '/queue/simulation/'+routegroup+'/srDeviceState';
let hmiTopic = '/queue/simulation/'+routegroup+'/train/001/Hmi';
let header = {'X-Token': getToken() };
let connectmsg = {
@ -50,87 +51,6 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,sta
};
//切换车辆修改列车属性
function changeNowTrain(data){
if(data[i][3] == "0"){
if(data.rightDoorCanClose == false){
trainmodel.openright = '0';
for (let an=actions["traindoor"].down.length-1; an>=0; an--) {
actions["traindoor"].down[an].reset();
actions["traindoor"].down[an].time = 0;
actions["traindoor"].down[an].timeScale = -1;
actions["traindoor"].down[an].play();
}
}else{
trainmodel.openright = "1";
for(let an=actions["traindoor"].down.length-1;an>=0;an--){
actions["traindoor"].down[an].reset();
actions["traindoor"].down[an].time = actions["traindoor"].top[an]._clip.duration;
actions["traindoor"].down[an].timeScale = 1;
actions["traindoor"].down[an].play();
}
}
if(data.leftDoorCanClose == false){
trainmodel.openleft = "0";
for(let an=actions["traindoor"].top.length-1;an>=0;an--){
actions["traindoor"].top[an].reset();
actions["traindoor"].top[an].time = 0;
actions["traindoor"].top[an].timeScale = -1;
actions["traindoor"].top[an].play();
}
}else{
trainmodel.openleft = "1";
for(let an=actions["traindoor"].top.length-1;an>=0;an--){
actions["traindoor"].top[an].reset();
actions["traindoor"].top[an].time = actions["traindoor"].top[an]._clip.duration;
actions["traindoor"].top[an].timeScale = 1;
actions["traindoor"].top[an].play();
}
}
}else{
if(data.leftDoorCanClose == false){
trainmodel.openleft = "0";
for(let an=actions["traindoor"].top.length-1;an>=0;an--){
actions["traindoor"].top[an].reset();
actions["traindoor"].top[an].time = 0;
actions["traindoor"].top[an].timeScale = -1;
actions["traindoor"].top[an].play();
}
}else{
trainmodel.openleft = "1";
for(let an=actions["traindoor"].top.length-1;an>=0;an--){
actions["traindoor"].top[an].reset();
actions["traindoor"].top[an].time = actions["traindoor"].top[an]._clip.duration;
actions["traindoor"].top[an].timeScale = 1;
actions["traindoor"].top[an].play();
}
}
if(data.rightDoorCanClose == false){
trainmodel.openright = '0';
for (let an=actions["traindoor"].down.length-1; an>=0; an--) {
actions["traindoor"].down[an].reset();
actions["traindoor"].down[an].time = 0;
actions["traindoor"].down[an].timeScale = -1;
actions["traindoor"].down[an].play();
}
}else{
trainmodel.openright = "1";
for(let an=actions["traindoor"].down.length-1;an>=0;an--){
actions["traindoor"].down[an].reset();
actions["traindoor"].down[an].time = actions["traindoor"].top[an]._clip.duration;
actions["traindoor"].down[an].timeScale = 1;
actions["traindoor"].down[an].play();
}
}
}
}
this.updatamap = function(newsectionlist,newlinklist,newsignallist,newstationstandlist,newtrainlisttest,newrealsectionlist,newrails,newtdt, materiallist, nowaction, scene) {
// console.log(mapdata);
// console.log(newtrainlisttest);
@ -153,9 +73,10 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,sta
this.socketon = function() {
try {
// console.log("teststomp");
scope.teststomp.subscribe(scope.topic, callback, header);
scope.teststomp.subscribe(hmiTopic, callback, header);
scope.teststomp.subscribe(allDeviceTopic, callback, header);
} catch (error) {
console.error('websocket订阅失败');
}
@ -178,22 +99,34 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,sta
}
}
};
let initStatus = true;
// 仿真socket接口回调函数
function callback(Response) {
// console.log(Response);
// 对象化数据
let data = JSON.parse(Response.body);
if(data.trainPosList){
// console.log(data.trainPosList);
// console.log(data.trainPosList);
nowTrainRun(data.trainPosList);
return;
}
if(data.srSignalList){
for(let i=0;i<data.srSignalList.length;i++){
if(signallist.list[data.srSignalList[i][0]].mesh){
signalLightUpdate(data.srSignalList[i][0],data.srSignalList[i][1]);
}
}
}
if(data.srSignal){
signalLightUpdate(data.srSignal[0],data.srSignal[1]);
}
if(data.hmi){
// console.log(data);
if(initStatus == true){
initStatus = false;
updateDriveValue(data.hmi);
}
updateSpeedView(data.hmi[1]);
}
// stats.update();
@ -203,8 +136,8 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,sta
}
function DeviceDestroy(data){
// console.log(data);
for(let i=0,leni=data.length;i<leni;i++){
if(data[i].type == "SIGNAL"){
@ -256,10 +189,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,sta
}
function otherTrainUpdate(data,updateTrainModel){
// console.log(data);
// if(data.code = "336"){
// console.log(data);
// }
if(data.section != updateTrainModel.nowsection){
updateTrainModel.nowsection = data.section;
@ -312,7 +242,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,sta
// trainmodel.position.z = point.z;
}
// if(updateTrainModel.children[1].rotalist.length > 0 || updateTrainModel.children[2].rotalist.length > 0 || updateTrainModel.children[3].rotalist.length > 0 || updateTrainModel.children[4].rotalist.length > 0|| updateTrainModel.children[5].rotalist.length > 0){
// if(updateTrainModel.children[1].rotalist.length > 0 || updateTrainModel.children[2].rotalist.length > 0 || updateTrainModel.children[3].rotalist.length > 0 || updateTrainModel.children[4].rotalist.length > 0|| updateTrainModel.children["black"].rotalist.length > 0){
for(let rs = 1;rs<updateTrainModel.children.length;rs++){
//console.log(rs);
@ -388,7 +318,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,sta
}
// if(updateTrainModel.children[1].rotalist.length > 0 || updateTrainModel.children[2].rotalist.length > 0 || updateTrainModel.children[3].rotalist.length > 0 || updateTrainModel.children[4].rotalist.length > 0|| updateTrainModel.children[5].rotalist.length > 0){
// if(updateTrainModel.children[1].rotalist.length > 0 || updateTrainModel.children[2].rotalist.length > 0 || updateTrainModel.children[3].rotalist.length > 0 || updateTrainModel.children[4].rotalist.length > 0|| updateTrainModel.children["black"].rotalist.length > 0){
for(let rs = 1;rs<updateTrainModel.children.length;rs++){
//console.log(rs);
if(updateTrainModel.children[rs].rotalist[0]){
@ -793,29 +723,29 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,sta
function signalupdate(data) {
code = data.code;
if(data.red == 1){
signallist.list[code].mesh.getObjectByName("red").material.map = materials[0];
signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
}else{
signallist.list[code].mesh.getObjectByName("red").material.map = materials[3];
signallist.list[code].mesh.getObjectByName("red").material.map = materials["white"];
signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true;
}
if(data.yellow == 1){
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[1];
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
}else{
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials[3];
signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["white"];
signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true;
}
if(data.green == 1){
signallist.list[code].mesh.getObjectByName("green").material.map = materials[2];
signallist.list[code].mesh.getObjectByName("green").material.map = materials["green"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}else{
signallist.list[code].mesh.getObjectByName("green").material.map = materials[3];
signallist.list[code].mesh.getObjectByName("green").material.map = materials["white"];
signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true;
}
@ -862,6 +792,189 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,sta
}
}
function signalLightUpdate(code,lightType){
signallist.list[code].mesh.lightType = lightType;
if(signallist.list[code].mesh.deviceType == "ARRIVAL"){
if(lightType == '0'){
signallist.list[code].mesh.getObjectByName("01").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("01").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("02").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("02").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("03").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("03").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("04").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("04").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("05").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("05").material.map.needsUpdate = true;
}
if(lightType == '3'){
signallist.list[code].mesh.getObjectByName("01").material.map = materials["yellow"];
signallist.list[code].mesh.getObjectByName("01").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("02").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("02").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("03").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("03").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("04").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("04").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("05").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("05").material.map.needsUpdate = true;
}
if(lightType == '7'){
signallist.list[code].mesh.getObjectByName("01").material.map = materials["yellow"];
signallist.list[code].mesh.getObjectByName("01").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("02").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("02").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("03").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("03").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("04").material.map = materials["yellow"];
signallist.list[code].mesh.getObjectByName("04").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("05").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("05").material.map.needsUpdate = true;
}
if(lightType == '1'){
signallist.list[code].mesh.getObjectByName("01").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("01").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("02").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("02").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("03").material.map = materials["red"];
signallist.list[code].mesh.getObjectByName("03").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("04").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("04").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("05").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("05").material.map.needsUpdate = true;
}
if(lightType == '9'){
signallist.list[code].mesh.getObjectByName("01").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("01").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("02").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("02").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("03").material.map = materials["red"];
signallist.list[code].mesh.getObjectByName("03").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("04").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("04").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("05").material.map = materials["white"];
signallist.list[code].mesh.getObjectByName("05").material.map.needsUpdate = true;
}
if(lightType == '6'){
signallist.list[code].mesh.getObjectByName("01").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("01").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("02").material.map = materials["green"];
signallist.list[code].mesh.getObjectByName("02").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("03").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("03").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("04").material.map = materials["yellow"];
signallist.list[code].mesh.getObjectByName("04").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("05").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("05").material.map.needsUpdate = true;
}
}else if(signallist.list[code].mesh.deviceType == "EXIT"){
if(lightType == '0'){
signallist.list[code].mesh.getObjectByName("01").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("01").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("02").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("02").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("03").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("03").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("04").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("04").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("05").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("05").material.map.needsUpdate = true;
}
if(lightType == '1'){
signallist.list[code].mesh.getObjectByName("01").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("01").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("02").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("02").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("03").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("03").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("04").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("04").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("05").material.map = materials["red"];
signallist.list[code].mesh.getObjectByName("05").material.map.needsUpdate = true;
}
if(lightType == '2'){
signallist.list[code].mesh.getObjectByName("01").material.map = materials["green"];
signallist.list[code].mesh.getObjectByName("01").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("02").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("02").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("03").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("03").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("04").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("04").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("05").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("05").material.map.needsUpdate = true;
}
if(lightType == '3'){
signallist.list[code].mesh.getObjectByName("01").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("01").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("02").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("02").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("03").material.map = materials["yellow"];
signallist.list[code].mesh.getObjectByName("03").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("04").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("04").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("05").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("05").material.map.needsUpdate = true;
}
}else if(signallist.list[code].mesh.deviceType == "PASSING"){
if(lightType == '0'){
signallist.list[code].mesh.getObjectByName("01").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("01").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("02").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("02").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("03").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("03").material.map.needsUpdate = true;
}
if(lightType == '1'){
signallist.list[code].mesh.getObjectByName("01").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("01").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("02").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("02").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("03").material.map = materials["red"];
signallist.list[code].mesh.getObjectByName("03").material.map.needsUpdate = true;
}
if(lightType == '2'){
signallist.list[code].mesh.getObjectByName("01").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("01").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("02").material.map = materials["green"];
signallist.list[code].mesh.getObjectByName("02").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("03").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("03").material.map.needsUpdate = true;
}
if(lightType == '3'){
signallist.list[code].mesh.getObjectByName("01").material.map = materials["yellow"];
signallist.list[code].mesh.getObjectByName("01").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("02").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("02").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("03").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("03").material.map.needsUpdate = true;
}
}else if(signallist.list[code].mesh.deviceType == "SHUNTING"){
if(lightType == '0'){
signallist.list[code].mesh.getObjectByName("01").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("01").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("02").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("02").material.map.needsUpdate = true;
}
if(lightType == '10'){
signallist.list[code].mesh.getObjectByName("01").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("01").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("02").material.map = materials["blue"];
signallist.list[code].mesh.getObjectByName("02").material.map.needsUpdate = true;
}
if(lightType == '11'){
signallist.list[code].mesh.getObjectByName("01").material.map = materials["white"];
signallist.list[code].mesh.getObjectByName("01").material.map.needsUpdate = true;
signallist.list[code].mesh.getObjectByName("02").material.map = materials["black"];
signallist.list[code].mesh.getObjectByName("02").material.map.needsUpdate = true;
}
}
}
function simulationreset(data){
for(let i=0;i<trainlisttest.group.children.length;i++){
trainlisttest.group.children[i].dispose = true;

View File

@ -2,9 +2,9 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.8.107:9000'; // 袁琪
// BASE_API = 'http://192.168.3.83:9000'; // 旭强 有线
BASE_API = 'http://192.168.3.83:9000'; // 旭强 有线
// BASE_API = 'http://192.168.8.114:9000'; // 旭强 无线
// BASE_API = 'http://192.168.3.120:9000'; // 张赛
// BASE_API = 'http://192.168.8.140:9000'; // 杜康

View File

@ -144,6 +144,15 @@
},
methods: {
updateInitStatus : function(data){
this.moveheight = data[4]/100*235;
this.movex = this.moveheight+15 +"px";
let angle = 397 - data[6]/150*83;
let angleall =397 - data[5]/100*105;
this.braketrans = "rotate("+angle+"deg)";
this.braketransall = "rotate("+angleall+"deg)";
},
centerstate : function(gear){
this.touchstate = gear;
if(this.touchstate == "Drive"){
@ -201,13 +210,12 @@
},
speedchange: function(event){
this.moveheight = event.pageY-this.movelimit.y;
this.movex = this.moveheight-7 +"px";
this.movex = this.moveheight-15 +"px";
// if(this.atostate == true){
// this.$store.dispatch('app/setAtoState', false);
// }
this.move = this.moveheight/235;
if(this.moveheight<=30){
if(this.moveheight<=40){
this.moveheight=30;
this.movex=23+"px";
this.move = 0;

View File

@ -289,10 +289,8 @@ import axios from 'axios';
},
updateDriveValue(newvalue){
if(newvalue != this.value){
this.value = newvalue;
this.groupnum = newvalue;
}
this.$refs.centercontrol.updateInitStatus(newvalue);
this.$refs.rightcontrol.updateInitStatus(newvalue);
},
updatetrainlist(){
getMemberListCommon(this.$route.query.group,"DRIVER").then(netdata => {

View File

@ -181,6 +181,74 @@
},
methods: {
updateInitStatus : function(data){
if(data[2] == "1"){
this.doordirecttou = "rotate("+320+"deg)";
this.oldDirectType = 1;
}
if(data[2] == "0"){
this.doordirecttou = "rotate("+360+"deg)";
this.oldDirectType = 0;
}
if(data[2] == "-1"){
this.doordirecttou = "rotate("+399+"deg)";
this.oldDirectType = -1;
}
if(data[2] == "2"){
this.doordirecttou = "rotate("+442+"deg)";
this.oldDirectType = 2;
}
switch (data[3]) {
case -1:
this.stallh = 0;
this.stalll = 0;
break;
case 0:
this.stallh = 1;
this.stalll = 2;
break;
case 1:
this.stallh = 2;
this.stalll = 0;
break;
case 2:
this.stallh = 0;
this.stalll = 1;
break;
case 3:
this.stallh = 2;
this.stalll = 1;
break;
case 4:
this.stallh = 2;
this.stalll = 2;
break;
case 5:
this.stallh = 0;
this.stalll = 2;
break;
case 6:
this.stallh = 0;
this.stalll = 3;
break;
case 7:
this.stallh = 2;
this.stalll = 3;
break;
case 8:
this.stallh = 0;
this.stalll = 4;
break;
case 9:
this.stallh = 2;
this.stalll = 4;
}
this.stalltop = this.stalls[this.stallh][this.stalll].t +"px";
this.stallleft = this.stalls[this.stallh][this.stalll].l +"px";
},
handleKeyup(event){
const e = event || window.event || arguments.callee.caller.arguments[0];
if(!e) return;
@ -224,7 +292,6 @@
id:"001",
pos:parseInt(this.stalls[this.stallh][this.stalll].type)
};
console.log(param);
const userInfo = store.state.training.simulationUserList.find(el => el.id == store.state.user.id);
trainSimulationForce(this.group,userInfo.memberId,param,"Train_Drive_Gear_Change").then(res => {

View File

@ -10,9 +10,9 @@
<el-button-group>
<!-- <el-button type="primary" @click="raystand">站台选择</el-button> -->
<el-button type="primary" @click="cctvplane">{{ cctvbuttonmsg }}</el-button>
<!-- <el-button type="primary" @click="cctvplane">{{ cctvbuttonmsg }}</el-button>
<el-button type="primary" @click="showplane">{{ showbuttonmsg }}</el-button>
<el-button type="primary" @click="back">{{backmsg}}</el-button>
<el-button type="primary" @click="back">{{backmsg}}</el-button> -->
</el-button-group>
</div>

View File

@ -5,7 +5,7 @@
<el-button-group ref="button_group_box" class="button_group_box" :style="`margin-left:-${btnWidth}px`">
<el-button v-if="jl3dmodelShow && !isContest && project !== 'bjd'" size="small" @click="jumpjlmap3dmodel">{{ jl3dmodel }}</el-button>
<!-- 司机视角 -->
<el-button v-if="$route.query.lineCode === '15'" size="small" type="jumpjlmap3d" @click="jumpjlmap3dDriver">司机视角</el-button>
<!-- <el-button v-if="$route.query.lineCode === '15'" size="small" type="jumpjlmap3d" @click="jumpjlmap3dDriver">司机视角</el-button> -->
<el-button v-if="$route.query.lineCode === '15'" size="small" @click="clCaAnCall">经典案例分析</el-button>
<el-button v-if="$route.query.lineCode === '15'" size="small" @click="normStudy">规范学习</el-button>
</el-button-group>
@ -140,6 +140,10 @@ export default {
console.log('获取留言板信息失败');
});
}
if(this.$route.query.project == "zzww"){
this.jumpjlmap3dDriver();
}
},
methods:{
menuClick() {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB