diff --git a/src/api/jmap/map.js b/src/api/jmap/map.js index 9acfc87ba..7a625330d 100644 --- a/src/api/jmap/map.js +++ b/src/api/jmap/map.js @@ -236,3 +236,10 @@ export function getNewMapDataByMapId(mapId) { method: 'get' }); } +/** 发布地图根据id生成子系统及权限 */ +export function generateAncillaryData(mapId) { + return request({ + url: `/api/map/${mapId}/function/generate`, + method: 'post' + }); +} diff --git a/src/i18n/langs/en/display.js b/src/i18n/langs/en/display.js index 5cef3d6e5..8f157a6d9 100644 --- a/src/i18n/langs/en/display.js +++ b/src/i18n/langs/en/display.js @@ -55,6 +55,7 @@ export default { threeDimensionalView: 'Three-Dimensional View', threeDimensionalStation: 'Three-Dimensional Station', passengerflow: 'CCTV View', + trafficplantext:'Passer Planing', maintainer: 'Maintainer View', deviceView: 'DeviceView', taskOperateSuccess: 'Task Operate success', diff --git a/src/i18n/langs/zh/display.js b/src/i18n/langs/zh/display.js index a1f631698..8afa2346c 100644 --- a/src/i18n/langs/zh/display.js +++ b/src/i18n/langs/zh/display.js @@ -55,6 +55,7 @@ export default { threeDimensionalView: '数字沙盘', threeDimensionalStation: '三维车站', passengerflow: 'cctv视图', + trafficplantext:'客流规划', maintainer: '设备故障视图', deviceView: '设备视图', taskOperateSuccess: '任务操作成功', diff --git a/src/jlmap3d/edit/config/editassetconfig.js b/src/jlmap3d/edit/config/editassetconfig.js index 9f8e95bb3..fe2eff174 100644 --- a/src/jlmap3d/edit/config/editassetconfig.js +++ b/src/jlmap3d/edit/config/editassetconfig.js @@ -40,7 +40,7 @@ export let driverListConfig = [ url:'' }, { - assetname:"三站台", + assetname:"特殊站台", id:'', packageName:'', deviceType:'', @@ -98,7 +98,7 @@ export let sceneListConfig = [ url:'' }, { - assetname:"三站台", + assetname:"特殊站台", id:'', packageName:'', deviceType:'', diff --git a/src/jlmap3d/edit/connect/newgetmodels.js b/src/jlmap3d/edit/connect/newgetmodels.js index bba4b7afd..394cdd47e 100644 --- a/src/jlmap3d/edit/connect/newgetmodels.js +++ b/src/jlmap3d/edit/connect/newgetmodels.js @@ -93,9 +93,9 @@ export function getmodels(data) { assets.push(assetwaicestation); let assetstation3 = { - assetname:"三站台", + assetname:"特殊站台", id:"6", - packageName:"沙盘驾驶三站台", + packageName:"沙盘驾驶特殊站台", deviceType:"SimulationStation", type:"stationThree", url:JL3D_LOCAL_STATIC+"/MODEL/station/station3.FBX" diff --git a/src/jlmap3d/jl3dtrafficplan/connect/stationconnect.js b/src/jlmap3d/jl3dtrafficplan/connect/stationconnect.js new file mode 100644 index 000000000..747dcb79d --- /dev/null +++ b/src/jlmap3d/jl3dtrafficplan/connect/stationconnect.js @@ -0,0 +1,241 @@ +import StompClient from '@/utils/sock'; +import { getBaseUrl } from '@/utils/baseUrl' +import { getToken } from '@/utils/auth'; +import store from '@/store/index_APP_TARGET'; + +// 定于仿真socket接口 +export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passerStation,passerAi,jl3d) { + const scope = this; + this.teststomp = new StompClient(); + let start = true; + let topic = '/user/queue/simulation/jl3d/'+routegroup; + let header = {'X-Token': getToken() }; + + socketon(topic); + + function socketon(topic) { + try { + scope.teststomp.subscribe(topic, callback, header); + } catch (error) { + console.error('websocket订阅失败'); + } + + }; + + this.socketoff = function(topic) { + scope.teststomp.unsubscribe(topic); + }; + + // 仿真socket接口回调函数 + function callback(Response) { + const data = JSON.parse(Response.body); + + // console.log(data); + /** 站台客流当前人数信息 */ + if(data.type == "STAND_PFI"){ + + let newStandData = data.body; + let count = 0; + for(let j=0;j { + location.reload(); + }); + } + } + let actions; + + function opentraindoor(train,doorcode,direct){ + // console.log(train); + if(direct == "top"){ + if(doorcode == "1"){ + actions = train.action.down; + } + + if(doorcode == "2"){ + actions = train.action.top; + } + }else{ + if(doorcode == "1"){ + actions = train.action.top; + } + + if(doorcode == "2"){ + actions = train.action.down; + } + } + + for(let an=actions.length-1;an>=0;an--){ + actions[an].reset(); + actions[an].time = 0; + actions[an].timeScale = 1; + actions[an].play(); + } + } + function closetraindoor(train,doorcode,direct){ + + if(direct == "top"){ + if(doorcode == "1"){ + actions = train.action.down; + } + if(doorcode == "2"){ + actions = train.action.top; + } + toptrain.nowcode = null; + }else{ + if(doorcode == "1"){ + actions = train.action.top; + } + if(doorcode == "2"){ + actions = train.action.down; + } + downtrain.nowcode = null; + } + + for(let an=actions.length-1;an>=0;an--){ + actions[an].reset(); + actions[an].time = actions[an]._clip.duration; + actions[an].timeScale = -1; + actions[an].play(); + } + + } +} diff --git a/src/jlmap3d/jl3dtrafficplan/connect/trainconnect.js b/src/jlmap3d/jl3dtrafficplan/connect/trainconnect.js new file mode 100644 index 000000000..2409de364 --- /dev/null +++ b/src/jlmap3d/jl3dtrafficplan/connect/trainconnect.js @@ -0,0 +1,120 @@ +import StompClient from '@/utils/sock'; +import { getBaseUrl } from '@/utils/baseUrl' +import { getToken } from '@/utils/auth'; +import store from '@/store/index_APP_TARGET'; + +// 定于仿真socket接口 +export function TrainConnect(trafficTrain,deviceaction,toptrain,routegroup,passerAi) { + const scope = this; + this.teststomp = new StompClient(); + + let topic = '/user/queue/simulation/jl3d/'+routegroup; + let header = {'X-Token': getToken() }; + + socketon(topic); + + function socketon(topic) { + try { + scope.teststomp.subscribe(topic, callback, header); + } catch (error) { + console.error('websocket订阅失败'); + } + + }; + + this.socketoff = function(topic) { + scope.teststomp.unsubscribe(topic); + }; + + // 仿真socket接口回调函数 + function callback(Response) { + const data = JSON.parse(Response.body); + // console.log(data); + if(data.type == "TrainRun_3D"){ + trafficTrain.trainList = data.body; + // console.log(trafficTrain.nowTrainCode); + } + + if(data.type == "DeviceCtrl_3D"){ + + if(data.body.type == "TRAIN_DOOR"){ + + if(toptrain.nowcode == data.body.code){ + console.log(data.body); + console.log(toptrain.nowcode); + if(data.body.open == "0"){ + closetraindoor(toptrain,data.body.doorCode,"top"); + + }else{ + opentraindoor(toptrain,data.body.doorCode,"top"); + + } + + } + + } + } + + if(data.type == 'Simulation_Over') { + store.dispatch('LogOut').then(() => { + location.reload(); + }); + } + } + let actions; + + function opentraindoor(train,doorcode,direct){ + + if(direct == "top"){ + if(doorcode == "1"){ + actions = train.action.down; + } + + if(doorcode == "2"){ + actions = train.action.top; + } + }else{ + if(doorcode == "1"){ + actions = train.action.top; + } + + if(doorcode == "2"){ + actions = train.action.down; + } + } + console.log(actions); + for(let an=actions.length-1;an>=0;an--){ + actions[an].reset(); + actions[an].time = 0; + actions[an].timeScale = 1; + actions[an].play(); + } + } + function closetraindoor(train,doorcode,direct){ + + if(direct == "top"){ + if(doorcode == "1"){ + actions = train.action.down; + } + if(doorcode == "2"){ + actions = train.action.top; + } + toptrain.nowcode = null; + }else{ + if(doorcode == "1"){ + actions = train.action.top; + } + if(doorcode == "2"){ + actions = train.action.down; + } + } + console.log(actions); + for(let an=actions.length-1;an>=0;an--){ + actions[an].reset(); + actions[an].time = actions[an]._clip.duration; + actions[an].timeScale = -1; + actions[an].play(); + } + + } +} diff --git a/src/jlmap3d/jl3dtrafficplan/jl3dtrafficplan.js b/src/jlmap3d/jl3dtrafficplan/jl3dtrafficplan.js new file mode 100644 index 000000000..271b3e2bd --- /dev/null +++ b/src/jlmap3d/jl3dtrafficplan/jl3dtrafficplan.js @@ -0,0 +1,440 @@ +import { Staticmodel } from '@/jlmap3d/jl3dtrafficplan/loader/stationconfig.js'; +//静态资源文件路劲 +import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js'; +//loader +import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader'; +//轨道视角控制 +import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls'; +//模型管理器 +import { ModelManager } from '@/jlmap3d/jl3dtrafficplan/loader/loader.js'; +//骨骼动画模型辅助工具 +import { SkeletonUtils } from '@/jlmap3d/main/utils/SkeletonUtils.js'; +//获取信息接口 +import { getPublishMapVersion, getPublishMapDetail,getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata'; +//cctv站台对象 +import { PasserStation } from '@/jlmap3d/jl3dtrafficplan/model/passerstation.js'; +//cctv检票机对象 +import { PasserCheckDoor } from '@/jlmap3d/jl3dtrafficplan/model/passercheckdoor.js'; +//cctv列车对象 +import { PasserTrain } from '@/jlmap3d/jl3dtrafficplan/model/passertrain.js'; +//cctv行人对象 +import { PasserHuman } from '@/jlmap3d/jl3dtrafficplan/model/passerhuman.js'; +//cctv渲染器 +import { PasserRender } from '@/jlmap3d/jl3dpassflow/passerrender/passerrender.js'; +//cctv行人ai +import { PasserAi } from '@/jlmap3d/jl3dtrafficplan/passerai/passerai.js'; +//行人寻路相关工具 +import { ZoneManager } from '@/jlmap3d/jl3dtrafficplan/model/zonemanager.js'; +import { PathFinder } from '@/jlmap3d/jl3dtrafficplan/passerai/pathfinder.js'; +//cctv通信工具 +import { PassflowConnect } from '@/jlmap3d/jl3dtrafficplan/connect/stationconnect.js'; + +import StompClient from '@/utils/sock'; +import store from '@/store/index_APP_TARGET'; +// import { Loading } from 'element-ui'; +import {Stats} from '@/jlmap3d/main/lib/stats.min.js'; + +//动画播放相关 +let clock = new THREE.Clock(); +let delta; + +let scene,camerass,renderer; + +let aiswitch = 0; +//动画组 +let mixers = []; +//车站摄像机模型 +let monitor; + +//寻路相关对象 +let passerZone = new ZoneManager(); +let pathFinder = new PathFinder(); +let path; + +//设备动画action组 +let deviceaction = []; +//控制帧率的webworker线程 +let passerWebWork = new Worker(JL3D_LOCAL_STATIC+"/workertest/trafficplan/trafficstation.js"); + +//老版本临时ai控制 +let olddataai = false; + +export function Jl3dTrafficPlan(dom,skinCode,routegroup,viewMap) { + + // let stats = new Stats(); + // dom.appendChild( stats.dom ); + + let scope = this; + + this.dom = dom; + this.nowcode = null; + this.animateswitch = false; + this.signallights = []; + this.mixers = []; + this.showmodel = null; + + this.allStationData = []; + this.humanWaitTop = 0; + this.humanWaitDown = 0; + this.humanInSpeed = 0; + this.humanOutSpeed = 0; + let waitForCreatIn = []; + let waitForCreatOutTop = []; + let waitForCreatOutDown = []; + //定义相机 + camerass = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 1000); + camerass.position.set(0, 80, 40); + camerass.aspect = dom.offsetWidth / dom.offsetHeight; + camerass.updateProjectionMatrix(); + + //定义场景(渲染容器) + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xa0a0a0); + + let passerRender = new PasserRender(viewMap); + passerRender.initView(dom,scene,camerass); + + //定义全局光 + let ambientLight = new THREE.AmbientLight(0xffffff, 1.3); + scene.add(ambientLight); + + let controls = new THREE.OrbitControls(camerass, dom); + controls.maxPolarAngle = Math.PI / 2; + controls.minPolarangle = Math.PI / 5; + controls.maxDistance = 800; + controls.screenSpacePanning = true; + controls.update(); + this.selectmodel = null; + + // let mouse = new THREE.Vector2(); + let raycaster = new THREE.Raycaster(); + + //进站运动中乘客 + let humanlist = new THREE.Group(); + //上行等待上车乘客 + let topWaitPassers = new THREE.Group(); + //下行等待上车乘客 + let downWaitPassers = new THREE.Group(); + //出站乘客 + let outStationPassers = new THREE.Group(); + + let passerHuman = new PasserHuman(); + + let passerAi = new PasserAi(passerZone,pathFinder); + + this.anime = null; + + this.modelmanager = new ModelManager(); + // let loadingInstance = Loading.service({ fullscreen: true }); + + let stationlist = []; + let socktest = null; + let passerStation = new PasserStation(); + let passerCheckDoor = new PasserCheckDoor(); + let passerTrain = new PasserTrain(); + + // document.addEventListener( "mousedown", onselect, false ); + + getPublish3dMapDetail(skinCode).then(netdata3d => { + passerStation.loadMaterial(netdata3d); + this.modelmanager.loadpromise(Staticmodel, scope.mixers,"2").then(function (data) { + // console.log(scope.modelmanager.station.mesh.getObjectByName("top")); + // let testtop = scope.modelmanager.station.mesh.getObjectByName("down"); + // for(let i=0;i { + + scope.switchviews('freeview'); + passerHuman.initHumans(scope.modelmanager.man1.mesh,scope.modelmanager.man2.mesh); + scene.add(humanlist); + scene.add(topWaitPassers); + scene.add(downWaitPassers); + scene.add(outStationPassers); + + passerStation.initStationList(netdata.data.stationList,netdata.data.stationStandList,netdata.data.psdList); + socktest = new PassflowConnect(deviceaction,passerTrain.toptrain,passerTrain.downtrain,routegroup,passerStation,passerAi,scope); + + store.dispatch('app/animationsClose'); + + let checkobject = setInterval(function(){ + + clearInterval(checkobject); + + //进站控制 + startWorker(); + passerWebWork.postMessage(["on"]); + },1000); + }); + + animate(); + }) + }); + + this.initTrafficStart = function(){ + + scope.humanWaitTop = passerStation.nowStation.toppassers; + scope.humanWaitDown = passerStation.nowStation.downpassers; + scope.humanInSpeed = 0; + scope.humanOutSpeed = 0; + passerHuman.speed = scope.humanInSpeed; + passerAi.initPasser(humanlist,topWaitPassers,downWaitPassers,passerHuman,scope); + + updatePasserData(humanlist.children.length,topWaitPassers.children.length,downWaitPassers.children.length,outStationPassers.children.length,passerHuman.speed); + } + + this.changestation = function(stationname){ + passerStation.changestation(stationname); + scope.humanWaitTop = passerStation.nowStation.toppassers; + scope.humanWaitDown = passerStation.nowStation.downpassers; + passerHuman.speed = passerStation.nowStation.topspeed + passerStation.nowStation.downspeed; + updatePasserData(humanlist.children.length,topWaitPassers.children.length,downWaitPassers.children.length,outStationPassers.children.length,passerHuman.speed); + + scope.resetscene(); + } + + this.updateNowStationData = function(){ + for(let i=0;i=0;an--){ + passerTrain.toptrain.action.top[an].reset(); + passerTrain.toptrain.action.top[an].time = passerTrain.toptrain.action.top[an]._clip.duration; + passerTrain.toptrain.action.top[an].timeScale = -1; + passerTrain.toptrain.action.top[an].play(); + } + for(let an=passerTrain.toptrain.action.down.length-1;an>=0;an--){ + passerTrain.toptrain.action.down[an].reset(); + passerTrain.toptrain.action.down[an].time = passerTrain.toptrain.action.down[an]._clip.duration; + passerTrain.toptrain.action.down[an].timeScale = -1; + passerTrain.toptrain.action.down[an].play(); + } + // for(let an=actions.length-1;an>=0;an--){ + // actions[an].reset(); + // actions[an].time = actions[an]._clip.duration; + // actions[an].timeScale = -1; + // actions[an].play(); + // } + setTimeout(function(){ + passerAi.initPasser(humanlist,topWaitPassers,downWaitPassers,passerHuman,scope); + aiswitch = 0; + }, 2000); + + } + + function startWorker(){ + + let updateaianimate = setInterval( + function(){ + // console.log("?"); + if(aiswitch == 0){ + updatePasserData(humanlist.children.length,topWaitPassers.children.length,downWaitPassers.children.length,outStationPassers.children.length,passerHuman.speed); + + passerHuman.moveAnimateUpdate(humanlist,topWaitPassers,downWaitPassers,outStationPassers,passerHuman); + passerAi.aiUpdate(humanlist,topWaitPassers,downWaitPassers,outStationPassers,passerHuman,passerCheckDoor,deviceaction); + // passerZone.zoneActionCheck(humanlist,passerHuman,passerCheckDoor,deviceaction); + delta = clock.getDelta(); + + for(let i=mixers.length-1;i>=0;i--){ + if(mixers[i]._actions[0].isRunning()){ + mixers[i].update( delta ); + } + } + for(let i=topWaitPassers.children.length-1;i>=0;i--){ + if(topWaitPassers.children[i].mixer._actions[0].isRunning()){ + topWaitPassers.children[i].mixer.update( delta ); + } + } + for(let i=downWaitPassers.children.length-1;i>=0;i--){ + if(downWaitPassers.children[i].mixer._actions[0].isRunning()){ + downWaitPassers.children[i].mixer.update( delta ); + } + } + for(let i=outStationPassers.children.length-1;i>=0;i--){ + if(outStationPassers.children[i].mixer._actions[0].isRunning()){ + outStationPassers.children[i].mixer.update( delta ); + } + } + for(let i=humanlist.children.length-1;i>=0;i--){ + if(humanlist.children[i].mixer._actions[0].isRunning()){ + humanlist.children[i].mixer.update( delta ); + } + } + } + } + , 100); + + passerWebWork.onmessage = function (event) { + if(aiswitch == 0){ + // console.log(humanlist.children.length); + + this.allStationData = []; + console.log("create"); + if(waitForCreatIn.length>0){ + let direct = Math.floor(Math.random()*(3-1+1))+1; + //1--top + //2-- down + if(direct == 1){ + passerHuman.newHumanCreate(humanlist,passerZone.getzoneposition("enter1"),0,waitForCreatIn[0].overGoal); + }else{ + passerHuman.newHumanCreate(humanlist,passerZone.getzoneposition("enter2"),0,waitForCreatIn[0].overGoal); + } + waitForCreatIn.shift(); + } + } + }; + } + // + // function onselect(event){ + // if(event.button == '0'){ + // + // //定义光线 + // let raycaster = new THREE.Raycaster(); + // //定义平面鼠标点击坐标 + // let mouse = new THREE.Vector2(); + // mouse.x = (event.clientX / scope.dom.offsetWidth) * 2 - 1; + // mouse.y = -(event.clientY / scope.dom.offsetHeight) * 2 + 1; + // + // raycaster.setFromCamera( mouse, camerass ); + // + // let intersects = raycaster.intersectObject(scope.modelmanager.station.mesh,true); + // console.log(intersects[0].point); + // } + // } + + + //循环渲染函数 + function animate() { + passerRender.update(); + + // if(passerRender.state == "freeview"){ + controls.update(); + // } + // delta = clock.getDelta(); + requestAnimationFrame(animate); + + } + + window.onresize = function () { + passerRender.reSize(scope.dom.offsetWidth,scope.dom.offsetHeight); + } + + this.switchviews = function(viewmode){ + passerRender.changeRenderMode(viewmode); + } + + function getnum(num,pnum){ + let re = []; + let base = Math.floor(num/pnum); + let reset = num%pnum; + for(let i=0;i { + scope.switchviews('freeview'); + passerHuman.initHumans(scope.modelmanager.man1.mesh,scope.modelmanager.man2.mesh); + scene.add(humanlist); + + socktest = new TrainConnect(scope,deviceaction,passerTrain.toptrain,routegroup,passerAi); + + store.dispatch('app/animationsClose'); + + let checkobject = setInterval(function(){ + + clearInterval(checkobject); + //进站控制 + startWorker(); + passerWebWork.postMessage("on"); + animate(); + },1000); + }); + + + }) + + + + this.resetscene = function(){ + aiswitch = 1; + passerAi.toppasserin = false; + passerAi.downpasserin = false; + //下车控制开关 + passerAi.toppasseron = false; + passerAi.downpasseron = false; + + passerTrain.toptrain.nowcode = null; + passerTrain.downtrain.nowcode = null; + // humanlist = new THREE.Group(); + for(let j=0; j=0;an--){ + passerTrain.toptrain.action.top[an].reset(); + passerTrain.toptrain.action.top[an].time = passerTrain.toptrain.action.top[an]._clip.duration; + passerTrain.toptrain.action.top[an].timeScale = -1; + passerTrain.toptrain.action.top[an].play(); + } + for(let an=passerTrain.toptrain.action.down.length-1;an>=0;an--){ + passerTrain.toptrain.action.down[an].reset(); + passerTrain.toptrain.action.down[an].time = passerTrain.toptrain.action.down[an]._clip.duration; + passerTrain.toptrain.action.down[an].timeScale = -1; + passerTrain.toptrain.action.down[an].play(); + } + // for(let an=actions.length-1;an>=0;an--){ + // actions[an].reset(); + // actions[an].time = actions[an]._clip.duration; + // actions[an].timeScale = -1; + // actions[an].play(); + // } + setTimeout(function(){ + passerHuman.setNowTrunkPasser(humanlist); + aiswitch = 0; + }, 2000); + + } + + function startWorker(){ + passerHuman.setNowTrunkPasser(humanlist,200,0); + let updateaianimate = setInterval( + function(){ + // console.log("?"); + if(aiswitch == 0){ + // passerHuman.moveAnimateUpdate(humanlist,olddataai,passerHuman); + // passerAi.aiUpdate(humanlist,passerHuman,passerCheckDoor,deviceaction); + + delta = clock.getDelta(); + // console.log(mixers); + for(let i=mixers.length-1;i>=0;i--){ + if(mixers[i]._actions[0].isRunning()){ + // console.log(mixers[i]); + mixers[i].update( delta ); + } + } + // for(let i=humanlist.children.length-1;i>=0;i--){ + // if(humanlist.children[i].mixer._actions[0].isRunning()){ + // humanlist.children[i].mixer.update( delta ); + // } + // } + } + } + , 100); + + passerWebWork.onmessage = function (event) { + if(aiswitch == 0){ + // console.log(humanlist.children.length); + if(humanlist.children.length < 80){ + let direct = Math.floor(Math.random()*(3-1+1))+1; + + if(passerAi.toppasseron){ + for(let i=0,leni=passerZone.list["standtop"].doorpoints.length;i { + console.log("success"); + resolve("success"); //['成功了', 'success'] + }).catch((error) => { + //console.log(error); + }); + + }); + } + +} +//fbx模型加载 +function fbxpromise(asset,mixers,model){ + return new Promise(function(resolve, reject){ + var loader = new THREE.FBXLoader(); + + if( mode == "2"){ + + loader.load( asset.url, function ( object ) { + + model.mesh = object; + + resolve(asset.deviceType); + } ); + + }else{ + loader.load( BASE_ASSET_API+asset.url, function ( object ) { + + //列车模型子物体重新排序 + if(asset.type == "cctvTrain"){ + // let mixer = new THREE.AnimationMixer( object ); + let realtrain = new THREE.Group(); + for(let j=6;j>0;j--){ + let name = "c"+j; + for(let i=0;i=1){ + outStationPassers.children[i].progress = 1; + outStationPassers.children[i].action.stop(); + outStationPassers.children[i].status = 0; + + if(outStationPassers.children[i].stage == 8){ + passerHuman.uncache(outStationPassers.children[i]); + outStationPassers.remove(outStationPassers.children[i]); + i--; + }else if(outStationPassers.children[i].stage == 7){ + outStationPassers.children[i].stage = 8; + } + else if(outStationPassers.children[i].stage == 5){ + + outStationPassers.children[i].stage = 7; + + } + }else{ + //根据动画进度获取动画轨迹上点 + // console.log(i); + // console.log(humanlist.children[i].runrail); + // console.log(humanlist.children[i].progress); + let point = outStationPassers.children[i].runrail.getPointAt(outStationPassers.children[i].progress); + + //更新模型坐标 + outStationPassers.children[i].position.x = point.x; + outStationPassers.children[i].position.y = point.y; + outStationPassers.children[i].position.z = point.z; + if((outStationPassers.children[i].progress+0.001)<1){ + let tangent = outStationPassers.children[i].runrail.getPointAt(outStationPassers.children[i].progress+0.001); + outStationPassers.children[i].lookAt(new THREE.Vector3(tangent.x,outStationPassers.children[i].position.y,tangent.z)); + } + + outStationPassers.children[i].progress += outStationPassers.children[i].speed; + point = null; + + } + } + } + + for(let i=0;i=1){ + topWaitPassers.children[i].progress = 1; + topWaitPassers.children[i].action.stop(); + topWaitPassers.children[i].status = 0; + + if(topWaitPassers.children[i].stage == 4){ + passerHuman.uncache(topWaitPassers.children[i]); + topWaitPassers.remove(topWaitPassers.children[i]); + i--; + } + }else{ + //根据动画进度获取动画轨迹上点 + // console.log(i); + // console.log(humanlist.children[i].runrail); + // console.log(humanlist.children[i].progress); + let point = topWaitPassers.children[i].runrail.getPointAt(topWaitPassers.children[i].progress); + + //更新模型坐标 + topWaitPassers.children[i].position.x = point.x; + topWaitPassers.children[i].position.y = point.y; + topWaitPassers.children[i].position.z = point.z; + if((topWaitPassers.children[i].progress+0.001)<1){ + let tangent = topWaitPassers.children[i].runrail.getPointAt(topWaitPassers.children[i].progress+0.001); + topWaitPassers.children[i].lookAt(new THREE.Vector3(tangent.x,topWaitPassers.children[i].position.y,tangent.z)); + } + + topWaitPassers.children[i].progress += topWaitPassers.children[i].speed; + point = null; + + } + } + } + + for(let i=0;i=1){ + downWaitPassers.children[i].progress = 1; + downWaitPassers.children[i].action.stop(); + downWaitPassers.children[i].status = 0; + if(downWaitPassers.children[i].stage == 4){ + passerHuman.uncache(downWaitPassers.children[i]); + downWaitPassers.remove(downWaitPassers.children[i]); + i--; + } + }else{ + //根据动画进度获取动画轨迹上点 + // console.log(i); + // console.log(humanlist.children[i].runrail); + // console.log(humanlist.children[i].progress); + let point = downWaitPassers.children[i].runrail.getPointAt(downWaitPassers.children[i].progress); + + //更新模型坐标 + downWaitPassers.children[i].position.x = point.x; + downWaitPassers.children[i].position.y = point.y; + downWaitPassers.children[i].position.z = point.z; + if((downWaitPassers.children[i].progress+0.001)<1){ + let tangent = downWaitPassers.children[i].runrail.getPointAt(downWaitPassers.children[i].progress+0.001); + downWaitPassers.children[i].lookAt(new THREE.Vector3(tangent.x,downWaitPassers.children[i].position.y,tangent.z)); + } + + downWaitPassers.children[i].progress += downWaitPassers.children[i].speed; + point = null; + + } + } + } + + for(let i=0;i=1){ + //更新模型坐标 + if(humanlist.children[i].status == 1){ + + + humanlist.children[i].progress = 1; + humanlist.children[i].action.stop(); + humanlist.children[i].status = 0; + if(humanlist.children[i].stage == 3){ + + humanlist.children[i].stage = 4; + if(humanlist.children[i].direct == "top"){ + topWaitPassers.add(humanlist.children[i]); + i--; + }else if(humanlist.children[i].direct == "down"){ + downWaitPassers.add(humanlist.children[i]); + i--; + } + + }else if(humanlist.children[i].stage == 2){ + humanlist.children[i].stage = 3; + + }else if(humanlist.children[i].stage == 1){ + + + humanlist.children[i].stage = 2; + + }else if(humanlist.children[i].stage == 0){ + // // console.log(humans[i].doors); + // zhajiin[humanlist.children[i].doors].waiting = 0; + humanlist.children[i].stage = 1; + } + + } + + }else{ + //根据动画进度获取动画轨迹上点 + // console.log(i); + // console.log(humanlist.children[i].runrail); + // console.log(humanlist.children[i].progress); + let point = humanlist.children[i].runrail.getPointAt(humanlist.children[i].progress); + + //更新模型坐标 + humanlist.children[i].position.x = point.x; + humanlist.children[i].position.y = point.y; + humanlist.children[i].position.z = point.z; + if((humanlist.children[i].progress+0.001)<1){ + let tangent = humanlist.children[i].runrail.getPointAt(humanlist.children[i].progress+0.001); + humanlist.children[i].lookAt(new THREE.Vector3(tangent.x,humanlist.children[i].position.y,tangent.z)); + } + + humanlist.children[i].progress += humanlist.children[i].speed; + point = null; + + } + } + } + } + //离开车站释放缓存 + this.uncache = function(uncachemodel){ + if(uncachemodel){ + uncachemodel.mixer.uncacheAction(); + uncachemodel.traverse( function ( child ) { + if ( child.isMesh ) { + child.geometry.dispose(); + child.material.dispose(); + } + } ); + } + } +} diff --git a/src/jlmap3d/jl3dtrafficplan/model/passerstation.js b/src/jlmap3d/jl3dtrafficplan/model/passerstation.js new file mode 100644 index 000000000..c02d4134f --- /dev/null +++ b/src/jlmap3d/jl3dtrafficplan/model/passerstation.js @@ -0,0 +1,186 @@ +import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js'; + +export function PasserStation() { + var scope = this; + this.stationMesh = null; + this.stationleft = []; + this.stationright = []; + //替换材质组(站台的) + this.stationtexture = []; + + this.stationlist = []; + + this.nowStation = ""; + + for(let i=0;i<22;i++){ + let sl = { + id:"left"+i, + status:0, + waiting:0 + } + scope.stationleft.push(sl); + } + + for(let i=0;i<22;i++){ + let sr = { + id:"right"+i, + status:0, + waiting:0 + } + scope.stationright.push(sr); + } + //初始化车站模型动画 + this.initStationAnimation = function( object,mixers ,deviceaction ,scene){ + let mixer = new THREE.AnimationMixer( object ,mixers ,deviceaction ,scene); + + let newclip = object.animations[ 0 ]; + for(let j=0;j0){ + let stationobject = { + code : list[k][0].stationCode, + name : k, + topspeed:0, + downspeed:0, + toppassers:0, + downpassers:0, + toppsd:null, + downpsd:null, + topsection:null, + downsection:null, + topstand:null, + downstand:null + }; + if(list[k][0].position.y=1){ + outStationPassers.children[i].progress = 1; + outStationPassers.children[i].action.stop(); + outStationPassers.children[i].status = 0; + + if(outStationPassers.children[i].stage == 8){ + passerHuman.uncache(outStationPassers.children[i]); + outStationPassers.remove(outStationPassers.children[i]); + i--; + }else if(outStationPassers.children[i].stage == 7){ + outStationPassers.children[i].stage = 8; + } + else if(outStationPassers.children[i].stage == 5){ + + outStationPassers.children[i].stage = 7; + + } + }else{ + //根据动画进度获取动画轨迹上点 + // console.log(i); + // console.log(humanlist.children[i].runrail); + // console.log(humanlist.children[i].progress); + let point = outStationPassers.children[i].runrail.getPointAt(outStationPassers.children[i].progress); + + //更新模型坐标 + outStationPassers.children[i].position.x = point.x; + outStationPassers.children[i].position.y = point.y; + outStationPassers.children[i].position.z = point.z; + if((outStationPassers.children[i].progress+0.001)<1){ + let tangent = outStationPassers.children[i].runrail.getPointAt(outStationPassers.children[i].progress+0.001); + outStationPassers.children[i].lookAt(new THREE.Vector3(tangent.x,outStationPassers.children[i].position.y,tangent.z)); + } + + outStationPassers.children[i].progress += outStationPassers.children[i].speed; + point = null; + + } + } + } + + for(let i=0;i=1){ + topWaitPassers.children[i].progress = 1; + topWaitPassers.children[i].action.stop(); + topWaitPassers.children[i].status = 0; + + if(topWaitPassers.children[i].stage == 4){ + passerHuman.uncache(topWaitPassers.children[i]); + topWaitPassers.remove(topWaitPassers.children[i]); + i--; + } + }else{ + //根据动画进度获取动画轨迹上点 + // console.log(i); + // console.log(humanlist.children[i].runrail); + // console.log(humanlist.children[i].progress); + let point = topWaitPassers.children[i].runrail.getPointAt(topWaitPassers.children[i].progress); + + //更新模型坐标 + topWaitPassers.children[i].position.x = point.x; + topWaitPassers.children[i].position.y = point.y; + topWaitPassers.children[i].position.z = point.z; + if((topWaitPassers.children[i].progress+0.001)<1){ + let tangent = topWaitPassers.children[i].runrail.getPointAt(topWaitPassers.children[i].progress+0.001); + topWaitPassers.children[i].lookAt(new THREE.Vector3(tangent.x,topWaitPassers.children[i].position.y,tangent.z)); + } + + topWaitPassers.children[i].progress += topWaitPassers.children[i].speed; + point = null; + + } + } + } + + for(let i=0;i=1){ + downWaitPassers.children[i].progress = 1; + downWaitPassers.children[i].action.stop(); + downWaitPassers.children[i].status = 0; + if(downWaitPassers.children[i].stage == 4){ + passerHuman.uncache(downWaitPassers.children[i]); + downWaitPassers.remove(downWaitPassers.children[i]); + i--; + } + }else{ + //根据动画进度获取动画轨迹上点 + // console.log(i); + // console.log(humanlist.children[i].runrail); + // console.log(humanlist.children[i].progress); + let point = downWaitPassers.children[i].runrail.getPointAt(downWaitPassers.children[i].progress); + + //更新模型坐标 + downWaitPassers.children[i].position.x = point.x; + downWaitPassers.children[i].position.y = point.y; + downWaitPassers.children[i].position.z = point.z; + if((downWaitPassers.children[i].progress+0.001)<1){ + let tangent = downWaitPassers.children[i].runrail.getPointAt(downWaitPassers.children[i].progress+0.001); + downWaitPassers.children[i].lookAt(new THREE.Vector3(tangent.x,downWaitPassers.children[i].position.y,tangent.z)); + } + + downWaitPassers.children[i].progress += downWaitPassers.children[i].speed; + point = null; + + } + } + } + + for(let i=0;i=1){ + //更新模型坐标 + if(humanlist.children[i].status == 1){ + + + humanlist.children[i].progress = 1; + humanlist.children[i].action.stop(); + humanlist.children[i].status = 0; + if(humanlist.children[i].stage == 3){ + + humanlist.children[i].stage = 4; + if(humanlist.children[i].direct == "top"){ + topWaitPassers.add(humanlist.children[i]); + i--; + }else if(humanlist.children[i].direct == "down"){ + downWaitPassers.add(humanlist.children[i]); + i--; + } + + }else if(humanlist.children[i].stage == 2){ + humanlist.children[i].stage = 3; + + }else if(humanlist.children[i].stage == 1){ + + + humanlist.children[i].stage = 2; + + }else if(humanlist.children[i].stage == 0){ + // // console.log(humans[i].doors); + // zhajiin[humanlist.children[i].doors].waiting = 0; + humanlist.children[i].stage = 1; + } + + } + + }else{ + //根据动画进度获取动画轨迹上点 + // console.log(i); + // console.log(humanlist.children[i].runrail); + // console.log(humanlist.children[i].progress); + let point = humanlist.children[i].runrail.getPointAt(humanlist.children[i].progress); + + //更新模型坐标 + humanlist.children[i].position.x = point.x; + humanlist.children[i].position.y = point.y; + humanlist.children[i].position.z = point.z; + if((humanlist.children[i].progress+0.001)<1){ + let tangent = humanlist.children[i].runrail.getPointAt(humanlist.children[i].progress+0.001); + humanlist.children[i].lookAt(new THREE.Vector3(tangent.x,humanlist.children[i].position.y,tangent.z)); + } + + humanlist.children[i].progress += humanlist.children[i].speed; + point = null; + + } + } + } + } + + this.resetPasser = function(humanlist){ + let passerlength = humanlist.children.length; + for(let i=0;i y ? (x > c ? x : c) : (y > c ? y : c); + // var min = x < y ? (x < c ? x : c) : (y < c ? y : c); + + function getnum(num,pnum){ + let re = []; + let base = Math.floor(num/pnum); + let reset = num%pnum; + for(let i=0;i Math.round(Math.random()*(max-min))+min; + + this.getDoorRandomPos = function(trunkNum,direct){ + let newPos = null; + let doorNum = rand(0,2); + + if(direct == "1"){ + newPos = scope.trunk[trunkNum].leftdoor[doorNum]; + }else if(direct == "2"){ + newPos = scope.trunk[trunkNum].rightdoor[doorNum]; + } + return newPos; + } + + this.getTrunkRandomPos = function(index){ + let newPos = new THREE.Vector3( + scope.trunk[index].position.x+RandomNum(-11,11), + 1.22, + scope.trunk[index].position.z+RandomNum(-1.28,1.28)); + + return newPos; + } + + function RandomNum(Min, Max) { + var Range = Max - Min; + var Rand = Math.random(); + var num = Min + Rand * Range; //四舍五入 + return num; + } +} diff --git a/src/jlmap3d/jl3dtrafficplan/model/zonemanager.js b/src/jlmap3d/jl3dtrafficplan/model/zonemanager.js new file mode 100644 index 000000000..912057e35 --- /dev/null +++ b/src/jlmap3d/jl3dtrafficplan/model/zonemanager.js @@ -0,0 +1,331 @@ +import { ZoneModel } from '@/jlmap3d/jl3dpassflow/model/zonemodel.js'; +//进站区域1 +let enter1 = { + code : '001', + name : "enter1", + type : "normal", + stage : "0", + randompoint : new THREE.Vector3(26.6,9.8,-2.7), + railpoints : [ + new THREE.Vector3(34,9.8,-6), + new THREE.Vector3(32,9.8,-6) + ] +}; +//进站区域2 +let enter2 = { + code : '002', + name : "enter2", + type : "normal", + stage : "0", + randompoint : new THREE.Vector3(27,9.8,16), + railpoints : [ + new THREE.Vector3(34,9.8,31.5), + new THREE.Vector3(32,9.8,31.5) + ] +}; +//安检区域 +let security = { + code : '003', + name : "security", + type : "device", + stage : "1", + randompoint : new THREE.Vector3(8.8,9.8,18), + railpoints : [ + new THREE.Vector3(20.5,9.8,18), + new THREE.Vector3(21,9.8,21) + ] +}; +//进方向闸机区域 +let entergate = { + code : '004', + name : "entergate", + type : "device", + stage : "2", + randompoint : new THREE.Vector3(2.3,9.8,13), + railpoints : [ + new THREE.Vector3(6.3,9.8,18.1), + new THREE.Vector3(4.8,9.8,18.1), + new THREE.Vector3(3.4,9.8,18.1), + new THREE.Vector3(2.1,9.8,18.1), + new THREE.Vector3(0.7,9.8,18.1) + ] +}; +//站台上车区域 +let standtop = { + code : '005', + name : "standtop", + type : "stand", + stage : "3", + randompoint : new THREE.Vector3(-64,1.77,0.38), + doorpoints:[ + new THREE.Vector3(-62.1,1.77,-4.38), + new THREE.Vector3(-57.54,1.77,-4.38), + new THREE.Vector3(-53.1,1.77,-4.38), + new THREE.Vector3(-42.5,1.77,-4.38), + new THREE.Vector3(-37.6,1.77,-4.38), + new THREE.Vector3(-33.6,1.77,-4.38), + new THREE.Vector3(-20.8,1.77,-4.38), + new THREE.Vector3(-16.6,1.77,-4.38), + new THREE.Vector3(-12,1.77,-4.38), + new THREE.Vector3(0.5,1.77,-4.38), + new THREE.Vector3(4.8,1.77,-4.38), + new THREE.Vector3(9.27,1.77,-4.38), + new THREE.Vector3(21.6,1.77,-4.38), + new THREE.Vector3(26.2,1.77,-4.38), + new THREE.Vector3(30.48,1.77,-4.38), + new THREE.Vector3(43.2,1.77,-4.38), + new THREE.Vector3(47.5,1.77,-4.38), + new THREE.Vector3(51.9,1.77,-4.38) + ], + // new THREE.Vector3(-62.84,1.77,-4.38), + // new THREE.Vector3(-58.11,1.77,-4.38), + // new THREE.Vector3(-53.47,1.77,-4.38), + // new THREE.Vector3(-45.45,1.77,-4.38), + // new THREE.Vector3(-41.1,1.77,-4.38), + // new THREE.Vector3(-36.33,1.77,-4.38), + // new THREE.Vector3(-31.5,1.77,-4.38), + // new THREE.Vector3(-23.65,1.77,-4.38), + // new THREE.Vector3(-18.98,1.77,-4.38), + // new THREE.Vector3(-14.46,1.77,-4.38), + // new THREE.Vector3(-10,1.77,-4.38), + // new THREE.Vector3(-2.2,1.77,-4.38), + // new THREE.Vector3(2.49,1.77,-4.38), + // new THREE.Vector3(7.17,1.77,-4.38), + // new THREE.Vector3(11.8,1.77,-4.38), + // new THREE.Vector3(19.41,1.77,-4.38), + // new THREE.Vector3(24.09,1.77,-4.38), + // new THREE.Vector3(28.72,1.77,-4.38), + // new THREE.Vector3(33.46,1.77,-4.38), + // new THREE.Vector3(41.24,1.77,-4.38), + // new THREE.Vector3(45.82,1.77,-4.38), + // new THREE.Vector3(50.69,1.77,-4.38) + railpoints : [ + new THREE.Vector3(53.1,1.77,-1.8), + new THREE.Vector3(-63.5,1.77,-1.8) + ] +}; +//站台下车区域 +let standdown = { + code : '006', + name : "standdown", + type : "stand", + stage : "3", + randompoint : new THREE.Vector3(-64,1.77,21), + doorpoints:[ + new THREE.Vector3(-62.1,1.77,27), + new THREE.Vector3(-57.54,1.77,27), + new THREE.Vector3(-53.1,1.77,27), + new THREE.Vector3(-42.5,1.77,27), + new THREE.Vector3(-37.6,1.77,27), + new THREE.Vector3(-33.6,1.77,27), + new THREE.Vector3(-20.8,1.77,27), + new THREE.Vector3(-16.6,1.77,27), + new THREE.Vector3(-12,1.77,27), + new THREE.Vector3(0.5,1.77,27), + new THREE.Vector3(4.8,1.77,27), + new THREE.Vector3(9.27,1.77,27), + new THREE.Vector3(21.6,1.77,27), + new THREE.Vector3(26.2,1.77,27), + new THREE.Vector3(30.48,1.77,27), + new THREE.Vector3(43.2,1.77,27), + new THREE.Vector3(47.5,1.77,27), + new THREE.Vector3(51.9,1.77,27) + ], + // new THREE.Vector3(-62.84,1.77,27), + // new THREE.Vector3(-58.11,1.77,27), + // new THREE.Vector3(-53.47,1.77,27), + // new THREE.Vector3(-45.45,1.77,27), + // new THREE.Vector3(-41.1,1.77,27), + // new THREE.Vector3(-36.33,1.77,27), + // new THREE.Vector3(-31.5,1.77,27), + // new THREE.Vector3(-23.65,1.77,27), + // new THREE.Vector3(-18.98,1.77,27), + // new THREE.Vector3(-14.46,1.77,27), + // new THREE.Vector3(-10,1.77,27), + // new THREE.Vector3(-2.2,1.77,27), + // new THREE.Vector3(2.49,1.77,27), + // new THREE.Vector3(7.17,1.77,27), + // new THREE.Vector3(11.8,1.77,27), + // new THREE.Vector3(19.41,1.77,27), + // new THREE.Vector3(24.09,1.77,27), + // new THREE.Vector3(28.72,1.77,27), + // new THREE.Vector3(33.46,1.77,27), + // new THREE.Vector3(41.24,1.77,27), + // new THREE.Vector3(45.82,1.77,27), + // new THREE.Vector3(50.69,1.77,27) + railpoints : [ + new THREE.Vector3(53.1,1.77,24), + new THREE.Vector3(-64,1.77,24) + ] +}; +//4是刚下车状态 +//出方向闸机区域 +let exitgate = { + code : '007', + name : "exitgate", + type : "device", + stage : "5", + randompoint : new THREE.Vector3(-16,9.8,-0.4), + railpoints : [ + new THREE.Vector3(18,9.8,-0.27), + new THREE.Vector3(18,9.8,1.18), + new THREE.Vector3(18,9.8,2.64), + new THREE.Vector3(18,9.8,4.1), + new THREE.Vector3(18,9.8,5.4) + ] +}; +//出站台区域1 +let exit1 = { + code : '008', + name : "exit1", + type : "normal", + stage : "6", + randompoint : new THREE.Vector3(), + railpoints : [ + new THREE.Vector3(28.2,9.8,-7), + new THREE.Vector3(30.5,9.8,-7.4) + ] +}; +//出站台区域2 +let exit2 = { + code : '009', + name : "exit2", + type : "normal", + stage : "6", + randompoint : new THREE.Vector3(), + railpoints : [ + new THREE.Vector3(28.3,9.8,28), + new THREE.Vector3(30.2,9.8,28) + ] +}; +let enternum = 0; +let exitnum = 0; +//区域管理器 +export function ZoneManager() { + + var scope = this; + + this.name = "test"; + + this.list = []; + + initzone(); + //初始化区域对象 + function initzone(){ + scope.list[enter1.name] = new ZoneModel(enter1); + scope.list[enter2.name] = new ZoneModel(enter2); + scope.list[security.name] = new ZoneModel(security); + scope.list[entergate.name] = new ZoneModel(entergate); + scope.list[standtop.name] = new ZoneModel(standtop); + scope.list[standdown.name] = new ZoneModel(standdown); + scope.list[exitgate.name] = new ZoneModel(exitgate); + scope.list[exit1.name] = new ZoneModel(exit1); + scope.list[exit2.name] = new ZoneModel(exit2); + } + //获取区域范围内点 + this.getinitposition = function(name){ + // console.log(scope.list[name]); + let randompoint = new THREE.Vector3(0,scope.list[name].randompoint.y,0); + + // console.log(randompoint); + if(name == "enter1"){ + randompoint.x = scope.list[name].randompoint.x + Math.random()*8; + randompoint.z = scope.list[name].randompoint.z + Math.random()*8; + } + if(name == "enter2"){ + randompoint.x = scope.list[name].randompoint.x + Math.random()*8; + randompoint.z = scope.list[name].randompoint.z + Math.random()*8; + } + if(name == "security"){ + randompoint.x = scope.list[name].randompoint.x + Math.random()*10; + randompoint.z = scope.list[name].randompoint.z + Math.random()*2; + } + if(name == "entergate"){ + randompoint.x = scope.list[name].randompoint.x + Math.random()*5; + randompoint.z = scope.list[name].randompoint.z - Math.random()*2; + } + if(name == "standtop"){ + randompoint.x = scope.list[name].randompoint.x + Math.random()*100; + randompoint.z = scope.list[name].randompoint.z + Math.random(); + } + if(name == "standdown"){ + randompoint.x = scope.list[name].randompoint.x + Math.random()*100; + randompoint.z = scope.list[name].randompoint.z ; + } + if(name == "exitgate"){ + randompoint.x = scope.list[name].randompoint.x + Math.random()*30; + randompoint.z = scope.list[name].randompoint.z + Math.random()*5; + } + // let random = Math.random(); + return randompoint; + } + + this.getstandposition = function(name){ + let n = Math.round(Math.random()*17); + if(n>=1){ + n=n; + }else{ + n=0; + } + let randompoint = new THREE.Vector3(0,scope.list[name].doorpoints[n].y,0); + + if(name == "standtop"){ + randompoint.x = scope.list[name].doorpoints[n].x + Math.random()*3; + randompoint.z = scope.list[name].doorpoints[n].z +4+Math.random()*5; + } + if(name == "standdown"){ + randompoint.x = scope.list[name].doorpoints[n].x + Math.random()*3; + randompoint.z = scope.list[name].doorpoints[n].z -4-Math.random()*5; + } + let standdata = { + door:n, + point:randompoint + }; + return standdata; + } + + this.getgateposition = function(name){ + let randompoint = new THREE.Vector3(0,0,0); + + let standdata = { + door:null, + point:null + }; + if(name == "entergate"){ + randompoint.x = scope.list[name].railpoints[enternum].x ; + randompoint.y = scope.list[name].railpoints[enternum].y ; + randompoint.z = scope.list[name].railpoints[enternum].z ; + standdata.door = 4-enternum; + enternum += 1; + if(enternum>4){ + enternum = 0; + } + } + + if(name == "exitgate"){ + + randompoint.x = scope.list[name].railpoints[exitnum].x ; + randompoint.y = scope.list[name].railpoints[exitnum].y ; + randompoint.z = scope.list[name].railpoints[exitnum].z ; + standdata.door = 4-exitnum; + exitnum += 1; + if(exitnum>4){ + exitnum = 0; + } + } + standdata.point = randompoint; + + return standdata; + } + + this.getzoneposition = function(name){ + // let random = Math.random(); + let position = scope.list[name].railline.getPointAt(Math.random()); + return position; + } + + this.zoneActionCheck = function(){ + + } + +} diff --git a/src/jlmap3d/jl3dtrafficplan/model/zonemodel.js b/src/jlmap3d/jl3dtrafficplan/model/zonemodel.js new file mode 100644 index 000000000..d31f8883f --- /dev/null +++ b/src/jlmap3d/jl3dtrafficplan/model/zonemodel.js @@ -0,0 +1,20 @@ +export function ZoneModel(data) { + var scope = this; + //code + this.code = data.code; + //命名 + this.name = data.name; + this.type = data.type; + this.stage = data.stage; + this.status = 0; + this.randompoint = data.randompoint; + //轨迹点 + this.railpoints = data.railpoints; + + this.railline = new THREE.CatmullRomCurve3(data.railpoints); + if(data.doorpoints){ + this.doorpoints = data.doorpoints; + }else{ + this.doorpoints = null; + } +} diff --git a/src/jlmap3d/jl3dtrafficplan/passerai/passerai.js b/src/jlmap3d/jl3dtrafficplan/passerai/passerai.js new file mode 100644 index 000000000..8b5709dd7 --- /dev/null +++ b/src/jlmap3d/jl3dtrafficplan/passerai/passerai.js @@ -0,0 +1,267 @@ + + +export function PasserAi(zone,finder) { + let scope = this; + + //下车控制开关 + this.toppasseron = false; + this.downpasseron = false; + //上车控制开关 + this.toppasserin = false; + this.downpasserin = false; + let passerZone = zone; + let pathFinder = finder; + + let path; + let playerPosition = new THREE.Vector3( -3.5, 0.5, 5.5 ); + let targetPosition = new THREE.Vector3(); + //生成下车出站人物 + this.passerout = function(direct,mode){ + // console.log(direct); + if(direct == "top"){ + // console.log("toppasser"); + if(mode == "start"){ + scope.toppasseron = true; + scope.toppasserin = true; + } + if(mode == "end"){ + scope.toppasseron = false + scope.toppasserin = false; + } + // scope.toppasseron = true; + // setTimeout(function(){ + // scope.toppasseron = false + // scope.toppasserin = true; + // + // setTimeout(function(){ + // scope.toppasserin = false; + // }, 20000); + // }, 5000); + } + if(direct == "down"){ + if(mode == "start"){ + scope.downpasseron = true; + scope.downpasserin = true; + } + if(mode == "end"){ + scope.downpasseron = false; + scope.downpasserin = false; + } + // console.log("downpasser"); + // scope.downpasseron = true; + // setTimeout(function(){ + // scope.downpasseron = false; + // scope.downpasserin = true; + // setTimeout(function(){ + // scope.downpasserin = false; + // }, 20000); + // }, 5000); + } + } + + //初始化加载人物 + this.initPasser = function(humanlist,topWaitPassers,downWaitPassers,passerHuman,jl3d){ + + + for(let i=0;i val2) { + return 1; + } else { + return 0; + } +} //canvas文字贴图方法 //PS:待提炼 增强功能 var stationcanvas = new Image(); diff --git a/src/jmapNew/config/skinCode/bejing_01.js b/src/jmapNew/config/skinCode/bejing_01.js index f40879aaa..5c0308133 100644 --- a/src/jmapNew/config/skinCode/bejing_01.js +++ b/src/jmapNew/config/skinCode/bejing_01.js @@ -383,9 +383,16 @@ class SkinCode extends defaultStyle { }; this[deviceType.Station] = { - // text: { - // show: true // 公里标名称显示 - // }, + // 北京线车站元素 车站名称 + elemnetType:['stationText'], + stationText:{ + z:0, + fontWeight:'normal', // 字体粗细 + textPadding:[0, 0], // 字体边距 + borderColor:'', // 字体边框颜色 + textBorderWidth:0 // 字体边框宽度 + }, + kmPostShow: true, // 公里标显示 kilometerPosition: 'down', // 公里标位置 fontWeight: 'bold', // 文字错细 @@ -688,7 +695,6 @@ class SkinCode extends defaultStyle { haveArrowText: true, // 是否需创建arrowText对象 textOffset: 4, // 字体偏移(用以控制字体据车头的距离) trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸 - displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗 trainTip:true // 鼠标悬停列车状态信息框是否显示 }, trainStatusStyle: { diff --git a/src/jmapNew/config/skinCode/chengdu_01.js b/src/jmapNew/config/skinCode/chengdu_01.js index 8a69318ad..5a083dcd0 100644 --- a/src/jmapNew/config/skinCode/chengdu_01.js +++ b/src/jmapNew/config/skinCode/chengdu_01.js @@ -335,9 +335,16 @@ class SkinCode extends defaultStyle { } }; this[deviceType.Station] = { - // text: { - // show: true // 公里标名称显示 - // }, + // 成都一号线车站元素 车站名称 + elemnetType:['stationText'], + stationText:{ + z:0, + fontWeight:'normal', // 字体粗细 + textPadding:[0, 0], // 字体边距 + borderColor:'', // 字体边框颜色 + textBorderWidth:0 // 字体边框宽度 + }, + kmPostShow: false, // 公里标显示 kilometerPosition: 'up', // 公里标朝向 text: { @@ -612,7 +619,6 @@ class SkinCode extends defaultStyle { haveArrowText: true, // 是否需创建arrowText对象 textOffset: 4, // 字体偏移(用以控制字体据车头的距离) trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸 - displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗 trainTip:true // 鼠标悬停列车状态信息框是否显示 }, trainStatusStyle: { diff --git a/src/jmapNew/config/skinCode/chengdu_03.js b/src/jmapNew/config/skinCode/chengdu_03.js index 171d3313f..6e34272f1 100644 --- a/src/jmapNew/config/skinCode/chengdu_03.js +++ b/src/jmapNew/config/skinCode/chengdu_03.js @@ -332,9 +332,16 @@ class SkinCode extends defaultStyle { }; this[deviceType.Station] = { - // text: { - // show: true // 公里标名称显示 - // }, + // 成都三号线车站元素 车站名称 + elemnetType:['stationText'], + stationText:{ + z:0, + fontWeight:'normal', // 字体粗细 + textPadding:[0, 0], // 字体边距 + borderColor:'', // 字体边框颜色 + textBorderWidth:0 // 字体边框宽度 + }, + kmPostShow: false, // 公里标显示 kilometerPosition: 'up', // 公里标朝向 text: { @@ -798,7 +805,6 @@ class SkinCode extends defaultStyle { haveArrowText: true, // 是否需创建arrowText对象 textOffset: 4, // 字体偏移(用以控制字体据车头的距离) trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸 - displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗 trainTip:true // 鼠标悬停列车状态信息框是否显示 }, trainStatusStyle: { diff --git a/src/jmapNew/config/skinCode/foshan_01.js b/src/jmapNew/config/skinCode/foshan_01.js index 08ba7fc49..72e90c9ab 100644 --- a/src/jmapNew/config/skinCode/foshan_01.js +++ b/src/jmapNew/config/skinCode/foshan_01.js @@ -342,9 +342,16 @@ class SkinCode extends defaultStyle { } }; this[deviceType.Station] = { - // text: { - // show: true // 公里标名称显示 - // }, + // 佛山有轨电车 车站元素 车站名称 + elemnetType:['stationText'], + stationText:{ + z:0, + fontWeight:'normal', // 字体粗细 + textPadding:[0, 0], // 字体边距 + borderColor:'', // 字体边框颜色 + textBorderWidth:0 // 字体边框宽度 + }, + kmPostShow: true, // 公里标显示 kilometerPosition: 'up', // 公里标朝向 text: { @@ -649,7 +656,6 @@ class SkinCode extends defaultStyle { haveArrowText: true, // 是否需创建arrowText对象 textOffset: 1, // 字体偏移(用以控制字体据车头的距离) trainWidthMoreText: 2, // 计算列车长度时--列车长比text多出尺寸 - displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗 trainTip:true // 鼠标悬停列车状态信息框是否显示 }, trainStatusStyle: { diff --git a/src/jmapNew/config/skinCode/fuzhou_01.js b/src/jmapNew/config/skinCode/fuzhou_01.js index 669521a8a..db8739e34 100644 --- a/src/jmapNew/config/skinCode/fuzhou_01.js +++ b/src/jmapNew/config/skinCode/fuzhou_01.js @@ -338,9 +338,16 @@ class SkinCode extends defaultStyle { } }; this[deviceType.Station] = { - // text: { - // show: true // 公里标名称显示 - // }, + // 福州一号线 车站元素 车站名称 + elemnetType:['stationText'], + stationText:{ + z:0, + fontWeight:'normal', // 字体粗细 + textPadding:[0, 0], // 字体边距 + borderColor:'', // 字体边框颜色 + textBorderWidth:0 // 字体边框宽度 + }, + kmPostShow: true, // 公里标显示 kilometerPosition: 'up', // 公里标朝向 text: { @@ -648,7 +655,6 @@ class SkinCode extends defaultStyle { haveArrowText: true, // 是否需创建arrowText对象 textOffset: 1, // 字体偏移(用以控制字体据车头的距离) trainWidthMoreText: 2, // 计算列车长度时--列车长比text多出尺寸 - displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗 trainTip:true // 鼠标悬停列车状态信息框是否显示 }, trainStatusStyle: { diff --git a/src/jmapNew/config/skinCode/haerbin_01.js b/src/jmapNew/config/skinCode/haerbin_01.js index 58921660f..b624b709f 100644 --- a/src/jmapNew/config/skinCode/haerbin_01.js +++ b/src/jmapNew/config/skinCode/haerbin_01.js @@ -374,9 +374,16 @@ class SkinCode extends defaultStyle { } }; this[deviceType.Station] = { - // text: { - // show: true // 公里标名称显示 - // }, + // 哈尔滨一号线 车站元素 车站名称 + elemnetType:['stationText'], + stationText:{ + z:0, + fontWeight:'normal', // 字体粗细 + textPadding:[2, 6], // 字体边距 + borderColor:'', // 字体边框颜色 + textBorderWidth:1 // 字体边框宽度 + }, + kmPostShow: true, // 公里标显示 kilometerPosition: 'up', // 公里标朝向 text: { @@ -722,7 +729,6 @@ class SkinCode extends defaultStyle { haveArrowText: true, // 是否需创建arrowText对象 textOffset: 1, // 字体偏移(用以控制字体据车头的距离) trainWidthMoreText: 2, // 计算列车长度时--列车长比text多出尺寸 - displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗, trainTip:true // 鼠标悬停列车状态信息框是否显示 }, trainStatusStyle: { diff --git a/src/jmapNew/config/skinCode/ningbo_01.js b/src/jmapNew/config/skinCode/ningbo_01.js index 4f4dfccaf..a8b58e64c 100644 --- a/src/jmapNew/config/skinCode/ningbo_01.js +++ b/src/jmapNew/config/skinCode/ningbo_01.js @@ -192,9 +192,16 @@ class SkinCode extends defaultStyle { }; this[deviceType.Station] = { - // text: { - // show: true // 公里标名称显示 - // }, + // 宁波一号线 车站元素 车站名称 + elemnetType:['stationText'], + stationText:{ + z:0, + fontWeight:'normal', // 字体粗细 + textPadding:[0, 0], // 字体边距 + borderColor:'', // 字体边框颜色 + textBorderWidth:0 // 字体边框宽度 + }, + kmPostShow: false, // 公里标显示 kilometerPosition: 'up', // 公里标朝向 text: { @@ -681,7 +688,6 @@ class SkinCode extends defaultStyle { textOffset: 4, // 字体偏移(用以控制字体据车头的距离) trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸 trainHeadColorChangeMode: 1, // 1:driveMode + runlevel - displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗 trainTip:false // 鼠标悬停列车状态信息框是否显示 }, mouseOverStyle:{ diff --git a/src/jmapNew/config/skinCode/ningbo_03.js b/src/jmapNew/config/skinCode/ningbo_03.js index ac71be77f..02fc2e07c 100644 --- a/src/jmapNew/config/skinCode/ningbo_03.js +++ b/src/jmapNew/config/skinCode/ningbo_03.js @@ -231,9 +231,16 @@ class SkinCode extends defaultStyle { }; this[deviceType.Station] = { - // text: { - // show: true // 公里标名称显示 - // }, + // 宁波三号线 车站元素 车站名称 + elemnetType:['stationText'], + stationText:{ + z:0, + fontWeight:'normal', // 字体粗细 + textPadding:[0, 0], // 字体边距 + borderColor:'', // 字体边框颜色 + textBorderWidth:0 // 字体边框宽度 + }, + kmPostShow: false, // 公里标显示 kilometerPosition: 'up', // 公里标朝向 text: { @@ -741,7 +748,6 @@ class SkinCode extends defaultStyle { textOffset: 4, // 字体偏移(用以控制字体据车头的距离) trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸 trainHeadColorChangeMode: 1, // 1:driveMode + runlevel - displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗 trainTip:false // 鼠标悬停列车状态信息框是否显示 }, mouseOverStyle:{ diff --git a/src/jmapNew/config/skinCode/race_01.js b/src/jmapNew/config/skinCode/race_01.js index 8d8c4f0cd..ec4c206a0 100644 --- a/src/jmapNew/config/skinCode/race_01.js +++ b/src/jmapNew/config/skinCode/race_01.js @@ -413,9 +413,16 @@ class SkinCode extends defaultStyle { }; this[deviceType.Station] = { - // text: { - // show: true // 公里标名称显示 - // }, + // 竞赛线路 车站元素 车站名称 + elemnetType:['stationText'], + stationText:{ + z:0, + fontWeight:'normal', // 字体粗细 + textPadding:[0, 0], // 字体边距 + borderColor:'', // 字体边框颜色 + textBorderWidth:0 // 字体边框宽度 + }, + kmPostShow: true, // 公里标显示 kilometerPosition: 'down', // 公里标位置 fontWeight: 'bold', // 文字错细 @@ -722,7 +729,6 @@ class SkinCode extends defaultStyle { haveArrowText: true, // 是否需创建arrowText对象 textOffset: 4, // 字体偏移(用以控制字体据车头的距离) trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸 - displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗 trainTip:true // 鼠标悬停列车状态信息框是否显示 }, trainStatusStyle: { diff --git a/src/jmapNew/config/skinCode/xian_01.js b/src/jmapNew/config/skinCode/xian_01.js index dedc4203f..e3fda6713 100644 --- a/src/jmapNew/config/skinCode/xian_01.js +++ b/src/jmapNew/config/skinCode/xian_01.js @@ -355,9 +355,16 @@ class SkinCode extends defaultStyle { } }; this[deviceType.Station] = { - // text: { - // show: true // 公里标名称显示 - // }, + // 西安一号线 车站元素 车站名称 + elemnetType:['stationText'], + stationText:{ + z:0, + fontWeight:'normal', // 字体粗细 + textPadding:[0, 0], // 字体边距 + borderColor:'', // 字体边框颜色 + textBorderWidth:0 // 字体边框宽度 + }, + kmPostShow: true, // 公里标显示 kilometerPosition: 'up', // 公里标朝向 text: { @@ -713,7 +720,6 @@ class SkinCode extends defaultStyle { haveArrowText: true, // 是否需创建arrowText对象 textOffset: 1, // 字体偏移(用以控制字体据车头的距离) trainWidthMoreText: 2, // 计算列车长度时--列车长比text多出尺寸 - displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗 trainTip:true // 鼠标悬停列车状态信息框是否显示 }, trainStatusStyle: { diff --git a/src/jmapNew/config/skinCode/xian_02.js b/src/jmapNew/config/skinCode/xian_02.js index 97b63f7cc..c5d687bb4 100644 --- a/src/jmapNew/config/skinCode/xian_02.js +++ b/src/jmapNew/config/skinCode/xian_02.js @@ -382,9 +382,16 @@ class SkinCode extends defaultStyle { } }; this[deviceType.Station] = { - // text: { - // show: true // 公里标名称显示 - // }, + // 西安二号线 车站元素 车站名称 + elemnetType:['stationText'], + stationText:{ + z:0, + fontWeight:'normal', // 字体粗细 + textPadding:[0, 0], // 字体边距 + borderColor:'', // 字体边框颜色 + textBorderWidth:0 // 字体边框宽度 + }, + kmPostShow: false, // 公里标显示 kilometerPosition: 'up', // 公里标朝向 text: { @@ -793,7 +800,6 @@ class SkinCode extends defaultStyle { haveArrowText: true, // 是否需创建arrowText对象 textOffset: 4, // 字体偏移(用以控制字体据车头的距离) trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸 - displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗 trainTip:true // 鼠标悬停列车状态信息框是否显示 }, trainStatusStyle: { diff --git a/src/jmapNew/painter.js b/src/jmapNew/painter.js index 637772076..e4d93be0b 100644 --- a/src/jmapNew/painter.js +++ b/src/jmapNew/painter.js @@ -87,41 +87,40 @@ class Painter { } } - checkIntersect(device) { - var intersect = false; - var befor = device.instance; - var train = shapefactory(device, this.$jmap); - + checkTrainOverlap(device) { // 检查重叠列车 + const trainWindowCode = device.trainWindowCode; + const overlapTrainList = [device.code]; this.mapInstanceLevel[deviceType.Train].eachChild(elem => { - if (elem !== befor && elem.getBoundingRect().intersect(train.getBoundingRect())) { - intersect = true; - return; + if (elem.model.code !== device.code && elem.model.trainWindowCode === trainWindowCode) { + overlapTrainList.push(elem.model.code); + } + }); + if (overlapTrainList.length > 1) { + this.sortOverLapTrain(overlapTrainList); + } + return overlapTrainList; + } + sortOverLapTrain(overlapTrainList) { // 对重叠列车按照区段上的位置进行排序 + overlapTrainList.sort((a, b) => { + const trainA = this.$jmap.getDeviceByCode(a); + const trainB = this.$jmap.getDeviceByCode(b); + if (trainA.right) { + return trainA.offsetp - trainB.offsetp; + } else { + return trainB.offsetp - trainA.offsetp; } }); - - return intersect; } - /** * 更新列车 * @param {*} device */ updateTrain(device) { - var oldTrainWindowModel = null; - var instance = device.instance; - var curModel = device; - let displayPosition = 'margin'; - if (instance) { - oldTrainWindowModel = device.trainWindowModel; - displayPosition = instance.style.Train.common.displayPosition; - } + const curModel = device; if (curModel.sectionCode) { curModel.sectionModel = this.$jmap.getDeviceByCode(curModel.sectionCode); if (curModel.sectionModel.trainWindowCode) { curModel.trainWindowCode = curModel.sectionModel.trainWindowCode; - } else if (displayPosition === 'center' && curModel.sectionModel.logicSectionCodeList && curModel.sectionModel.logicSectionCodeList.length) { - const sec = this.$jmap.getDeviceByCode(curModel.sectionModel.logicSectionCodeList[Math.floor(curModel.sectionModel.logicSectionCodeList.length / 2)]); - curModel.trainWindowCode = sec.trainWindowCode; } else if (curModel.right && curModel.sectionModel.logicSectionCodeList && curModel.sectionModel.logicSectionCodeList.length) { const sec = this.$jmap.getDeviceByCode(curModel.sectionModel.logicSectionCodeList[curModel.sectionModel.logicSectionCodeList.length - 1]); curModel.trainWindowCode = sec.trainWindowCode; @@ -134,13 +133,13 @@ class Painter { if (curModel.trainWindowCode) { curModel.trainWindowModel = this.$jmap.getDeviceByCode(curModel.trainWindowCode); } - - if (instance && oldTrainWindowModel && this.checkIntersect(device)) { - device.trainWindowModel = oldTrainWindowModel; - } - - instance && this.mapInstanceLevel[deviceType.Train].remove(instance); - this.add(device); + const overlapTrainList = this.checkTrainOverlap(device); + overlapTrainList.forEach((item, index) => { + const trainDevice = this.$jmap.getDeviceByCode(item); + trainDevice.overLapIndex = index; + trainDevice.instance && this.mapInstanceLevel[deviceType.Train].remove(trainDevice.instance); + this.add(trainDevice); + }); if (this.screenFlag) { this.$transformHandleScreen.transformView(device.instance); @@ -233,7 +232,6 @@ class Painter { y: transPoint[1] }; } - } } diff --git a/src/jmapNew/shape/Station/EStationText.js b/src/jmapNew/shape/Station/EStationText.js new file mode 100644 index 000000000..f6b8418a9 --- /dev/null +++ b/src/jmapNew/shape/Station/EStationText.js @@ -0,0 +1,67 @@ +import Group from 'zrender/src/container/Group'; +import Text from 'zrender/src/graphic/Text'; + +class EStationText extends Group { + constructor(model) { + super(); + this.model = model; + this.create(); + } + + create() { + const model = this.model.modelData; + const style = this.model.style; + + // 车站名称 + this.stationName = new Text({ + zlevel: this.model.zlevel, + z: this.model.z, + silent: !model.visible || false, + style: { + x: model.position.x, + y: model.position.y, + fontWeight: style.Station.stationText.fontWeight, + fontSize: isNaN(Number(model.nameFont)) ? 20 : Number(model.nameFont), + fontFamily: style.fontFamily, + text: model.number ? model.number + model.name : model.name, + textAlign: 'middle', + textFill: model.nameFontColor, + textVerticalAlign: 'top', + textPadding:style.Station.stationText.textPadding, + textBorderColor:style.Station.stationText.borderColor || model.nameFontColor, + textBorderWidth:style.Station.stationText.textBorderWidth + } + }); + this.add(this.stationName); + if (model.subheadDisplay) { // 副标题 + this.subheadText = new Text({ + zlevel: this.model.zlevel, + z: this.model.z, + silent: !model.visible || false, + style: { + x: model.subheadPosition.x, + y: model.subheadPosition.y, + fontWeight: model.fontWeight, + fontSize: model.subheadFont || 18, + fontFamily: style.fontFamily, + text: model.subhead, + textAlign: 'middle', + textVerticalAlign: 'top', + textFill: model.subheadFontColor, + textPadding:style.Station.stationText.textPadding, + textBorderColor:style.Station.stationText.borderColor || model.nameFontColor, + textBorderWidth:style.Station.stationText.textBorderWidth + } + }); + this.add(this.subheadText); + } + } + + recover() { + } + + setState() { + } +} + +export default EStationText; diff --git a/src/jmapNew/shape/Station/index.js b/src/jmapNew/shape/Station/index.js index f24fbe4e6..f2c31b1fe 100644 --- a/src/jmapNew/shape/Station/index.js +++ b/src/jmapNew/shape/Station/index.js @@ -11,6 +11,10 @@ import { arrow } from '../utils/ShapePoints'; import Rect from 'zrender/src/graphic/shape/Rect'; import Text from 'zrender/src/graphic/Text'; import store from '@/store/index_APP_TARGET'; + +import EStationText from './EStationText'; +import {traverseLineElements, traverseStatusElements} from '../utils/ShapeStatusCovert'; + import Vue from 'vue'; export default class Station extends Group { @@ -28,37 +32,21 @@ export default class Station extends Group { this.createControlMode(); this.setState(model); this.checkIsDrawMap(); + this.setVisible(model.visible); } create() { const model = this.model; const style = this.style; - // 公里标名称是否显示 - this.stationText = new ETextName({ - zlevel: this.zlevel, - z: this.z, - x: model.position.x, - y: model.position.y, - fontWeight: style.Station.text.fontWeight, - fontSize: isNaN(Number(model.nameFont)) ? 20 : Number(model.nameFont), - fontFamily: style.fontFamily, - silent: !model.visible, - text: model.number ? model.number + model.name : model.name, - textAlign: 'middle', - textVerticalAlign: 'top', - textFill: model.nameFontColor - }); - this.add(this.stationText); - if (style.Station.text.borderShow) { // 哈尔滨线路单独显示 - this.stationText.attr({ - style: { - textPadding: style.Station.text.textPadding || [2, 6], - textBorderColor: style.Station.text.borderColor || model.nameFontColor, - textBorderWidth: style.Station.text.textBorderWidth || 1 - } - }); - } + // // 站台所有的绘图元素 + const elementTypeList = { + 'stationText':EStationText // 车站名称 (普通站台样式) + }; + + // 遍历当前线路下的绘图元素 组合模式 + traverseLineElements(style.Station, elementTypeList, model, style, this); + const path = window.location.href; if (style.Station.kmPostShow || path.includes('/map/draw')) { // 公里标是否显示 let direction = 1; @@ -88,37 +76,13 @@ export default class Station extends Group { this.add(this.mileageText); model.kmPostShow ? this.mileageText.show() : this.mileageText.hide(); } - if (model.subheadDisplay) { // 副标题 - this.subheadText = new ETextName({ - zlevel: this.zlevel, - z: this.z, - x: model.subheadPosition.x, - y: model.subheadPosition.y, - fontWeight: model.fontWeight, - fontSize: model.subheadFont || 18, - fontFamily: style.fontFamily, - text: model.subhead, - silent: !model.visible, - textAlign: 'middle', - textVerticalAlign: 'top', - textFill: model.subheadFontColor - }); - this.add(this.subheadText); - if (style.Station.text.borderShow) { - this.subheadText.attr({ - style: { - textPadding: [2, 6], - textBorderColor: model.nameFontColor, - textBorderWidth: 1 - } - }); - } - } - if (!model.visible) { // 隐藏车站 - this.subheadText && this.subheadText.setStyle('textFill', 'rgba(0,0,0,0)'); - this.mileageText && this.mileageText.setStyle('textFill', 'rgba(0,0,0,0)'); - this.stationText && this.stationText.setStyle('textFill', 'rgba(0,0,0,0)'); - } + + // if (!model.visible) { // 隐藏车站 + // // this.subheadText && this.subheadText.setStyle('textFill', 'rgba(0,0,0,0)'); + // // this.mileageText && this.mileageText.setStyle('textFill', 'rgba(0,0,0,0)'); + // // this.stationText && this.stationText.setStyle('textFill', 'rgba(0,0,0,0)'); + // this.eachChild(elem => { elem.hide(); }); + // } } createTurnBack() { // 创建按图折返 const model = this.model; @@ -406,6 +370,13 @@ export default class Station extends Group { } } + // /** 恢复初始状态*/ + // recover() { + // const currentTypeList = this.style.Station.elemnetType; + // currentTypeList.forEach(element => { + // this[element].recover(); + // }); + // } recover() { this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor); this.emergencyControl && this.emergencyControl.setTextColor(this.style.Station.StationControl.text.fontColor); @@ -433,6 +404,18 @@ export default class Station extends Group { } } + // setState(model) { + // if (!this.isShowShape) return; + // // // 新版地图使用新版状态变更方式 + // this.recover(); + + // // 更新状态 + // const currentTypeList = this.style.Station.elemnetType; + // currentTypeList.forEach(element => { + // this[element].setState(model); + // }); + // } + getShapeTipPoint(opts) { let rect; if (opts.subDeviceType === 'button') { @@ -448,13 +431,14 @@ export default class Station extends Group { getBoundingRect() { const rect = this.stationText.getBoundingRect().clone(); - if (this.model.subheadDisplay) { - const subheadText = this.subheadText.getBoundingRect().clone(); - rect.union(subheadText); - return rect; - } else { - return rect; - } + // if (this.model.subheadDisplay) { + // const subheadText = this.subheadText.getBoundingRect().clone(); + // rect.union(subheadText); + // return rect; + // } else { + // return rect; + // } + return rect; } drawSelected(selected) { @@ -489,4 +473,12 @@ export default class Station extends Group { this.isShowShape = false; } } + + setVisible(visible) { + if (visible) { + this.eachChild(elem => { elem.show(); }); + } else { + this.eachChild(elem => { elem.hide(); }); + } + } } diff --git a/src/jmapNew/shape/StationStand/index.js b/src/jmapNew/shape/StationStand/index.js index 540cdfc97..d3b640253 100644 --- a/src/jmapNew/shape/StationStand/index.js +++ b/src/jmapNew/shape/StationStand/index.js @@ -63,6 +63,7 @@ class StationStand extends Group { // 加载皮肤控制的元素 const model = this.model; const style = this.style; + // // 站台所有的绘图元素 const elementTypeList = { 'solidStand':ESolidStand, // 矩形实心站台 (普通站台样式) diff --git a/src/jmapNew/shape/Train/index.js b/src/jmapNew/shape/Train/index.js index 55913cfa3..faa2404aa 100644 --- a/src/jmapNew/shape/Train/index.js +++ b/src/jmapNew/shape/Train/index.js @@ -46,10 +46,10 @@ export default class Train extends Group { }; if (model.right) { this.point.x = this.point.x - style.Train.trainHead.trainConntWidth * this.newScale - style.Train.common.trainWidth / 2; - this.point.y = this.point.y - style.Train.common.trainHeight / 2; + this.point.y = this.point.y - style.Train.common.trainHeight / 2 + model.overLapIndex * (style.Train.common.trainHeight + 5); } else { this.point.x = this.point.x + style.Train.trainHead.trainConntWidth * this.newScale - style.Train.common.trainWidth / 2; - this.point.y = this.point.y + model.trainWindowModel.height - style.Train.common.trainHeight / 2; + this.point.y = this.point.y + model.trainWindowModel.height - style.Train.common.trainHeight / 2 - model.overLapIndex * (style.Train.common.trainHeight + 5); } } else { this.point = model.position; diff --git a/src/router/index_Common.js b/src/router/index_Common.js index 5ac7231fd..f1f415cc9 100644 --- a/src/router/index_Common.js +++ b/src/router/index_Common.js @@ -16,6 +16,8 @@ const Jlmap3dAssetManager = () => import('@/views/jlmap3d/jl3dassetmanager/asset const Jlmap3d = () => import('@/views/jlmap3d/drive/jl3ddrive'); const Jlmap3dSandbox = () => import('@/views/jlmap3d/simulation/jl3dsimulation'); const Jlmap3dPassFlow = () => import('@/views/jlmap3d/passflow/jl3dpassflow'); +const Jlmap3dTrafficPlan = () => import('@/views/jlmap3d/trafficplan/jl3dtrafficplan'); +const Jlmap3dTrafficTrain = () => import('@/views/jlmap3d/trafficplan/jl3dtraffictrain'); const Jlmap3dModel = () => import('@/views/jlmap3d/device/jl3ddevice'); const Jlmap3dMaintainer = () => import('@/views/jlmap3d/maintainer/jl3dmaintainer'); const Jlmap3dMaintainerVr = () => import('@/views/jlmap3d/maintainer/jl3dmaintainervr'); @@ -89,6 +91,7 @@ const DesignPlatform = () => import('@/views/designPlatform/index'); const MapPreviewNew = () => import('@/views/designPlatform/mapPreviewNew'); const BigScreen = () => import('@/views/designPlatform/bigScreen'); const BigSplitScreen = () => import('@/views/designPlatform/bigSplitScreen'); +const TestRunplan = () => import('@/views/designPlatform/testRunplan'); const Package = () => import('@/views/package/index'); @@ -205,12 +208,12 @@ export const constantRoutes = [ path: '/design/jlmap3d/assetmanager', component: Jlmap3dAssetManager, hidden: true - }, - { - path: '/data2json', - component: () => import('@/views/planMonitor/data2json/page.vue'), - hidden: true - }, + }, + { + path: '/data2json', + component: () => import('@/views/planMonitor/data2json/page.vue'), + hidden: true + }, { // 线信息 path: '/AUSline', component: PlanMonitorEditAUSLine, @@ -231,6 +234,16 @@ export const constantRoutes = [ component: Jlmap3dPassFlow, hidden: true }, + { + path: '/jlmap3d/trafficplan', + component: Jlmap3dTrafficPlan, + hidden: true + }, + { + path: '/jlmap3d/traffictrain', + component: Jlmap3dTrafficTrain, + hidden: true + }, { path: '/jlmap3d/devicemodel', @@ -379,6 +392,12 @@ export const publicAsyncRoute = [ path: '/planSchedule/window', component: PlanScheduleWicket, hidden: true + }, + { + // 运行图测试(仿真,仅有按计划行车和初始化操作) + path: '/design/runPlan/testRunplan', + component: TestRunplan, + hidden: true } ]; // 城市轨道项目 diff --git a/src/router/index_HEB.js b/src/router/index_HEB.js index ccbe0c245..79f73eab2 100644 --- a/src/router/index_HEB.js +++ b/src/router/index_HEB.js @@ -46,6 +46,7 @@ const LessonHome = () => import('@/views/lesson/home'); const LessonDetail = () => import('@/views/lesson/details'); const BigScreen = () => import('@/views/designPlatform/bigScreen'); const BigSplitScreen = () => import('@/views/designPlatform/bigSplitScreen'); +const TestRunplan = () => import('@/views/designPlatform/testRunplan'); const ScriptmanageHome = () => import('@/views/scriptManage/home'); @@ -273,6 +274,12 @@ export const publicAsyncRoute = [ path: '/device/result/:userExamId', component: ExamResult, hidden: true + }, + { + // 运行图测试(仿真,仅有按计划行车和初始化操作) + path: '/design/runPlan/testRunplan', + component: TestRunplan, + hidden: true } ]; export const asyncRouter = [ diff --git a/src/scripts/ConstDic.js b/src/scripts/ConstDic.js index f234c7cf1..8153ffcca 100644 --- a/src/scripts/ConstDic.js +++ b/src/scripts/ConstDic.js @@ -2277,6 +2277,7 @@ export const UrlConfig = { lessonTraining: '/design/lesson/training', trainingRecord: '/design/lesson/training', runPlan: '/design/runPlan/detail', + testRunPlan: '/design/runPlan/testRunplan', scriptHome: '/design/script/home', display: '/design/display', displayNew: '/design/displayNew', diff --git a/src/store/modules/exam.js b/src/store/modules/exam.js index 7663d4895..aa709a6fc 100644 --- a/src/store/modules/exam.js +++ b/src/store/modules/exam.js @@ -2,7 +2,6 @@ import store from '@/store/index_APP_TARGET'; const exam = { namespaced: true, - state: { deviceCode: '', // 考试目标code started: false, // 考试状态 diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index f3730c1bc..712d5eee0 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -4,9 +4,9 @@ export function getBaseUrl() { // BASE_API = 'https://joylink.club/jlcloud'; BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'http://192.168.8.107:9000'; // 袁琪 - // BASE_API = 'http://192.168.8.114:9000'; // 旭强 + // BASE_API = 'http://192.168.8.129:9000'; // 旭强 // BASE_API = 'http://192.168.8.109:9000'; // 张赛 - // BASE_API = 'http://192.168.8.110:9008'; // 杜康 + // BASE_API = 'http://192.168.8.110:9000'; // 杜康 // BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康 // BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛 diff --git a/src/views/components/limits/distribute.vue b/src/views/components/limits/distribute.vue index a12c06355..c011c11bf 100644 --- a/src/views/components/limits/distribute.vue +++ b/src/views/components/limits/distribute.vue @@ -1,7 +1,7 @@ - diff --git a/src/views/newMap/displayNew/menuSchema.vue b/src/views/newMap/displayNew/menuSchema.vue index f4765aad9..0a73e57fe 100644 --- a/src/views/newMap/displayNew/menuSchema.vue +++ b/src/views/newMap/displayNew/menuSchema.vue @@ -2,7 +2,7 @@
-