三维编辑器修改

This commit is contained in:
sunzhenyu 2020-07-10 09:17:00 +08:00
parent 41a0ac6ebd
commit ccd14e903d
5 changed files with 198 additions and 12 deletions

View File

@ -121,7 +121,7 @@ export function Jlmap3ddata(mapid,scope){
let switchdata = JSON.parse(netdata.switchs);
let signaldata = JSON.parse(netdata.signals);
let standsdata = JSON.parse(netdata.stands);
jlmap3dasset = JSON.parse(netdata.assets);
jlmap3dasset = JSON.parse(netdata.assets);
console.log(jlmap3dasset);
assetloader.setmodellistnew(netdata.assets,5);
assetloader.assetpromise(scene)

View File

@ -0,0 +1,171 @@
//import request from '@/utils/request';
export function testgetmodels(data) {
let postmap = {
id:data.mapdata.id,
mapId:data.mapdata.mapId,
assets:"null",
sections:"null",
signals:"null",
trains:"null",
stands:"null",
switchs:"null"
};
console.log(data.mapdata);
if(data.mapdata.sectionlist.sections== undefined){
return postmap;
}
if(data == undefined){
return postmap;
}else{
let models = data.assetManager;
postmap.assets = JSON.stringify(models);
console.log(models);
//link轨道
// let links = [];
// for(let i=0;i<data.mapdata.linklist.linksgroup.children.length;i++){
// let link = {
// uuid:data.mapdata.linklist.linksgroup.children[i].uuid,
// code:data.mapdata.linklist.linksgroup.children[i].code,
// name:data.mapdata.linklist.linksgroup.children[i].name,
// lengthfact:data.mapdata.linklist.linksgroup.children[i].lengthfact,
// position:data.mapdata.linklist.linksgroup.children[i].position,
// rotation:data.mapdata.linklist.linksgroup.children[i].rotation,
// scale:data.mapdata.linklist.linksgroup.children[i].scale,
// rightlist:data.mapdata.linklist.linksgroup.children[i].rightlist,
// leftlist:data.mapdata.linklist.linksgroup.children[i].leftlist,
// lp:data.mapdata.linklist.linksgroup.children[i].lp,
// rp:data.mapdata.linklist.linksgroup.children[i].rp,
// rail:data.mapdata.linklist.linksgroup.children[i].rail,
// }
// links.push(link);
// }
// postmap.sections.link = JSON.stringify(links);
//section隧道
let sections = [];
// console.log(data.mapdata.sectionlist.sections.datalist);
for(let i in data.mapdata.sectionlist.sections.datalist){
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++){
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,
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
}
}
stands.push(station);
}
postmap.stands = JSON.stringify(stands);
//列车
let trains = [];
for(let i=0;i<data.assetloader.modellist.length;i++){
if(data.assetloader.modellist[i].deviceType == "train"){
let train = {
id:data.assetloader.modellist[i].id,
name:data.assetloader.modellist[i].name,
deviceType:data.assetloader.modellist[i].deviceType,
type:data.assetloader.modellist[i].type,
assetUrl:data.assetloader.modellist[i].assetUrl
}
trains.push(train);
}
}
postmap.trains = JSON.stringify(trains);
return postmap;
}
}

View File

@ -211,9 +211,6 @@ import {driverListConfig,sceneListConfig,deviceListConfig,maintainerListConfig,c
export default {
name: 'EditAction',
props: {
assetListAll: Object
},
components: {
},
@ -224,6 +221,7 @@ export default {
size:'medium',
isActive:-1,
nowSelect:null,
assetListAll:null,
driverAssetList:driverListConfig,
sceneAssetList:sceneListConfig,
deviceAssetList:deviceListConfig,
@ -353,6 +351,7 @@ export default {
}
}
}
this.assetListAll ={
driverAssetList:this.driverAssetList,
@ -364,6 +363,7 @@ export default {
deviceTextureList:this.deviceTextureList,
signalTextureAssetList:this.signalTextureAssetList
};
changeEditAssetList(this.assetListAll);
console.log(this.assetListAll);
},
actionevent(event){

View File

@ -18,7 +18,7 @@
<el-button type="save" @click="save">保存</el-button>
<el-button type="savetest" @click="savetest">保存</el-button>
<el-button type="savetest" @click="savetest">测试中保存</el-button>
<el-button type="back" @click="back">返回</el-button>
</el-row>

View File

@ -5,7 +5,7 @@
<div id="testdraw" class="testdraw">
</div>
<Edit-Action ref="action" :assetListAll="assetListAll" @saction="saction" @actionevent="actionevent">
<Edit-Action ref="action" @saction="saction" @actionevent="actionevent">
</Edit-Action>
<Edit-Property ref="property" :selectmodel='selectmodel'>
@ -39,7 +39,7 @@
import axios from 'axios';
import { update3dMapData } from '@/api/jlmap3d/load3ddata'
import { getmodels } from '@/jlmap3d/edit/connect/newgetmodels';
import { testgetmodels } from '@/jlmap3d/edit/connect/testgetmodels';
//components
import EditProperty from '@/views/jlmap3d/edit/component/property';
import EditAction from '@/views/jlmap3d/edit/component/action';
@ -75,7 +75,6 @@
mapdata: null,
jlmap3dedit: null,
assetListAll: null,
selectmodel: null
}
@ -110,6 +109,11 @@
}
}
},
mounted() {
this.init();
window.changeEditAssetList = this.changeEditAssetList;
},
beforeDestroy() {
if (this.jlmap3dedit) {
@ -117,6 +121,9 @@
}
},
methods: {
changeEditAssetList(newList){
this.jlmap3dedit.assetManager = newList;
},
show: function () {
},
@ -179,6 +186,7 @@
},
save() {
//console.log("save");
console.log(this.jlmap3dedit.assetManager);
let param = getmodels(this.jlmap3dedit);
update3dMapData(param).then(data => {
//console.log(data);
@ -191,7 +199,17 @@
},
savetest(){
console.log();
console.log(this.jlmap3dedit.assetManager);
let param = testgetmodels(this.jlmap3dedit);
// update3dMapData(param).then(data => {
// //console.log(data);
// if (data.code == "200") {
// alert("");
// }
// }).catch(error => {
// console.log(error);
// });
},
back() {
@ -200,10 +218,7 @@
}
},
mounted() {
this.init();
}
}
</script>