diff --git a/src/jlmap3d/edit/connect/initDataSave.js b/src/jlmap3d/edit/connect/initDataSave.js new file mode 100644 index 000000000..755c4fc4b --- /dev/null +++ b/src/jlmap3d/edit/connect/initDataSave.js @@ -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 { + + 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(); + }); + } + + + }); + } + + + +} diff --git a/src/jlmap3d/edit/jlmap3dedit.js b/src/jlmap3d/edit/jlmap3dedit.js index d2bc5caff..d3aebbe86 100644 --- a/src/jlmap3d/edit/jlmap3dedit.js +++ b/src/jlmap3d/edit/jlmap3dedit.js @@ -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; diff --git a/src/jlmap3d/edit/neweditmodel/StationStandList.js b/src/jlmap3d/edit/neweditmodel/StationStandList.js index 674172001..574ee7954 100644 --- a/src/jlmap3d/edit/neweditmodel/StationStandList.js +++ b/src/jlmap3d/edit/neweditmodel/StationStandList.js @@ -28,7 +28,7 @@ export function StationStandList() { let newstationstand = new StationStandModel(stationdata[i]); //判断站台是否显示 - console.log(stationdata[i]); + if(stationdata[i].visible == true){ //遍历车站站台数据 diff --git a/src/jlmap3d/edit/testEditorModel/RailList.js b/src/jlmap3d/edit/testEditorModel/RailList.js new file mode 100644 index 000000000..28cbe68e1 --- /dev/null +++ b/src/jlmap3d/edit/testEditorModel/RailList.js @@ -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 cposx){ + if(aposy < cposy){ + // ——A + // /C + scope.sections.datalist[ccode].ctype = 1; + }else{ + // \C + // ——A + scope.sections.datalist[ccode].ctype = 2; + } + }else{ + if(aposy < cposy){ + // A—— + // \C + scope.sections.datalist[ccode].ctype = 3; + }else{ + // /C + // A—— + scope.sections.datalist[ccode].ctype = 4; + } + } + + scope.sections.datalist[acode].csection = ccode; + + if(scope.sections.datalist[ccode].ctype == 1 || scope.sections.datalist[ccode].ctype == 2){ + if(scope.sections.datalist[acode].lsection == "" || scope.sections.datalist[acode].lsection == undefined){ + scope.sections.datalist[acode].lsection = bcode; + } + + if(scope.sections.datalist[bcode].rsection == "" || scope.sections.datalist[bcode].rsection == undefined){ + scope.sections.datalist[bcode].rsection = acode; + } + + if(scope.sections.datalist[ccode].rsection == "" || scope.sections.datalist[ccode].rsection == undefined){ + scope.sections.datalist[ccode].rsection = acode; + }else if(scope.sections.datalist[ccode].lsection == "" || scope.sections.datalist[ccode].lsection == undefined){ + scope.sections.datalist[ccode].lsection = acode; + } + } + + if(scope.sections.datalist[ccode].ctype == 3 || scope.sections.datalist[ccode].ctype == 4){ + if(scope.sections.datalist[acode].rsection == "" || scope.sections.datalist[acode].rsection == undefined){ + scope.sections.datalist[acode].rsection = bcode; + } + + if(scope.sections.datalist[bcode].lsection == "" ||scope.sections.datalist[bcode].lsection == undefined ){ + scope.sections.datalist[bcode].lsection = acode; + } + + if(scope.sections.datalist[ccode].rsection == "" || scope.sections.datalist[ccode].rsection == undefined){ + scope.sections.datalist[ccode].rsection = acode; + }else if(scope.sections.datalist[ccode].lsection == "" || scope.sections.datalist[ccode].lsection == undefined){ + scope.sections.datalist[ccode].lsection = acode; + } + } + + + } + + let stationlist = jlmap3ddata.stationstandlist.list; + let stopsections = []; + + for(let i=0,leni = stationlist.length;i0){ + let nowFindArray = findarray[k]; + let maxlengthfact = 0; + let maxsection = null; + + let topNowSection = scope.sections.datalist[nowFindArray[0].startSection.code]; + let topNextSection = scope.sections.datalist[nowFindArray[0].endSection.code]; + let downNowSection = scope.sections.datalist[nowFindArray[1].startSection.code]; + let downNextSection = scope.sections.datalist[nowFindArray[1].endSection.code]; + + let topStopPointLength = nowFindArray[0].distance+(topNowSection.lengthFact-topNowSection.rightStopPointOffset)+topNextSection.leftStopPointOffset; + let downStopPointLength = nowFindArray[1].distance+(downNowSection.lengthFact-downNowSection.rightStopPointOffset)+downNextSection.leftStopPointOffset; + if(topStopPointLength > downStopPointLength){ + if(nowFindArray[0].sectionArrays.length == 0 && nowFindArray[1].sectionArrays.length == 0){ + + }else if(nowFindArray[1].sectionArrays.length > 0){ + let offset = topStopPointLength - downStopPointLength; + for(let n=0,lenn= nowFindArray[1].sectionArrays.length;nmaxsection){ + maxlengthfact = nowFindArray[1].sectionArrays[n].lengthFact; + maxsection = nowFindArray[1].sectionArrays[n]; + } + } + scope.sections.datalist[maxsection.code].lengthFact += offset; + }else{ + let offset = topStopPointLength - downStopPointLength; + for(let n=0,lenn= nowFindArray[0].sectionArrays.length;nmaxsection){ + maxlengthfact = nowFindArray[0].sectionArrays[n].lengthFact; + maxsection = nowFindArray[0].sectionArrays[n]; + } + } + scope.sections.datalist[maxsection.code].lengthFact -= offset; + } + + }else if(topStopPointLength < downStopPointLength){ + + if(nowFindArray[0].sectionArrays.length == 0 && nowFindArray[1].sectionArrays.length == 0){ + + }else if(nowFindArray[0].sectionArrays.length > 0){ + let offset = downStopPointLength - topStopPointLength; + for(let n=0,lenn= nowFindArray[0].sectionArrays.length;nmaxsection){ + maxlengthfact = nowFindArray[0].sectionArrays[n].lengthFact; + maxsection = nowFindArray[0].sectionArrays[n]; + } + } + scope.sections.datalist[maxsection.code].lengthFact += offset; + }else{ + let offset = downStopPointLength - topStopPointLength; + for(let n=0,lenn= nowFindArray[1].sectionArrays.length;nmaxsection){ + maxlengthfact = nowFindArray[1].sectionArrays[n].lengthFact; + maxsection = nowFindArray[1].sectionArrays[n]; + } + } + scope.sections.datalist[maxsection.code].lengthFact -= offset; + } + } + } + } + } + } + + let topstartpoint = { + x:0, + y:0, + z:0 + }; + + let downstartpoint = { + x:0, + y:0, + z:0 + }; + + createsection(stopsections[0].reals[0].code,topstartpoint,stopsections[0].reals[0].code,0); + createsection(stopsections[0].reals[1].code,downstartpoint,stopsections[0].reals[1].code,34.8); + + for(let i=1,leni=stopsections.length;idata.points[data.pointslength].y){ + initRotation = 0.2678; + data.rp.x = data.lp.x+(data.lengthFact)*Math.cos(initRotation); + data.rp.z = data.lp.z-(data.lengthFact)*Math.sin(initRotation); + + }else if(data.points[0].ydata.points[data.pointslength].y){ + initRotation = 0.2678; + data.lp.x = data.rp.x - (data.lengthFact)*Math.cos(initRotation); + data.lp.z = data.rp.z + (data.lengthFact)*Math.sin(initRotation); + }else if(data.points[0].ydata.points[data.pointslength].y){ + initRotation = 0.2678; + data.lp.x = data.rp.x - (data.lengthFact)*Math.cos(initRotation); + data.lp.z = data.rp.z + (data.lengthFact)*Math.sin(initRotation); + }else if(data.points[0].ydata.points[data.pointslength].y){ + initRotation = 0.2678; + data.rp.x = data.lp.x+(data.lengthFact)*Math.cos(initRotation); + data.rp.z = data.lp.z-(data.lengthFact)*Math.sin(initRotation); + }else if(data.points[0].y2){ + + // console.log(newsection); + console.log("======================="); + if(newsection.code == "T27"){ + console.log(newsection.railpoint[0]); + console.log(newsection.railpoint[1]); + console.log(newsection.railpoint[2]); + } + 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+0.0001), + new THREE.Vector3(newsection.railpoint[2].x,height,newsection.railpoint[2].z) + ] ); + closedSpline.type = 'catmullrom'; + closedSpline.closed = false; + var extrudeSettings = { + steps : 5, + curveSegments : 1, + bevelSegments : 1, + bevelEnabled : false, + extrudePath : closedSpline, + }; + var shape = new THREE.Shape(); + shape.moveTo( 0,-2 ); + shape.lineTo( 0, 2 ); + var geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings ); + var randomMaterail = new THREE.MeshLambertMaterial({ + //color:color.fromArray(colorArray) + color:0xFFFFFF*Math.random() + }); + + // if(newsection.standTrack == false){ + // testmesh2 = new THREE.Mesh( geometry, randomMaterail ); + // }else{ + testmesh2 = new THREE.Mesh( geometry, selectmaterial ); + // } + + testmesh2.railpoint = [ + {x:newsection.railpoint[0].x,y:height,z:newsection.railpoint[0].z}, + {x:newsection.railpoint[1].x,y:height,z:newsection.railpoint[1].z}, + {x:newsection.railpoint[2].x,y:height,z:newsection.railpoint[2].z}, + ]; + testmesh2.lengthFact = newsection.railpoint[2].x-newsection.railpoint[0].x; + let len = testmesh2.lengthFact; + // testmesh2.lengthFact = newsection.lengthFact; + // let len = newsection.lengthFact; + // closedSpline.arcLengthDivisions; + let count = testmesh2.geometry.attributes.position.count/3; + + for(let i=0;i 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;jsectiondata[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 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(){ + + } + +} diff --git a/src/jlmap3d/edit/testEditorModel/SwitchModel.js b/src/jlmap3d/edit/testEditorModel/SwitchModel.js new file mode 100644 index 000000000..bd8e452a3 --- /dev/null +++ b/src/jlmap3d/edit/testEditorModel/SwitchModel.js @@ -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; +} diff --git a/src/jlmap3d/edit/testEditorModel/TrainModel.js b/src/jlmap3d/edit/testEditorModel/TrainModel.js new file mode 100644 index 000000000..7bf6a92cb --- /dev/null +++ b/src/jlmap3d/edit/testEditorModel/TrainModel.js @@ -0,0 +1,8 @@ +export function TrainModel(opts) { + + var scope = this; + + this.mesh = null; + this.meshurl = null; + this.picurl = null; +} diff --git a/src/jlmap3d/main/loaders/DriverLoadNew.js b/src/jlmap3d/main/loaders/DriverLoadNew.js index a67f76d68..801b725eb 100644 --- a/src/jlmap3d/main/loaders/DriverLoadNew.js +++ b/src/jlmap3d/main/loaders/DriverLoadNew.js @@ -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; + } + } } diff --git a/src/jlmap3d/main/loaders/SimulationLoadNew.js b/src/jlmap3d/main/loaders/SimulationLoadNew.js index 774bd81c7..d4fd3a759 100644 --- a/src/jlmap3d/main/loaders/SimulationLoadNew.js +++ b/src/jlmap3d/main/loaders/SimulationLoadNew.js @@ -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; + } + } diff --git a/src/jlmap3d/main/newmodel/SectionListN.js b/src/jlmap3d/main/newmodel/SectionListN.js index 81ef66cad..6a68ddc1f 100644 --- a/src/jlmap3d/main/newmodel/SectionListN.js +++ b/src/jlmap3d/main/newmodel/SectionListN.js @@ -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) ] ); diff --git a/src/jlmap3d/main/newmodel/StationStandListN.js b/src/jlmap3d/main/newmodel/StationStandListN.js index 09b4518d2..12eb113bc 100644 --- a/src/jlmap3d/main/newmodel/StationStandListN.js +++ b/src/jlmap3d/main/newmodel/StationStandListN.js @@ -156,19 +156,20 @@ export function StationStandListN() { for(let i=0;i导出obj - 保存 + 新地图初始化保存 测试中保存 diff --git a/src/views/jlmap3d/edit/jlmap3dedit.vue b/src/views/jlmap3d/edit/jlmap3dedit.vue index ebf29313a..54ef4accf 100644 --- a/src/views/jlmap3d/edit/jlmap3dedit.vue +++ b/src/views/jlmap3d/edit/jlmap3dedit.vue @@ -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); diff --git a/static/vrtest/vrHuman.FBX b/static/vrtest/vrHuman.FBX index 7f7e2a04b..47a969a0a 100644 Binary files a/static/vrtest/vrHuman.FBX and b/static/vrtest/vrHuman.FBX differ