新数据存读
This commit is contained in:
parent
103929b23f
commit
af17dbece4
@ -26,9 +26,7 @@ export function Jlmap3ddata(mapid,scope){
|
||||
get3dMapData(editmapid).then(data => {
|
||||
//console.log(data);
|
||||
if(data.code == "200"){
|
||||
|
||||
//console.log("数据存在");
|
||||
|
||||
let isSection = false;
|
||||
//console.log(data.data);
|
||||
if(data.data.assets){
|
||||
@ -40,14 +38,14 @@ export function Jlmap3ddata(mapid,scope){
|
||||
}
|
||||
}
|
||||
|
||||
console.log(isSection);
|
||||
if(isSection == true){
|
||||
initobj(editmapid,data.data.id);
|
||||
//init3d(editmapid,data.data);
|
||||
}else{
|
||||
// console.log(editmapid);
|
||||
// console.log(data.data.id);
|
||||
initobj(editmapid,data.data.id);
|
||||
init3d(editmapid,data.data);
|
||||
// initobj(editmapid,data.data.id);
|
||||
}
|
||||
|
||||
}
|
||||
@ -60,7 +58,7 @@ export function Jlmap3ddata(mapid,scope){
|
||||
set3dMapData(params).then(data => {
|
||||
if(data.code == "200"){
|
||||
//console.log("创建三维数据成功");
|
||||
//console.log(data);
|
||||
// console.log(data);
|
||||
initobj(editmapid,data.data.id);
|
||||
|
||||
}
|
||||
@ -72,14 +70,11 @@ export function Jlmap3ddata(mapid,scope){
|
||||
});
|
||||
|
||||
function initobj(mapid,data3did){
|
||||
console.log(mapid);
|
||||
getMapDetail(mapid).then(data => {
|
||||
let mapdata = data.data;
|
||||
console.log(mapdata);
|
||||
//console.log(data3did);
|
||||
jlmap3ddata.id = data3did;
|
||||
jlmap3ddata.mapId = mapid;
|
||||
console.log(jlmap3ddata.mapId);
|
||||
//初始化轨道和道岔 暂时
|
||||
jlmap3ddata.linklist = new LinkList();
|
||||
jlmap3ddata.sectionlist = new SectionList();
|
||||
@ -120,50 +115,60 @@ export function Jlmap3ddata(mapid,scope){
|
||||
}
|
||||
|
||||
function init3d(mapid,netdata){
|
||||
console.log(netdata)
|
||||
getMapDetail(mapid).then(data => {
|
||||
jlmap3ddata.id = netdata.id;
|
||||
jlmap3ddata.mapId = mapid;
|
||||
let mapdata = data.data;
|
||||
|
||||
//初始化轨道和道岔 暂时
|
||||
jlmap3ddata.sectionlist = new SectionList();
|
||||
jlmap3ddata.signallist = new SignalList();
|
||||
//初始化站台
|
||||
jlmap3ddata.stationstandlist = new StationStandList();
|
||||
//初始化测试列车
|
||||
jlmap3ddata.trainlisttest = new TrainListTest();
|
||||
jlmap3ddata.linklist = new LinkList();
|
||||
//初始化轨道和道岔 暂时
|
||||
jlmap3ddata.sectionlist = new SectionList();
|
||||
jlmap3ddata.signallist = new SignalList();
|
||||
//初始化站台
|
||||
jlmap3ddata.stationstandlist = new StationStandList();
|
||||
//初始化测试列车
|
||||
jlmap3ddata.trainlisttest = new TrainListTest();
|
||||
|
||||
jlmap3ddata.realsectionlist = new RealSectionList();
|
||||
jlmap3ddata.realsectionlist = new RealSectionList();
|
||||
|
||||
assetloader.setmodellist(netdata.assets);
|
||||
assetloader.setmodellist(netdata.assets);
|
||||
let loaderdata = JSON.parse(netdata.sections);
|
||||
let switchdata = JSON.parse(netdata.switchs);
|
||||
let signaldata = JSON.parse(netdata.signals);
|
||||
let standsdata = JSON.parse(netdata.stands);
|
||||
console.log(loaderdata);
|
||||
assetloader.assetpromise(scene)
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return jlmap3ddata.linklist.loadpromise(loaderdata.link,scene,assetloader);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return jlmap3ddata.sectionlist.loadpromise(jlmap3ddata,assetloader,loaderdata.section,switchdata,scene);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return jlmap3ddata.signallist.loadpromise(signaldata,scene,assetloader);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return jlmap3ddata.stationstandlist.initpromise(jlmap3ddata,mapdata.stationList,mapdata.stationStandList,scene,assetloader,standsdata);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return jlmap3ddata.trainlisttest.initpromise(mapdata.trainList,scene,assetloader);
|
||||
})
|
||||
// .then(function(data){
|
||||
// //console.log(data);
|
||||
// return jlmap3ddata.realsectionlist.loadpromise(jlmap3ddata,scene,assetloader);
|
||||
// })
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
loadingInstance.close();
|
||||
});
|
||||
|
||||
assetloader.assetpromise(scene)
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return jlmap3ddata.sectionlist.initpromise(mapdata.sectionList,mapdata.switchList,scene);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return jlmap3ddata.signallist.initpromise(mapdata.signalList,scene,assetloader,netdata.signals);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return jlmap3ddata.stationstandlist.initpromise(mapdata.stationList,mapdata.stationStandList,scene,assetloader,netdata.stands);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return jlmap3ddata.trainlisttest.initpromise(mapdata.trainList,scene,assetloader);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
return jlmap3ddata.realsectionlist.initpromise(jlmap3ddata,scene,assetloader);
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
loadingInstance.close();
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -37,48 +37,30 @@ export function Sectionaction(){
|
||||
}
|
||||
//点击事件
|
||||
this.raycaster = function(data,type){
|
||||
console.log("sa");
|
||||
console.log(type);
|
||||
let modellist;
|
||||
if(type == "test"){
|
||||
let modellist = data.scene.getObjectByName("link").children;
|
||||
//定义光线
|
||||
let raycaster = new THREE.Raycaster();
|
||||
//定义平面鼠标点击坐标
|
||||
let mouse = new THREE.Vector2();
|
||||
mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
|
||||
mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;
|
||||
|
||||
raycaster.setFromCamera( mouse, data.camera );
|
||||
let intersects1;
|
||||
for(let i=0;i<modellist.length;i++){
|
||||
intersects1 = raycaster.intersectObject(modellist[i]);
|
||||
if(intersects1[0]){
|
||||
console.log(intersects1[0].object.code);
|
||||
console.log(modellist[i].code);
|
||||
if(intersects1[0].object.code == modellist[i].code){
|
||||
|
||||
return modellist[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
modellist = data.scene.getObjectByName("link").children;
|
||||
}else if(type == "suidao"){
|
||||
modellist = data.scene.getObjectByName("section").children;
|
||||
}else if(type == "switch"){
|
||||
modellist = data.scene.getObjectByName("switch").children;
|
||||
}else{
|
||||
if(scope.on == true){
|
||||
|
||||
//定义光线
|
||||
let raycaster = new THREE.Raycaster();
|
||||
//定义平面鼠标点击坐标
|
||||
|
||||
let mouse = new THREE.Vector2();
|
||||
mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
|
||||
mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;
|
||||
|
||||
raycaster.setFromCamera( mouse, data.camera );
|
||||
let intersects1;
|
||||
console.log(data.mapdata.sectionlist.sections.modellist[0]);
|
||||
for(let i=0;i<data.mapdata.sectionlist.sections.modellist.length;i++){
|
||||
intersects1 = raycaster.intersectObject(data.mapdata.sectionlist.sections.modellist[i]);
|
||||
if(intersects1[0]){
|
||||
console.log(intersects1[0].object.code);
|
||||
console.log(data.mapdata.sectionlist.sections.modellist[i].code);
|
||||
if(intersects1[0].object.code == data.mapdata.sectionlist.sections.modellist[i].code){
|
||||
|
||||
return data.mapdata.sectionlist.sections.modellist[i];
|
||||
@ -89,6 +71,27 @@ export function Sectionaction(){
|
||||
|
||||
}
|
||||
}
|
||||
//定义光线
|
||||
let raycaster = new THREE.Raycaster();
|
||||
//定义平面鼠标点击坐标
|
||||
let mouse = new THREE.Vector2();
|
||||
mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
|
||||
mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;
|
||||
|
||||
raycaster.setFromCamera( mouse, data.camera );
|
||||
let intersects1;
|
||||
for(let i=0;i<modellist.length;i++){
|
||||
intersects1 = raycaster.intersectObject(modellist[i],true);
|
||||
if(intersects1[0]){
|
||||
console.log(intersects1[0].object.code);
|
||||
console.log(modellist[i].code);
|
||||
if(intersects1[0].object.code == modellist[i].code){
|
||||
|
||||
return modellist[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
//import request from '@/utils/request';
|
||||
|
||||
export function getmodels(data) {
|
||||
console.log(data);
|
||||
let postmap = {
|
||||
id:data.mapdata.id,
|
||||
mapId:data.mapdata.mapId,
|
||||
@ -35,32 +34,71 @@ export function getmodels(data) {
|
||||
assets.push(asset);
|
||||
}
|
||||
postmap.assets = JSON.stringify(assets);
|
||||
//区段
|
||||
//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
|
||||
}
|
||||
links.push(link);
|
||||
}
|
||||
// postmap.sections.link = JSON.stringify(links);
|
||||
|
||||
//section隧道
|
||||
console.log(data.mapdata.sectionlist.sections);
|
||||
let sections = [];
|
||||
for(let i=0;i<data.mapdata.sectionlist.sections.datalist.length;i++){
|
||||
let section = {
|
||||
uuid:data.mapdata.sectionlist.sections.datalist[i].uuid,
|
||||
name:data.mapdata.sectionlist.sections.datalist[i].name,
|
||||
index:data.mapdata.sectionlist.sections.datalist[i].index,
|
||||
isStandTrack:data.mapdata.sectionlist.sections.datalist[i].isStandTrack,
|
||||
rail:data.mapdata.sectionlist.sections.datalist[i].rail,
|
||||
distance:data.mapdata.sectionlist.sections.datalist[i].distance,
|
||||
uuid:data.mapdata.sectionlist.sections.modellist[i].uuid,
|
||||
code:data.mapdata.sectionlist.sections.modellist[i].code,
|
||||
name:data.mapdata.sectionlist.sections.modellist[i].name,
|
||||
lengthfact:data.mapdata.sectionlist.sections.modellist[i].lengthfact,
|
||||
isStandTrack:data.mapdata.sectionlist.sections.modellist[i].isStandTrack,
|
||||
relStandCode:data.mapdata.sectionlist.sections.datalist[i].relStandCode,
|
||||
linkCode:data.mapdata.sectionlist.sections.datalist[i].linkCode,
|
||||
rightlist:data.mapdata.sectionlist.sections.modellist[i].rightlist,
|
||||
leftlist:data.mapdata.sectionlist.sections.modellist[i].leftlist,
|
||||
rightpoint:data.mapdata.sectionlist.sections.modellist[i].rightpoint,
|
||||
leftpoint:data.mapdata.sectionlist.sections.modellist[i].leftpoint,
|
||||
rail:data.mapdata.sectionlist.sections.modellist[i].rail,
|
||||
position:data.mapdata.sectionlist.sections.modellist[i].position,
|
||||
rotation:data.mapdata.sectionlist.sections.modellist[i].rotation,
|
||||
scale:data.mapdata.sectionlist.sections.modellist[i].scale
|
||||
}
|
||||
|
||||
// testmesh1.position.z = link.position.z;
|
||||
|
||||
sections.push(section);
|
||||
}
|
||||
postmap.sections = JSON.stringify(sections);
|
||||
let arrray = {
|
||||
link:links,
|
||||
section:sections,
|
||||
};
|
||||
postmap.sections = JSON.stringify(arrray);
|
||||
//道岔
|
||||
let switchs = [];
|
||||
|
||||
for(let i=0;i<data.mapdata.sectionlist.switchs.datalist.length;i++){
|
||||
console.log(data.mapdata.sectionlist.switchs.datalist);
|
||||
for(let i=0;i<data.mapdata.sectionlist.switchs.modellist.length;i++){
|
||||
let switcha = {
|
||||
uuid:data.mapdata.sectionlist.switchs.datalist[i].uuid,
|
||||
uuid:data.mapdata.sectionlist.switchs.modellist[i].uuid,
|
||||
code:data.mapdata.sectionlist.switchs.datalist[i].code,
|
||||
name:data.mapdata.sectionlist.switchs.datalist[i].name,
|
||||
index:data.mapdata.sectionlist.switchs.datalist[i].index,
|
||||
alink:data.mapdata.sectionlist.switchs.datalist[i].alink,
|
||||
blink:data.mapdata.sectionlist.switchs.datalist[i].blink,
|
||||
clink:data.mapdata.sectionlist.switchs.datalist[i].clink,
|
||||
paname:data.mapdata.sectionlist.switchs.datalist[i].paname,
|
||||
pbname:data.mapdata.sectionlist.switchs.datalist[i].pbname,
|
||||
pcname:data.mapdata.sectionlist.switchs.datalist[i].pcname,
|
||||
position:data.mapdata.sectionlist.switchs.modellist[i].position,
|
||||
rotation:data.mapdata.sectionlist.switchs.modellist[i].rotation,
|
||||
scale:data.mapdata.sectionlist.switchs.modellist[i].scale
|
||||
@ -90,7 +128,6 @@ export function getmodels(data) {
|
||||
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,
|
||||
|
@ -5,6 +5,8 @@ export function LinkList(data){
|
||||
|
||||
this.type = "linklist";
|
||||
|
||||
this.linkdata = [];
|
||||
|
||||
this.linksgroup = new THREE.Group();
|
||||
this.linksgroup.name = "link";
|
||||
|
||||
@ -16,7 +18,15 @@ export function LinkList(data){
|
||||
linktest(linkdata,scene,assetloader);
|
||||
resolve("loadedrealsection");
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
this.loadpromise = function(linkdata,scene,assetloader){
|
||||
return new Promise(function(resolve, reject){
|
||||
scene.add(scope.linksgroup);
|
||||
loadlink(linkdata,scene,assetloader);
|
||||
resolve("loadedrealsection");
|
||||
});
|
||||
};
|
||||
|
||||
function linkhelp(data,scene){
|
||||
let groups = new THREE.Group();
|
||||
@ -47,6 +57,61 @@ function linkhelp(data,scene){
|
||||
|
||||
|
||||
|
||||
function loadlink(data,scene,assetloader){
|
||||
let autorail;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
for(let i=0;i<data.length;i++){
|
||||
let testmesh2 = autorail.clone(true);
|
||||
testmesh2.code = data[i].code;
|
||||
testmesh2.name = data[i].name;
|
||||
testmesh2.rightlist = rightlist;
|
||||
testmesh2.leftlist = leftlist;
|
||||
testmesh2.rp = data[i].rp;
|
||||
testmesh2.lp = data[i].lp;
|
||||
testmesh2.lengthfact = data[i].lengthfact;
|
||||
|
||||
for(let i=0;i<testmesh2.rightlist.length;i++){
|
||||
testmesh2.geometry.attributes.position.array[testmesh2.rightlist[i]*3] = testmesh2.lengthfact-20.5;
|
||||
testmesh2.geometry.attributes.uv.array[testmesh2.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.x = data[i].position.x;
|
||||
testmesh2.position.y = data[i].position.y;
|
||||
testmesh2.position.z = data[i].position.z;
|
||||
// testmesh2.rotation.x = data[i].rotation._x;
|
||||
// testmesh2.rotation.y = data[i].rotation._y;
|
||||
testmesh2.rotation.z = data[i].rotation._z;
|
||||
scope.linkdata.push(testmesh2);
|
||||
scope.linksgroup.add(testmesh2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// return linklist;
|
||||
|
||||
@ -57,7 +122,6 @@ function linkhelp(data,scene){
|
||||
if(assetloader.modellist[i].deviceType == "autorail"){
|
||||
autorail = assetloader.modellist[i].mesh.children[0];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
let rightlist = [];
|
||||
@ -234,10 +298,14 @@ function linkhelp(data,scene){
|
||||
// testmesh2.position.y = 10;
|
||||
testmesh2.code = data.code;
|
||||
testmesh2.name = data.name;
|
||||
testmesh2.meshtype = "link";
|
||||
testmesh2.lp = data.lp;
|
||||
testmesh2.rp = data.rp;
|
||||
testmesh2.rightlist = autorail.rightlist;
|
||||
testmesh2.leftlist = autorail.leftlist;
|
||||
testmesh2.lengthfact = data.lengthFact;
|
||||
scope.linksgroup.add( testmesh2 );
|
||||
scope.linkdata.push(testmesh2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,11 +6,16 @@ export function SectionList() {
|
||||
|
||||
this.type = "sectionlist";
|
||||
|
||||
let sectiongroup = new THREE.Group();
|
||||
sectiongroup.name = "section";
|
||||
|
||||
let switchgroup = new THREE.Group();
|
||||
switchgroup.name = "switch";
|
||||
|
||||
this.sections = {
|
||||
datalist:[],
|
||||
modellist:[]
|
||||
};
|
||||
|
||||
this.switchs = {
|
||||
datalist:[],
|
||||
modellist:[]
|
||||
@ -19,6 +24,8 @@ export function SectionList() {
|
||||
|
||||
this.initpromise = function(jlmap3ddata,assetloader,sectiondata,switchdata,scene){
|
||||
return new Promise(function(resolve, reject){
|
||||
scene.add(sectiongroup);
|
||||
scene.add(switchgroup);
|
||||
let linkdata = jlmap3ddata.linklist;
|
||||
//遍历区段
|
||||
for(let i=0;i<sectiondata.length;i++){
|
||||
@ -41,43 +48,281 @@ export function SectionList() {
|
||||
}
|
||||
}
|
||||
buildsuidao(linkdata,scope.sections,assetloader,scene);
|
||||
console.log(scope.sections.datalist);
|
||||
//定义区分道岔组
|
||||
let switchlist = [];
|
||||
//遍历道岔数据
|
||||
for(let i=0;i<switchdata.length;i++){
|
||||
//道岔信息
|
||||
let newswitch = {
|
||||
code:null,
|
||||
pa:null,
|
||||
pb:null,
|
||||
pc:null,
|
||||
paname:null,
|
||||
pbname:null,
|
||||
pcname:null,
|
||||
alink:null,
|
||||
blink:null,
|
||||
clink:null
|
||||
};
|
||||
//获取道岔分辨的点 PS:可能修改动态判断
|
||||
|
||||
//定义区分道岔组
|
||||
let switchlist = [];
|
||||
//遍历道岔数据
|
||||
for(let i=0;i<switchdata.length;i++){
|
||||
//道岔信息
|
||||
let newswitch = {
|
||||
code:null,
|
||||
pa:null,
|
||||
pb:null,
|
||||
pc:null,
|
||||
paname:null,
|
||||
pbname:null,
|
||||
pcname:null
|
||||
};
|
||||
//获取道岔分辨的点 PS:可能修改动态判断
|
||||
for(let j=0;j<sectiondata.length;j++){
|
||||
if(switchdata[i].sectionACode == sectiondata[j].code){
|
||||
newswitch.pa = sectiondata[j].points;
|
||||
newswitch.paname = switchdata[i].sectionACode;
|
||||
for(let j=0;j<sectiondata.length;j++){
|
||||
if(switchdata[i].sectionACode == sectiondata[j].code){
|
||||
newswitch.pa = sectiondata[j].points;
|
||||
newswitch.paname = switchdata[i].sectionACode;
|
||||
|
||||
}
|
||||
if(switchdata[i].sectionBCode == sectiondata[j].code){
|
||||
newswitch.pb = sectiondata[j].points;
|
||||
newswitch.pbname = switchdata[i].sectionBCode;
|
||||
}
|
||||
if(switchdata[i].sectionCCode == sectiondata[j].code){
|
||||
newswitch.pc = sectiondata[j].points;
|
||||
newswitch.pcname = switchdata[i].sectionCCode;
|
||||
}
|
||||
if(newswitch.pa != null && newswitch.pb!= null && newswitch.pc != null){
|
||||
newswitch.code = switchdata[i].code;
|
||||
switchlist.push(newswitch);
|
||||
j = sectiondata.length;
|
||||
}
|
||||
}
|
||||
if(switchdata[i].sectionBCode == sectiondata[j].code){
|
||||
newswitch.pb = sectiondata[j].points;
|
||||
newswitch.pbname = switchdata[i].sectionBCode;
|
||||
}
|
||||
if(switchdata[i].sectionCCode == sectiondata[j].code){
|
||||
newswitch.pc = sectiondata[j].points;
|
||||
newswitch.pcname = switchdata[i].sectionCCode;
|
||||
}
|
||||
if(newswitch.pa != null && newswitch.pb!= null && newswitch.pc != null){
|
||||
newswitch.code = switchdata[i].code;
|
||||
switchlist.push(newswitch);
|
||||
j = sectiondata.length;
|
||||
|
||||
for(let n=0;n<scope.sections.datalist.length;n++){
|
||||
if(scope.sections.datalist[n].code == switchlist[i].paname){
|
||||
switchlist[i].alink = scope.sections.datalist[n].linkCode;
|
||||
}
|
||||
if(scope.sections.datalist[n].code == switchlist[i].pbname){
|
||||
switchlist[i].blink = scope.sections.datalist[n].linkCode;
|
||||
}
|
||||
if(scope.sections.datalist[n].code == switchlist[i].pcname){
|
||||
switchlist[i].clink = scope.sections.datalist[n].linkCode;
|
||||
}
|
||||
if(switchlist[i].alink != null && switchlist[i].blink!= null && switchlist[i].clink != null){
|
||||
n = scope.sections.datalist.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
scope.switchs.datalist = switchlist;
|
||||
console.log(switchlist);
|
||||
//道岔贴图
|
||||
let switchmesh;
|
||||
for(let i=0;i<assetloader.modellist.length;i++){
|
||||
if(assetloader.modellist[i].deviceType == "autoswitch"){
|
||||
switchmesh = assetloader.modellist[i].mesh;
|
||||
}
|
||||
}
|
||||
|
||||
//遍历道岔信息组合轨道
|
||||
for(let i=0;i<switchlist.length;i++){
|
||||
let sectionA,sectionB,sectionC;
|
||||
|
||||
for(let j=0;j<scope.sections.modellist.length;j++){
|
||||
if(switchlist[i].paname == scope.sections.modellist[j].code){
|
||||
sectionA = scope.sections.modellist[j];
|
||||
}else if(switchlist[i].pbname == scope.sections.modellist[j].code){
|
||||
sectionB = scope.sections.modellist[j];
|
||||
}else if(switchlist[i].pcname == scope.sections.modellist[j].code){
|
||||
sectionC = scope.sections.modellist[j];
|
||||
}
|
||||
}
|
||||
let testswitch = switchmesh.clone(true);
|
||||
sectionA.matrixAutoUpdate = false;
|
||||
let switchposx = sectionA.position.x;
|
||||
let switchposz = sectionA.position.z;
|
||||
|
||||
if(sectionA.position.x>sectionB.position.x){
|
||||
testswitch.rotation.y = Math.PI;
|
||||
|
||||
// if(sectionA.position.z>sectionC.position.z){
|
||||
// }else{
|
||||
// }
|
||||
|
||||
}else{
|
||||
testswitch.rotation.y = 0;
|
||||
|
||||
// if(sectionA.position.z>sectionC.position.z){
|
||||
// }else{
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
testswitch.position.x = switchposx;
|
||||
testswitch.position.y = 0;
|
||||
testswitch.position.z = switchposz;
|
||||
scope.switchs.modellist.push(testswitch);
|
||||
switchgroup.add(testswitch);
|
||||
}
|
||||
|
||||
resolve("loadersection");
|
||||
});
|
||||
|
||||
}
|
||||
//
|
||||
// this.init = function(sectiondata,switchdata,scene){
|
||||
//
|
||||
// //遍历区段
|
||||
// for(let i=0;i<sectiondata.length;i++){
|
||||
// if(sectiondata[i].type == "01"){
|
||||
// //初始化区段对象数据
|
||||
// let newsection = new SectionModel(sectiondata);
|
||||
//
|
||||
// newsection.name = sectiondata[i].code;
|
||||
// newsection.code = sectiondata[i].code;
|
||||
// newsection.index = i;
|
||||
// newsection.isStandTrack = sectiondata[i].isStandTrack;
|
||||
// newsection.type = sectiondata[i].type;
|
||||
//
|
||||
// scope.sections.datalist.push(newsection);
|
||||
// // scope.sections.modellist.push("");
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// //定义区分道岔组
|
||||
// let switchlist = [];
|
||||
// //遍历道岔数据
|
||||
// for(let i=0;i<switchdata.length;i++){
|
||||
// //道岔信息
|
||||
// let newswitch = {
|
||||
// code:null,
|
||||
// pa:null,
|
||||
// pb:null,
|
||||
// pc:null,
|
||||
// paname:null,
|
||||
// pbname:null,
|
||||
// pcname:null
|
||||
// };
|
||||
// //获取道岔分辨的点 PS:可能修改动态判断
|
||||
// for(let j=0;j<sectiondata.length;j++){
|
||||
// if(switchdata[i].sectionACode == sectiondata[j].code){
|
||||
// newswitch.pa = sectiondata[j].points;
|
||||
// newswitch.paname = switchdata[i].sectionACode;
|
||||
// }
|
||||
// if(switchdata[i].sectionBCode == sectiondata[j].code){
|
||||
// newswitch.pb = sectiondata[j].points;
|
||||
// newswitch.pbname = switchdata[i].sectionBCode;
|
||||
// }
|
||||
// if(switchdata[i].sectionCCode == sectiondata[j].code){
|
||||
// newswitch.pc = sectiondata[j].points;
|
||||
// newswitch.pcname = switchdata[i].sectionCCode;
|
||||
// }
|
||||
// if(newswitch.pa != null && newswitch.pb!= null && newswitch.pc != null){
|
||||
// newswitch.code = switchdata[i].code;
|
||||
// switchlist.push(newswitch);
|
||||
// j = sectiondata.length;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //道岔贴图
|
||||
//
|
||||
// //遍历道岔信息组合轨道
|
||||
// for(let i=0;i<switchlist.length;i++){
|
||||
// //道岔对象组
|
||||
// let newswitch = new SwitchModel();
|
||||
//
|
||||
// newswitch.name = switchlist[i].code;
|
||||
// newswitch.code = switchlist[i].code;
|
||||
//
|
||||
// newswitch.index = i;
|
||||
//
|
||||
// scope.switchs.datalist.push(newswitch);
|
||||
// scope.switchs.modellist.push("");
|
||||
// }
|
||||
// }
|
||||
|
||||
this.loadpromise = function(jlmap3ddata,assetloader,sectiondata,switchdata,scene){
|
||||
return new Promise(function(resolve, reject){
|
||||
console.log(sectiondata);
|
||||
scene.add(sectiongroup);
|
||||
scene.add(switchgroup);
|
||||
let linkdata = jlmap3ddata.linklist;
|
||||
|
||||
for(let i=0;i<sectiondata.length;i++){
|
||||
if(sectiondata[i].type == "01"){
|
||||
//初始化区段对象数据
|
||||
let newsection = new SectionModel(sectiondata);
|
||||
|
||||
newsection.name = sectiondata[i].code;
|
||||
newsection.code = sectiondata[i].code;
|
||||
newsection.index = i;
|
||||
newsection.isStandTrack = sectiondata[i].isStandTrack;
|
||||
newsection.relStandCode = sectiondata[i].relStandCode;
|
||||
newsection.type = sectiondata[i].type;
|
||||
newsection.offsetRight = sectiondata[i].offsetRight;
|
||||
newsection.offsetLeft = sectiondata[i].offsetLeft;
|
||||
newsection.linkCode = sectiondata[i].linkCode;
|
||||
|
||||
scope.sections.datalist.push(newsection);
|
||||
// scope.sections.modellist.push("");
|
||||
}
|
||||
}
|
||||
//道岔贴图
|
||||
|
||||
let autosuidao;
|
||||
for(let i=0;i<assetloader.modellist.length;i++){
|
||||
if(assetloader.modellist[i].deviceType == "autosuidao"){
|
||||
autosuidao = assetloader.modellist[i].mesh.children[0];
|
||||
}
|
||||
}
|
||||
|
||||
for(let i = 0;i < sectiondata.length;i++){
|
||||
|
||||
let testmesh1 = autosuidao.clone(true);
|
||||
|
||||
testmesh1.code = sectiondata.code;
|
||||
testmesh1.name = sectiondata.code;
|
||||
if(sectiondata[i].relStandCode){
|
||||
testmesh1.relStandCode = sectiondata[i].relStandCode;
|
||||
}else{
|
||||
testmesh1.relStandCode = "";
|
||||
}
|
||||
testmesh1.rightlist = sectiondata[i].rightlist;
|
||||
testmesh1.leftlist = sectiondata[i].leftlist;
|
||||
testmesh1.rightpoint = sectiondata[i].rightpoint;
|
||||
testmesh1.leftpoint = sectiondata[i].leftpoint;
|
||||
testmesh1.isStandTrack = sectiondata[i].isStandTrack;
|
||||
testmesh1.lengthfact = sectiondata[i].lengthfact;
|
||||
for(let i=0;i<testmesh1.rightlist.length;i++){
|
||||
testmesh1.geometry.attributes.position.array[testmesh1.rightlist[i]*3] = testmesh1.lengthfact;
|
||||
testmesh1.geometry.attributes.uv.array[testmesh1.rightlist[i]*2] = (testmesh1.geometry.attributes.position.array[3]-testmesh1.geometry.attributes.position.array[0])/15.3;
|
||||
}
|
||||
let newsuidao = new THREE.BufferGeometry();
|
||||
newsuidao.copy(testmesh1.geometry);
|
||||
testmesh1.geometry = newsuidao;
|
||||
testmesh1.geometry.attributes.position.needsUpdate = true;
|
||||
testmesh1.geometry.attributes.uv.needsUpdate = true;
|
||||
testmesh1.geometry.computeBoundingSphere();
|
||||
testmesh1.geometry.center();
|
||||
testmesh1.position.x = sectiondata[i].position.x;
|
||||
testmesh1.position.y = sectiondata[i].position.y;
|
||||
testmesh1.position.z = sectiondata[i].position.z;
|
||||
testmesh1.rotation.x = -Math.PI/2;
|
||||
testmesh1.rotation.z = sectiondata[i].rotation._z;
|
||||
|
||||
let newsection = new SectionModel(sectiondata);
|
||||
|
||||
newsection.name = sectiondata[i].code;
|
||||
newsection.code = sectiondata[i].code;
|
||||
newsection.isStandTrack = sectiondata[i].isStandTrack;
|
||||
newsection.relStandCode = sectiondata[i].relStandCode;
|
||||
newsection.linkCode = sectiondata[i].linkCode;
|
||||
|
||||
scope.sections.datalist.push(newsection);
|
||||
|
||||
|
||||
if(testmesh1.isStandTrack == false){
|
||||
sectiongroup.add(testmesh1);
|
||||
|
||||
}else{
|
||||
scope.standtrack.push(testmesh1);
|
||||
var box = new THREE.BoxHelper( testmesh1, 0xff0000 );
|
||||
sectiongroup.add( box );
|
||||
}
|
||||
scope.sections.modellist.push(testmesh1);
|
||||
}
|
||||
|
||||
let switchmesh;
|
||||
for(let i=0;i<assetloader.modellist.length;i++){
|
||||
if(assetloader.modellist[i].deviceType == "autoswitch"){
|
||||
@ -85,169 +330,38 @@ export function SectionList() {
|
||||
}
|
||||
}
|
||||
|
||||
//遍历道岔信息组合轨道
|
||||
for(let i=0;i<switchlist.length;i++){
|
||||
let sectionA,sectionB,sectionC;
|
||||
for(let i=0;i<switchdata.length;i++){
|
||||
let newswitch = {
|
||||
code:switchdata[i].code,
|
||||
pa:null,
|
||||
pb:null,
|
||||
pc:null,
|
||||
paname:switchdata[i].paname,
|
||||
pbname:switchdata[i].pbname,
|
||||
pcname:switchdata[i].pcname,
|
||||
alink:switchdata[i].alink,
|
||||
blink:switchdata[i].blink,
|
||||
clink:switchdata[i].clink
|
||||
};
|
||||
|
||||
for(let j=0;j<scope.sections.modellist.length;j++){
|
||||
if(switchlist[i].paname == scope.sections.modellist[j].code){
|
||||
sectionA = scope.sections.modellist[j];
|
||||
}else if(switchlist[i].pbname == scope.sections.modellist[j].code){
|
||||
sectionB = scope.sections.modellist[j];
|
||||
}else if(switchlist[i].pcname == scope.sections.modellist[j].code){
|
||||
sectionC = scope.sections.modellist[j];
|
||||
}
|
||||
}
|
||||
let testswitch = switchmesh.clone(true);
|
||||
sectionA.matrixAutoUpdate = false;
|
||||
let switchposx = sectionA.matrixWorld.elements[12];
|
||||
let switchposz = sectionA.matrixWorld.elements[14];
|
||||
testswitch.position.x = switchdata[i].position.x;
|
||||
testswitch.position.y = switchdata[i].position.y;
|
||||
testswitch.position.z = switchdata[i].position.z;
|
||||
testswitch.rotation.x = switchdata[i].rotation._x;
|
||||
testswitch.rotation.y = switchdata[i].rotation._y;
|
||||
testswitch.rotation.z = switchdata[i].rotation._z;
|
||||
|
||||
if(sectionA.position.x>sectionB.position.x){
|
||||
testswitch.rotation.y = Math.PI;
|
||||
|
||||
// if(sectionA.position.z>sectionC.position.z){
|
||||
// }else{
|
||||
// }
|
||||
|
||||
}else{
|
||||
testswitch.rotation.y = 0;
|
||||
|
||||
// if(sectionA.position.z>sectionC.position.z){
|
||||
// }else{
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
testswitch.position.x = switchposx;
|
||||
testswitch.position.y = 0;
|
||||
testswitch.position.z = switchposz;
|
||||
scene.add(testswitch);
|
||||
scope.switchs.datalist.push(newswitch);
|
||||
scope.switchs.modellist.push(testswitch);
|
||||
switchgroup.add(testswitch);
|
||||
}
|
||||
// for(let i=0;i<switchlist.length;i++){
|
||||
// let sectionA,sectionB,sectionC;
|
||||
// for(let j=0;j<scope.sections.modellist.length;j++){
|
||||
// if(switchlist[i].paname == scope.sections.modellist[j].code){
|
||||
// sectionA = scope.sections.modellist[j]
|
||||
// }else if(switchlist[i].pbname == scope.sections.modellist[j].code){
|
||||
// sectionB = scope.sections.modellist[j];
|
||||
// }else if(switchlist[i].pcname == scope.sections.modellist[j].code){
|
||||
// sectionC = scope.sections.modellist[j];
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// let testswitch = switchmesh.clone(true);
|
||||
// if(sectionA.position.x>sectionB.position.x){
|
||||
// if(sectionA.position.z>sectionC.position.z){
|
||||
// testswitch.rotation.y = 0;
|
||||
// }else{
|
||||
// testswitch.rotation.y = Math.PI;
|
||||
// }
|
||||
// }else{
|
||||
// if(sectionA.position.z>sectionC.position.z){
|
||||
// testswitch.rotation.y = 0;
|
||||
// }else{
|
||||
// testswitch.rotation.y = Math.PI;
|
||||
// }
|
||||
// }
|
||||
// testswitch.position.x = (sectionA.position.x+sectionB.position.x)/2;
|
||||
// testswitch.position.y = 0;
|
||||
// testswitch.position.z = sectionA.position.z;
|
||||
// console.log("----------");
|
||||
// console.log(testswitch.position);
|
||||
// console.log(sectionA.position);
|
||||
// console.log(sectionB.position);
|
||||
// console.log(sectionC.position);
|
||||
// console.log("---------");
|
||||
// scene.add(testswitch);
|
||||
// //道岔对象组
|
||||
// let newswitch = new SwitchModel();
|
||||
// newswitch.name = switchlist[i].code;
|
||||
// newswitch.code = switchlist[i].code;
|
||||
// newswitch.index = i;
|
||||
// scope.switchs.datalist.push(newswitch);
|
||||
// scope.switchs.modellist.push("");
|
||||
// }
|
||||
|
||||
|
||||
resolve("loadersection");
|
||||
resolve("loadersection");
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
this.init = function(sectiondata,switchdata,scene){
|
||||
|
||||
//遍历区段
|
||||
for(let i=0;i<sectiondata.length;i++){
|
||||
if(sectiondata[i].type == "01"){
|
||||
//初始化区段对象数据
|
||||
let newsection = new SectionModel(sectiondata);
|
||||
|
||||
newsection.name = sectiondata[i].code;
|
||||
newsection.code = sectiondata[i].code;
|
||||
newsection.index = i;
|
||||
newsection.isStandTrack = sectiondata[i].isStandTrack;
|
||||
newsection.type = sectiondata[i].type;
|
||||
|
||||
scope.sections.datalist.push(newsection);
|
||||
// scope.sections.modellist.push("");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//定义区分道岔组
|
||||
let switchlist = [];
|
||||
//遍历道岔数据
|
||||
for(let i=0;i<switchdata.length;i++){
|
||||
//道岔信息
|
||||
let newswitch = {
|
||||
code:null,
|
||||
pa:null,
|
||||
pb:null,
|
||||
pc:null,
|
||||
paname:null,
|
||||
pbname:null,
|
||||
pcname:null
|
||||
};
|
||||
//获取道岔分辨的点 PS:可能修改动态判断
|
||||
for(let j=0;j<sectiondata.length;j++){
|
||||
if(switchdata[i].sectionACode == sectiondata[j].code){
|
||||
newswitch.pa = sectiondata[j].points;
|
||||
newswitch.paname = switchdata[i].sectionACode;
|
||||
}
|
||||
if(switchdata[i].sectionBCode == sectiondata[j].code){
|
||||
newswitch.pb = sectiondata[j].points;
|
||||
newswitch.pbname = switchdata[i].sectionBCode;
|
||||
}
|
||||
if(switchdata[i].sectionCCode == sectiondata[j].code){
|
||||
newswitch.pc = sectiondata[j].points;
|
||||
newswitch.pcname = switchdata[i].sectionCCode;
|
||||
}
|
||||
if(newswitch.pa != null && newswitch.pb!= null && newswitch.pc != null){
|
||||
newswitch.code = switchdata[i].code;
|
||||
switchlist.push(newswitch);
|
||||
j = sectiondata.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//道岔贴图
|
||||
|
||||
//遍历道岔信息组合轨道
|
||||
for(let i=0;i<switchlist.length;i++){
|
||||
//道岔对象组
|
||||
let newswitch = new SwitchModel();
|
||||
|
||||
newswitch.name = switchlist[i].code;
|
||||
newswitch.code = switchlist[i].code;
|
||||
|
||||
newswitch.index = i;
|
||||
|
||||
scope.switchs.datalist.push(newswitch);
|
||||
scope.switchs.modellist.push("");
|
||||
}
|
||||
}
|
||||
|
||||
function buildsuidao(linkdata,suidaodata,assetloader,scene){
|
||||
let autosuidao;
|
||||
for(let i=0;i<assetloader.modellist.length;i++){
|
||||
@ -336,20 +450,31 @@ export function SectionList() {
|
||||
testmesh1.name = suidaodata.datalist[i].code;
|
||||
// testmesh1.position.z = link.position.z;
|
||||
testmesh1.relStandCode = suidaodata.datalist[i].relStandCode;
|
||||
testmesh1.stationCode = suidaodata.datalist[i].stationCode;
|
||||
// testmesh1.stationCode = suidaodata.datalist[i].stationCode;
|
||||
|
||||
testmesh1.rightlist = autosuidao.rightlist;
|
||||
testmesh1.leftlist = autosuidao.leftlist;
|
||||
testmesh1.rightpoint = autosuidao.rightpoint;
|
||||
testmesh1.leftpoint = autosuidao.leftpoint;
|
||||
testmesh1.isStandTrack = suidaodata.datalist[i].isStandTrack;
|
||||
testmesh1.lengthfact = len;
|
||||
if(suidaodata.datalist[i].isStandTrack == false){
|
||||
scene.add(testmesh1);
|
||||
sectiongroup.add(testmesh1);
|
||||
|
||||
}else{
|
||||
scope.standtrack.push(testmesh1);
|
||||
var box = new THREE.BoxHelper( testmesh1, 0xff0000 );
|
||||
sectiongroup.add( box );
|
||||
}
|
||||
|
||||
|
||||
scope.sections.modellist.push(testmesh1);
|
||||
}
|
||||
}
|
||||
|
||||
this.reposition = function(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
this.update = function(){
|
||||
|
||||
}
|
||||
|
@ -101,6 +101,37 @@ export function SignalList() {
|
||||
});
|
||||
}
|
||||
|
||||
this.loadpromise = function(signaldata,scene,assetloader){
|
||||
return new Promise(function(resolve, reject){
|
||||
for(let i=0;i<signaldata.length;i++){
|
||||
let newsignal = new SignalModel(signaldata[i]);
|
||||
let num;
|
||||
for(let j=0;j<assetloader.modellist.length;j++){
|
||||
if(assetloader.modellist[j].id == signaldata[i].modelid){
|
||||
num = j;
|
||||
}
|
||||
}
|
||||
let newmesh = assetloader.modellist[num].mesh.clone(true);
|
||||
newmesh.uuid = signaldata[i].id;
|
||||
newmesh.name = signaldata[i].name;
|
||||
newmesh.modelid = assetloader.modellist[num].id;
|
||||
newmesh.code = signaldata[i].code;
|
||||
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);
|
||||
}
|
||||
scene.add(scope.group);
|
||||
resolve("loadedsignal");
|
||||
});
|
||||
};
|
||||
|
||||
this.init = function(data,realsectionlist,scene,assetloader){
|
||||
|
||||
@ -136,6 +167,10 @@ export function SignalList() {
|
||||
scene.add(scope.group);
|
||||
}
|
||||
|
||||
this.reposition = function(){
|
||||
|
||||
}
|
||||
|
||||
this.update = function(){
|
||||
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ export function StationStandList() {
|
||||
let netstand = null;
|
||||
let haddata = false;
|
||||
if(netdata){
|
||||
netstand = JSON.parse(netdata);
|
||||
haddata = true;
|
||||
}
|
||||
scope.group.name = "station";
|
||||
@ -87,7 +86,6 @@ export function StationStandList() {
|
||||
standsection.push(jlmap3ddata.sectionlist.standtrack[n]);
|
||||
}
|
||||
}
|
||||
console.log(standsection);
|
||||
let posx = (standsection[0].position.x + standsection[1].position.x)/2;
|
||||
let posz = (standsection[0].position.z + standsection[1].position.z)/2;;
|
||||
scope.list[i].mesh.position.set(posx,0,posz);
|
||||
@ -106,29 +104,28 @@ export function StationStandList() {
|
||||
}else{
|
||||
|
||||
for(let j=0;j<assetloader.modellist.length;j++){
|
||||
if(assetloader.modellist[j].id == netstand[i].modelid){
|
||||
if(assetloader.modellist[j].deviceType == "stand"){
|
||||
num = j;
|
||||
}
|
||||
}
|
||||
|
||||
scope.list[i].mesh = assetloader.modellist[num].mesh.clone(true);
|
||||
scope.list[i].mesh.name = netstand[i].name;
|
||||
scope.list[i].mesh.code = netstand[i].code;
|
||||
scope.list[i].id = netstand[i].id;
|
||||
scope.list[i].modelid = netstand[i].modelid;
|
||||
scope.list[i].mesh.name = netdata[i].name;
|
||||
scope.list[i].mesh.code = netdata[i].code;
|
||||
scope.list[i].id = netdata[i].id;
|
||||
scope.list[i].modelid = netdata[i].modelid;
|
||||
for(let j=0;j<scope.list[i].mesh.children.length;j++){
|
||||
scope.list[i].mesh.children[j].code = netstand[i].code;
|
||||
scope.list[i].mesh.children[j].code = netdata[i].code;
|
||||
}
|
||||
|
||||
scope.list[i].mesh.position.x = netstand[i].position.x;
|
||||
scope.list[i].mesh.position.y = netstand[i].position.y;
|
||||
scope.list[i].mesh.position.z = netstand[i].position.z;
|
||||
scope.list[i].mesh.position.x = netdata[i].position.x;
|
||||
scope.list[i].mesh.position.y = netdata[i].position.y;
|
||||
scope.list[i].mesh.position.z = netdata[i].position.z;
|
||||
// scope.list[i].mesh.rotation.x = netstand[i].rotation._x;
|
||||
// scope.list[i].mesh.rotation.y = netstand[i].rotation._y;
|
||||
// scope.list[i].mesh.rotation.z = netstand[i].rotation._z;
|
||||
scope.list[i].mesh.scale.x = netstand[i].scale.x;
|
||||
scope.list[i].mesh.scale.y = netstand[i].scale.y;
|
||||
scope.list[i].mesh.scale.z = netstand[i].scale.z;
|
||||
scope.list[i].mesh.scale.x = netdata[i].scale.x;
|
||||
scope.list[i].mesh.scale.y = netdata[i].scale.y;
|
||||
scope.list[i].mesh.scale.z = netdata[i].scale.z;
|
||||
|
||||
let textgeometry = new THREE.PlaneBufferGeometry( 128, 64, 1 );
|
||||
let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map: new THREE.CanvasTexture(getTextCanvas(stationdata[i])),transparent: true} );
|
||||
|
@ -13,6 +13,7 @@ import { OBJExporter} from '@/jlmap3d/main/export/OBJExporter.js';
|
||||
import {OrbitControlsedit} from '@/jlmap3d/main/control/OrbitControlsEdit.js';
|
||||
import { TransformControls } from '@/jlmap3d/main/control/TransformControls.js';
|
||||
import { DragControls } from '@/jlmap3d/main/control/DragControls.js';
|
||||
import { ScalControls } from '@/jlmap3d/main/control/ScalControls.js';
|
||||
|
||||
|
||||
//setconfig
|
||||
@ -95,6 +96,18 @@ export function JLmap3dEdit(dom, data, mapid) {
|
||||
|
||||
Jlmap3ddata(mapid,scope);
|
||||
|
||||
let scalControls = new THREE.ScalControls(scope.scene,scope.camera, scope.renderer.domElement );
|
||||
this.scalswitch = false;
|
||||
scalControls.addEventListener( 'dragstart', function () {
|
||||
|
||||
scope.controls.enabled = false;
|
||||
|
||||
} );
|
||||
scalControls.addEventListener( 'dragend', function () {
|
||||
|
||||
scope.controls.enabled = true;
|
||||
|
||||
} );
|
||||
//循环渲染
|
||||
animate();
|
||||
|
||||
@ -120,6 +133,7 @@ export function JLmap3dEdit(dom, data, mapid) {
|
||||
animate();
|
||||
};
|
||||
|
||||
|
||||
this.animateoff = function(){
|
||||
scope.animateswitch = false;
|
||||
scope.Subscribe.socketoff(scope.Subscribe.topic);
|
||||
@ -131,7 +145,7 @@ export function JLmap3dEdit(dom, data, mapid) {
|
||||
document.getElementById("testdraw").addEventListener( "mousedown", onselect, false );
|
||||
//窗口自适应
|
||||
window.addEventListener( 'resize', onWindowResize, false );
|
||||
controls.enabled = true;
|
||||
scope.controls.enabled = true;
|
||||
scope.controls.update();
|
||||
};
|
||||
|
||||
@ -157,10 +171,18 @@ export function JLmap3dEdit(dom, data, mapid) {
|
||||
// console.log(scope.actionmode);
|
||||
// console.log(changedata);
|
||||
if(changedata == "trackreplace"){
|
||||
scope.editmode == "trackedit";
|
||||
scope.editmode = "trackedit";
|
||||
scope.eventon();
|
||||
}
|
||||
if(changedata == "tracktexture"){
|
||||
scope.editmode = "suidaoedit";
|
||||
scope.eventon();
|
||||
}
|
||||
|
||||
if(changedata == "switchreplace"){
|
||||
scope.editmode = "switchedit";
|
||||
scope.eventon();
|
||||
}
|
||||
|
||||
// if(scope.editmode == "trackedit"){
|
||||
// scope.selectmodel = scope.action.sectionaction.changemodel(scope,changedata);
|
||||
@ -198,6 +220,29 @@ export function JLmap3dEdit(dom, data, mapid) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
this.vexscal = function(){
|
||||
|
||||
this.scalswitch = true;
|
||||
scalControls.attach(scope.selectmodel);
|
||||
scope.transcontrol.detach()
|
||||
|
||||
};
|
||||
|
||||
this.vexscaloff = function(){
|
||||
|
||||
scalControls.detach()
|
||||
|
||||
};
|
||||
|
||||
this.testrail = function(){
|
||||
console.log("testrail");
|
||||
};
|
||||
|
||||
this.autoss = function(){
|
||||
console.log("autoss");
|
||||
};
|
||||
|
||||
function onWindowResize() {
|
||||
//窗口自适应
|
||||
scope.camera.aspect = window.innerWidth / window.innerHeight;
|
||||
@ -212,12 +257,20 @@ export function JLmap3dEdit(dom, data, mapid) {
|
||||
if(scope.selectswitch == true){
|
||||
|
||||
scope.transcontrol.detach();
|
||||
scalControls.detach();
|
||||
//从站台对象组获取点击目标
|
||||
|
||||
if(scope.editmode == "trackedit"){
|
||||
scope.selectmodel = scope.action.sectionaction.raycaster(scope,"test");
|
||||
}
|
||||
|
||||
if(scope.editmode == "suidaoedit"){
|
||||
scope.selectmodel = scope.action.sectionaction.raycaster(scope,"suidao");
|
||||
}
|
||||
if(scope.editmode == "switchedit"){
|
||||
scope.selectmodel = scope.action.sectionaction.raycaster(scope,"switch");
|
||||
}
|
||||
|
||||
if(scope.editmode == "signaledit"){
|
||||
scope.selectmodel = scope.action.signalaction.raycaster(scope);
|
||||
}
|
||||
@ -230,9 +283,9 @@ export function JLmap3dEdit(dom, data, mapid) {
|
||||
scope.selectmodel = scope.action.trainaction.raycaster(scope);
|
||||
}
|
||||
|
||||
if(scope.editmode == "switchedit"){
|
||||
scope.selectmodel = scope.action.switchaction.raycaster(scope);
|
||||
}
|
||||
// if(scope.editmode == "switchedit"){
|
||||
// scope.selectmodel = scope.action.switchaction.raycaster(scope);
|
||||
// }
|
||||
|
||||
if(scope.editmode == "pathedit"){
|
||||
scope.selectmodel = scope.action.pathaction.raycaster(scope);
|
||||
@ -242,6 +295,7 @@ export function JLmap3dEdit(dom, data, mapid) {
|
||||
if(scope.selectmodel != null){
|
||||
//console.log(scope.selectmodel.rotation);
|
||||
scope.transcontrol.attach( scope.selectmodel );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
378
src/jlmap3d/main/control/ScalControls.js
Normal file
378
src/jlmap3d/main/control/ScalControls.js
Normal file
@ -0,0 +1,378 @@
|
||||
/*
|
||||
* @author zz85 / https://github.com/zz85
|
||||
* @author mrdoob / http://mrdoob.com
|
||||
* Running this will allow you to drag three.js objects around the screen.
|
||||
*/
|
||||
|
||||
THREE.ScalControls = function ( scene,_camera, _domElement ) {
|
||||
var _scene = scene;
|
||||
var originposition;
|
||||
var _objects = [];
|
||||
var cubegroup = new THREE.Group();
|
||||
|
||||
var geometry = new THREE.BoxBufferGeometry( 5, 5, 5 );
|
||||
var material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
|
||||
var cube = new THREE.Mesh( geometry, material );
|
||||
cube.position.x = 1;
|
||||
cube.position.z = 0;
|
||||
cube.name = "right";
|
||||
cubegroup.add( cube );
|
||||
_objects.push(cube);
|
||||
|
||||
var geometry = new THREE.BoxBufferGeometry( 5, 5, 5 );
|
||||
var material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
|
||||
var cube = new THREE.Mesh( geometry, material );
|
||||
cube.position.x = -1;
|
||||
cube.position.z = 0;
|
||||
cube.name = "left";
|
||||
cubegroup.add( cube );
|
||||
_objects.push(cube);
|
||||
|
||||
|
||||
if ( _objects instanceof THREE.Camera ) {
|
||||
|
||||
console.warn( 'THREE.ScalControls: Constructor now expects ( objects, camera, domElement )' );
|
||||
var temp = _objects; _objects = _camera; _camera = temp;
|
||||
|
||||
}
|
||||
|
||||
var _movemesh;
|
||||
var _plane = new THREE.Plane();
|
||||
var _raycaster = new THREE.Raycaster();
|
||||
|
||||
var _mouse = new THREE.Vector2();
|
||||
var _offset = new THREE.Vector3();
|
||||
var _intersection = new THREE.Vector3();
|
||||
var _worldPosition = new THREE.Vector3();
|
||||
var _inverseMatrix = new THREE.Matrix4();
|
||||
|
||||
var _selected = null, _hovered = null;
|
||||
|
||||
|
||||
//
|
||||
|
||||
var scope = this;
|
||||
|
||||
function activate() {
|
||||
|
||||
_domElement.addEventListener( 'mousemove', onDocumentMouseMove, false );
|
||||
_domElement.addEventListener( 'mousedown', onDocumentMouseDown, false );
|
||||
_domElement.addEventListener( 'mouseup', onDocumentMouseCancel, false );
|
||||
_domElement.addEventListener( 'mouseleave', onDocumentMouseCancel, false );
|
||||
_domElement.addEventListener( 'touchmove', onDocumentTouchMove, false );
|
||||
_domElement.addEventListener( 'touchstart', onDocumentTouchStart, false );
|
||||
_domElement.addEventListener( 'touchend', onDocumentTouchEnd, false );
|
||||
|
||||
}
|
||||
|
||||
function deactivate() {
|
||||
|
||||
_domElement.removeEventListener( 'mousemove', onDocumentMouseMove, false );
|
||||
_domElement.removeEventListener( 'mousedown', onDocumentMouseDown, false );
|
||||
_domElement.removeEventListener( 'mouseup', onDocumentMouseCancel, false );
|
||||
_domElement.removeEventListener( 'mouseleave', onDocumentMouseCancel, false );
|
||||
_domElement.removeEventListener( 'touchmove', onDocumentTouchMove, false );
|
||||
_domElement.removeEventListener( 'touchstart', onDocumentTouchStart, false );
|
||||
_domElement.removeEventListener( 'touchend', onDocumentTouchEnd, false );
|
||||
|
||||
}
|
||||
|
||||
function dispose() {
|
||||
|
||||
deactivate();
|
||||
|
||||
}
|
||||
|
||||
function onDocumentMouseMove( event ) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
var rect = _domElement.getBoundingClientRect();
|
||||
|
||||
_mouse.x = ( ( event.clientX - rect.left ) / rect.width ) * 2 - 1;
|
||||
_mouse.y = - ( ( event.clientY - rect.top ) / rect.height ) * 2 + 1;
|
||||
|
||||
_raycaster.setFromCamera( _mouse, _camera );
|
||||
|
||||
if ( _selected && scope.enabled ) {
|
||||
|
||||
if ( _raycaster.ray.intersectPlane( _plane, _intersection ) ) {
|
||||
_selected.position.copy( _intersection.sub( _offset ).applyMatrix4( _inverseMatrix ) );
|
||||
_selected.position.y = 0;
|
||||
console.log(_movemesh);
|
||||
if(_movemesh.meshtype == "link"){
|
||||
if(_selected.name == "left"){
|
||||
for(let i=0;i<_movemesh.leftlist.length;i++){
|
||||
_movemesh.geometry.attributes.position.array[_movemesh.leftlist[i]*3] = _selected.position.x - originposition;
|
||||
_movemesh.geometry.attributes.uv.array[_movemesh.leftlist[i]*2] = _movemesh.geometry.attributes.position.array[0]-_movemesh.geometry.attributes.position.array[3];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(_selected.name == "right"){
|
||||
for(let i=0;i<_movemesh.rightlist.length;i++){
|
||||
_movemesh.geometry.attributes.position.array[_movemesh.rightlist[i]*3] = _selected.position.x - originposition;
|
||||
_movemesh.geometry.attributes.uv.array[_movemesh.leftlist[i]*2] = _movemesh.geometry.attributes.position.array[0]-_movemesh.geometry.attributes.position.array[3];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(_selected.name == "left"){
|
||||
for(let i=0;i<_movemesh.leftlist.length;i++){
|
||||
_movemesh.geometry.attributes.position.array[_movemesh.leftlist[i]*3] = _selected.position.x - originposition;
|
||||
_movemesh.geometry.attributes.uv.array[_movemesh.leftlist[i]*2] = (_movemesh.geometry.attributes.position.array[3]-_movemesh.geometry.attributes.position.array[0])/15.3;
|
||||
}
|
||||
}
|
||||
|
||||
if(_selected.name == "right"){
|
||||
for(let i=0;i<_movemesh.rightlist.length;i++){
|
||||
|
||||
_movemesh.geometry.attributes.position.array[_movemesh.rightlist[i]*3] = _selected.position.x - originposition;
|
||||
_movemesh.geometry.attributes.uv.array[_movemesh.leftlist[i]*2] = (_movemesh.geometry.attributes.position.array[3]-_movemesh.geometry.attributes.position.array[0])/15.3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// newgeometry.attributes.uv.array[7] = i;
|
||||
|
||||
_movemesh.geometry.attributes.position.needsUpdate = true;
|
||||
_movemesh.geometry.attributes.uv.needsUpdate = true;
|
||||
_movemesh.material.needsUpdate = true;
|
||||
// _movemesh.geometry.computeBoundingBox();
|
||||
_movemesh.geometry.computeBoundingSphere();
|
||||
_movemesh.geometry.center();
|
||||
_movemesh.lengthfact = _movemesh.geometry.attributes.position.array[_movemesh.rightlist[0]] - _movemesh.geometry.attributes.position.array[_movemesh.leftlist[0]];
|
||||
// testmesh2.position.z = 50;
|
||||
|
||||
// testmesh2.geometry.center();
|
||||
// console.log(testmesh2.geometry.attributes);
|
||||
|
||||
}
|
||||
|
||||
scope.dispatchEvent( { type: 'drag', object: _selected } );
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
_raycaster.setFromCamera( _mouse, _camera );
|
||||
|
||||
var intersects = _raycaster.intersectObjects( _objects );
|
||||
|
||||
if ( intersects.length > 0 ) {
|
||||
|
||||
var object = intersects[ 0 ].object;
|
||||
|
||||
_plane.setFromNormalAndCoplanarPoint( _camera.getWorldDirection( _plane.normal ), _worldPosition.setFromMatrixPosition( object.matrixWorld ) );
|
||||
|
||||
if ( _hovered !== object ) {
|
||||
|
||||
scope.dispatchEvent( { type: 'hoveron', object: object } );
|
||||
|
||||
_domElement.style.cursor = 'pointer';
|
||||
_hovered = object;
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if ( _hovered !== null ) {
|
||||
|
||||
scope.dispatchEvent( { type: 'hoveroff', object: _hovered } );
|
||||
|
||||
_domElement.style.cursor = 'auto';
|
||||
_hovered = null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function onDocumentMouseDown( event ) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
_raycaster.setFromCamera( _mouse, _camera );
|
||||
|
||||
var intersects = _raycaster.intersectObjects( _objects );
|
||||
|
||||
if ( intersects.length > 0 ) {
|
||||
|
||||
_selected = intersects[ 0 ].object;
|
||||
|
||||
if ( _raycaster.ray.intersectPlane( _plane, _intersection ) ) {
|
||||
|
||||
_inverseMatrix.getInverse( _selected.parent.matrixWorld );
|
||||
_offset.copy( _intersection ).sub( _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) );
|
||||
|
||||
}
|
||||
|
||||
_domElement.style.cursor = 'move';
|
||||
|
||||
scope.dispatchEvent( { type: 'dragstart', object: _selected } );
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function onDocumentMouseCancel( event ) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
if ( _selected ) {
|
||||
|
||||
scope.dispatchEvent( { type: 'dragend', object: _selected } );
|
||||
|
||||
_selected = null;
|
||||
|
||||
}
|
||||
|
||||
_domElement.style.cursor = _hovered ? 'pointer' : 'auto';
|
||||
|
||||
}
|
||||
|
||||
function onDocumentTouchMove( event ) {
|
||||
|
||||
event.preventDefault();
|
||||
event = event.changedTouches[ 0 ];
|
||||
|
||||
var rect = _domElement.getBoundingClientRect();
|
||||
|
||||
_mouse.x = ( ( event.clientX - rect.left ) / rect.width ) * 2 - 1;
|
||||
_mouse.y = - ( ( event.clientY - rect.top ) / rect.height ) * 2 + 1;
|
||||
|
||||
_raycaster.setFromCamera( _mouse, _camera );
|
||||
|
||||
if ( _selected && scope.enabled ) {
|
||||
|
||||
if ( _raycaster.ray.intersectPlane( _plane, _intersection ) ) {
|
||||
|
||||
_selected.position.copy( _intersection.sub( _offset ).applyMatrix4( _inverseMatrix ) );
|
||||
|
||||
}
|
||||
|
||||
scope.dispatchEvent( { type: 'drag', object: _selected } );
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function onDocumentTouchStart( event ) {
|
||||
|
||||
event.preventDefault();
|
||||
event = event.changedTouches[ 0 ];
|
||||
|
||||
var rect = _domElement.getBoundingClientRect();
|
||||
|
||||
_mouse.x = ( ( event.clientX - rect.left ) / rect.width ) * 2 - 1;
|
||||
_mouse.y = - ( ( event.clientY - rect.top ) / rect.height ) * 2 + 1;
|
||||
|
||||
_raycaster.setFromCamera( _mouse, _camera );
|
||||
|
||||
var intersects = _raycaster.intersectObjects( _objects );
|
||||
|
||||
if ( intersects.length > 0 ) {
|
||||
|
||||
_selected = intersects[ 0 ].object;
|
||||
|
||||
_plane.setFromNormalAndCoplanarPoint( _camera.getWorldDirection( _plane.normal ), _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) );
|
||||
|
||||
if ( _raycaster.ray.intersectPlane( _plane, _intersection ) ) {
|
||||
|
||||
_inverseMatrix.getInverse( _selected.parent.matrixWorld );
|
||||
_offset.copy( _intersection ).sub( _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) );
|
||||
|
||||
}
|
||||
|
||||
_domElement.style.cursor = 'move';
|
||||
|
||||
scope.dispatchEvent( { type: 'dragstart', object: _selected } );
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function onDocumentTouchEnd( event ) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
if ( _selected ) {
|
||||
|
||||
scope.dispatchEvent( { type: 'dragend', object: _selected } );
|
||||
|
||||
_selected = null;
|
||||
|
||||
}
|
||||
|
||||
_domElement.style.cursor = 'auto';
|
||||
|
||||
}
|
||||
|
||||
activate();
|
||||
|
||||
// API
|
||||
|
||||
this.enabled = true;
|
||||
|
||||
this.activate = activate;
|
||||
this.deactivate = deactivate;
|
||||
this.dispose = dispose;
|
||||
|
||||
// Backward compatibility
|
||||
this.attach = function(movemesh){
|
||||
console.log(movemesh);
|
||||
_movemesh = movemesh;
|
||||
originposition = movemesh.position.x;
|
||||
let offset = (_movemesh.geometry.attributes.position.array[movemesh.rightlist[0]*3] - _movemesh.geometry.attributes.position.array[movemesh.leftlist[0]*3])/2;
|
||||
cubegroup.children[0].position.x = movemesh.position.x + offset;
|
||||
cubegroup.children[0].position.y = movemesh.position.y;
|
||||
cubegroup.children[0].position.z = movemesh.position.z;
|
||||
cubegroup.children[1].position.x = movemesh.position.x - offset;
|
||||
cubegroup.children[1].position.y = movemesh.position.y;
|
||||
cubegroup.children[1].position.z = movemesh.position.z;
|
||||
|
||||
_scene.add(cubegroup);
|
||||
}
|
||||
|
||||
this.detach = function(){
|
||||
// _movemesh = "";
|
||||
_scene.remove(cubegroup);
|
||||
}
|
||||
|
||||
this.setObjects = function () {
|
||||
|
||||
console.error( 'THREE.ScalControls: setObjects() has been removed.' );
|
||||
|
||||
};
|
||||
|
||||
this.on = function ( type, listener ) {
|
||||
|
||||
console.warn( 'THREE.ScalControls: on() has been deprecated. Use addEventListener() instead.' );
|
||||
scope.addEventListener( type, listener );
|
||||
|
||||
};
|
||||
|
||||
this.off = function ( type, listener ) {
|
||||
|
||||
console.warn( 'THREE.ScalControls: off() has been deprecated. Use removeEventListener() instead.' );
|
||||
scope.removeEventListener( type, listener );
|
||||
|
||||
};
|
||||
|
||||
this.notify = function ( type ) {
|
||||
|
||||
console.error( 'THREE.ScalControls: notify() has been deprecated. Use dispatchEvent() instead.' );
|
||||
scope.dispatchEvent( { type: type } );
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
THREE.ScalControls.prototype = Object.create( THREE.EventDispatcher.prototype );
|
||||
THREE.ScalControls.prototype.constructor = THREE.ScalControls;
|
@ -28,7 +28,7 @@ let defaultstation = {
|
||||
deviceType:"stand",
|
||||
type:"num4",
|
||||
picUrl:"",
|
||||
assetUrl:"https://joylink.club/oss/models/station/fuzhou/fuzhou.FBX"
|
||||
assetUrl:"../../static/model/station/fuzhou.FBX"
|
||||
}//https://joylink.club/oss/models/station/fuzhou/fuzhou.FBX
|
||||
//../../static/model/station/zhantai715(2).FBX
|
||||
|
||||
@ -105,11 +105,8 @@ export function AssetLoader(){
|
||||
let defaultmodel2 = new AssetModel(defaulttrain);
|
||||
scope.modellist.push(defaultmodel2);
|
||||
|
||||
let defaultmodel3 = new AssetModel(defaultstation);
|
||||
scope.modellist.push(defaultmodel3);
|
||||
|
||||
let defaultmodel4 = new AssetModel(defaultswitch);
|
||||
scope.modellist.push(defaultmodel4);
|
||||
let station = new AssetModel(defaultstation);
|
||||
scope.modellist.push(station);
|
||||
|
||||
let driver = new AssetModel(defaultdriver);
|
||||
scope.modellist.push(driver);
|
||||
@ -117,7 +114,8 @@ export function AssetLoader(){
|
||||
let suidao = new AssetModel(defaultsuidao);
|
||||
scope.modellist.push(suidao);
|
||||
|
||||
|
||||
let defaultswitch = new AssetModel(testswitch);
|
||||
scope.modellist.push(defaultswitch);
|
||||
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
export function AssetModel(data){
|
||||
|
||||
let scope = this;
|
||||
|
||||
|
||||
this.id = data.id;
|
||||
|
||||
this.name = data.name;
|
||||
|
@ -6,7 +6,13 @@
|
||||
|
||||
<el-button type="transrota" @click="transrota">旋转</el-button>
|
||||
|
||||
<el-button type="transscal" @click="transscal">拉伸</el-button>
|
||||
<el-button type="transscal" @click="transscal">放大缩小</el-button>
|
||||
|
||||
<el-button type="vexscal" @click="vexscal">拉伸</el-button>
|
||||
|
||||
<el-button type="testrail" @click="testrail">测试轨迹</el-button>
|
||||
|
||||
<el-button type="autoss" @click="autoss">自动匹配轨道信号灯</el-button>
|
||||
|
||||
<el-button type="expo" @click="expo">导出obj</el-button>
|
||||
|
||||
@ -49,6 +55,15 @@ export default {
|
||||
async transscal(){
|
||||
this.$emit('transscal');
|
||||
},
|
||||
async vexscal(){
|
||||
this.$emit('vexscal');
|
||||
},
|
||||
async testrail(){
|
||||
this.$emit('testrail');
|
||||
},
|
||||
async autoss(){
|
||||
this.$emit('autoss');
|
||||
},
|
||||
async expo(){
|
||||
this.$emit('expo');
|
||||
},
|
||||
|
@ -14,7 +14,7 @@
|
||||
<Edit-Assets ref="assets" @smodel="smodel" @stexture="stexture">
|
||||
</Edit-Assets>
|
||||
|
||||
<Edit-Menu ref="menu" @transpos="transpos" @transrota="transrota" @transscal="transscal" @expo="expo" @save="save"
|
||||
<Edit-Menu ref="menu" @transpos="transpos" @transrota="transrota" @transscal="transscal" @vexscal= "vexscal" @testrail="testrail" @autoss="autoss" @expo="expo" @save="save"
|
||||
@back="back">
|
||||
</Edit-Menu>
|
||||
|
||||
@ -150,12 +150,27 @@
|
||||
},
|
||||
transpos() {
|
||||
this.jlmap3dedit.transcontrol.setMode('translate');
|
||||
this.jlmap3dedit.vexscaloff();
|
||||
},
|
||||
transrota() {
|
||||
this.jlmap3dedit.transcontrol.setMode('rotate');
|
||||
this.jlmap3dedit.vexscaloff();
|
||||
},
|
||||
transscal() {
|
||||
this.jlmap3dedit.transcontrol.setMode('scale');
|
||||
this.jlmap3dedit.vexscaloff();
|
||||
},
|
||||
vexscal(){
|
||||
|
||||
this.jlmap3dedit.transcontrol.detach();
|
||||
this.jlmap3dedit.vexscal();
|
||||
console.log("vexscal");
|
||||
},
|
||||
testrail(){
|
||||
this.jlmap3dedit.testrail();
|
||||
},
|
||||
autoss(){
|
||||
this.jlmap3dedit.autoss();
|
||||
},
|
||||
expo() {
|
||||
|
||||
@ -164,9 +179,8 @@
|
||||
save() {
|
||||
//console.log("save");
|
||||
let param = getmodels(this.jlmap3dedit);
|
||||
console.log(this.jlmap3dedit);
|
||||
console.log(param);
|
||||
//console.log(param);
|
||||
|
||||
update3dMapData(param).then(data => {
|
||||
//console.log(data);
|
||||
if (data.code == "200") {
|
||||
|
Binary file not shown.
BIN
static/model/auto/railold.FBX
Normal file
BIN
static/model/auto/railold.FBX
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/model/auto/suidaoold.FBX
Normal file
BIN
static/model/auto/suidaoold.FBX
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/model/auto/testdaocha1.FBX
Normal file
BIN
static/model/auto/testdaocha1.FBX
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user