diff --git a/src/jlmap3d/config/SetCamera.js b/src/jlmap3d/config/SetCamera.js index 4b90e1d8f..7a41dfeca 100644 --- a/src/jlmap3d/config/SetCamera.js +++ b/src/jlmap3d/config/SetCamera.js @@ -1,5 +1,5 @@ export function SetCamera(dom) { - var camera = new THREE.PerspectiveCamera(60, dom.clientWidth/dom.clientHeight, 1, 3000); + var camera = new THREE.PerspectiveCamera(60, dom.clientWidth/dom.clientHeight, 1, 2000); camera.position.set( 0, 0, 0 ); camera.aspect = window.innerWidth / window.innerHeight; camera.updateProjectionMatrix(); diff --git a/src/jlmap3d/config/SetRender.js b/src/jlmap3d/config/SetRender.js index 14578c220..d3ea52b76 100644 --- a/src/jlmap3d/config/SetRender.js +++ b/src/jlmap3d/config/SetRender.js @@ -1,9 +1,5 @@ export function SetRender(dom) { - var renderer = new THREE.WebGLRenderer({antialias: true}); + var renderer = new THREE.WebGLRenderer();//{antialias: true} renderer.setSize(dom.offsetWidth, dom.offsetHeight); - // renderer.gammaInput = true; - // renderer.gammaOutput = true; - // renderer.setPixelRatio( window.devicePixelRatio ); - //renderer.setSize( window.innerWidth, window.innerHeight ); return renderer; } diff --git a/src/jlmap3d/config/SetScene.js b/src/jlmap3d/config/SetScene.js index b7efb6c30..96abfbedb 100644 --- a/src/jlmap3d/config/SetScene.js +++ b/src/jlmap3d/config/SetScene.js @@ -13,11 +13,11 @@ export function SetScene(project) { var bgTexture; // console.log(project); if(project == "login" || project == undefined){ - bgTexture = new THREE.TextureLoader().load("../../static/background/background.jpg"); + bgTexture = new THREE.TextureLoader().load("../../static/background/other.jpg"); }else if(project == "hyd"){ bgTexture = new THREE.TextureLoader().load("../../static/background/other.jpg"); } scene.background = bgTexture; - // cubeTexture.dispose(); + // cubeTexture.dispos e(); return scene; } diff --git a/src/jlmap3d/edit/connect/getmodels.js b/src/jlmap3d/edit/connect/getmodels.js index 0ffbaf522..1e633d62e 100644 --- a/src/jlmap3d/edit/connect/getmodels.js +++ b/src/jlmap3d/edit/connect/getmodels.js @@ -56,7 +56,6 @@ export function getmodels(data) { // postmap.sections.link = JSON.stringify(links); //section隧道 - console.log(data.mapdata.sectionlist.sections); let sections = []; for(let i=0;i=0;an--){ + actions[code].down[an].reset(); + actions[code].down[an].time = actions[code].top[an]._clip.duration; + actions[code].down[an].timeScale = -1; + actions[code].down[an].play(); + } + }else if(trainlisttest.list[code].open != data.open && data.open == "1"){ + //console.log("open"); + trainlisttest.list[code].open = "1"; + for(let an=actions[code].down.length-1;an>=0;an--){ + actions[code].down[an].reset(); + actions[code].down[an].time = 0; + actions[code].down[an].timeScale = 1; + actions[code].down[an].play(); + } + } + }else{ + if (trainlisttest.list[code].open != data.open && data.open == '0') { + // console.log("close"); + trainlisttest.list[code].open = '0'; + for (let an=actions[code].top.length-1; an>=0; an--) { + actions[code].top[an].reset(); + actions[code].top[an].time = actions[code].top[an]._clip.duration; + actions[code].top[an].timeScale = -1; + actions[code].top[an].play(); + } + } else if (trainlisttest.list[code].open != data.open && data.open == '1') { + trainlisttest.list[code].open = "1"; + for(let an=actions[code].top.length-1;an>=0;an--){ + actions[code].top[an].reset(); + actions[code].top[an].time = 0; + actions[code].top[an].timeScale = 1; + actions[code].top[an].play(); + } + } + + } + + } function trainstatus(data){ // 遍历列车对象组 @@ -296,47 +366,6 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) { trainlisttest.list[code].driveMode = data.driveMode; trainlisttest.list[code].status = data.right; // 车门开关验证 - if(data.right == "1"){ - // console.log(data); - if (trainlisttest.list[code].doorCloseLock != data.doorCloseLock && data.doorCloseLock == '1') { - // console.log("close"); - trainlisttest.list[code].doorCloseLock = '1'; - for (let an=actions[code].top.length-1; an>=0; an--) { - actions[code].top[an].reset(); - actions[code].top[an].time = actions[code].top[an]._clip.duration; - actions[code].top[an].timeScale = -1; - actions[code].top[an].play(); - } - } else if (trainlisttest.list[code].doorCloseLock != data.doorCloseLock && data.doorCloseLock == '0') { - trainlisttest.list[code].doorCloseLock = "0"; - for(let an=actions[code].down.length-1;an>=0;an--){ - actions[code].down[an].reset(); - actions[code].down[an].time = 0; - actions[code].down[an].timeScale = 1; - actions[code].down[an].play(); - } - } - }else{ - if(trainlisttest.list[code].doorCloseLock != data.doorCloseLock && data.doorCloseLock == "1"){ - //console.log("close"); - trainlisttest.list[code].doorCloseLock = "1"; - for(let an=actions[code].down.length-1;an>=0;an--){ - actions[code].down[an].reset(); - actions[code].down[an].time = actions[code].top[an]._clip.duration; - actions[code].down[an].timeScale = -1; - actions[code].down[an].play(); - } - }else if(trainlisttest.list[code].doorCloseLock != data.doorCloseLock && data.doorCloseLock == "0"){ - //console.log("open"); - trainlisttest.list[code].doorCloseLock = "0"; - for(let an=actions[code].down.length-1;an>=0;an--){ - actions[code].down[an].reset(); - actions[code].down[an].time = 0; - actions[code].down[an].timeScale = 1; - actions[code].down[an].play(); - } - } - } // 遍历获取所在轨道 @@ -370,7 +399,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) { trainlisttest.list[code].dispose = "1"; code = trainlisttest.group.children[i].name; trainlisttest.list[code].rotation.y = 0; - trainlisttest.list[code].doorCloseLock = '1'; + trainlisttest.list[code].open = '1'; trainlisttest.list[code].curve = null; trainlisttest.list[code].nextcurve = null; trainlisttest.list[code].speed = 0; diff --git a/src/jlmap3d/jl3dsimulation/connect/TrainingConnect.js b/src/jlmap3d/jl3dsimulation/connect/TrainingConnect.js new file mode 100644 index 000000000..d7013f4ff --- /dev/null +++ b/src/jlmap3d/jl3dsimulation/connect/TrainingConnect.js @@ -0,0 +1,744 @@ +import StompClient from '@/utils/sock'; + +// import { getTrainingCbtcDemon, runDiagramStart, runDiagramOver, setTrainingCbtcInitTime } from '@/api/simulation'; +// import { creatSubscribe, clearSubscribe, displayTopic, screenTopic } from '@/utils/stomp'; +import { getBaseUrl } from '@/utils/baseUrl' +import { getToken } from '@/utils/auth'; + +// 定于仿真socket接口 +export function Jlmap3dSubscribe(jlmap3d,routegroup,jsonwebwork) { + + const scope = this; + this.map = null; + + var trainlisttest = null; + var sectionlist = null; + var signallist = null; + var stationstandlist = null; + var sectionlist = null; + var materials = null; + var actions = null; + var rails = null; + var links = null; + + var scenes = null; + + var code = null; + + var drivingcode = null; + var drivingspeed = null; + var drivingaptspeed = null; + + let driverswitch = false; + + let stoptimer = null; + let num = 30; + let pointstand = null; + + let data = null; + // run as plane = 01; + // reset = 02; + + var datatype = '00'; + this.teststomp = new StompClient(); + this.topic = '/user/queue/simulation/jl3d/'+routegroup; + let header = {'X-Token': getToken() }; + let connectmsg = { + type:'init', + baseurl:getBaseUrl(), + topic:this.topic, + token:getToken(), + }; + jsonwebwork.postMessage(connectmsg); + jsonwebwork.onmessage = function (event) { + + // if(event.data.type == 'Simulation_Driver_Change'){ + // drivingcode = event.data.body.code; + // jlmap3d.updatedrivingcode( event.data.body.code); + // } + // if(data.type == 'Simulation_TrainSpeed'){ + // trainspeed(data); + // } + // console.log(event); + // if(event.data.type == 'SJL3D_TrainStatus'){ + // trainstatus(event.data); + // } + // if(event.data.type == 'Simulation_DeviceStatus'){ + // devicestatus(event.data); + // } + if(event.data._type == 'Simulation_Driver_Change'){ + drivingcode = event.data.body.code; + jlmap3d.updatedrivingcode( event.data.body.code); + } + if(event.data._type == 'Train'){ + // console.log(event.data); + trainstatus(event.data); + } + if (event.data._type== 'Signal' && signallist) { + // console.log(event.data); + signalupdate(event.data); + } + + if (event.data._type== 'StationStand' && actions) { + // console.log(event.data); + standupdate(event.data); + } + + if (event.data._type == 'Switch' && sectionlist) { + // console.log(event.data); + switchupdate(event.data); + } + // if(event.data._type = ''){ + // trainstatus(event.data); + // } + // if(event.data.type == 'Simulation_DeviceStatus'){ + // devicestatus(event.data); + // } + if(event.data.type == 'Simulation_Reset'){ + simulationreset(event.data); + } + }; + + // jsonwebwork.onmessage = function (event) { + // console.log(event.data); + // if(event.data.type == 'Simulation_Driver_Change'){ + // drivingcode = event.data.body.code; + // jlmap3d.updatedrivingcode( event.data.body.code); + // } + // // if(event.data.type == 'Simulation_TrainSpeed'){ + // // trainspeed(event.data); + // // } + // if(event.data.type == 'SJL3D_TrainStatus'){ + // trainstatus(event.data); + // } + // if(event.data.type == 'Simulation_DeviceStatus'){ + // devicestatus(event.data); + // } + // if(event.data.type == 'Simulation_Reset'){ + // simulationreset(event.data); + // } + // }; + + this.updatamap = function(newsectionlist,newlinklist,newsignallist,newstationstandlist,newtrainlisttest,newrealsectionlist,newrails, materiallist, nowaction, scene) { + // console.log(mapdata); + + trainlisttest = newtrainlisttest; + sectionlist = newsectionlist; + signallist = newsignallist; + stationstandlist = newstationstandlist; + materials = materiallist; + scenes = scene; + actions = nowaction; + links = newlinklist; + rails = newrails; + + }; + + this.socketon = function(topic) { + try { + // console.log("teststomp"); + // scope.teststomp.subscribe(topic, callback, header); + } catch (error) { + console.error('websocket订阅失败'); + } + + }; + + this.socketoff = function(topic) { + scope.teststomp.unsubscribe(topic); + for (let i=0; i=0; i--) { + // console.log(data.body[i]); + + // console.log(data); + // 遍历列车对象组 + if (trainlisttest) { + code = data.code; + // 剔除不显示的车 + // 找到对应列车 + + + if ( trainlisttest.list[code]) { + + trainlisttest.list[code].runMode = data.runMode; + // 车门开关验证 + // if(data.directionType == "02"){ + if (trainlisttest.list[code].doorStatus != data.doorStatus && data.doorStatus == '01') { + // console.log("close"); + trainlisttest.list[code].doorStatus = '01'; + for (let an=actions[code].top.length-1; an>=0; an--) { + actions[code].top[an].reset(); + actions[code].top[an].time = actions[code].top[an]._clip.duration; + actions[code].top[an].timeScale = -1; + actions[code].top[an].play(); + } + } else if (trainlisttest.list[code].doorStatus != data.doorStatus && data.doorStatus == '02') { + // console.log("open"); + trainlisttest.list[code].doorStatus = '02'; + for (let an=actions[code].top.length-1; an>=0; an--) { + actions[code].top[an].reset(); + actions[code].top[an].time = 0; + actions[code].top[an].timeScale = 1; + actions[code].top[an].play(); + } + } + // if(trainlisttest.list[code].doorStatus != data.doorStatus && data.doorStatus == "01"){ + // //console.log("close"); + // trainlisttest.list[code].doorStatus = "01"; + // for(let an=actions[code].down.length-1;an>=0;an--){ + // actions[code].down[an].reset(); + // actions[code].down[an].time = actions[code].top[an]._clip.duration; + // actions[code].down[an].timeScale = -1; + // actions[code].down[an].play(); + // } + // }else if(trainlisttest.list[code].doorStatus != data.doorStatus && data.doorStatus == "02"){ + // //console.log("open"); + // trainlisttest.list[code].doorStatus = "02"; + // for(let an=actions[code].down.length-1;an>=0;an--){ + // actions[code].down[an].reset(); + // actions[code].down[an].time = 0; + // actions[code].down[an].timeScale = 1; + // actions[code].down[an].play(); + // } + // } + // } + // 遍历获取所在轨道 + if (trainlisttest.list[code].dispose != data.dispose && data.dispose == false) { + + if (rails.linkrail[data.linkCode]) { + trainlisttest.group.add(trainlisttest.list[code]); + trainlisttest.list[code].position.y = 0; + // trainlisttest.list[code].progress = 0; + trainlisttest.list[code].dispose = false; + trainlisttest.list[code].nowcode = data.linkCode; + trainlisttest.list[code].nextcode = null; + trainlisttest.list[code].pc = 1; + + if(trainlisttest.list[code].mixerpush == false){ + for(let mi=0,lenmi=trainlisttest.list[code].mixer.length;mi=0; j--) { + if (rails.switchrail[code]) { + if (rails.switchrail[code].locateType != data.locateType) { + if (data.locateType == '02') { + if (actions[sectionlist.switchs.modellist[j].code]) { + sectionlist.switchs.modellist[j].locateType = data.locateType; + actions[sectionlist.switchs.modellist[j].code].reset(); + actions[sectionlist.switchs.modellist[j].code].time = 0; + actions[sectionlist.switchs.modellist[j].code].timeScale = 1; + actions[sectionlist.switchs.modellist[j].code].play(); + } + + rails.switchrail[code].locateType = "02"; + + let testswitch = rails.switchrail[code]; + // console.log(testswitch); + // console.log(rails.linkrail[testswitch.alink]); + // console.log(rails.linkrail[testswitch.clink]); + if(rails.switchrail[code].directtype == "1"){ + rails.linkrail[testswitch.alink].lconnect = testswitch.clink; + rails.linkrail[testswitch.clink].rconnect = testswitch.alink; + }else if(rails.switchrail[code].directtype == "2"){ + rails.linkrail[testswitch.alink].rconnect = testswitch.clink; + rails.linkrail[testswitch.clink].lconnect = testswitch.alink; + } + + } else if (data.locateType == '01') { + if (actions[sectionlist.switchs.modellist[j].code]) { + sectionlist.switchs.modellist[j].locateType = data.locateType; + actions[sectionlist.switchs.modellist[j].code].reset(); + actions[sectionlist.switchs.modellist[j].code].time = actions[sectionlist.switchs.modellist[j].code]._clip.duration; + actions[sectionlist.switchs.modellist[j].code].timeScale = -1; + actions[sectionlist.switchs.modellist[j].code].play(); + } + + rails.switchrail[code].locateType = "01"; + let testswitch = rails.switchrail[code]; + // console.log(testswitch); + // console.log(rails.linkrail[testswitch.alink]); + // console.log(rails.linkrail[testswitch.clink]); + if(rails.switchrail[code].directtype == "1"){ + rails.linkrail[testswitch.alink].lconnect = testswitch.blink; + rails.linkrail[testswitch.blink].rconnect = testswitch.alink; + }else if(rails.switchrail[code].directtype == "2"){ + rails.linkrail[testswitch.alink].rconnect = testswitch.blink; + rails.linkrail[testswitch.blink].lconnect = testswitch.alink; + } + + } + } + j = 0; + } + } + } + function simulationreset(data){ + for(let i=0;i0.02){ + let offset = Math.abs( point.z -parseFloat(worldpositionz)); + if(offset >0.02){ trainmodel.children[0].up = new THREE.Vector3(-1,0,0); let tangent = movecurve.getTangentAt(traindata.group.children[j].progress).normalize(); trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize(); @@ -35,55 +47,70 @@ export function UpdateTrainNew(camera,traindata){ rota:trainmodel.children[0].rotation.z } trainmodel.children[1].rotalist.push(rotas); + let offsetz = worldpositionz - parseFloat(point.z); - let offsetz = parseFloat(trainmodel.children[0].matrixWorld.elements[14]) - parseFloat(point.z); trainmodel.children[0].position.z += offsetz; - - } - - if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){ - for(let rs = 1;rs<6;rs++){ - if(trainmodel.children[rs].rotalist[0]){ - let offsetz = parseFloat(trainmodel.children[rs].matrixWorld.elements[14]) - parseFloat(trainmodel.children[rs].rotalist[0].posr.z); - - trainmodel.children[rs].position.z += offsetz; - - for(let xh=0;xh 0.95){ - trainmodel.progress += trainmodel.speeds; - } - - }else{ - trainmodel.progress += trainmodel.speeds; - } + // if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){ + // for(let rs = 1;rs<6;rs++){ + // if(trainmodel.children[rs].rotalist[0]){ + // let offsetz = parseFloat(trainmodel.children[rs].matrixWorld.elements[14]) - parseFloat(trainmodel.children[rs].rotalist[0].posr.z); + // + // trainmodel.children[rs].position.z += offsetz; + // + // for(let xh=0;xh 0.95){ + // + // trainmodel.progress += trainmodel.speeds; + // } + // + // }else{ + // trainmodel.progress += trainmodel.speeds; + // } } if(trainmodel.status == "0"){ let point = movecurve.getPointAt(trainmodel.progress); + trainmodel.children[0].updateMatrixWorld(true); + let worldpositionz = parseFloat(trainmodel.children[0].matrixWorld.elements[14]); + trainmodel.position.x = point.x; trainmodel.position.y = 0; - if(Math.abs( point.z -trainmodel.children[0].matrixWorld.elements[14]) >0.02){ + if(trainmodel.groupNumber == "020"){ + console.log("==============================="); + console.log(trainmodel.children[0]); + console.log(worldpositionz); + console.log(trainmodel.children[0].position.z); + console.log(point.z); + } + + if(Math.abs( point.z -parseFloat(worldpositionz)) >0.02){ trainmodel.children[0].up = new THREE.Vector3(1,0,0); let tangent = movecurve.getTangentAt(traindata.group.children[j].progress).normalize(); trainmodel.children[0].axis.crossVectors(trainmodel.children[0].up, tangent).normalize(); @@ -97,43 +124,48 @@ export function UpdateTrainNew(camera,traindata){ rota:trainmodel.children[0].rotation.z } trainmodel.children[1].rotalist.push(rotas); - let offsetz = parseFloat(point.z) - parseFloat(trainmodel.children[0].matrixWorld.elements[14]); + let offsetz = parseFloat(point.z) - parseFloat(worldpositionz); trainmodel.children[0].position.z += offsetz; - } - - if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){ - - for(let rs = 1;rs<6;rs++){ - if(trainmodel.children[rs].rotalist[0]){ - - let offsetz = parseFloat(trainmodel.children[rs].rotalist[0].posr.z) - parseFloat(trainmodel.children[rs].matrixWorld.elements[14]); - trainmodel.children[rs].position.z += offsetz; - - for(let xh=0;xh=trainmodel.children[rs].rotalist[0].posr.x){ - - if(rs != 5){ - let asd = trainmodel.children[rs].rotalist[0]; - trainmodel.children[rs+1].rotalist.push(asd); - - } - trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rota; - trainmodel.children[rs].rotalist.splice(0,1) - xh--; - }else{ - xh = trainmodel.children[rs].rotalist.length; - } - } - } + if(trainmodel.groupNumber == "020"){ + console.log(offsetz); + console.log(trainmodel.children[0].position.z); } } - if(trainmodel.statsstop == 0){ - if(trainmodel.progress < 0.95){ - trainmodel.progress += trainmodel.speeds; - } - }else{ - trainmodel.progress += trainmodel.speeds; - } + + // if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){ + // + // for(let rs = 1;rs<6;rs++){ + // if(trainmodel.children[rs].rotalist[0]){ + // + // let offsetz = parseFloat(trainmodel.children[rs].rotalist[0].posr.z) - parseFloat(trainmodel.children[rs].matrixWorld.elements[14]); + // trainmodel.children[rs].position.z += offsetz; + // + // for(let xh=0;xh=trainmodel.children[rs].rotalist[0].posr.x){ + // + // if(rs != 5){ + // let asd = trainmodel.children[rs].rotalist[0]; + // trainmodel.children[rs+1].rotalist.push(asd); + // + // } + // trainmodel.children[rs].rotation.z = trainmodel.children[rs].rotalist[0].rota; + // trainmodel.children[rs].rotalist.splice(0,1) + // xh--; + // }else{ + // xh = trainmodel.children[rs].rotalist.length; + // } + // } + // } + // } + // } + trainmodel.progress += trainmodel.speeds; + // if(trainmodel.statsstop == 0){ + // if(trainmodel.progress < 0.95){ + // trainmodel.progress += trainmodel.speeds; + // } + // }else{ + // trainmodel.progress += trainmodel.speeds; + // } } diff --git a/src/jlmap3d/jl3dsimulation/jlmap3d.js b/src/jlmap3d/jl3dsimulation/jlmap3d.js index 884b63806..e1acc0f71 100644 --- a/src/jlmap3d/jl3dsimulation/jlmap3d.js +++ b/src/jlmap3d/jl3dsimulation/jlmap3d.js @@ -44,8 +44,6 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) { let scope = this; this.dom = dom; - //渲染循环开关 - this.animateswitch = false; //初始化webgl渲染 let renderer = SetRender(dom); renderer.domElement.style.position = "absolute"; @@ -59,7 +57,7 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) { let controls = new THREE.OrbitControls(camera); controls.maxPolarAngle = Math.PI/2; //controls.minPolarAngle = Math.PI/8; - controls.maxDistance = 4800; + controls.maxDistance = 2000; //模型加载器 this.assetloader = new AssetLoader(); //替换材质组,例:信号机不同灯光 @@ -122,8 +120,8 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) { }); }); // - // let stats = new Stats(); - // dom.appendChild( stats.dom ); + let stats = new Stats(); + dom.appendChild( stats.dom ); // var timer = setInterval(function() { // if(trainlisttest){ @@ -161,7 +159,6 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) { // } // // }, 2000); - controls.upscene(scope.animateswitch); //开启渲染 animate(); startWorker(scope.webwork); @@ -174,17 +171,12 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) { //renderer.setAnimationLoop(animate); requestAnimationFrame(animate); //判断渲染是否开启 - // if(scope.animateswitch == true){ - // if(camera.position.y<4000){ - // - // } //根据相机渲染场景 renderer.render(scene,camera); - // console.log(scope.animateswitch); //检测动画构造器播放动画 // } - // stats.update(); + stats.update(); } function startWorker(webwork){ @@ -293,12 +285,10 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) { this.animateon = function(){ controls.enabled = true; - // scope.animateswitch = true; }; this.animateoff = function(){ controls.enabled = false; - // scope.animateswitch = false; }; this.loaderdata = function(loadsectionlist,loadlinklist,loadsignallist,loadstationstandlist,loadtrainlisttest,loadrealsectionlist,loadrails){ diff --git a/src/jlmap3d/main/control/OrbitControls.js b/src/jlmap3d/main/control/OrbitControls.js index 91f3245bc..b2b37acfa 100644 --- a/src/jlmap3d/main/control/OrbitControls.js +++ b/src/jlmap3d/main/control/OrbitControls.js @@ -133,10 +133,6 @@ THREE.OrbitControls = function ( object, domElement ) { scope.data.trainlisttest = newtrainlisttest; } - this.upscene = function(animateswitch){ - // scope.animateswitch = animateswitch; - } - // this method is exposed, but perhaps it would be better if we can make it private... this.update = function () { diff --git a/src/jlmap3d/main/control/ScalControls.js b/src/jlmap3d/main/control/ScalControls.js index 9adb87dad..14edb8315 100644 --- a/src/jlmap3d/main/control/ScalControls.js +++ b/src/jlmap3d/main/control/ScalControls.js @@ -142,7 +142,9 @@ THREE.ScalControls = function ( scene,_camera, _domElement ) { // _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]])*2+28; + // _movemesh.lengthfact = (_movemesh.geometry.attributes.position.array[_movemesh.rightlist[0]] - _movemesh.geometry.attributes.position.array[_movemesh.leftlist[0]])*2+28; + _movemesh.lengthFact = (_movemesh.geometry.attributes.position.array[_movemesh.rightlist[0]*3] - _movemesh.geometry.attributes.position.array[_movemesh.leftlist[0]*3]); + // testmesh2.position.z = 50; // testmesh2.geometry.center(); diff --git a/src/jlmap3d/main/loaders/SimulationLoadNew.js b/src/jlmap3d/main/loaders/SimulationLoadNew.js index ab68cdfc3..1d763f25b 100644 --- a/src/jlmap3d/main/loaders/SimulationLoadNew.js +++ b/src/jlmap3d/main/loaders/SimulationLoadNew.js @@ -29,7 +29,6 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce let backdata = scope; let jlmap3ddata = mapdata; let assetloader = scope.assetloader; - let animateswitch = scope.animateswitch; let mixers = scope.mixers; let actions = scope.actions; @@ -48,8 +47,7 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce } function initnew3d(data,netdata){ - console.log(data); - console.log(netdata); + let mapdata = data; //初始化轨道和道岔 // lengthfact(data); @@ -118,14 +116,13 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce // } // // - scope.animateswitch = true; - + console.log("scene+++++++++++++++++++++++++++++++++"); + console.log(sceneload); // // mapdata = jlmap3ddata; backdata.loaderdata(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails); scope.Subscribe.updatamap(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails,scope.materiallist,scope.actions,scope.sceneload); scope.webwork.postMessage("on"); - // console.log(stationstandlist); - scope.jsonwebworknew.postMessage("connect"); + scope.jsonwebworknew.postMessage("connect"); updatemenulist(stationstandlist.list,trainlisttest.list); loadingInstance.close(); }); diff --git a/src/jlmap3d/main/newmodel/SectionListN.js b/src/jlmap3d/main/newmodel/SectionListN.js index 4fc5349a6..e166d3c01 100644 --- a/src/jlmap3d/main/newmodel/SectionListN.js +++ b/src/jlmap3d/main/newmodel/SectionListN.js @@ -40,6 +40,7 @@ this.loadpromise = function(sectionList,sectiondata,scene,assetloader){ scene.add(scope.sectiongroup); return new Promise(function(resolve, reject){ // console.log(sectiondata); + let mergegeometry = new THREE.Geometry(); for(let i=0,leni = sectiondata.length;i