diff --git a/src/jlmap3d/jl3drailwaydrive/jl3drailwaydrive.js b/src/jlmap3d/jl3drailwaydrive/jl3drailwaydrive.js index 070818955..516063728 100644 --- a/src/jlmap3d/jl3drailwaydrive/jl3drailwaydrive.js +++ b/src/jlmap3d/jl3drailwaydrive/jl3drailwaydrive.js @@ -1,7 +1,7 @@ import Vue from 'vue'; import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js'; // 模型loader -import { AssetLoader } from '@/jlmap3d/main/loaders/AssetLoader.js'; +import { AssetLoader } from '@/jlmap3d/jl3drailwaydrive/loader/AssetLoader.js'; import {DDSLoader} from '@/jlmap3d/main/loaders/DDSLoader.js'; import {OBJLoader} from '@/jlmap3d/main/loaders/OBJLoader.js'; import {MTLLoader} from '@/jlmap3d/main/loaders/MTLLoader.js'; @@ -135,6 +135,8 @@ export function JLmapDriving(dom,data,mapId,storemod,translation,routegroup,proj // sound.play(); // }); + + let controls3 = new MouseControls(camera, 1.6); controls3.enabled = false; // controls3.getObject().rotation.x = Math.PI/2; diff --git a/src/jlmap3d/jl3drailwaydrive/loader/AssetLoader.js b/src/jlmap3d/jl3drailwaydrive/loader/AssetLoader.js new file mode 100644 index 000000000..e09c1d851 --- /dev/null +++ b/src/jlmap3d/jl3drailwaydrive/loader/AssetLoader.js @@ -0,0 +1,486 @@ +import { AssetModel } from '@/jlmap3d/main/loaders/model/Assetmodel'; +import { Assetmaterial } from '@/jlmap3d/main/loaders/model/Assetmaterial'; +import { getBaseUrl } from '@/utils/baseUrl'; +import { Loading } from 'element-ui'; +const BASE_API = getBaseUrl(); +import { JL3D_LOCAL_STATIC,BASE_ASSET_API } from '@/api/jlmap3d/assets3d.js'; + +let signal5 = { + id:"s1", + name:"竖5灯", + deviceType:"signal5", + type:"static", + mesh:"", + url:JL3D_LOCAL_STATIC+"/jl3d/railway/model/signal5.FBX" +} + +let signal32 = { + id:"s2", + name:"32灯", + deviceType:"signal32", + type:"static", + mesh:"", + url:JL3D_LOCAL_STATIC+"/jl3d/railway/model/signal32.FBX" +} + +let signal3 = { + id:"s3", + name:"3灯", + deviceType:"signal3", + type:"static", + mesh:"", + url:JL3D_LOCAL_STATIC+"/jl3d/railway/model/signal3.FBX" +} + +let signal2 = { + id:"s4", + name:"2灯", + deviceType:"signal2", + type:"static", + mesh:"", + url:JL3D_LOCAL_STATIC+"/jl3d/railway/model/signal2.FBX" +} + + +export function AssetLoader(){ + + let scope = this; + + this.name = null; + + this.trainoffset = 0; + + this.modellist = []; + this.modelgroup = []; + + this.materiallist = []; + + this.setModelListOver = function (data,trainoffset,others){ + + if(trainoffset){ + scope.trainoffset = trainoffset; + } + + let signal5model = new AssetModel(signal5); + scope.modellist.push(signal5); + + let signal32model = new AssetModel(signal32); + scope.modellist.push(signal32); + + let signal3model = new AssetModel(signal3); + scope.modellist.push(signal3); + + let signal2model = new AssetModel(signal2); + scope.modellist.push(signal2); + + + let modeldata = data; + + for(let j=0;j { + + resolve("loaderassets"); //['成功了', 'success'] + }).catch((error) => { + //console.log(error); + }); + + }); + } + + + this.assetpromise = function (scene){ + let initlist = []; + for(let i=0;i { + + resolve("loaderassets"); //['成功了', 'success'] + }).catch((error) => { + //console.log(error); + }); + + }); + } + + this.assetinit = function(scene){ + return new Promise(function(resolve, reject){ + let signal = new AssetModel(defaultsignal); + scope.modellist.push(signal); + + let train = new AssetModel(defaulttrain); + scope.modellist.push(train); + + let station = new AssetModel(defaultstation); + scope.modellist.push(station); + + let wstation = new AssetModel(waicestation); + scope.modellist.push(wstation); + + let autorail = new AssetModel(defaultautorail); + scope.modellist.push(autorail); + + let defaultswitch1 = new AssetModel(autoswitch1); + scope.modellist.push(defaultswitch1); + + let defaultswitch2 = new AssetModel(autoswitch2); + scope.modellist.push(defaultswitch2); + + + let autoswitchs = new AssetModel(autoswitch); + scope.modellist.push(autoswitchs); + + fbxpromise(signal) + .then(function(data){ + ////console.log(data); + // console.log("test"); + return fbxpromise(train); + }) + .then(function(data){ + ////console.log(data); + // console.log("test"); + return fbxpromise(station); + }) + .then(function(data){ + ////console.log(data); + // console.log("test"); + return fbxpromise(wstation); + }) + // .then(function(data){ + // ////console.log(data); + // return fbxpromise(autorail); + // }) + // .then(function(data){ + // ////console.log(data); + // return fbxpromise(autosuidao); + // }) + .then(function(data){ + ////console.log(data); + // console.log("defaultswitch1"); + return fbxpromise(defaultswitch1); + }) + .then(function(data){ + // console.log("defaultswitch2"); + ////console.log(data); + return fbxpromise(defaultswitch2); + }) + .then(function(data){ + ////console.log(data); + // console.log("autoswitchs"); + return fbxpromise(autoswitchs); + }) + .then(function(data){ + ////console.log(scope.modellist); + resolve("loaderassets"); + }); + }); + } + + this.loadnewsection = function(newdata,jlmap3dedit){ + let loadingInstance = Loading.service({ fullscreen: true }); + let scene = jlmap3dedit.scene; + let newmodel = new AssetModel(newdata); + let jlmap3ddata = jlmap3dedit.mapdata; + scope.modellist.push(newmodel); + + scene.remove(jlmap3dedit.exportmodel); + var loader = new THREE.FBXLoader(); + loader.load( newdata.assetUrl, function ( object ) { + + let newmesh = object; + + //let mixer = new THREE.AnimationMixer( newmesh ); + ////console.log(jlmap3ddata.sectionlist); + for(let i=0;i4){ + + let realtrain = new THREE.Group(); + let j = object.children.length; + for(j;j>0;j--){ + let name = "C"+j; + for(let i=0;i 1){ + for(let i=0,leni=standTextureData.urls.length;i0){ + // let testline = new THREE.CatmullRomCurve3([ + // new THREE.Vector3(scope.sectionrail[section[i].code].lp.x,0,scope.sectionrail[section[i].code].lp.z), + // new THREE.Vector3(scope.sectionrail[section[i].code].rp.x,0,scope.sectionrail[section[i].code].rp.z) + // ]); + // + // scope.sectionrail[section[i].code].type = "b"; + // if(scope.sectionrail[section[i].code].lswitch){ + // let switchpoint1 = scope.sectionrail[section[i].code].lp; + // scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint1.x,0,switchpoint1.z)); + // scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint1.x+0.5,0,switchpoint1.z)); + // scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint1.x+1,0,switchpoint1.z-0.02)); + // scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint1.x+1.5,0,switchpoint1.z-0.09)); + // // scope.sectionrail[section[i].code].points.push(testline.getPointAt(0.7)); + // scope.sectionrail[section[i].code].points.push(testline.getPointAt(1)); + // } + // + // + // + // if(scope.sectionrail[section[i].code].rswitch){ + // let switchpoint2 = scope.sectionrail[section[i].code].rp; + // scope.sectionrail[section[i].code].points.push(testline.getPointAt(0)); + // // scope.sectionrail[section[i].code].points.push(testline.getPointAt(0.3)); + // scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint2.x-1.5,0,switchpoint2.z+0.09)); + // scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint2.x-1,0,switchpoint2.z+0.02)); + // scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint2.x-0.5,0,switchpoint2.z)); + // scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint2.x,0,switchpoint2.z)); + // + // } + // + // }else{ + // let testline = new THREE.CatmullRomCurve3([ + // new THREE.Vector3(scope.sectionrail[section[i].code].lp.x,0,scope.sectionrail[section[i].code].lp.z), + // new THREE.Vector3(scope.sectionrail[section[i].code].rp.x,0,scope.sectionrail[section[i].code].rp.z) + // ]); + // scope.sectionrail[section[i].code].type = "c"; + // + // if(scope.sectionrail[section[i].code].lswitch){ + // let switchpoint1 = scope.sectionrail[section[i].code].lp; + // scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint1.x,0,switchpoint1.z)); + // scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint1.x+0.5,0,switchpoint1.z)); + // scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint1.x+1,0,switchpoint1.z+0.02)); + // scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint1.x+1.5,0,switchpoint1.z+0.09)); + // // scope.sectionrail[section[i].code].points.push(testline.getPointAt(0.7)); + // scope.sectionrail[section[i].code].points.push(testline.getPointAt(1)); + // } + // + // + // + // if(scope.sectionrail[section[i].code].rswitch){ + // let switchpoint2 = scope.sectionrail[section[i].code].rp; + // scope.sectionrail[section[i].code].points.push(testline.getPointAt(0)); + // // scope.sectionrail[section[i].code].points.push(testline.getPointAt(0.3)); + // scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint2.x-1.5,0,switchpoint2.z-0.09)); + // scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint2.x-1,0,switchpoint2.z-0.02)); + // scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint2.x-0.5,0,switchpoint2.z)); + // scope.sectionrail[section[i].code].points.push(new THREE.Vector3(switchpoint2.x,0,switchpoint2.z)); + // + // } + // + // } + // } + // + // } + // + + for(let i=0;i{ + rightpoints.push(item); + } + ); + rightpoints.reverse(); + scope.sectionrail[section[i].code].lineright = new THREE.CatmullRomCurve3(rightpoints); + scope.sectionrail[section[i].code].lineright.curveType = "chordal"; + scope.sectionrail[section[i].code].lineright.tension = 0.15; + scope.sectionrail[section[i].code].lineright.name = section[i].code; + if(section[i].standTrack == true){ + scope.sectionrail[section[i].code].standTrack = true; + // var geometry = new THREE.CircleGeometry( 5, 16 ); + // var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); + // var circle1 = new THREE.Mesh( geometry, material ); + // var circle2 = new THREE.Mesh( geometry, material ); + // circle1.position.x = scope.sectionrail[section[i].code].points[0].x; + // circle1.position.y = 5; + // circle1.position.z = scope.sectionrail[section[i].code].points[0].z; + // circle1.rotation.x = -Math.PI/2; + // circle2.position.x = scope.sectionrail[section[i].code].points[1].x; + // circle2.position.y = 5; + // circle2.position.z = scope.sectionrail[section[i].code].points[1].z; + // circle2.rotation.x = -Math.PI/2; + // scene.add( circle1 ); + // scene.add( circle2 ); + // console.log(scope.sectionrail[section[i].code]); + }else{ + scope.sectionrail[section[i].code].standTrack = false; + } + + // + // for(let n=0,nm=scope.sectionrail[section[i].code].lineleft.points.length;n0.49){ + // rightlist.push(i); + // } + // if(autorail.geometry.attributes.position.array[i*3] <-0.49){ + // leftlist.push(i); + // } + // } + // autorail.rightlist = rightlist; + // autorail.leftlist = leftlist; + 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;i2 + let len = newsection.lengthFact; + // let testmesh2 = autorail.clone(true); + // for(let i=0;i=3){ + // console.log(newsection); + let height = Math.random()/1000; + var closedSpline; + + if(Math.abs(newsection.railpoint[0].y-newsection.railpoint[2].y)>0.01){ + closedSpline = new THREE.CatmullRomCurve3( [ + new THREE.Vector3(newsection.railpoint[0].x,newsection.railpoint[0].y,newsection.railpoint[0].z), + new THREE.Vector3(newsection.railpoint[1].x,newsection.railpoint[1].y,newsection.railpoint[1].z+0.0001), + new THREE.Vector3(newsection.railpoint[2].x,newsection.railpoint[2].y,newsection.railpoint[2].z) + ] ); + }else{ + closedSpline = new THREE.CatmullRomCurve3( [ + new THREE.Vector3(newsection.railpoint[0].x,newsection.railpoint[2].y,newsection.railpoint[0].z), + new THREE.Vector3(newsection.railpoint[1].x,newsection.railpoint[2].y,newsection.railpoint[1].z+0.0001), + new THREE.Vector3(newsection.railpoint[2].x,newsection.railpoint[2].y,newsection.railpoint[2].z) + ] ); + } + + + + // closedSpline.type = 'catmullrom'; + closedSpline.curveType = "chordal"; + closedSpline.tension = 0.15; + closedSpline.closed = false; + var extrudeSettings = { + steps : 6, + curveSegments : 1, + bevelSegments : 1, + bevelEnabled : false, + extrudePath : closedSpline, + }; + var shape = new THREE.Shape(); + + len = closedSpline.getLength(); + + + if(Math.abs(newsection.railpoint[0].y - newsection.railpoint[2].y)>0.01){ + shape.moveTo( -2, 0 ); + shape.lineTo( 2, 0 ); + }else{ + shape.moveTo( 0,-2 ); + shape.lineTo( 0, 2 ); + } + var geometry = new THREE.ExtrudeBufferGeometry( shape, extrudeSettings ); + var mesh = new THREE.Mesh( geometry, selectmaterial ); + let count = mesh.geometry.attributes.position.count/3; + + for(let i=0;i val2) { + return 1; + } else { + return 0; + } +} +//canvas文字贴图方法 +//PS:待提炼 增强功能 +var stationcanvas = new Image(); +stationcanvas.src = JL3D_LOCAL_STATIC+"/texture/msgtnew.png"; +function getTextCanvas(text){ + let canvas = document.getElementById('canvastexture'); + + canvas.width = 128; + canvas.height = 256; + // canvas.style.width = width; + // canvas.style.height = height; + + let ctx = canvas.getContext('2d'); + //ctx.fillStyle = '#FFFFFF'; + ctx.fillRect(0, 0,128,256); + + ctx.fillStyle = '#FFFFFF'; + // ctx.textAlign = 'center'; + // ctx.textBaseline = 'middle'; + ctx.clearRect(0,0,128,256); + + ctx.drawImage(stationcanvas,0,0,128,256); + + ctx.font = "10px"; + ctx.fillText("车站: "+text.name, 15,25); + + ctx.fillText("漫游", 18,48); + ctx.fillText("信息", 54,48); + ctx.fillText("备忘", 93,48); + + ctx.fillText("车站序号: "+text.name, 10,115); + + ctx.fillText("公里标记:",10 ,135); + ctx.fillText(text.kmPost,10 ,155); + + let data = ctx.getImageData(0, 0,128,256); + return data; +} diff --git a/src/jlmap3d/jl3drailwaydrive/model/StationStandModel.js b/src/jlmap3d/jl3drailwaydrive/model/StationStandModel.js new file mode 100644 index 000000000..27a084ddf --- /dev/null +++ b/src/jlmap3d/jl3drailwaydrive/model/StationStandModel.js @@ -0,0 +1,35 @@ +export function StationStandModel(opts) { + + var scope = this; + + this.uuid = null; + this.code = null; + this.name = null; + this.modelid = null; + this.type = null; + this.inside = null; + this.ismodel = false; + this.istexture = false; + this.modelurl = null; + this.stands = []; + this.direction1= { + position:null, + name:null, + screenDoorOpenStatus:null, + mesh:null, + openpos:[], + closepos:[] + } + this.direction2= { + position:null, + name:null, + screenDoorOpenStatus:null, + mesh:null, + openpos:[], + closepos:[] + } + + this.mesh = null; + this.meshurl = null; + this.picurl = null; +} diff --git a/src/jlmap3d/jl3drailwaydrive/model/SwitchListN.js b/src/jlmap3d/jl3drailwaydrive/model/SwitchListN.js new file mode 100644 index 000000000..121bcd544 --- /dev/null +++ b/src/jlmap3d/jl3drailwaydrive/model/SwitchListN.js @@ -0,0 +1,67 @@ +import {SwitchModel} from '@/jlmap3d/main/newmodel/SwitchModel.js'; + +export function SwitchListN() { + + let scope = this; + this.type = "switchlist"; + + this.switchgroup = new THREE.Group(); + this.switchgroup.name = "switch"; + + this.switchs = { + datalist:[], + modellist:[] + }; + + this.loadpromise = function(jlmap3ddata,switchdata,scene,assetloader,mixers,actions){ + 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=0;n--){ + if(assetloader.modellist[n].type == "train"){ + + selectmesh = assetloader.modellist[n].mesh; + scope.trainmesh = assetloader.modellist[n].mesh; + // ntracks1 = assetloader.modellist[n].animations.slice(16,27); + // + // tclip = new THREE.AnimationClip("three",2,ntracks1); + // + // ntracks2 = assetloader.modellist[n].animations.slice(0,15); + // + // fclip = new THREE.AnimationClip("four",2,ntracks2); + + // ntracks2 = assetloader.modellist[n].animations.slice(6,14); + // + // fclip = new THREE.AnimationClip("four",2,ntracks2); + // + // ntracks1 = assetloader.modellist[n].animations.slice(0,6); + + tclip = new THREE.AnimationClip("three",2,assetloader.modellist[n].animations); + + n = 0; + } + } + + actionss["traindoor"] = { + top:[], + down:[] + }; + let newmesh = selectmesh.clone(true); + newmesh.mixer = []; + + for(let j=0;j=0;n--){ + if(assetloader.modellist[n].type == "train"){ + + selectmesh = assetloader.modellist[n].mesh; + // ntracks1 = assetloader.modellist[n].animations.slice(16,27); + // + // tclip = new THREE.AnimationClip("three",2,ntracks1); + // + // ntracks2 = assetloader.modellist[n].animations.slice(0,15); + // + // fclip = new THREE.AnimationClip("four",2,ntracks2); + + // ntracks2 = assetloader.modellist[n].animations.slice(6,14); + // + // fclip = new THREE.AnimationClip("four",2,ntracks2); + // + // ntracks1 = assetloader.modellist[n].animations.slice(0,6); + tclip = new THREE.AnimationClip("three",2,assetloader.modellist[n].animations); + n = 0; + } + } + + selectmesh.traverse( function ( child ) { + + if ( child.isMesh ) { + child.renderOrder = 8; + } + + } ); + + //遍历列车数据 + // console.log(data.length); + for(let i=0;i=1;n--){ + // newmesh.children[n].position.x = -76; + // newmesh.children[n-1].add(newmesh.children[n]); + // } + //创建列车字牌 + if(mode){ + if(mode == "02"){ + let textgeometry = new THREE.PlaneBufferGeometry( 64, 32, 1 ); + let textt = new THREE.CanvasTexture(getTextCanvas(data[i])); + let textmaterial = new THREE.MeshBasicMaterial( { + side: THREE.DoubleSide, + map:textt ,transparent: true, + alphaTest:0.1 + } ); + let textplane = new THREE.Mesh( textgeometry, textmaterial ); + textplane.name = data[i].groupNumber; + textplane.position.x = 0; + textplane.position.y = 0; + textplane.position.z = 20; + textplane.rotation.x = Math.PI/2; + textplane.tcode = data[i].code; + //textplane.rotation.x = Math.PI; + scope.textlist.push(textplane); + newmesh.children[0].add(textplane); + textgeometry.dispose(); + textmaterial.dispose(); + textt.dispose(); + } + } + + + + //group.add(textplane); + newmesh.first = false; + newmesh.name = data[i].groupNumber; + newmesh.rname = data[i].groupNumber; + newmesh.groupNumber = data[i].groupNumber; + + newmesh.position.set(0,-50000,0); + // newmesh.children[0].position.y = 0; + //newmesh.rotation.y = Math.PI/2; + newmesh.status = "00"; + newmesh.nowcode = null; + newmesh.curve = null; + newmesh.doorStatus = "01"; + newmesh.dispose = 1; + newmesh.nowsection = null; + newmesh.nextsection = null; + newmesh.speed = 0; + newmesh.speeds = 0; + newmesh.progress = null; + newmesh.startmark = 0; + newmesh.open = null; + newmesh.statsstop = 0; + newmesh.openleft = '0'; + newmesh.openright = '0'; + + scope.list[data[i].groupNumber] = newmesh; + //scene.add(newmesh); + } + // console.log(selectmesh); + // for(let i=0,leni=selectmesh.children.length;i=0; an--) { - actions["traindoor"].down[an].reset(); - actions["traindoor"].down[an].time = 0; - actions["traindoor"].down[an].timeScale = -1; - actions["traindoor"].down[an].play(); - } - }else{ - trainmodel.openright = "1"; - for(let an=actions["traindoor"].down.length-1;an>=0;an--){ - actions["traindoor"].down[an].reset(); - actions["traindoor"].down[an].time = actions["traindoor"].top[an]._clip.duration; - actions["traindoor"].down[an].timeScale = 1; - actions["traindoor"].down[an].play(); - } - - } - - if(data.leftDoorCanClose == false){ - trainmodel.openleft = "0"; - for(let an=actions["traindoor"].top.length-1;an>=0;an--){ - actions["traindoor"].top[an].reset(); - actions["traindoor"].top[an].time = 0; - actions["traindoor"].top[an].timeScale = -1; - actions["traindoor"].top[an].play(); - } - }else{ - trainmodel.openleft = "1"; - for(let an=actions["traindoor"].top.length-1;an>=0;an--){ - actions["traindoor"].top[an].reset(); - actions["traindoor"].top[an].time = actions["traindoor"].top[an]._clip.duration; - actions["traindoor"].top[an].timeScale = 1; - actions["traindoor"].top[an].play(); - } - } - - }else{ - if(data.leftDoorCanClose == false){ - - trainmodel.openleft = "0"; - for(let an=actions["traindoor"].top.length-1;an>=0;an--){ - actions["traindoor"].top[an].reset(); - actions["traindoor"].top[an].time = 0; - actions["traindoor"].top[an].timeScale = -1; - actions["traindoor"].top[an].play(); - } - }else{ - trainmodel.openleft = "1"; - for(let an=actions["traindoor"].top.length-1;an>=0;an--){ - actions["traindoor"].top[an].reset(); - actions["traindoor"].top[an].time = actions["traindoor"].top[an]._clip.duration; - actions["traindoor"].top[an].timeScale = 1; - actions["traindoor"].top[an].play(); - } - } - - if(data.rightDoorCanClose == false){ - trainmodel.openright = '0'; - for (let an=actions["traindoor"].down.length-1; an>=0; an--) { - actions["traindoor"].down[an].reset(); - actions["traindoor"].down[an].time = 0; - actions["traindoor"].down[an].timeScale = -1; - actions["traindoor"].down[an].play(); - } - - }else{ - trainmodel.openright = "1"; - for(let an=actions["traindoor"].down.length-1;an>=0;an--){ - actions["traindoor"].down[an].reset(); - actions["traindoor"].down[an].time = actions["traindoor"].top[an]._clip.duration; - actions["traindoor"].down[an].timeScale = 1; - actions["traindoor"].down[an].play(); - } - } - } - - } this.updatamap = function(newsectionlist,newlinklist,newsignallist,newstationstandlist,newtrainlisttest,newrealsectionlist,newrails,newtdt, materiallist, nowaction, scene) { // console.log(mapdata); // console.log(newtrainlisttest); @@ -153,9 +73,10 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,sta this.socketon = function() { try { - // console.log("teststomp"); scope.teststomp.subscribe(scope.topic, callback, header); scope.teststomp.subscribe(hmiTopic, callback, header); + scope.teststomp.subscribe(allDeviceTopic, callback, header); + } catch (error) { console.error('websocket订阅失败'); } @@ -178,22 +99,34 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,sta } } }; - + let initStatus = true; // 仿真socket接口回调函数 function callback(Response) { // console.log(Response); // 对象化数据 let data = JSON.parse(Response.body); - if(data.trainPosList){ - // console.log(data.trainPosList); - // console.log(data.trainPosList); + nowTrainRun(data.trainPosList); - return; } + if(data.srSignalList){ + for(let i=0;i 0 || updateTrainModel.children[2].rotalist.length > 0 || updateTrainModel.children[3].rotalist.length > 0 || updateTrainModel.children[4].rotalist.length > 0|| updateTrainModel.children[5].rotalist.length > 0){ + // if(updateTrainModel.children[1].rotalist.length > 0 || updateTrainModel.children[2].rotalist.length > 0 || updateTrainModel.children[3].rotalist.length > 0 || updateTrainModel.children[4].rotalist.length > 0|| updateTrainModel.children["black"].rotalist.length > 0){ for(let rs = 1;rs 0 || updateTrainModel.children[2].rotalist.length > 0 || updateTrainModel.children[3].rotalist.length > 0 || updateTrainModel.children[4].rotalist.length > 0|| updateTrainModel.children[5].rotalist.length > 0){ + // if(updateTrainModel.children[1].rotalist.length > 0 || updateTrainModel.children[2].rotalist.length > 0 || updateTrainModel.children[3].rotalist.length > 0 || updateTrainModel.children[4].rotalist.length > 0|| updateTrainModel.children["black"].rotalist.length > 0){ for(let rs = 1;rs { diff --git a/src/views/jlmap3d/railwaydrive/drivecontrol/rightpane.vue b/src/views/jlmap3d/railwaydrive/drivecontrol/rightpane.vue index e2d812e67..b6653da07 100644 --- a/src/views/jlmap3d/railwaydrive/drivecontrol/rightpane.vue +++ b/src/views/jlmap3d/railwaydrive/drivecontrol/rightpane.vue @@ -181,6 +181,74 @@ }, methods: { + updateInitStatus : function(data){ + if(data[2] == "1"){ + this.doordirecttou = "rotate("+320+"deg)"; + this.oldDirectType = 1; + } + if(data[2] == "0"){ + this.doordirecttou = "rotate("+360+"deg)"; + this.oldDirectType = 0; + } + if(data[2] == "-1"){ + this.doordirecttou = "rotate("+399+"deg)"; + this.oldDirectType = -1; + } + if(data[2] == "2"){ + this.doordirecttou = "rotate("+442+"deg)"; + this.oldDirectType = 2; + } + + switch (data[3]) { + case -1: + this.stallh = 0; + this.stalll = 0; + break; + case 0: + this.stallh = 1; + this.stalll = 2; + break; + case 1: + this.stallh = 2; + this.stalll = 0; + break; + case 2: + this.stallh = 0; + this.stalll = 1; + break; + case 3: + this.stallh = 2; + this.stalll = 1; + break; + case 4: + this.stallh = 2; + this.stalll = 2; + break; + case 5: + this.stallh = 0; + this.stalll = 2; + break; + case 6: + this.stallh = 0; + this.stalll = 3; + break; + case 7: + this.stallh = 2; + this.stalll = 3; + break; + case 8: + this.stallh = 0; + this.stalll = 4; + break; + case 9: + this.stallh = 2; + this.stalll = 4; + } + + + this.stalltop = this.stalls[this.stallh][this.stalll].t +"px"; + this.stallleft = this.stalls[this.stallh][this.stalll].l +"px"; + }, handleKeyup(event){ const e = event || window.event || arguments.callee.caller.arguments[0]; if(!e) return; @@ -224,7 +292,6 @@ id:"001", pos:parseInt(this.stalls[this.stallh][this.stalll].type) }; - console.log(param); const userInfo = store.state.training.simulationUserList.find(el => el.id == store.state.user.id); trainSimulationForce(this.group,userInfo.memberId,param,"Train_Drive_Gear_Change").then(res => { diff --git a/src/views/jlmap3d/railwaydrive/jl3drailwaydrive.vue b/src/views/jlmap3d/railwaydrive/jl3drailwaydrive.vue index 639ac4cd6..c762a511b 100644 --- a/src/views/jlmap3d/railwaydrive/jl3drailwaydrive.vue +++ b/src/views/jlmap3d/railwaydrive/jl3drailwaydrive.vue @@ -10,9 +10,9 @@ - {{ cctvbuttonmsg }} + diff --git a/src/views/newMap/displayCity/demonMenu.vue b/src/views/newMap/displayCity/demonMenu.vue index b7af65e9d..432390341 100644 --- a/src/views/newMap/displayCity/demonMenu.vue +++ b/src/views/newMap/displayCity/demonMenu.vue @@ -5,7 +5,7 @@ {{ jl3dmodel }} - 司机视角 + 经典案例分析 规范学习 @@ -140,6 +140,10 @@ export default { console.log('获取留言板信息失败'); }); } + + if(this.$route.query.project == "zzww"){ + this.jumpjlmap3dDriver(); + } }, methods:{ menuClick() { diff --git a/static/jl3d/railway/model/signal2.FBX b/static/jl3d/railway/model/signal2.FBX new file mode 100644 index 000000000..6125ca2f5 Binary files /dev/null and b/static/jl3d/railway/model/signal2.FBX differ diff --git a/static/jl3d/railway/model/signal3.FBX b/static/jl3d/railway/model/signal3.FBX new file mode 100644 index 000000000..0cbe5c2d1 Binary files /dev/null and b/static/jl3d/railway/model/signal3.FBX differ diff --git a/static/jl3d/railway/model/signal32.FBX b/static/jl3d/railway/model/signal32.FBX new file mode 100644 index 000000000..7be466497 Binary files /dev/null and b/static/jl3d/railway/model/signal32.FBX differ diff --git a/static/jl3d/railway/model/signal5.FBX b/static/jl3d/railway/model/signal5.FBX new file mode 100644 index 000000000..fb355ffa7 Binary files /dev/null and b/static/jl3d/railway/model/signal5.FBX differ diff --git a/static/jl3d/railway/texture/1.jpg b/static/jl3d/railway/texture/1.jpg new file mode 100644 index 000000000..9a7e8ff3c Binary files /dev/null and b/static/jl3d/railway/texture/1.jpg differ diff --git a/static/jl3d/railway/texture/2.jpg b/static/jl3d/railway/texture/2.jpg new file mode 100644 index 000000000..105c81620 Binary files /dev/null and b/static/jl3d/railway/texture/2.jpg differ diff --git a/static/jl3d/railway/texture/3.jpg b/static/jl3d/railway/texture/3.jpg new file mode 100644 index 000000000..ca99a7faa Binary files /dev/null and b/static/jl3d/railway/texture/3.jpg differ diff --git a/static/jl3d/railway/texture/4.jpg b/static/jl3d/railway/texture/4.jpg new file mode 100644 index 000000000..3a49ac6c0 Binary files /dev/null and b/static/jl3d/railway/texture/4.jpg differ diff --git a/static/jl3d/railway/texture/5.jpg b/static/jl3d/railway/texture/5.jpg new file mode 100644 index 000000000..8ca83829f Binary files /dev/null and b/static/jl3d/railway/texture/5.jpg differ diff --git a/static/jl3d/railway/texture/6.jpg b/static/jl3d/railway/texture/6.jpg new file mode 100644 index 000000000..365a0368f Binary files /dev/null and b/static/jl3d/railway/texture/6.jpg differ