diff --git a/src/jlmap3d/edit/Jlmap3ddata.js b/src/jlmap3d/edit/Jlmap3ddata.js deleted file mode 100644 index 01d712ebf..000000000 --- a/src/jlmap3d/edit/Jlmap3ddata.js +++ /dev/null @@ -1,196 +0,0 @@ -import { getPublishMapDetail,getMapDetail,set3dMapData,get3dMapData } from '@/api/jlmap3d/load3ddata'; - -//原始信息obj化提供给三维建模 -import {SetObj} from '@/jlmap3d/edit/utils/SetObj.js'; -//componnent -import {SectionList} from '@/jlmap3d/edit/editmodel/SectionList.js'; -import {SignalList} from '@/jlmap3d/edit/editmodel/SignalList.js'; -import {StationStandList} from '@/jlmap3d/edit/editmodel/StationStandList.js'; -import {TrainList} from '@/jlmap3d/edit/editmodel/TrainList.js'; -import {TrainListTest} from '@/jlmap3d/edit/editmodel/TrainListTest.js'; -import {LinkList} from '@/jlmap3d/edit/editmodel/LinkList.js'; -import {RailList} from '@/jlmap3d/edit/editmodel/RailList.js'; - - -import {RealSectionList} from '@/jlmap3d/edit/editmodel/RealSectionList.js'; - -import axios from 'axios'; -import {getmodels} from '@/jlmap3d/edit/connect/getmodels'; -import { Loading } from 'element-ui'; -// import {SwitchModel} from '@/jlmap3d/model/SwitchModel.js'; - -export function Jlmap3ddata(mapid,scope){ - let editmapid = mapid; - let scene = scope.scene; - let jlmap3ddata = scope.mapdata; - let assetloader = scope.assetloader; - let loadingInstance = Loading.service({ fullscreen: true }); - get3dMapData(editmapid).then(data => { - //console.log(data); - if(data.code == "200"){ - //console.log("数据存在"); - let isSection = false; - //console.log(data.data); - if(data.data.assets){ - let assets = JSON.parse(data.data.assets); - for(let i=0;i { - //console.log(error); - if(error.code == "30001"){ - //console.log("没有三维数据"); - let params = {mapId:editmapid}; - - set3dMapData(params).then(data => { - if(data.code == "200"){ - //console.log("创建三维数据成功"); - // console.log(data); - initobj(editmapid,data.data.id); - - } - }).catch(error => { - //console.log(error); - }); - - } - }); - - function initobj(mapid,data3did){ - getMapDetail(mapid).then(data => { - let mapdata = data.data; - //console.log(data3did); - jlmap3ddata.id = data3did; - jlmap3ddata.mapId = mapid; - //初始化轨道和道岔 暂时 - jlmap3ddata.linklist = new LinkList(); - jlmap3ddata.sectionlist = new SectionList(); - jlmap3ddata.signallist = new SignalList(); - //初始化站台 - jlmap3ddata.stationstandlist = new StationStandList(); - jlmap3ddata.trainlisttest = new TrainListTest(); - - jlmap3ddata.raillist = new RailList(); - - - assetloader.assetinit(scene) - .then(function(data){ - //console.log(data); - return jlmap3ddata.linklist.initpromise(mapdata.linkList,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){ - //console.log(data); - return jlmap3ddata.stationstandlist.initpromise(jlmap3ddata,mapdata.stationList,mapdata.stationStandList,scene,assetloader); - }) - .then(function(data){ - //console.log(data); - return jlmap3ddata.trainlisttest.initpromise(mapdata.trainList,scene,assetloader); - }) - .then(function(data){ - //console.log(data); - loadingInstance.close(); - }); - //初始化信号 - //SetObj(mapdata,scope); - - }); - } - - function init3d(mapid,netdata){ - // console.log(netdata) - getMapDetail(mapid).then(data => { - jlmap3ddata.id = netdata.id; - jlmap3ddata.mapId = mapid; - let mapdata = data.data; - - jlmap3ddata.linklist = new LinkList(); - //初始化轨道和道岔 暂时 - jlmap3ddata.sectionlist = new SectionList(); - jlmap3ddata.signallist = new SignalList(); - //初始化站台 - jlmap3ddata.stationstandlist = new StationStandList(); - //初始化测试列车 - jlmap3ddata.trainlisttest = new TrainListTest(); - - jlmap3ddata.raillist = new RailList(); - - 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(mapdata); - assetloader.setmodellist(netdata.assets,5); - assetloader.assetpromise(scene) - .then(function(data){ - //console.log(data); - return jlmap3ddata.linklist.loadpromise(loaderdata.link,mapdata.linkList,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,mapdata.signalList); - }) - .then(function(data){ - //console.log(data); - return jlmap3ddata.stationstandlist.initpromise(jlmap3ddata,mapdata.stationList,mapdata.stationStandList,scene,assetloader,standsdata); - }) - .then(function(data){ - return jlmap3ddata.sectionlist.sectionpromise(loaderdata.link,mapdata.linkList,mapdata.sectionList,switchdata,standsdata,scene); - }) - .then(function(data){ - //console.log(data); - return jlmap3ddata.trainlisttest.initpromise(mapdata.trainList,scene,assetloader,"0"); - }) - // .then(function(data){ - // //console.log(data); - // return jlmap3ddata.realsectionlist.loadpromise(jlmap3ddata,scene,assetloader); - // }) - .then(function(data){ - //console.log(data); - - for(let mn=0;mn { - console.log("3dmapdata:"); - console.log(data); - if(data.data ){ - if(data.data.assets){ - // initobj(editmapid,data.data.id); - init3d(editmapid,data.data); - }else{ - initobj(editmapid,data.data.id); - } - - }else{ - let params = {mapId:editmapid}; - - set3dMapData(params).then(data => { - if(data.code == "200"){ - //console.log("创建三维数据成功"); - // console.log(data); - initobj(editmapid,data.data.id); - - } - }).catch(error => { - console.log(error); - }); - } - - }).catch(error => { - console.log(error); - }); - - function initobj(mapid,data3did){ - // console.log(mapid); - // console.log(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 init3d(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/editmodel/LinkList.js b/src/jlmap3d/edit/editmodel/LinkList.js deleted file mode 100644 index a4b100395..000000000 --- a/src/jlmap3d/edit/editmodel/LinkList.js +++ /dev/null @@ -1,315 +0,0 @@ - -export function LinkList(data){ - - let scope = this; - - this.type = "linklist"; - - this.linkdata = []; - - this.linksgroup = new THREE.Group(); - this.linksgroup.name = "link"; - - this.initpromise = function(linkdata,scene,assetloader){ - return new Promise(function(resolve, reject){ - linkhelp(linkdata,scene); - - scene.add(scope.linksgroup); - linktest(linkdata,scene,assetloader); - resolve("loadedrealsection"); - }); - }; - - this.loadpromise = function(linkdata,netlink,scene,assetloader){ - return new Promise(function(resolve, reject){ - scene.add(scope.linksgroup); - loadlink(linkdata,netlink,scene,assetloader); - resolve("loadedrealsection"); - }); - }; - -function linkhelp(data,scene){ - let groups = new THREE.Group(); - for(let i=0;i0.49){ - rightlist.push(i); - } - if(autorail.geometry.attributes.position.array[i*3] <-0.49){ - leftlist.push(i); - } - } - - - - for(let i=0;i0.49){ - rightlist.push(i); - } - if(autorail.geometry.attributes.position.array[i*3] <-0.49){ - leftlist.push(i); - } - } - - autorail.rightlist = rightlist; - autorail.leftlist = leftlist; - - - let reallinks = []; - let testlink; - testlink = data; - if(data){ - let index,startdata; - for(let n=0;n=0){ - if(reallinks[i].leftFdCode == data[j].code){ - buildmodel(data[j],reallinks[i],j,"left"); - reallinks.push(data[j]); - data.splice(j,1); - j--; - } - } - if(reallinks[i].leftSdCode && j>=0){ - - if(reallinks[i].leftSdCode == data[j].code){ - buildmodel(data[j],reallinks[i],j,"left"); - reallinks.push(data[j]); - data.splice(j,1); - j--; - } - } - - if(reallinks[i].rightFdCode && j>=0){ - if(reallinks[i].rightFdCode == data[j].code){ - - buildmodel(data[j],reallinks[i],j,"right"); - reallinks.push(data[j]); - data.splice(j,1); - j--; - } - } - - if(reallinks[i].rightSdCode && j>=0){ - if(reallinks[i].rightSdCode == data[j].code){ - buildmodel(data[j],reallinks[i],j,"right"); - reallinks.push(data[j]); - data.splice(j,1); - j--; - } - } - - } - } - - function buildmodel(data,mdata,sx,direct){ - let len = data.lengthFact; - - let testmesh2 = autorail.clone(true); - for(let i=0;idata.rp.y){ - testmesh2.rotation.z = 0.218; - data.lp.x = data.rp.x - (data.lengthFact)*Math.cos(testmesh2.rotation.z); - data.lp.y = data.rp.y + (data.lengthFact)*Math.sin(testmesh2.rotation.z); - }else if(data.lp.ydata.rp.y){ - testmesh2.rotation.z = 0.218; - data.rp.x = data.lp.x+(data.lengthFact)*Math.cos(testmesh2.rotation.z); - data.rp.y = data.lp.y-(data.lengthFact)*Math.sin(testmesh2.rotation.z); - }else if(data.lp.yswitchlist[i].pb[0].x){ - if(((switchlist[i].pc[0].y+switchlist[i].pc[1].y)/2) < switchlist[i].pa[0].y){ - if(((switchlist[i].pc[0].x+switchlist[i].pc[1].x)/2)>switchlist[i].pa[0].x){ - testswitch = switchmesh1.clone(true); - }else{ - testswitch = switchmesh2.clone(true); - } - }else{ - if(((switchlist[i].pc[0].x+switchlist[i].pc[1].x)/2)>switchlist[i].pa[0].x){ - testswitch = switchmesh2.clone(true); - }else{ - testswitch = switchmesh1.clone(true); - } - testswitch.rotation.y = Math.PI; - } - switchposx = (saleftpoint+sbrightpoint)/2; - }else{ - if(((switchlist[i].pc[0].y+switchlist[i].pc[1].y)/2) < switchlist[i].pa[1].y){ - if(((switchlist[i].pc[0].x+switchlist[i].pc[1].x)/2)>switchlist[i].pa[1].x){ - testswitch = switchmesh1.clone(true); - }else{ - testswitch = switchmesh2.clone(true); - } - }else{ - if(((switchlist[i].pc[0].x+switchlist[i].pc[1].x)/2)>switchlist[i].pa[1].x){ - testswitch = switchmesh2.clone(true); - }else{ - testswitch = switchmesh1.clone(true); - } - testswitch.rotation.y = Math.PI; - } - switchposx = (sarightpoint+sbleftpoint)/2; - } - - sectionA.matrixAutoUpdate = false; - - - testswitch.position.x = switchposx; - testswitch.position.y = 0; - testswitch.position.z = switchposz; - - scope.switchs.modellist.push(testswitch); - scope.switchgroup.add(testswitch); - } - - resolve("loadersection"); - }); - - } - - this.sectionpromise = function(linkdata,linklist,sectiondata,switchdata,standsdata,scene){ - // console.log(linkdata); - // console.log(linklist); - // console.log(sectiondata); - console.log(standsdata); - return new Promise(function(resolve, reject){ - let linkrail = []; - let switchrail = []; - for(let i=0;i0){ - let testline = new THREE.CatmullRomCurve3([ - new THREE.Vector3(linkrail[linkdata[i].code].lp.x,0,linkrail[linkdata[i].code].lp.z), - new THREE.Vector3(linkrail[linkdata[i].code].rp.x,0,linkrail[linkdata[i].code].rp.z) - ]); - - linkrail[linkdata[i].code].type = 1; - if(linkrail[linkdata[i].code].lswitch){ - let switchpoint = switchrail[linkrail[linkdata[i].code].lswitch].position; - linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z)); - linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+1.5,0,switchpoint.z)); - linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+2,0,switchpoint.z-0.01)); - linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+3.5,0,switchpoint.z-0.05)); - } - - linkrail[linkdata[i].code].points.push(testline.getPointAt(0.12)); - linkrail[linkdata[i].code].points.push(testline.getPointAt(0.22)); - linkrail[linkdata[i].code].points.push(testline.getPointAt(0.82)); - linkrail[linkdata[i].code].points.push(testline.getPointAt(0.92)); - - if(linkrail[linkdata[i].code].rswitch){ - let switchpoint = switchrail[linkrail[linkdata[i].code].rswitch].position; - linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-3.5,0,switchpoint.z+0.05)); - linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-2,0,switchpoint.z+0.01)); - linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-1.5,0,switchpoint.z)); - linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z)); - } - - }else{ - let testline = new THREE.CatmullRomCurve3([ - new THREE.Vector3(linkrail[linkdata[i].code].lp.x,0,linkrail[linkdata[i].code].lp.z), - new THREE.Vector3(linkrail[linkdata[i].code].rp.x,0,linkrail[linkdata[i].code].rp.z) - ]); - linkrail[linkdata[i].code].type = 2; - if(linkrail[linkdata[i].code].lswitch){ - let switchpoint = switchrail[linkrail[linkdata[i].code].lswitch].position; - linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z)); - linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+1.5,0,switchpoint.z)); - linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+2,0,switchpoint.z+0.01)); - linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x+3.5,0,switchpoint.z+0.05)); - } - - linkrail[linkdata[i].code].points.push(testline.getPointAt(0.12)); - linkrail[linkdata[i].code].points.push(testline.getPointAt(0.22)); - linkrail[linkdata[i].code].points.push(testline.getPointAt(0.82)); - linkrail[linkdata[i].code].points.push(testline.getPointAt(0.92)); - - if(linkrail[linkdata[i].code].rswitch){ - let switchpoint = switchrail[linkrail[linkdata[i].code].rswitch].position; - linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-3.5,0,switchpoint.z-0.05)); - linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-2,0,switchpoint.z-0.01)); - linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x-1.5,0,switchpoint.z)); - linkrail[linkdata[i].code].points.push(new THREE.Vector3(switchpoint.x,0,switchpoint.z)); - } - } - } - - } - - for(let i=0;i{ - rightpoints.push(item); - } - ); - rightpoints.reverse(); - linkrail[linkdata[i].code].lineright = new THREE.CatmullRomCurve3(rightpoints); - linkrail[linkdata[i].code].lineright.curveType = "centripetal"; - - // scope.linkrail[linkdata[i].code].lineright.tension = 0.11; - var points = linkrail[linkdata[i].code].lineleft.getPoints( 50 ); - var geometry = new THREE.BufferGeometry().setFromPoints( points ); - var material; - if(linkrail[linkdata[i].code].type == 0){ - material = new THREE.LineBasicMaterial( { color : 0xff0000 } ); - } - if(linkrail[linkdata[i].code].type == 1){ - material = new THREE.LineBasicMaterial( { color : 0x00ff00 } ); - } - if(linkrail[linkdata[i].code].type == 2){ - material = new THREE.LineBasicMaterial( { color : 0x0000ff } ); - } - - - // Create the final object to add to the scene - var curveObject = new THREE.Line( geometry, material ); - - curveObject.position.y = Math.random(); - scene.add(curveObject); - } - - let standsections = []; - for(let i=0,len=sectiondata.length;istandsdata[n].position.z){ - circle1.position.x = standsdata[n].position.x-64; - circle1.position.y = 5; - circle1.position.z = linkrail[linklist[j].code].points[0].z; - circle1.rotation.x = -Math.PI/2; - - circle2.position.x = standsdata[n].position.x+64; - circle2.position.y = 5; - circle2.position.z = linkrail[linklist[j].code].points[0].z-(linkrail[linklist[j].code].points[0].z-standsdata[n].position.z)*2; - circle2.rotation.x = -Math.PI/2; - }else{ - circle1.position.x = standsdata[n].position.x+64; - circle1.position.y = 5; - circle1.position.z = linkrail[linklist[j].code].points[0].z+(standsdata[n].position.z-linkrail[linklist[j].code].points[0].z)*2; - circle1.rotation.x = -Math.PI/2; - - circle2.position.x = standsdata[n].position.x-64; - circle2.position.y = 5; - circle2.position.z = linkrail[linklist[j].code].points[0].z; - circle2.rotation.x = -Math.PI/2; - } - - - scene.add( circle1 ); - scene.add( circle2 ); - n = lenn; - } - } - // console.log(standsections[i]); - // console.log(linklist[j]); - // console.log("===================================="); - - let progress1 = standsections[i].leftStopPointOffset/linklist[j].lengthFact; - let progress2 = standsections[i].rightStopPointOffset/linklist[j].lengthFact; - - let point1 = linkrail[linklist[j].code].lineleft.getPointAt(progress1); - - var geometry = new THREE.CircleGeometry( 2, 16 ); - var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); - let circle1 = new THREE.Mesh( geometry, material ); - circle1.position.x = point1.x; - circle1.position.y = point1.y; - circle1.position.z = point1.z; - circle1.rotation.x = -Math.PI/2; - scene.add( circle1 ); - - let point2 = linkrail[linklist[j].code].lineleft.getPointAt(progress2); - let circle2 = new THREE.Mesh( geometry, material ); - circle2.position.x = point2.x; - circle2.position.y = point2.y; - circle2.position.z = point2.z; - circle2.rotation.x = -Math.PI/2; - scene.add( circle2 ); - // console.log(progress1); - // console.log(progress2); - // console.log(standsections[i].leftStopPointOffset); - // console.log(standsections[i].rightStopPointOffset); - // console.log(linklist[j].lengthFact); - // console.log(linkrail[linklist[j].code].lineleft.points); - // console.log(point1); - // console.log(point2); - // console.log("===================================="); - - j = lenj; - - - - } - } - } - resolve("loadersection"); - }); - - } - // - // this.init = function(sectiondata,switchdata,scene){ - // - // //遍历区段 - // for(let i=0;iswitchdata[i].pb[0].x){ - if(((switchdata[i].pc[0].y+switchdata[i].pc[1].y)/2) < switchdata[i].pa[0].y){ - if(((switchdata[i].pc[0].x+switchdata[i].pc[1].x)/2)>switchdata[i].pa[0].x){ - testswitch = switchmesh1.clone(true); - }else{ - testswitch = switchmesh2.clone(true); - } - }else{ - if(((switchdata[i].pc[0].x+switchdata[i].pc[1].x)/2)>switchdata[i].pa[0].x){ - testswitch = switchmesh2.clone(true); - }else{ - testswitch = switchmesh1.clone(true); - } - testswitch.rotation.z = Math.PI; - } - }else{ - if(((switchdata[i].pc[0].y+switchdata[i].pc[1].y)/2) < switchdata[i].pa[1].y){ - if(((switchdata[i].pc[0].x+switchdata[i].pc[1].x)/2)>switchdata[i].pa[1].x){ - testswitch = switchmesh1.clone(true); - }else{ - testswitch = switchmesh2.clone(true); - } - }else{ - if(((switchdata[i].pc[0].x+switchdata[i].pc[1].x)/2)>switchdata[i].pa[1].x){ - testswitch = switchmesh2.clone(true); - }else{ - testswitch = switchmesh1.clone(true); - } - testswitch.rotation.z = Math.PI; - } - } - - 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; - - scope.switchs.datalist.push(newswitch); - scope.switchs.modellist.push(testswitch); - scope.switchgroup.add(testswitch); - } - - resolve("loadersection"); - }); - - } - - function buildsuidao(linkdata,suidaodata,assetloader,scene){ - let autosuidao; - for(let i=0;i7){ - rightlist.push(i); - if(autosuidao.geometry.attributes.position.array[i*3] > rightpoint){ - rightpoint = i; - } - } - if(autosuidao.geometry.attributes.position.array[i*3] <-7){ - leftlist.push(i); - if(autosuidao.geometry.attributes.position.array[i*3] < rightpoint){ - leftpoint = i; - } - } - } - autosuidao.rightlist = rightlist; - autosuidao.leftlist = leftlist; - autosuidao.rightpoint = rightpoint; - autosuidao.leftpoint = leftpoint; - // console.log(autosuidao); - // console.log(linkdata.linksgroup.children); - // console.log(suidaodata.datalist); - for(let i = 0;i < suidaodata.datalist.length;i++){ - let link = linkdata.linksgroup.getObjectByProperty("code",suidaodata.datalist[i].linkCode); - let suidao = suidaodata.datalist[i]; - let len = suidao.offsetRight-suidao.offsetLeft; - // console.log("-------------------------------------"); - // console.log("name:"+link.name); - // console.log(link.lengthfact); - // console.log(len); - // console.log("ofl:"+suidao.offsetLeft+" "+"ofr:"+suidao.offsetRight); - // console.log("-------------------------------------"); - - let testmesh1 = autosuidao.clone(true); - for(let i=0;i link.rp.y){ - testmesh1.position.z = link.lp.y-suidao.offsetLeft*(len/lenfact) + (link.rp.y-link.lp.y)*(len/lenfact)/2; - }else{ - testmesh1.position.z = link.lp.y+suidao.offsetLeft*(len/lenfact) + (link.rp.y-link.lp.y)*(len/lenfact)/2; - } - }else{ - testmesh1.position.x = link.lp.x+suidao.offsetLeft+len/2; - testmesh1.position.z = link.position.z; - } - testmesh1.position.y = 3.5; - // testmesh1.rotation.x = Math.PI/4; - testmesh1.code = suidaodata.datalist[i].code; - 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.rightlist = autosuidao.rightlist; - testmesh1.leftlist = autosuidao.leftlist; - testmesh1.rightpoint = autosuidao.rightpoint; - testmesh1.leftpoint = autosuidao.leftpoint; - testmesh1.isStandTrack = suidaodata.datalist[i].isStandTrack; - testmesh1.lengthfact = len; - testmesh1.linkCode = suidao.linkCode; - if(suidaodata.datalist[i].isStandTrack == false){ - scope.sectiongroup.add(testmesh1); - - }else{ - scope.standtrack.push(testmesh1); - var box = new THREE.BoxHelper( testmesh1, 0xff0000 ); - scope.sectiongroup.add( box ); - } - scope.sections.modellist.push(testmesh1); - } - } - - this.resetsection = function(scene){ - scene.remove(scope.sectiongroup); - }; - - this.reposition = function(){ - - } - - - this.update = function(){ - - } - - this.renderon = function(){ - - } - - this.renderoff = function(){ - - } - - this.dispose = function(){ - - } - -} diff --git a/src/jlmap3d/edit/editmodel/SectionModel.js b/src/jlmap3d/edit/editmodel/SectionModel.js deleted file mode 100644 index 9ba9abb07..000000000 --- a/src/jlmap3d/edit/editmodel/SectionModel.js +++ /dev/null @@ -1,26 +0,0 @@ -export function SectionModel(data) { - var scope = this; - //命名 - this.name = null; - //code - this.code = null; - //索引位置 - this.index = null; - //轨迹点 - this.rail = []; - - this.railline = null; - //长度 - this.distance = []; - - this.isStandTrack = null; - - this.type = null; - //指向模型 - this.mesh = null; - // //模型地址 - // this.meshurl = null; - // //贴图地址 - // this.picurl = null; - -} diff --git a/src/jlmap3d/edit/editmodel/SignalList.js b/src/jlmap3d/edit/editmodel/SignalList.js deleted file mode 100644 index 06e6d98d6..000000000 --- a/src/jlmap3d/edit/editmodel/SignalList.js +++ /dev/null @@ -1,222 +0,0 @@ -import {SignalModel} from '@/jlmap3d/edit/editmodel/SignalModel.js'; - -export function SignalList() { - - let scope = this; - - this.type = "signallist"; - - this.list = []; - - this.group = new THREE.Group(); - - this.initpromise = function(jlmap3ddata,data,scene,assetloader,netdata){ - return new Promise(function(resolve, reject){ - scope.group.name = "signal"; - //遍历信号数据 - let netsignal = null; - let haddata = false; - if(netdata){ - netsignal = JSON.parse(netdata); - haddata = true; - } - let linkdata = jlmap3ddata.linklist; - for(let i=0;i link.lengthfact/2){ - posx = link.position.x + data[i].offset - link.lengthfact/2-10; - }else{ - posx = link.position.x - (link.lengthfact/2 - data[i].offset)+10; - } - //根据线路方向修改信号灯位置 - if(data[i].directionType == "01"){ - newmesh.position.set(posx,0,link.position.z-3); - newmesh.rotation.z = ( Math.PI / 2 ); - }else if(data[i].directionType == "02"){ - newmesh.position.set(posx,0,link.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.offset = data[i].offset; - newmest.linkCode = data[i].linkCode; - newsignal.mesh = newmesh; - newsignal.offset = data[i].offset; - newsignal.mesh.status = "01"; - scope.group.add(newsignal.mesh); - scope.list.push(newsignal); - - }else{ - for(let j=0;j0.49){ - rightlist.push(i); - } - if(autorail.geometry.attributes.position.array[i*3] <-0.49){ - leftlist.push(i); - } - } - autorail.rightlist = rightlist; - autorail.leftlist = leftlist; - - return new Promise(function(resolve, reject){ - // scene.add(scope.sectiondata); - scene.add(scope.sectiongroup); - - - //收集需要显示区段 - for(let i=0;i sectiondata[i].points[sectiondata[i].points.length-1].y){ - // newsection.iscur = "1"; - // }else if(sectiondata[i].points[0].y < sectiondata[i].points[sectiondata[i].points.length-1].y){ - // newsection.iscur = "2"; - // }else{ - // newsection.iscur = "3"; - // } - // console.log(scope.sections.datalist[sectiondata[i].code]); - if(sectiondata[i].standTrack == true){ - sectiondata[i].startx = sectiondata[i].points[0].x; - sectiondata[i].starty = sectiondata[i].points[0].y; - scope.sections.datalist[sectiondata[i].code].lengthFact = 134; - sectiondata[i].lengthFact = 134; - // console.log(sectiondata[i].lengthFact); - scope.stopsection.push(sectiondata[i]); - } - // sections.modellist.push(""); - } - } - - //连接区段 - 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; - } - } - - if(scope.sections.datalist[acode].rsection == "" || scope.sections.datalist[acode].rsection == undefined){ - scope.sections.datalist[acode].rsection = bcode; - scope.sections.datalist[acode].csection = ccode; - }else if(scope.sections.datalist[acode].lsection == "" || scope.sections.datalist[acode].lsection == undefined){ - scope.sections.datalist[acode].lsection = bcode; - scope.sections.datalist[acode].csection = ccode; - } - - if(scope.sections.datalist[bcode].rsection == "" || scope.sections.datalist[bcode].rsection == undefined){ - scope.sections.datalist[bcode].rsection = acode; - }else 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; - } - } - - - // console.log(scope.sections.datalist); - // console.log(scope.stopsection); - let stationlist = jlmap3ddata.stationstandlist.list; - console.log(jlmap3ddata.stationstandlist.list); - let stopsections = []; - - - for(let i=0,leni = stationlist.length;i scope.stopsection[i+1].starty){ - // realstopsection.topsection = scope.stopsection[i+1]; - // realstopsection.downsection = scope.stopsection[i]; - // }else{ - // realstopsection.topsection = scope.stopsection[i]; - // realstopsection.downsection = scope.stopsection[i+1]; - // } - // stopsections.push(realstopsection); - // i=i+2; - // } - // - // }else{ - // alert("erro stopsection length"); - // } - - let leng1 = 0; - let leng2 = 0; - for(let i=0,leni=stopsections.length;i downresults.distance){ - let offset = topresults.distance - downresults.distance; - console.log(downresults.findarray); - for(let n=0,lenn= downresults.findarray.length;nmaxsection){ - maxlengthfact = downresults.findarray[n].lengthFact; - console.log(n); - - - maxsection = downresults.findarray[n]; - } - } - console.log(maxsection); - scope.sections.datalist[maxsection.code].lengthFact += offset; - }else if(topresults.distance < downresults.distance){ - let offset = downresults.distance - topresults.distance; - for(let n=0,lenn= topresults.findarray.length;nmaxsection){ - maxlengthfact = topresults.findarray[n].lengthFact; - maxsection = topresults.findarray[n]; - } - } - scope.sections.datalist[maxsection.code].lengthFact += offset; - } - - } - } - - let topstartpoint = { - x:stopsections[0].topsection.points[0].x, - y:0, - z:stopsections[0].topsection.points[0].y - }; - - let downstartpoint = { - x:stopsections[0].downsection.points[0].x, - y:0, - z:stopsections[0].downsection.points[0].y - }; - console.log(stopsections[1].topsection.lengthFact); - createsection(autorail,topstartpoint,stopsections[0].topsection.code,stopsections[1].topsection.code,0); - createsection(autorail,downstartpoint,stopsections[0].downsection.code,stopsections[1].downsection.code,34.8); - for(let i=1,leni=stopsections.length;idata.points[data.pointslength].y){ - testmesh2.rotation.z = 0.2193; - data.rp.x = data.lp.x+(data.lengthFact)*Math.cos(testmesh2.rotation.z); - data.rp.z = data.lp.z-(data.lengthFact)*Math.sin(testmesh2.rotation.z); - - }else if(data.points[0].ydata.points[data.pointslength].y){ - testmesh2.rotation.z = 0.2193; - data.lp.x = data.rp.x - (data.lengthFact)*Math.cos(testmesh2.rotation.z); - data.lp.z = data.rp.z + (data.lengthFact)*Math.sin(testmesh2.rotation.z); - }else if(data.points[0].ydata.points[data.pointslength].y){ - testmesh2.rotation.z = 0.2193; - data.lp.x = data.rp.x - (data.lengthFact)*Math.cos(testmesh2.rotation.z); - data.lp.z = data.rp.z + (data.lengthFact)*Math.sin(testmesh2.rotation.z); - }else if(data.points[0].ydata.points[data.pointslength].y){ - testmesh2.rotation.z = 0.2193; - data.rp.x = data.lp.x+(data.lengthFact)*Math.cos(testmesh2.rotation.z); - data.rp.z = data.lp.z-(data.lengthFact)*Math.sin(testmesh2.rotation.z); - }else if(data.points[0].y2){ - // 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[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 ); - 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; - // 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/neweditmodel/SwitchModel.js b/src/jlmap3d/edit/neweditmodel/SwitchModel.js deleted file mode 100644 index bd8e452a3..000000000 --- a/src/jlmap3d/edit/neweditmodel/SwitchModel.js +++ /dev/null @@ -1,22 +0,0 @@ -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/neweditmodel/TrainModel.js b/src/jlmap3d/edit/neweditmodel/TrainModel.js deleted file mode 100644 index 7bf6a92cb..000000000 --- a/src/jlmap3d/edit/neweditmodel/TrainModel.js +++ /dev/null @@ -1,8 +0,0 @@ -export function TrainModel(opts) { - - var scope = this; - - this.mesh = null; - this.meshurl = null; - this.picurl = null; -} diff --git a/src/jlmap3d/edit/testEditorModel/SectionList.js b/src/jlmap3d/edit/testEditorModel/SectionList.js index 5f43109e3..0113f0556 100644 --- a/src/jlmap3d/edit/testEditorModel/SectionList.js +++ b/src/jlmap3d/edit/testEditorModel/SectionList.js @@ -1027,7 +1027,7 @@ export function SectionList() { let ccode = switch2d[i].sectionCCode; // console.log(switchdata[i]); - console.log(scope.sections.datalist[acode]); + // console.log(scope.sections.datalist[acode]); let aposx = (scope.sections.datalist[acode].points[0].x + scope.sections.datalist[acode].points[scope.sections.datalist[acode].pointslength].x)/2; let cposx = (scope.sections.datalist[ccode].points[0].x + scope.sections.datalist[ccode].points[scope.sections.datalist[ccode].pointslength].x)/2; diff --git a/src/jlmap3d/edit/testEditorModel/StationStandList.js b/src/jlmap3d/edit/testEditorModel/StationStandList.js index 5cc7e5e1d..b9f2537c8 100644 --- a/src/jlmap3d/edit/testEditorModel/StationStandList.js +++ b/src/jlmap3d/edit/testEditorModel/StationStandList.js @@ -90,7 +90,7 @@ export function StationStandList() { this.loadpromise = function(jlmap3ddata,standsdata,jlmapstanddata,scene,assetloader){ return new Promise(function(resolve, reject){ // console.log(jlmap3ddata); - // console.log(standsdata); + console.log(standsdata); // console.log(jlmapstanddata); let stations = jlmap3ddata.stationstandlist.list; let num;