Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
7715271b0b
156
src/jlmap3d/edit/connect/initDataSave.js
Normal file
156
src/jlmap3d/edit/connect/initDataSave.js
Normal file
@ -0,0 +1,156 @@
|
||||
//import request from '@/utils/request';
|
||||
|
||||
export function initDataSave(data) {
|
||||
console.log(data);
|
||||
let postmap = {
|
||||
id:data.mapdata.id,
|
||||
mapId:data.mapdata.mapId,
|
||||
assets:"null",
|
||||
sections:"null",
|
||||
signals:"null",
|
||||
trains:"null",
|
||||
stands:"null",
|
||||
switchs:"null"
|
||||
};
|
||||
|
||||
if(data.mapdata.sectionlist.sections== undefined){
|
||||
return postmap;
|
||||
}
|
||||
|
||||
|
||||
if(data == undefined){
|
||||
|
||||
return postmap;
|
||||
}else{
|
||||
|
||||
let models = data.assetManager;
|
||||
console.log(data.assetManager);
|
||||
postmap.assets = JSON.stringify(models);
|
||||
|
||||
|
||||
//section隧道
|
||||
let sections = [];
|
||||
// console.log(data.mapdata.sectionlist.sections.datalist);
|
||||
for(let i in data.mapdata.sectionlist.sections.datalist){
|
||||
console.log(data.mapdata.sectionlist.sections.datalist[i].mesh.railpoint);
|
||||
let section = {
|
||||
// uuid:data.mapdata.sectionlist.sections.modellist[i].uuid,
|
||||
code:data.mapdata.sectionlist.sections.datalist[i].code,
|
||||
name:data.mapdata.sectionlist.sections.datalist[i].name,
|
||||
lengthFact:data.mapdata.sectionlist.sections.datalist[i].mesh.lengthFact,
|
||||
standTrack:data.mapdata.sectionlist.sections.datalist[i].standTrack,
|
||||
rp:data.mapdata.sectionlist.sections.datalist[i].rp,
|
||||
lp:data.mapdata.sectionlist.sections.datalist[i].lp,
|
||||
railpoint:data.mapdata.sectionlist.sections.datalist[i].mesh.railpoint,
|
||||
rail:data.mapdata.sectionlist.sections.datalist[i].rail,
|
||||
position:data.mapdata.sectionlist.sections.datalist[i].mesh.position,
|
||||
rotation:data.mapdata.sectionlist.sections.datalist[i].mesh.rotation,
|
||||
scale:data.mapdata.sectionlist.sections.datalist[i].mesh.scale,
|
||||
}
|
||||
let nowmesh = data.mapdata.sectionlist.sectiongroup.getObjectByProperty("code",section.code);
|
||||
section.railpoint = nowmesh.railpoint;
|
||||
// console.log(nowmesh.railpoint);
|
||||
// if(data.mapdata.sectionlist.sections.datalist[i].rsection){
|
||||
// section.rsection = data.mapdata.sectionlist.sections.datalist[i].rsection;
|
||||
// }
|
||||
// if(data.mapdata.sectionlist.sections.datalist[i].lsection){
|
||||
// section.lsection = data.mapdata.sectionlist.sections.datalist[i].lsection;
|
||||
// }
|
||||
// if(data.mapdata.sectionlist.sections.datalist[i].csection){
|
||||
// section.csection = data.mapdata.sectionlist.sections.datalist[i].csection;
|
||||
// }
|
||||
|
||||
// testmesh1.position.z = link.position.z;
|
||||
|
||||
sections.push(section);
|
||||
}
|
||||
let arrray = {
|
||||
section:sections,
|
||||
};
|
||||
postmap.sections = JSON.stringify(arrray);
|
||||
//道岔
|
||||
let switchs = [];
|
||||
|
||||
for(let i=0;i<data.mapdata.switchlist.switchs.datalist.length;i++){
|
||||
let switcha = {
|
||||
// uuid:data.mapdata.switchlist.switchs.modellist[i].uuid,
|
||||
code:data.mapdata.switchlist.switchs.datalist[i].code,
|
||||
name:data.mapdata.switchlist.switchs.datalist[i].name,
|
||||
pa:data.mapdata.switchlist.switchs.datalist[i].pa,
|
||||
pb:data.mapdata.switchlist.switchs.datalist[i].pb,
|
||||
pc:data.mapdata.switchlist.switchs.datalist[i].pc,
|
||||
position:data.mapdata.switchlist.switchs.modellist[i].position,
|
||||
rotation:data.mapdata.switchlist.switchs.modellist[i].rotation,
|
||||
scale:data.mapdata.switchlist.switchs.modellist[i].scale
|
||||
}
|
||||
switchs.push(switcha);
|
||||
}
|
||||
postmap.switchs = JSON.stringify(switchs);
|
||||
//信号
|
||||
let signals = [];
|
||||
for(let i=0;i<data.mapdata.signallist.list.length;i++){
|
||||
|
||||
|
||||
let signal = {
|
||||
// uuid:data.mapdata.signallist.list[i].mesh.uuid,
|
||||
name:data.mapdata.signallist.list[i].mesh.name,
|
||||
modelid:data.mapdata.signallist.list[i].mesh.modelid,
|
||||
code:data.mapdata.signallist.list[i].mesh.code,
|
||||
right:data.mapdata.signallist.list[i].mesh.right,
|
||||
position:data.mapdata.signallist.list[i].mesh.position,
|
||||
rotation:data.mapdata.signallist.list[i].mesh.rotation,
|
||||
scale:data.mapdata.signallist.list[i].mesh.scale
|
||||
}
|
||||
|
||||
signals.push(signal);
|
||||
}
|
||||
postmap.signals = JSON.stringify(signals);
|
||||
//车站
|
||||
let stands = [];
|
||||
|
||||
for(let i=0;i<data.mapdata.stationstandlist.list.length;i++){
|
||||
console.log(data.mapdata.stationstandlist.list[i]);
|
||||
let station = {
|
||||
// uuid:data.mapdata.stationstandlist.list[i].uuid,
|
||||
code:data.mapdata.stationstandlist.list[i].code,
|
||||
name:data.mapdata.stationstandlist.list[i].name,
|
||||
// modelid:data.mapdata.stationstandlist.list[i].modelid,
|
||||
position:data.mapdata.stationstandlist.list[i].mesh.position,
|
||||
rotation:data.mapdata.stationstandlist.list[i].mesh.rotation,
|
||||
scale:data.mapdata.stationstandlist.list[i].mesh.scale,
|
||||
inside:data.mapdata.stationstandlist.list[i].inside,
|
||||
stands:data.mapdata.stationstandlist.list[i].stands,
|
||||
// direction1:{
|
||||
// name:data.mapdata.stationstandlist.list[i].direction1.name,
|
||||
// code:data.mapdata.stationstandlist.list[i].direction1.code
|
||||
// },
|
||||
// direction2:{
|
||||
// name:data.mapdata.stationstandlist.list[i].direction2.name,
|
||||
// code:data.mapdata.stationstandlist.list[i].direction2.code
|
||||
// }
|
||||
}
|
||||
console.log(station);
|
||||
stands.push(station);
|
||||
}
|
||||
postmap.stands = JSON.stringify(stands);
|
||||
//列车
|
||||
let trains = [];
|
||||
for(let i=0;i<data.assetloader.modellist.length;i++){
|
||||
if(data.assetloader.modellist[i].deviceType == "train"){
|
||||
let train = {
|
||||
id:data.assetloader.modellist[i].id,
|
||||
name:data.assetloader.modellist[i].name,
|
||||
deviceType:data.assetloader.modellist[i].deviceType,
|
||||
type:data.assetloader.modellist[i].type,
|
||||
assetUrl:data.assetloader.modellist[i].assetUrl
|
||||
}
|
||||
|
||||
trains.push(train);
|
||||
}
|
||||
}
|
||||
postmap.trains = JSON.stringify(trains);
|
||||
|
||||
return postmap;
|
||||
}
|
||||
|
||||
}
|
188
src/jlmap3d/edit/jl3dEditorLoader.js
Normal file
188
src/jlmap3d/edit/jl3dEditorLoader.js
Normal file
@ -0,0 +1,188 @@
|
||||
import { getPublishMapDetail,getMapDetail,set3dMapData,get3dMapData } from '@/api/jlmap3d/load3ddata';
|
||||
|
||||
//原始信息obj化提供给三维建模
|
||||
import {SetObj} from '@/jlmap3d/edit/utils/SetObj.js';
|
||||
//componnent
|
||||
import {SectionList} from '@/jlmap3d/edit/testEditorModel/SectionList.js';
|
||||
import {SignalList} from '@/jlmap3d/edit/testEditorModel/SignalList.js';
|
||||
import {StationStandList} from '@/jlmap3d/edit/testEditorModel/StationStandList.js';
|
||||
import {SwitchList} from '@/jlmap3d/edit/testEditorModel/SwitchList.js';
|
||||
import {RailList} from '@/jlmap3d/edit/testEditorModel/RailList.js';
|
||||
|
||||
import axios from 'axios';
|
||||
import {getmodels} from '@/jlmap3d/edit/connect/getmodels';
|
||||
import { Loading } from 'element-ui';
|
||||
// import {SwitchModel} from '@/jlmap3d/model/SwitchModel.js';
|
||||
|
||||
export function jl3dEditorLoader(mapid,scope){
|
||||
let editmapid = mapid;
|
||||
let scene = scope.scene;
|
||||
let jlmap3ddata = scope.mapdata;
|
||||
let jlmap3dasset = scope.assetManager;
|
||||
let assetloader = scope.assetloader;
|
||||
let loadingInstance = Loading.service({ fullscreen: true });
|
||||
get3dMapData(editmapid).then(data => {
|
||||
|
||||
if(data.data ){
|
||||
if(data.data.assets){
|
||||
|
||||
loadData(editmapid,data.data);
|
||||
}else{
|
||||
initData(editmapid,data.data.id);
|
||||
}
|
||||
|
||||
}else{
|
||||
let params = {mapId:editmapid};
|
||||
|
||||
set3dMapData(params).then(data => {
|
||||
if(data.code == "200"){
|
||||
//console.log("创建三维数据成功");
|
||||
// console.log(data);
|
||||
initData(editmapid,data.data.id);
|
||||
|
||||
}
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
function initData(mapid,data3did){
|
||||
|
||||
getMapDetail(mapid).then(data => {
|
||||
console.log(data);
|
||||
let mapdata = data.data;
|
||||
//console.log(data3did);
|
||||
jlmap3ddata.id = data3did;
|
||||
jlmap3ddata.mapId = mapid;
|
||||
|
||||
// //初始化站台
|
||||
jlmap3ddata.stationstandlist = new StationStandList();
|
||||
//初始化轨道和道岔 暂时
|
||||
jlmap3ddata.sectionlist = new SectionList();
|
||||
|
||||
jlmap3ddata.signallist = new SignalList();
|
||||
|
||||
jlmap3ddata.switchlist = new SwitchList();
|
||||
//
|
||||
jlmap3ddata.raillist = new RailList();
|
||||
jlmap3ddata.raillist.setrail();
|
||||
|
||||
assetloader.assetinit(scene)
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return jlmap3ddata.stationstandlist.initpromise(jlmap3ddata,mapdata.stationList,mapdata.stationStandList,scene,assetloader);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return jlmap3ddata.sectionlist.initpromise(jlmap3ddata,assetloader,mapdata.sectionList,mapdata.switchList,scene);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return jlmap3ddata.signallist.initpromise(jlmap3ddata,mapdata.signalList,scene,assetloader);
|
||||
})
|
||||
.then(function(data){
|
||||
return jlmap3ddata.switchlist.initpromise(jlmap3ddata,mapdata.switchList,scene,assetloader);
|
||||
})
|
||||
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
loadingInstance.close();
|
||||
});
|
||||
//初始化信号
|
||||
//SetObj(mapdata,scope);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function loadData(mapid,netdata){
|
||||
|
||||
// console.log(netdata)
|
||||
getMapDetail(mapid).then(data => {
|
||||
jlmap3ddata.id = netdata.id;
|
||||
jlmap3ddata.mapId = mapid;
|
||||
let mapdata = data.data;
|
||||
// console.log(netdata);
|
||||
// //初始化站台
|
||||
jlmap3ddata.stationstandlist = new StationStandList();
|
||||
//初始化轨道和道岔 暂时
|
||||
jlmap3ddata.sectionlist = new SectionList();
|
||||
|
||||
jlmap3ddata.signallist = new SignalList();
|
||||
|
||||
jlmap3ddata.switchlist = new SwitchList();
|
||||
|
||||
jlmap3ddata.raillist = new RailList();
|
||||
|
||||
let sectiondata = JSON.parse(netdata.sections);
|
||||
let switchdata = JSON.parse(netdata.switchs);
|
||||
let signaldata = JSON.parse(netdata.signals);
|
||||
let standsdata = JSON.parse(netdata.stands);
|
||||
jlmap3dasset = JSON.parse(netdata.assets);
|
||||
console.log(netdata);
|
||||
if(jlmap3dasset.sceneAssetList == undefined){
|
||||
|
||||
// loadEditAllAsset(jlmap3dasset);
|
||||
assetloader.setmodellistnew(netdata.assets,5);
|
||||
assetloader.assetpromise(scene)
|
||||
.then(function(data){
|
||||
// return jlmap3ddata.stationstandlist.initpromise(jlmap3ddata,mapdata.stationList,mapdata.stationStandList,scene,assetloader);
|
||||
return jlmap3ddata.stationstandlist.loadpromise(jlmap3ddata,standsdata,mapdata.stationStandList,scene,assetloader);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
// return jlmap3ddata.sectionlist.initpromise(jlmap3ddata,assetloader,mapdata.sectionList,mapdata.switchList,scene);
|
||||
return jlmap3ddata.sectionlist.loadpromise(jlmap3ddata,assetloader,sectiondata.section,scene);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
// return jlmap3ddata.signallist.initpromise(jlmap3ddata,mapdata.signalList,scene,assetloader);
|
||||
return jlmap3ddata.signallist.loadpromise(signaldata,scene,assetloader,mapdata.signalList);
|
||||
})
|
||||
.then(function(data){
|
||||
// return jlmap3ddata.switchlist.initpromise(jlmap3ddata,mapdata.switchList,scene,assetloader);
|
||||
return jlmap3ddata.switchlist.loadpromise(jlmap3ddata,switchdata,scene,assetloader);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
loadingInstance.close();
|
||||
});
|
||||
}else{
|
||||
loadEditAllAsset(jlmap3dasset);
|
||||
assetloader.setModelListOver(jlmap3dasset.sceneAssetList,5);
|
||||
assetloader.assetPromiseOver(scene)
|
||||
.then(function(data){
|
||||
console.log(assetloader.modellist);
|
||||
// return jlmap3ddata.stationstandlist.initpromise(jlmap3ddata,mapdata.stationList,mapdata.stationStandList,scene,assetloader);
|
||||
return jlmap3ddata.stationstandlist.loadpromise(jlmap3ddata,standsdata,mapdata.stationStandList,scene,assetloader);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
// return jlmap3ddata.sectionlist.initpromise(jlmap3ddata,assetloader,mapdata.sectionList,mapdata.switchList,scene);
|
||||
return jlmap3ddata.sectionlist.loadpromise(jlmap3ddata,assetloader,sectiondata.section,scene);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
// return jlmap3ddata.signallist.initpromise(jlmap3ddata,mapdata.signalList,scene,assetloader);
|
||||
return jlmap3ddata.signallist.loadpromise(signaldata,scene,assetloader,mapdata.signalList);
|
||||
})
|
||||
.then(function(data){
|
||||
// return jlmap3ddata.switchlist.initpromise(jlmap3ddata,mapdata.switchList,scene,assetloader);
|
||||
return jlmap3ddata.switchlist.loadpromise(jlmap3ddata,switchdata,scene,assetloader);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
loadingInstance.close();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -23,8 +23,8 @@ import { SetScene } from '@/jlmap3d/config/SetScene';
|
||||
import { SetLights } from '@/jlmap3d/config/SetLights';
|
||||
|
||||
//加载器
|
||||
// import { Jlmap3ddata } from '@/jlmap3d/edit/Jlmap3ddata';
|
||||
import { Jlmap3ddata } from '@/jlmap3d/edit/Jlmap3dnewdata';
|
||||
// import { jl3dEditorLoader } from '@/jlmap3d/edit/jl3dEditorLoader';
|
||||
import { jl3dEditorLoader } from '@/jlmap3d/edit/jl3dEditorLoader';
|
||||
//操作管理器
|
||||
import { Actionmanage } from '@/jlmap3d/edit/actionmanage';
|
||||
|
||||
@ -96,7 +96,7 @@ export function JLmap3dEdit(dom, data, mapid) {
|
||||
path:[]
|
||||
};
|
||||
this.assetManager = null;
|
||||
Jlmap3ddata(mapid,scope);
|
||||
jl3dEditorLoader(mapid,scope);
|
||||
|
||||
let scalControls = new THREE.ScalControls(scope.scene,scope.camera, scope.renderer.domElement );
|
||||
this.scalswitch = false;
|
||||
|
@ -28,7 +28,7 @@ export function StationStandList() {
|
||||
|
||||
let newstationstand = new StationStandModel(stationdata[i]);
|
||||
//判断站台是否显示
|
||||
console.log(stationdata[i]);
|
||||
|
||||
if(stationdata[i].visible == true){
|
||||
|
||||
//遍历车站站台数据
|
||||
|
84
src/jlmap3d/edit/testEditorModel/RailList.js
Normal file
84
src/jlmap3d/edit/testEditorModel/RailList.js
Normal file
@ -0,0 +1,84 @@
|
||||
export function RailList(){
|
||||
let scope = this;
|
||||
|
||||
this.linkrail = [];
|
||||
|
||||
this.switchrail = [];
|
||||
|
||||
this.setrail = function(){
|
||||
|
||||
};
|
||||
|
||||
|
||||
this.resetrail = function(mapdata,scene){
|
||||
|
||||
|
||||
let section = mapdata.sectionlist.sections.datalist;
|
||||
|
||||
let n =0;
|
||||
for(let i in section){
|
||||
|
||||
n = n+1;
|
||||
var geometry = new THREE.PlaneBufferGeometry( section[i].lengthFact, 1, 1 );
|
||||
var material = new THREE.MeshBasicMaterial( {color: 0xffff00, side: THREE.DoubleSide} );
|
||||
var plane = new THREE.Mesh( geometry, material );
|
||||
plane.position.x = section[i].mesh.position.x;
|
||||
plane.position.y = 2+Math.random()*10;
|
||||
plane.position.z = section[i].mesh.position.z;
|
||||
plane.rotation.x = -Math.PI/2;
|
||||
plane.rotation.z = section[i].mesh.rotation._z;
|
||||
|
||||
// if( plane.rotation.z != ){
|
||||
//
|
||||
// }
|
||||
var geometry1 = new THREE.CircleBufferGeometry( 1, 16 );
|
||||
var material1 = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
|
||||
var geometry2 = new THREE.CircleBufferGeometry( 1, 16 );
|
||||
var material2 = new THREE.MeshBasicMaterial( { color: 0xff2000 } );
|
||||
var circle1 = new THREE.Mesh( geometry1, material1 );
|
||||
|
||||
circle1.rotation.x = -Math.PI/2;
|
||||
|
||||
|
||||
var circle2 = new THREE.Mesh( geometry2, material2 );
|
||||
|
||||
circle2.rotation.x = -Math.PI/2;
|
||||
|
||||
circle1.position.x = plane.position.x + (section[i].lengthFact)/2*Math.cos(plane.rotation.z);
|
||||
circle1.position.y = 1;
|
||||
circle1.position.z = plane.position.z - (section[i].lengthFact)/2*Math.sin(plane.rotation.z);
|
||||
circle2.position.x = plane.position.x - (section[i].lengthFact)/2*Math.cos(plane.rotation.z);
|
||||
circle2.position.y = 0.5;
|
||||
circle2.position.z = plane.position.z + (section[i].lengthFact)/2*Math.sin(plane.rotation.z);
|
||||
// }
|
||||
scene.add( circle1 );
|
||||
scene.add( circle2 );
|
||||
scene.add( plane );
|
||||
mapdata.sectionlist.sections.datalist[i].rail = [{
|
||||
x:circle2.position.x,
|
||||
z:circle2.position.z
|
||||
},{
|
||||
x:circle1.position.x,
|
||||
z:circle1.position.z
|
||||
}];
|
||||
// console.log(i);
|
||||
// console.log(section[i].mesh);
|
||||
// console.log(mapdata.sectionlist.sections.datalist[i].rail);
|
||||
// console.log("=======================");
|
||||
}
|
||||
// console.log(n);
|
||||
// for(let i=0;i<mapdata.switchlist.switchgroup.children.length;i++){
|
||||
// var geometry = new THREE.CircleBufferGeometry( 1, 16 );
|
||||
// var material = new THREE.MeshBasicMaterial( { color: 0xff00ff } );
|
||||
// var circle1 = new THREE.Mesh( geometry, material );
|
||||
// circle1.position.x = mapdata.switchlist.switchgroup.children[i].position.x;
|
||||
// circle1.position.z = mapdata.switchlist.switchgroup.children[i].position.z;
|
||||
// circle1.rotation.x = -Math.PI/2;
|
||||
// scene.add( circle1 );
|
||||
// }
|
||||
};
|
||||
|
||||
this.getrail = function(){
|
||||
|
||||
};
|
||||
}
|
1005
src/jlmap3d/edit/testEditorModel/SectionList.js
Normal file
1005
src/jlmap3d/edit/testEditorModel/SectionList.js
Normal file
File diff suppressed because it is too large
Load Diff
26
src/jlmap3d/edit/testEditorModel/SectionModel.js
Normal file
26
src/jlmap3d/edit/testEditorModel/SectionModel.js
Normal file
@ -0,0 +1,26 @@
|
||||
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.type = null;
|
||||
//指向模型
|
||||
this.mesh = null;
|
||||
// //模型地址
|
||||
// this.meshurl = null;
|
||||
// //贴图地址
|
||||
// this.picurl = null;
|
||||
|
||||
}
|
270
src/jlmap3d/edit/testEditorModel/SignalList.js
Normal file
270
src/jlmap3d/edit/testEditorModel/SignalList.js
Normal file
@ -0,0 +1,270 @@
|
||||
import {SignalModel} from '@/jlmap3d/edit/editmodel/SignalModel.js';
|
||||
|
||||
export function SignalList() {
|
||||
|
||||
let scope = this;
|
||||
|
||||
this.type = "signallist";
|
||||
|
||||
this.list = [];
|
||||
|
||||
this.group = new THREE.Group();
|
||||
|
||||
this.initpromise = function(jlmap3ddata,data,scene,assetloader,netdata){
|
||||
return new Promise(function(resolve, reject){
|
||||
scope.group.name = "signal";
|
||||
// console.log(data);
|
||||
//遍历信号数据
|
||||
let netsignal = null;
|
||||
let haddata = false;
|
||||
if(netdata){
|
||||
netsignal = JSON.parse(netdata);
|
||||
haddata = true;
|
||||
}
|
||||
let sectiondata = jlmap3ddata.sectionlist.sections.datalist;
|
||||
let num;
|
||||
for(let j=0;j<assetloader.modellist.length;j++){
|
||||
if(assetloader.modellist[j].deviceType == "signal"){
|
||||
num = j;
|
||||
}
|
||||
}
|
||||
for(let i=0;i<data.length;i++){
|
||||
if(data[i].virtual == false){
|
||||
let newsignal = new SignalModel(data[i]);
|
||||
if(haddata == false){
|
||||
// console.log(data[i])
|
||||
let newmesh = assetloader.modellist[num].mesh.clone(true);
|
||||
|
||||
newmesh.name = data[i].name;
|
||||
newmesh.modelid = assetloader.modellist[num].id;
|
||||
newmesh.code = data[i].code;
|
||||
newmesh.sectionCode = data[i].sectionCode;
|
||||
newmesh.right = data[i].right;
|
||||
newmesh.virtual = data[i].virtual;
|
||||
for(let j=0;j<newmesh.children.length;j++){
|
||||
newmesh.children[j].code = data[i].code;
|
||||
}
|
||||
let section = sectiondata[data[i].sectionCode];
|
||||
let posx = null;
|
||||
|
||||
if(data[i].sectionOffset > section.lengthFact/2){
|
||||
posx = section.mesh.position.x + data[i].sectionOffset - section.lengthFact/2;
|
||||
}else{
|
||||
posx = section.mesh.position.x - (section.lengthFact/2 - data[i].sectionOffset);
|
||||
}
|
||||
//根据线路方向修改信号灯位置
|
||||
if(data[i].right == false){
|
||||
if(section.standTrack == true){
|
||||
posx = posx - 7;
|
||||
}
|
||||
|
||||
newmesh.position.set(posx,0,section.mesh.position.z-3);
|
||||
newmesh.rotation.z = ( Math.PI / 2 );
|
||||
}else if(data[i].right == true){
|
||||
if(section.standTrack == true){
|
||||
posx = posx + 7;
|
||||
}
|
||||
newmesh.position.set(posx,0,section.mesh.position.z+3);
|
||||
newmesh.rotation.z = ( - Math.PI / 2 );
|
||||
}
|
||||
newmesh.scale.x = 0.05;
|
||||
newmesh.scale.y = 0.05;
|
||||
newmesh.scale.z = 0.05;
|
||||
newmesh.sectionOffset = data[i].sectionOffset;
|
||||
newmesh.sectionCode = data[i].sectionCode;
|
||||
newmesh.right = data[i].right;
|
||||
newsignal.mesh = newmesh;
|
||||
|
||||
newsignal.sectionOffset = data[i].sectionOffset;
|
||||
newsignal.mesh.status = "01";
|
||||
newsignal.name = data[i].name;
|
||||
newsignal.modelid = assetloader.modellist[num].id;
|
||||
newsignal.code = data[i].code;
|
||||
newsignal.sectionCode = data[i].sectionCode;
|
||||
newsignal.right = data[i].right;
|
||||
scope.group.add(newmesh);
|
||||
scope.list.push(newsignal);
|
||||
|
||||
}else{
|
||||
for(let j=0;j<assetloader.modellist.length;j++){
|
||||
if(assetloader.modellist[j].id == netsignal[i].modelid){
|
||||
num = j;
|
||||
}
|
||||
}
|
||||
let newmesh = assetloader.modellist[num].mesh.clone(true);
|
||||
|
||||
newmesh.uuid = netsignal[i].id;
|
||||
newmesh.name = netsignal[i].name;
|
||||
newmesh.modelid = assetloader.modellist[num].id;
|
||||
newmesh.code = netsignal[i].code;
|
||||
newmesh.virtual = data[i].virtual;
|
||||
for(let j=0;j<newmesh.children.length;j++){
|
||||
newmesh.children[j].code = netsignal[i].code;
|
||||
}
|
||||
newmesh.position.x = netsignal[i].position.x;
|
||||
newmesh.position.y = netsignal[i].position.y;
|
||||
newmesh.position.z = netsignal[i].position.z;
|
||||
newmesh.rotation.x = netsignal[i].rotation._x;
|
||||
newmesh.rotation.y = netsignal[i].rotation._y;
|
||||
newmesh.rotation.z = netsignal[i].rotation._z;
|
||||
newmesh.scale.x = netsignal[i].scale.x;
|
||||
newmesh.scale.y = netsignal[i].scale.y;
|
||||
newmesh.scale.z = netsignal[i].scale.z;
|
||||
|
||||
|
||||
// newsignal.mesh = newmesh;
|
||||
newsignal.mesh.status = "01";
|
||||
scope.group.add(newmesh);
|
||||
scope.list.push(newsignal);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
scene.add(scope.group);
|
||||
resolve("loadedsignal");
|
||||
});
|
||||
}
|
||||
|
||||
this.loadpromise = function(signaldata,scene,assetloader,data){
|
||||
return new Promise(function(resolve, reject){
|
||||
let num;
|
||||
for(let j=0;j<assetloader.modellist.length;j++){
|
||||
if(assetloader.modellist[j].type == "signal"){
|
||||
num = j;
|
||||
}
|
||||
}
|
||||
for(let i=0;i<signaldata.length;i++){
|
||||
//signaldata[i].virtual == "false"
|
||||
for(let n=0;n<data.length;n++){
|
||||
if(signaldata[i].code == data[n].code){
|
||||
if(data[n].virtual == false){
|
||||
let newsignal = new SignalModel(signaldata[i]);
|
||||
|
||||
// console.log(signaldata[i]);
|
||||
let newmesh = assetloader.modellist[num].mesh.clone(true);
|
||||
newmesh.sectionCode = data[n].sectionCode;
|
||||
newmesh.sectionOffset = data[n].sectionOffset;
|
||||
// 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.modelid = assetloader.modellist[num].id;
|
||||
newmesh.code = signaldata[i].code;
|
||||
newmesh.right = data[n].right;
|
||||
newmesh.virtual = data[n].virtual;
|
||||
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;
|
||||
newsignal.mesh = newmesh;
|
||||
newsignal.mesh.status = "01";
|
||||
|
||||
scope.group.add(newsignal.mesh);
|
||||
scope.list.push(newsignal);
|
||||
n = data.length;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
scene.add(scope.group);
|
||||
resolve("loadedsignal");
|
||||
});
|
||||
};
|
||||
this.resetsignal = function(jlmap3ddata){
|
||||
// console.log(jlmap3ddata.linksgroup);
|
||||
let sectiondata = jlmap3ddata.sectionlist.sectiongroup.children;
|
||||
for(let i=0;i<scope.group.children.length;i++){
|
||||
let signaldata = scope.group.children[i];
|
||||
|
||||
for(let j=0;j<sectiondata.length;j++){
|
||||
if(sectiondata[j].code == signaldata.sectionCode){
|
||||
let section = sectiondata[j];
|
||||
let posx = null;
|
||||
// console.log(section);
|
||||
|
||||
posx = section.railpoint[0].x + signaldata.sectionOffset;
|
||||
|
||||
//根据线路方向修改信号灯位置
|
||||
if(signaldata.right == false){
|
||||
if(section.standTrack == true){
|
||||
posx = posx - 7;
|
||||
}
|
||||
|
||||
signaldata.position.set(posx,0,section.railpoint[0].z-3);
|
||||
signaldata.rotation.z = ( Math.PI / 2 );
|
||||
}else if(signaldata.right == true){
|
||||
if(section.standTrack == true){
|
||||
posx = posx + 7;
|
||||
}
|
||||
signaldata.position.set(posx,0,section.railpoint[0].z+3);
|
||||
signaldata.rotation.z = ( - Math.PI / 2 );
|
||||
}
|
||||
j = sectiondata.length;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
this.init = function(data,realsectionlist,scene,assetloader){
|
||||
|
||||
|
||||
scope.group.name = "signal";
|
||||
//遍历信号数据
|
||||
for(let i=0;i<data.length;i++){
|
||||
let newsignal = new SignalModel(data);
|
||||
|
||||
let newmesh = assetloader.modellist[0].mesh.clone(true);
|
||||
|
||||
newmesh.name = assetloader.modellist[0].id;
|
||||
newmesh.code = data[i].code;
|
||||
for(let j=0;j<newmesh.children.length;j++){
|
||||
newmesh.children[j].code = data[i].code;
|
||||
}
|
||||
|
||||
//根据线路方向修改信号灯位置
|
||||
if(data[i].directionType == "01"){
|
||||
newmesh.position.set(data[i].position.x,1,data[i].position.y-10);
|
||||
newmesh.rotation.z = ( Math.PI / 2 );
|
||||
}else if(data[i].directionType == "02"){
|
||||
newmesh.position.set(data[i].position.x,1,data[i].position.y+10);
|
||||
newmesh.rotation.z = ( - Math.PI / 2 );
|
||||
}
|
||||
//newmesh.scale.set(0.1,0.1,0.1);
|
||||
newsignal.mesh = newmesh;
|
||||
newsignal.mesh.status = "01";
|
||||
scope.group.add(newsignal.mesh);
|
||||
scope.list.push(newsignal);
|
||||
|
||||
}
|
||||
scene.add(scope.group);
|
||||
}
|
||||
|
||||
this.reposition = function(){
|
||||
|
||||
}
|
||||
|
||||
this.update = function(){
|
||||
|
||||
}
|
||||
|
||||
this.renderon = function(){
|
||||
|
||||
}
|
||||
|
||||
this.renderoff = function(){
|
||||
|
||||
}
|
||||
|
||||
this.dispose = function(){
|
||||
|
||||
}
|
||||
}
|
36
src/jlmap3d/edit/testEditorModel/SignalModel.js
Normal file
36
src/jlmap3d/edit/testEditorModel/SignalModel.js
Normal file
@ -0,0 +1,36 @@
|
||||
export function SignalModel(data) {
|
||||
|
||||
this.uuid = null;
|
||||
this.code = null;
|
||||
this.name = null;
|
||||
this.modelid = null;
|
||||
this.type = null;
|
||||
this.direction = null;
|
||||
this.ismodel = false;
|
||||
this.istexture = false;
|
||||
this.modelurl = null;
|
||||
// this.textures = {
|
||||
// red:null,
|
||||
// yellor:null,
|
||||
// green:null
|
||||
// }
|
||||
// this.position = {
|
||||
// x:0,
|
||||
// y:0,
|
||||
// z:0
|
||||
// };
|
||||
// this.rotation = {
|
||||
// x:0,
|
||||
// y:0,
|
||||
// z:0
|
||||
// };
|
||||
// this.scale = {
|
||||
// x:0,
|
||||
// y:0,
|
||||
// z:0
|
||||
// }
|
||||
|
||||
this.mesh = null;
|
||||
this.meshurl = null;
|
||||
this.picurl = null;
|
||||
}
|
228
src/jlmap3d/edit/testEditorModel/StationStandList.js
Normal file
228
src/jlmap3d/edit/testEditorModel/StationStandList.js
Normal file
@ -0,0 +1,228 @@
|
||||
import {StationStandModel} from '@/jlmap3d/edit/testEditorModel/StationStandModel.js';
|
||||
|
||||
export function StationStandList() {
|
||||
|
||||
let scope = this;
|
||||
|
||||
this.type = "stationstandlist";
|
||||
|
||||
this.list = [];
|
||||
|
||||
this.group = new THREE.Group();
|
||||
|
||||
this.textlist = [];
|
||||
|
||||
this.initpromise = function(jlmap3ddata,stationdata,stationstanddata,scene,assetloader,netdata){
|
||||
|
||||
return new Promise(function(resolve, reject){
|
||||
|
||||
let netstand = null;
|
||||
let haddata = false;
|
||||
if(netdata){
|
||||
haddata = true;
|
||||
}
|
||||
scope.group.name = "station";
|
||||
scene.add(scope.group);
|
||||
//遍历车站数据
|
||||
for(let i=0;i<stationdata.length;i++){
|
||||
|
||||
let newstationstand = new StationStandModel(stationdata[i]);
|
||||
//判断站台是否显示
|
||||
|
||||
if(stationdata[i].visible == true){
|
||||
|
||||
//遍历车站站台数据
|
||||
for(let j=0;j<stationstanddata.length;j++){
|
||||
|
||||
if(stationstanddata[j].small == false){
|
||||
//收集有效车站数据
|
||||
if(stationstanddata[j].stationCode == stationdata[i].code){
|
||||
newstationstand.name = stationdata[i].name;
|
||||
|
||||
newstationstand.code = stationdata[i].code;
|
||||
|
||||
newstationstand.inside = stationstanddata[i].inside;
|
||||
let stand= {
|
||||
code : stationstanddata[j].code,
|
||||
position : stationstanddata[j].position,
|
||||
name : stationstanddata[j].name,
|
||||
right : stationstanddata[j].right,
|
||||
section : stationstanddata[j].standTrackCode,
|
||||
inside : stationstanddata[j].inside,
|
||||
};
|
||||
newstationstand.stands.push(stand);
|
||||
// //向右上行
|
||||
// if(stationstanddata[j].right == true){
|
||||
// newstationstand.direction1.code = stationstanddata[j].code;
|
||||
// newstationstand.direction1.position = stationstanddata[j].position;
|
||||
// newstationstand.direction1.name = stationstanddata[j].name;
|
||||
// newstationstand.direction1.screenDoorOpenStatus = "01";
|
||||
// newstationstand.direction1.section = stationstanddata[j].standTrackCode;
|
||||
// newstationstand.direction1.inside = stationstanddata[j].inside;
|
||||
// }
|
||||
// //向左下行
|
||||
// if(stationstanddata[j].right == false){
|
||||
// newstationstand.direction2.code = stationstanddata[j].code;
|
||||
// newstationstand.direction2.position = stationstanddata[j].position;
|
||||
// newstationstand.direction2.name = stationstanddata[j].name;
|
||||
// newstationstand.direction2.screenDoorOpenStatus = "01";
|
||||
// newstationstand.direction2.section = stationstanddata[j].standTrackCode;
|
||||
// newstationstand.direction2.inside = stationstanddata[j].inside;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(newstationstand.code != null){
|
||||
scope.list.push(newstationstand);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
resolve("loadedstation");
|
||||
});
|
||||
}
|
||||
this.loadpromise = function(jlmap3ddata,standsdata,jlmapstanddata,scene,assetloader){
|
||||
return new Promise(function(resolve, reject){
|
||||
// console.log(jlmap3ddata);
|
||||
// console.log(standsdata);
|
||||
// console.log(jlmapstanddata);
|
||||
let stations = jlmap3ddata.stationstandlist.list;
|
||||
let num;
|
||||
let num2;
|
||||
let num3;
|
||||
for(let j=0;j<assetloader.modellist.length;j++){
|
||||
if(assetloader.modellist[j].type == "stationInside"){
|
||||
num = j;
|
||||
}
|
||||
if(assetloader.modellist[j].type == "stationOutside"){
|
||||
num2 = j;
|
||||
}
|
||||
if(assetloader.modellist[j].type == "stationThree"){
|
||||
num3 = j;
|
||||
}
|
||||
|
||||
|
||||
if(assetloader.modellist[j].deviceType == "stand"){
|
||||
num = j;
|
||||
}
|
||||
if(assetloader.modellist[j].deviceType == "standwaice"){
|
||||
num2 = j;
|
||||
// assetloader.modellist[num2].mesh.rotation.y = Math.PI/2;
|
||||
}
|
||||
if(assetloader.modellist[j].deviceType == "station3"){
|
||||
num3 = j;
|
||||
}
|
||||
}
|
||||
// console.log("+++++++++++++");
|
||||
// console.log(jlmapstanddata);
|
||||
// console.log(standsdata);
|
||||
for(let i=0;i<standsdata.length;i++){
|
||||
let newstationstand = new StationStandModel(standsdata[i]);
|
||||
let newstationmesh;
|
||||
let stands = [];
|
||||
console.log("--------------------");
|
||||
for(let j=0;j<jlmapstanddata.length;j++){
|
||||
if(jlmapstanddata[j].stationCode == standsdata[i].code && jlmapstanddata[j].small != true){
|
||||
console.log(jlmapstanddata[j]);
|
||||
let changestand = {
|
||||
code : jlmapstanddata[j].code,
|
||||
position : jlmapstanddata[j].position,
|
||||
name : jlmapstanddata[j].name,
|
||||
right : jlmapstanddata[j].right,
|
||||
section : jlmapstanddata[j].standTrackCode,
|
||||
inside : jlmapstanddata[j].inside,
|
||||
};
|
||||
stands.push(changestand);
|
||||
}
|
||||
}
|
||||
newstationstand.stands = stands;
|
||||
if(newstationstand.stands.length<=2){
|
||||
|
||||
if(standsdata[i].inside == true){
|
||||
newstationmesh = assetloader.modellist[num].mesh.clone(true);
|
||||
}else{
|
||||
newstationmesh = assetloader.modellist[num2].mesh.clone(true);
|
||||
}
|
||||
// console.log(jlmapstanddata[j]);
|
||||
newstationstand.code = standsdata[i].code;
|
||||
newstationstand.name = standsdata[i].name;
|
||||
newstationstand.inside = standsdata[i].inside;
|
||||
// console.log(standsdata[i]);
|
||||
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.push(newstationstand);
|
||||
}else{
|
||||
newstationmesh = assetloader.modellist[num3].mesh.clone(true);
|
||||
// console.log(jlmapstanddata[j]);
|
||||
newstationstand.code = standsdata[i].code;
|
||||
newstationstand.name = standsdata[i].name;
|
||||
newstationstand.inside = standsdata[i].inside;
|
||||
// console.log(standsdata[i]);
|
||||
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.push(newstationstand);
|
||||
}
|
||||
}
|
||||
scene.add(scope.group);
|
||||
resolve("loadedstation");
|
||||
});
|
||||
|
||||
}
|
||||
this.update = function(){
|
||||
|
||||
}
|
||||
|
||||
this.renderon = function(){
|
||||
|
||||
}
|
||||
|
||||
this.renderoff = function(){
|
||||
|
||||
}
|
||||
|
||||
this.dispose = function(){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//canvas文字贴图方法
|
||||
//PS:待提炼 增强功能
|
||||
function getTextCanvas(text){
|
||||
var canvas = document.getElementById('canvastexture');
|
||||
// let width = 128;
|
||||
// let height = 64;
|
||||
// canvas.style.width = width + "px";
|
||||
// canvas.style.height = height + "px";
|
||||
|
||||
var ctx = canvas.getContext('2d');
|
||||
ctx.fillStyle = '#FFFFFF';
|
||||
ctx.fillRect(0, 0,128,64);
|
||||
ctx.font = "500px";
|
||||
ctx.fillStyle = '#000000';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.textBaseline = 'middle';
|
||||
ctx.clearRect(0,0,128,64);
|
||||
|
||||
ctx.fillText(text.name, 128/2,64/4);
|
||||
ctx.fillText(text.runPlanName, 128/2,64*2/4);
|
||||
ctx.fillText(text.kmPost, 128/2,64*3/4);
|
||||
|
||||
let data = ctx.getImageData(0, 0,128,64);
|
||||
return data;
|
||||
}
|
21
src/jlmap3d/edit/testEditorModel/StationStandModel.js
Normal file
21
src/jlmap3d/edit/testEditorModel/StationStandModel.js
Normal file
@ -0,0 +1,21 @@
|
||||
export function StationStandModel(opts) {
|
||||
|
||||
var scope = this;
|
||||
|
||||
this.uuid = null;
|
||||
this.code = null;
|
||||
this.name = null;
|
||||
this.modelid = null;
|
||||
this.type = null;
|
||||
|
||||
this.ismodel = false;
|
||||
this.istexture = false;
|
||||
this.modelurl = null;
|
||||
|
||||
this.stands = [];
|
||||
|
||||
|
||||
this.mesh = null;
|
||||
this.meshurl = null;
|
||||
this.picurl = null;
|
||||
}
|
135
src/jlmap3d/edit/testEditorModel/SwitchList.js
Normal file
135
src/jlmap3d/edit/testEditorModel/SwitchList.js
Normal file
@ -0,0 +1,135 @@
|
||||
import {SwitchModel} from '@/jlmap3d/edit/neweditmodel/SwitchModel.js';
|
||||
|
||||
export function SwitchList() {
|
||||
|
||||
let scope = this;
|
||||
this.type = "switchlist";
|
||||
|
||||
this.switchgroup = new THREE.Group();
|
||||
this.switchgroup.name = "switch";
|
||||
|
||||
this.switchs = {
|
||||
datalist:[],
|
||||
modellist:[]
|
||||
};
|
||||
|
||||
this.initpromise = function(jlmap3ddata,data,scene,assetloader,netdata){
|
||||
// console.log(jlmap3ddata);
|
||||
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].deviceType == "autoswitch"){
|
||||
num = j;
|
||||
}
|
||||
};
|
||||
for(let i=0,leni = data.length;i<leni;i++){
|
||||
|
||||
let newswitch = {
|
||||
code:data[i].code,
|
||||
name:data[i].name,
|
||||
pa:data[i].sectionACode,
|
||||
pb:data[i].sectionBCode,
|
||||
pc:data[i].sectionCCode
|
||||
};
|
||||
|
||||
let autoswitch = assetloader.modellist[num].mesh.clone(true);
|
||||
autoswitch.code = data[i].code;
|
||||
scope.switchs.datalist.push(newswitch);
|
||||
scope.switchs.modellist.push(autoswitch);
|
||||
scope.switchgroup.add(autoswitch);
|
||||
if(sectiondata[data[i].sectionACode].mesh.position.x >sectiondata[data[i].sectionBCode].mesh.position.x){
|
||||
autoswitch.position.set(sectiondata[data[i].sectionACode].lp.x,0,sectiondata[data[i].sectionACode].lp.z);
|
||||
autoswitch.rotation.z = Math.PI;
|
||||
}else{
|
||||
autoswitch.position.set(sectiondata[data[i].sectionACode].rp.x,0,sectiondata[data[i].sectionACode].rp.z);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
resolve("loadedswitch");
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
this.loadpromise = function(jlmap3ddata,switchdata,scene,assetloader){
|
||||
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;
|
||||
}
|
||||
|
||||
if(assetloader.modellist[j].deviceType == "autoswitch"){
|
||||
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
|
||||
};
|
||||
|
||||
// console.log(newswitch.pa);
|
||||
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.switchs.modellist.push(autoswitch);
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
resolve("loadedswitch");
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
this.resetswitch = function(data){
|
||||
// console.log("reset");
|
||||
let sectiondata = data.sectionlist.sectiongroup;
|
||||
for(let i=0;i<scope.switchs.datalist.length;i++){
|
||||
|
||||
let sectionA = sectiondata.getObjectByProperty("code",scope.switchs.datalist[i].pa);
|
||||
let sectionB = sectiondata.getObjectByProperty("code",scope.switchs.datalist[i].pb);
|
||||
|
||||
if(sectionA.railpoint[0].x > sectionB.railpoint[0].x){
|
||||
scope.switchs.modellist[i].position.set(sectionA.railpoint[0].x,0,sectionA.railpoint[0].z);
|
||||
}else{
|
||||
scope.switchs.modellist[i].position.set(sectionA.railpoint[1].x,0,sectionA.railpoint[1].z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.update = function(){
|
||||
|
||||
}
|
||||
|
||||
this.renderon = function(){
|
||||
|
||||
}
|
||||
|
||||
this.renderoff = function(){
|
||||
|
||||
}
|
||||
|
||||
this.dispose = function(){
|
||||
|
||||
}
|
||||
|
||||
}
|
22
src/jlmap3d/edit/testEditorModel/SwitchModel.js
Normal file
22
src/jlmap3d/edit/testEditorModel/SwitchModel.js
Normal 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;
|
||||
}
|
8
src/jlmap3d/edit/testEditorModel/TrainModel.js
Normal file
8
src/jlmap3d/edit/testEditorModel/TrainModel.js
Normal file
@ -0,0 +1,8 @@
|
||||
export function TrainModel(opts) {
|
||||
|
||||
var scope = this;
|
||||
|
||||
this.mesh = null;
|
||||
this.meshurl = null;
|
||||
this.picurl = null;
|
||||
}
|
@ -106,19 +106,25 @@ export function DriverLoadNew(data,scope,netdata,mapdata,sectionlist,signallist,
|
||||
if(scope.stationtexture["stationlist"]){
|
||||
for(let mm=0;mm< stationstandlist.group.children.length;mm++){
|
||||
let stationname = stationstandlist.group.children[mm].name;
|
||||
stationstandlist.group.children[mm].getObjectByName("zhantailiebiao").material.map =scope.stationtexture["stationlist"];
|
||||
stationstandlist.group.children[mm].getObjectByName("zhantailiebiao").material.map.needsUpdate = true;
|
||||
if(stationstandlist.group.children[mm].getObjectByName("zhantailiebiao")){
|
||||
stationstandlist.group.children[mm].getObjectByName("zhantailiebiao").material.map =scope.stationtexture["stationlist"];
|
||||
stationstandlist.group.children[mm].getObjectByName("zhantailiebiao").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
if(stationstandlist.group.children[mm].getObjectByName("menkuangyanse")){
|
||||
stationstandlist.group.children[mm].getObjectByName("menkuangyanse").material.map =scope.stationtexture["pingbimen"];
|
||||
stationstandlist.group.children[mm].getObjectByName("menkuangyanse").material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
|
||||
let newmaterial = stationstandlist.group.children[mm].getObjectByName("zhantaiming").material.clone();
|
||||
newmaterial.map =scope.stationtexture[stationname];
|
||||
|
||||
stationstandlist.group.children[mm].getObjectByName("zhantaiming").material = newmaterial;
|
||||
stationstandlist.group.children[mm].getObjectByName("zhantaiming").material.map.needsUpdate = true;
|
||||
if(stationstandlist.group.children[mm].getObjectByName("zhantaiming")){
|
||||
let newmaterial = stationstandlist.group.children[mm].getObjectByName("zhantaiming").material.clone();
|
||||
newmaterial.map =scope.stationtexture[stationname];
|
||||
stationstandlist.group.children[mm].getObjectByName("zhantaiming").material = newmaterial;
|
||||
stationstandlist.group.children[mm].getObjectByName("zhantaiming").material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -47,7 +47,8 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce
|
||||
}
|
||||
|
||||
function initnew3d(data,netdata){
|
||||
|
||||
// console.log(JSON.parse());
|
||||
// console.log(netdata);
|
||||
// console.log(JSON.parse(netdata.assets));
|
||||
Materialload(scope,JSON.parse(netdata.assets).stationTextureList[0]);
|
||||
let mapdata = data;
|
||||
@ -130,22 +131,28 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce
|
||||
|
||||
if(scope.stationtexture["stationlist"]){
|
||||
for(let mm=0;mm< stationstandlist.group.children.length;mm++){
|
||||
let stationname = stationstandlist.group.children[mm].name;
|
||||
let stationname = stationstandlist.group.children[mm].name;
|
||||
if(stationstandlist.group.children[mm].getObjectByName("zhantailiebiao")){
|
||||
stationstandlist.group.children[mm].getObjectByName("zhantailiebiao").material.map =scope.stationtexture["stationlist"];
|
||||
stationstandlist.group.children[mm].getObjectByName("zhantailiebiao").material.map.needsUpdate = true;
|
||||
// console.log(stationstandlist.group.children[mm].getObjectByName("menkuangyanse"));
|
||||
if(stationstandlist.group.children[mm].getObjectByName("menkuangyanse")){
|
||||
stationstandlist.group.children[mm].getObjectByName("menkuangyanse").material.map =scope.stationtexture["pingbimen"];
|
||||
stationstandlist.group.children[mm].getObjectByName("menkuangyanse").material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// console.log(stationstandlist.group.children[mm].getObjectByName("menkuangyanse"));
|
||||
if(stationstandlist.group.children[mm].getObjectByName("menkuangyanse")){
|
||||
stationstandlist.group.children[mm].getObjectByName("menkuangyanse").material.map =scope.stationtexture["pingbimen"];
|
||||
stationstandlist.group.children[mm].getObjectByName("menkuangyanse").material.map.needsUpdate = true;
|
||||
}
|
||||
|
||||
if(stationstandlist.group.children[mm].getObjectByName("zhantaiming")){
|
||||
let newmaterial = stationstandlist.group.children[mm].getObjectByName("zhantaiming").material.clone();
|
||||
newmaterial.map =scope.stationtexture[stationname];
|
||||
|
||||
stationstandlist.group.children[mm].getObjectByName("zhantaiming").material = newmaterial;
|
||||
stationstandlist.group.children[mm].getObjectByName("zhantaiming").material.map.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -96,12 +96,12 @@ this.loadpromise = function(sectionList,sectiondata,rails,scene,assetloader){
|
||||
// }
|
||||
// testmesh2 = null;
|
||||
|
||||
if(newsection.railpoint.length>2){
|
||||
if(newsection.railpoint.length>=3){
|
||||
// console.log(newsection);
|
||||
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[1].z),
|
||||
new THREE.Vector3(newsection.railpoint[1].x,height,newsection.railpoint[1].z+0.0001),
|
||||
new THREE.Vector3(newsection.railpoint[2].x,height,newsection.railpoint[2].z)
|
||||
] );
|
||||
|
||||
|
@ -156,19 +156,20 @@ export function StationStandListN() {
|
||||
|
||||
for(let i=0;i<standsdata.length;i++){
|
||||
let newstationstand = new StationStandModel(standsdata[i]);
|
||||
console.log(standsdata[i]);
|
||||
if(standsdata[i].code != "Station96090"){
|
||||
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";
|
||||
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;
|
||||
if(standsdata[i].inside == undefined){
|
||||
newstationmesh = selectmesh1.clone(true);
|
||||
@ -209,19 +210,27 @@ export function StationStandListN() {
|
||||
let mixer = new THREE.AnimationMixer( newstationmesh.children[j] );
|
||||
|
||||
for(let n=0;n<psddata.length;n++){
|
||||
if(psddata[n].standCode == newstationstand.direction2.code){
|
||||
for(let m=0;m<newstationstand.stands.length;m++){
|
||||
console.log("====================");
|
||||
console.log(newstationstand.stands[m]);
|
||||
console.log(psddata[n]);
|
||||
if(psddata[n].standCode == newstationstand.stands[m].code && newstationstand.stands[m].right == false){
|
||||
|
||||
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;
|
||||
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;
|
||||
m = newstationstand.stands.length;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -231,18 +240,24 @@ export function StationStandListN() {
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newstationmesh.children[j] );
|
||||
for(let n=0;n<psddata.length;n++){
|
||||
if(psddata[n].standCode == newstationstand.direction1.code){
|
||||
for(let m=0;m<newstationstand.stands.length;m++){
|
||||
console.log("====================");
|
||||
console.log(newstationstand.stands[m]);
|
||||
console.log(psddata[n]);
|
||||
if(psddata[n].standCode == newstationstand.stands[m].code && newstationstand.stands[m].right == true){
|
||||
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;
|
||||
m = newstationstand.stands.length;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -270,7 +285,7 @@ export function StationStandListN() {
|
||||
newstationstand.name = standsdata[i].name;
|
||||
newstationstand.type = "station";
|
||||
newstationstand.num = i;
|
||||
|
||||
newstationstand.stand = [];
|
||||
newstationstand.direction1.code = standsdata[i].direction1.code;
|
||||
newstationstand.direction1.name = standsdata[i].direction1.name;
|
||||
newstationstand.direction1.screenDoorOpenStatus = "01";
|
||||
|
@ -11,7 +11,7 @@ export function StationStandModel(opts) {
|
||||
this.ismodel = false;
|
||||
this.istexture = false;
|
||||
this.modelurl = null;
|
||||
|
||||
this.stands = [];
|
||||
this.direction1= {
|
||||
position:null,
|
||||
name:null,
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
<el-button type="expo" @click="expo">导出obj</el-button>
|
||||
|
||||
<el-button type="save" @click="save">保存</el-button>
|
||||
<el-button type="save" @click="save">新地图初始化保存</el-button>
|
||||
|
||||
<el-button type="savetest" @click="savetest">测试中保存</el-button>
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
import axios from 'axios';
|
||||
import { update3dMapData } from '@/api/jlmap3d/load3ddata'
|
||||
import { getmodels } from '@/jlmap3d/edit/connect/newgetmodels';
|
||||
import { initDataSave } from '@/jlmap3d/edit/connect/initDataSave';
|
||||
import { testgetmodels } from '@/jlmap3d/edit/connect/testgetmodels';
|
||||
//components
|
||||
import EditProperty from '@/views/jlmap3d/edit/component/property';
|
||||
@ -189,11 +189,12 @@
|
||||
save() {
|
||||
//console.log("save");
|
||||
console.log(this.jlmap3dedit.assetManager);
|
||||
let param = getmodels(this.jlmap3dedit);
|
||||
let param = initDataSave(this.jlmap3dedit);
|
||||
console.log(param);
|
||||
update3dMapData(param).then(data => {
|
||||
//console.log(data);
|
||||
if (data.code == "200") {
|
||||
alert("保存成功");
|
||||
alert("初始化保存成功");
|
||||
}
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user