From 87d93e1fc863648d3bbac17c28ed93e3f3763c31 Mon Sep 17 00:00:00 2001 From: sunleking Date: Mon, 2 Nov 2020 11:22:46 +0800 Subject: [PATCH 01/72] url --- src/utils/baseUrl.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index 778caeb7b..bc9b3941d 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -1,8 +1,8 @@ export function getBaseUrl() { let BASE_API; if (process.env.NODE_ENV === 'development') { - // BASE_API = 'https://joylink.club/jlcloud'; - BASE_API = 'https://test.joylink.club/jlcloud'; + BASE_API = 'https://joylink.club/jlcloud'; + // BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'http://192.168.3.5:9000'; // 袁琪 // BASE_API = 'http://192.168.3.6:9000'; // 旭强 // BASE_API = 'http://192.168.3.41:9000'; // 张赛 From 23b98c7c4684eb377d2bb4461540c62ac8caf00f Mon Sep 17 00:00:00 2001 From: sunzhenyu Date: Wed, 4 Nov 2020 10:34:33 +0800 Subject: [PATCH 02/72] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AE=A2=E6=B5=81?= =?UTF-8?q?=E8=A7=84=E5=88=92=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/langs/en/display.js | 1 + src/i18n/langs/zh/display.js | 1 + src/jlmap3d/edit/config/editassetconfig.js | 4 +- src/jlmap3d/edit/connect/newgetmodels.js | 4 +- .../jl3dtrafficplan/jl3dtrafficplan.js | 300 ++++++++++++++++++ src/jlmap3d/main/loaders/AssetLoader.js | 2 +- .../main/newmodel/StationStandListN.js | 7 +- src/router/index_Common.js | 7 +- src/views/jlmap3d/edit/component/index.vue | 2 +- .../jlmap3d/trafficplan/jl3dtrafficplan.vue | 213 +++++++++++++ src/views/newMap/displayNew/demonMenu.vue | 20 ++ src/views/newMap/displayNew/menuDemon.vue | 1 + 12 files changed, 551 insertions(+), 11 deletions(-) create mode 100644 src/jlmap3d/jl3dtrafficplan/jl3dtrafficplan.js create mode 100644 src/views/jlmap3d/trafficplan/jl3dtrafficplan.vue diff --git a/src/i18n/langs/en/display.js b/src/i18n/langs/en/display.js index 5cef3d6e5..7f074ebb9 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', + trafficplan:'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..248245da7 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视图', + trafficplan:'客流规划', 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/jl3dtrafficplan.js b/src/jlmap3d/jl3dtrafficplan/jl3dtrafficplan.js new file mode 100644 index 000000000..ace3ecc63 --- /dev/null +++ b/src/jlmap3d/jl3dtrafficplan/jl3dtrafficplan.js @@ -0,0 +1,300 @@ +import { Staticmodel } from '@/jlmap3d/jl3dpassflow/config.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/jl3dpassflow/loader.js'; +//骨骼动画模型辅助工具 +import { SkeletonUtils } from '@/jlmap3d/main/utils/SkeletonUtils.js'; +//获取信息接口 +import { getPublishMapVersion, getPublishMapDetail,getPublish3dMapDetail} from '@/api/jlmap3d/load3ddata'; +//cctv站台对象 +import { PasserStation } from '@/jlmap3d/jl3dpassflow/model/passerstation.js'; +//cctv检票机对象 +import { PasserCheckDoor } from '@/jlmap3d/jl3dpassflow/model/passercheckdoor.js'; +//cctv列车对象 +import { PasserTrain } from '@/jlmap3d/jl3dpassflow/model/passertrain.js'; +//cctv行人对象 +import { PasserHuman } from '@/jlmap3d/jl3dpassflow/model/passerhuman.js'; +//cctv渲染器 +import { PasserRender } from '@/jlmap3d/jl3dpassflow/passerrender/passerrender.js'; +//cctv行人ai +import { PasserAi } from '@/jlmap3d/jl3dpassflow/passerai/passerai.js'; +//行人寻路相关工具 +import { ZoneManager } from '@/jlmap3d/jl3dpassflow/model/zonemanager.js'; +import { PathFinder } from '@/jlmap3d/jl3dpassflow/passerai/pathfinder.js'; +//cctv通信工具 +import { PassflowConnect } from '@/jlmap3d/jl3dpassflow/connect/passflowconnect.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/passsimulation/station.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; + + //定义相机 + 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 passerHuman = new PasserHuman(); + + let passerAi = new PasserAi(passerZone,pathFinder); + + this.anime = null; + + this.modelmanager = new ModelManager(); + // let loadingInstance = Loading.service({ fullscreen: true }); + + this.nowstation = null; + + let stationlist = []; + let socktest = null; + let passerStation = new PasserStation(); + let passerCheckDoor = new PasserCheckDoor(); + let passerTrain = new PasserTrain(); + + getPublish3dMapDetail(skinCode).then(netdata3d => { + passerStation.loadMaterial(netdata3d); + this.modelmanager.loadpromise(JSON.parse(netdata3d.data.assets).cctvAssetList, scope.mixers).then(function (data) { + + passerStation.initStationAnimation(scope.modelmanager.station.mesh,mixers,deviceaction,scene); + passerCheckDoor.initCheckDoorInAnimation(scope.modelmanager.zhajiin.mesh,mixers,deviceaction,scene); + passerCheckDoor.initCheckDoorOutAnimation(scope.modelmanager.zhajiout.mesh,mixers,deviceaction,scene); + + passerTrain.initTrain(scope.modelmanager.train.mesh,mixers,deviceaction,scene); + + scene.add(scope.modelmanager.section.mesh); + + monitor = scope.modelmanager.monitor.mesh; + scene.add(monitor); + + + + getPublishMapDetail(skinCode).then(netdata => { + scope.switchviews('freeview'); + passerHuman.initHumans(scope.modelmanager.man1.mesh,scope.modelmanager.man2.mesh); + scene.add(humanlist); + passerStation.initStationList(netdata.data.stationList,netdata.data.stationStandList,netdata.data.psdList); + socktest = new PassflowConnect(deviceaction,passerTrain.toptrain,passerTrain.downtrain,routegroup,passerStation,passerAi); + + store.dispatch('app/animationsClose'); + + let checkobject = setInterval(function(){ + + clearInterval(checkobject); + //进站控制 + startWorker(); + passerWebWork.postMessage("on"); + + },1000); + }); + + animate(); + }) + }); + + this.changestation = function(stationname){ + passerStation.changestation(stationname); + scope.resetscene(); + } + + 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(){ + passerAi.initPasser(humanlist,passerHuman); + aiswitch = 0; + }, 2000); + + } + + function startWorker(){ + passerAi.initPasser(humanlist,passerHuman); + let updateaianimate = setInterval( + function(){ + // console.log("?"); + if(aiswitch == 0){ + passerHuman.moveAnimateUpdate(humanlist,olddataai,passerHuman); + passerAi.aiUpdate(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=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; + //1--top + //2-- down + if(direct == 1){ + passerHuman.newHumanCreate(humanlist,passerZone.getzoneposition("enter1"),0); + }else{ + passerHuman.newHumanCreate(humanlist,passerZone.getzoneposition("enter2"),0); + } + if(passerAi.toppasseron){ + for(let i=0,leni=passerZone.list["standtop"].doorpoints.length;i 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 Jlmap3dModel = () => import('@/views/jlmap3d/device/jl3ddevice'); const Jlmap3dMaintainer = () => import('@/views/jlmap3d/maintainer/jl3dmaintainer'); const Jlmap3dMaintainerVr = () => import('@/views/jlmap3d/maintainer/jl3dmaintainervr'); @@ -225,7 +226,11 @@ export const constantRoutes = [ component: Jlmap3dPassFlow, hidden: true }, - + { + path: '/jlmap3d/trafficplan', + component: Jlmap3dTrafficPlan, + hidden: true + }, { path: '/jlmap3d/devicemodel', component: Jlmap3dModel, diff --git a/src/views/jlmap3d/edit/component/index.vue b/src/views/jlmap3d/edit/component/index.vue index a75f96293..10376f451 100644 --- a/src/views/jlmap3d/edit/component/index.vue +++ b/src/views/jlmap3d/edit/component/index.vue @@ -1,6 +1,6 @@ + diff --git a/src/views/newMap/displayNew/demonMenu.vue b/src/views/newMap/displayNew/demonMenu.vue index 3d88e05af..5e2df8413 100644 --- a/src/views/newMap/displayNew/demonMenu.vue +++ b/src/views/newMap/displayNew/demonMenu.vue @@ -11,6 +11,8 @@ {{ jl3dname }} {{ jl3dpassflow }} + + {{ jl3dtrafficplan }} 故障设备 @@ -72,6 +74,10 @@ export default { type:Boolean, require:true }, + trafficplanShow:{ + type:Boolean, + require:true + }, scheduleLoadShow:{ type:Boolean, require:true @@ -105,6 +111,7 @@ export default { practiceDisabled:false, deviceShow: false, drivingShow: false, + jl3dtrafficplan:this.$t('display.demon.trafficplan'), jl3dpassflow:this.$t('display.demon.passengerflow'), jl3dname: this.$t('display.demon.threeDimensionalView'), jl3dmodel: this.$t('display.demon.deviceView') @@ -179,6 +186,19 @@ export default { }); window.open(routeData.href, '_blank', 'noopener noreferrer'); }, + jumpjl3dtrafficplan() { + const routeData = this.$router.resolve({ + path:'/jlmap3d/trafficplan', + query:{ + mapid:this.mapId, + group:this.group, + project: this.project, + noPreLogout: true, + lineCode:this.lineCode + } + }); + window.open(routeData.href, '_blank', 'noopener noreferrer'); + }, jumpjlmap3dFault() { const routeData = this.$router.resolve({ path:'/jlmap3d/maintainer', diff --git a/src/views/newMap/displayNew/menuDemon.vue b/src/views/newMap/displayNew/menuDemon.vue index 3e957a275..89f5b27b2 100644 --- a/src/views/newMap/displayNew/menuDemon.vue +++ b/src/views/newMap/displayNew/menuDemon.vue @@ -13,6 +13,7 @@ :jl3dmodel-show="isShow3dmodel && !isShowScheduling && !isDrive" :jl3dname-show="!isShowScheduling&&!isDrive" :cctv-show="!isShowScheduling" + :trafficplan-show="!isShowScheduling" :schedule-load-show="isShowScheduling && !runing" :schedule-preview-show="isShowScheduling && runing" :jlmap3d-fault-show="false" From 3ad0ccffc136e4b07844f845af20b0283b3b6858 Mon Sep 17 00:00:00 2001 From: sunzhenyu Date: Fri, 6 Nov 2020 18:28:30 +0800 Subject: [PATCH 03/72] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=89=E7=BB=B4?= =?UTF-8?q?=E5=AE=A2=E6=B5=81=E8=A7=84=E5=88=92=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/langs/en/display.js | 2 +- src/i18n/langs/zh/display.js | 3 +- .../jl3dtrafficplan/connect/stationconnect.js | 185 ++++++++++ .../jl3dtrafficplan/connect/trainconnect.js | 117 ++++++ .../jl3dtrafficplan/jl3dtrafficplan.js | 101 +++-- .../jl3dtrafficplan/jl3dtraffictrain.js | 347 ++++++++++++++++++ src/jlmap3d/jl3dtrafficplan/loader/loader.js | 158 ++++++++ .../jl3dtrafficplan/loader/stationconfig.js | 71 ++++ .../jl3dtrafficplan/loader/trainconfig.js | 27 ++ .../jl3dtrafficplan/model/passercheckdoor.js | 230 ++++++++++++ .../jl3dtrafficplan/model/passerhuman.js | 297 +++++++++++++++ .../jl3dtrafficplan/model/passerstation.js | 176 +++++++++ .../jl3dtrafficplan/model/passertrain.js | 121 ++++++ .../jl3dtrafficplan/model/zonemanager.js | 295 +++++++++++++++ .../jl3dtrafficplan/model/zonemodel.js | 20 + .../jl3dtrafficplan/passerai/passerai.js | 273 ++++++++++++++ .../jl3dtrafficplan/passerai/pathfinder.js | 69 ++++ src/router/index_Common.js | 7 + .../trafficplan/component/stationdata.vue | 123 +++++++ .../jlmap3d/trafficplan/jl3dtrafficplan.vue | 51 ++- .../jlmap3d/trafficplan/jl3dtraffictrain.vue | 321 ++++++++++++++++ src/views/newMap/displayNew/demonMenu.vue | 7 +- static/trafficplan/man1.FBX | Bin 0 -> 973728 bytes static/trafficplan/man2.FBX | Bin 0 -> 650768 bytes static/trafficplan/train.FBX | Bin 0 -> 5559984 bytes static/trafficplan/trunkback.png | Bin 0 -> 3417106 bytes static/trafficplan/trunkbody.png | Bin 0 -> 2859249 bytes static/trafficplan/trunkhead.png | Bin 0 -> 3218853 bytes 28 files changed, 2959 insertions(+), 42 deletions(-) create mode 100644 src/jlmap3d/jl3dtrafficplan/connect/stationconnect.js create mode 100644 src/jlmap3d/jl3dtrafficplan/connect/trainconnect.js create mode 100644 src/jlmap3d/jl3dtrafficplan/jl3dtraffictrain.js create mode 100644 src/jlmap3d/jl3dtrafficplan/loader/loader.js create mode 100644 src/jlmap3d/jl3dtrafficplan/loader/stationconfig.js create mode 100644 src/jlmap3d/jl3dtrafficplan/loader/trainconfig.js create mode 100644 src/jlmap3d/jl3dtrafficplan/model/passercheckdoor.js create mode 100644 src/jlmap3d/jl3dtrafficplan/model/passerhuman.js create mode 100644 src/jlmap3d/jl3dtrafficplan/model/passerstation.js create mode 100644 src/jlmap3d/jl3dtrafficplan/model/passertrain.js create mode 100644 src/jlmap3d/jl3dtrafficplan/model/zonemanager.js create mode 100644 src/jlmap3d/jl3dtrafficplan/model/zonemodel.js create mode 100644 src/jlmap3d/jl3dtrafficplan/passerai/passerai.js create mode 100644 src/jlmap3d/jl3dtrafficplan/passerai/pathfinder.js create mode 100644 src/views/jlmap3d/trafficplan/component/stationdata.vue create mode 100644 src/views/jlmap3d/trafficplan/jl3dtraffictrain.vue create mode 100644 static/trafficplan/man1.FBX create mode 100644 static/trafficplan/man2.FBX create mode 100644 static/trafficplan/train.FBX create mode 100644 static/trafficplan/trunkback.png create mode 100644 static/trafficplan/trunkbody.png create mode 100644 static/trafficplan/trunkhead.png diff --git a/src/i18n/langs/en/display.js b/src/i18n/langs/en/display.js index 7f074ebb9..8f157a6d9 100644 --- a/src/i18n/langs/en/display.js +++ b/src/i18n/langs/en/display.js @@ -55,7 +55,7 @@ export default { threeDimensionalView: 'Three-Dimensional View', threeDimensionalStation: 'Three-Dimensional Station', passengerflow: 'CCTV View', - trafficplan:'Passer Planing', + 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 248245da7..72e5b6de4 100644 --- a/src/i18n/langs/zh/display.js +++ b/src/i18n/langs/zh/display.js @@ -55,7 +55,8 @@ export default { threeDimensionalView: '数字沙盘', threeDimensionalStation: '三维车站', passengerflow: 'cctv视图', - trafficplan:'客流规划', + trafficplantext:'客流规划', + traffictraintext:'列车客乘', maintainer: '设备故障视图', deviceView: '设备视图', taskOperateSuccess: '任务操作成功', diff --git a/src/jlmap3d/jl3dtrafficplan/connect/stationconnect.js b/src/jlmap3d/jl3dtrafficplan/connect/stationconnect.js new file mode 100644 index 000000000..b6306b47b --- /dev/null +++ b/src/jlmap3d/jl3dtrafficplan/connect/stationconnect.js @@ -0,0 +1,185 @@ +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,passerHuman) { + 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); + + if(data.type == "DeviceCtrl_3D"){ + if(data.body.type == "PSD"){ + if(data.body.code == passerStation.nowStation.toppsd){ + if(data.body.open == 0){ + passerAi.passerout("top","end"); + deviceaction.top.action.reset(); + deviceaction.top.action.time =deviceaction.top.action._clip.duration; + deviceaction.top.action.timeScale = -1; + deviceaction.top.action.play(); + + }else{ + passerAi.passerout("top","start") + deviceaction.top.action.reset(); + deviceaction.top.action.time = 0; + deviceaction.top.action.timeScale = 1; + deviceaction.top.action.play(); + } + } + if(data.body.code == passerStation.nowStation.downpsd){ + if(data.body.open == 0){ + passerAi.passerout("down","end"); + deviceaction.down.action.reset(); + deviceaction.down.action.time = deviceaction.down.action._clip.duration; + deviceaction.down.action.timeScale = -1; + deviceaction.down.action.play(); + + }else{ + passerAi.passerout("down","start"); + deviceaction.down.action.reset(); + deviceaction.down.action.time = 0; + deviceaction.down.action.timeScale = 1; + deviceaction.down.action.play(); + } + + } + } + if(data.body.type == "TRAIN_DOOR"){ + if(toptrain.nowcode == data.body.code){ + + if(data.body.open == "0"){ + closetraindoor(toptrain,data.body.doorCode,"top"); + + }else{ + opentraindoor(toptrain,data.body.doorCode,"top"); + + } + + } + if(downtrain.nowcode == data.body.code){ + // console.log(data.body); + if(data.body.open == "0"){ + closetraindoor(downtrain,data.body.doorCode,"down"); + + }else{ + opentraindoor(downtrain,data.body.doorCode,"down"); + + } + + } + } + } + + if(data.type == "TrainRun_3D"){ + + for(let i=0,leni = data.body.length;i { + 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; + } + } + + 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..69b7b267c --- /dev/null +++ b/src/jlmap3d/jl3dtrafficplan/connect/trainconnect.js @@ -0,0 +1,117 @@ +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); + + 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){ + + 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; + } + } + + 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; + } + } + + 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 index ace3ecc63..c63b6d250 100644 --- a/src/jlmap3d/jl3dtrafficplan/jl3dtrafficplan.js +++ b/src/jlmap3d/jl3dtrafficplan/jl3dtrafficplan.js @@ -1,4 +1,4 @@ -import { Staticmodel } from '@/jlmap3d/jl3dpassflow/config.js'; +import { Staticmodel } from '@/jlmap3d/jl3dtrafficplan/loader/stationconfig.js'; //静态资源文件路劲 import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js'; //loader @@ -6,28 +6,28 @@ import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader'; //轨道视角控制 import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls'; //模型管理器 -import { ModelManager } from '@/jlmap3d/jl3dpassflow/loader.js'; +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/jl3dpassflow/model/passerstation.js'; +import { PasserStation } from '@/jlmap3d/jl3dtrafficplan/model/passerstation.js'; //cctv检票机对象 -import { PasserCheckDoor } from '@/jlmap3d/jl3dpassflow/model/passercheckdoor.js'; +import { PasserCheckDoor } from '@/jlmap3d/jl3dtrafficplan/model/passercheckdoor.js'; //cctv列车对象 -import { PasserTrain } from '@/jlmap3d/jl3dpassflow/model/passertrain.js'; +import { PasserTrain } from '@/jlmap3d/jl3dtrafficplan/model/passertrain.js'; //cctv行人对象 -import { PasserHuman } from '@/jlmap3d/jl3dpassflow/model/passerhuman.js'; +import { PasserHuman } from '@/jlmap3d/jl3dtrafficplan/model/passerhuman.js'; //cctv渲染器 import { PasserRender } from '@/jlmap3d/jl3dpassflow/passerrender/passerrender.js'; //cctv行人ai -import { PasserAi } from '@/jlmap3d/jl3dpassflow/passerai/passerai.js'; +import { PasserAi } from '@/jlmap3d/jl3dtrafficplan/passerai/passerai.js'; //行人寻路相关工具 -import { ZoneManager } from '@/jlmap3d/jl3dpassflow/model/zonemanager.js'; -import { PathFinder } from '@/jlmap3d/jl3dpassflow/passerai/pathfinder.js'; +import { ZoneManager } from '@/jlmap3d/jl3dtrafficplan/model/zonemanager.js'; +import { PathFinder } from '@/jlmap3d/jl3dtrafficplan/passerai/pathfinder.js'; //cctv通信工具 -import { PassflowConnect } from '@/jlmap3d/jl3dpassflow/connect/passflowconnect.js'; +import { PassflowConnect } from '@/jlmap3d/jl3dtrafficplan/connect/stationconnect.js'; import StompClient from '@/utils/sock'; import store from '@/store/index_APP_TARGET'; @@ -101,7 +101,15 @@ export function Jl3dTrafficPlan(dom,skinCode,routegroup,viewMap) { // 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); @@ -134,14 +142,15 @@ export function Jl3dTrafficPlan(dom,skinCode,routegroup,viewMap) { monitor = scope.modelmanager.monitor.mesh; scene.add(monitor); - - getPublishMapDetail(skinCode).then(netdata => { 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); + socktest = new PassflowConnect(deviceaction,passerTrain.toptrain,passerTrain.downtrain,routegroup,passerStation,passerAi,passerHuman); store.dispatch('app/animationsClose'); @@ -181,6 +190,28 @@ export function Jl3dTrafficPlan(dom,skinCode,routegroup,viewMap) { j--; // j--; } + + for(let j=0; j=0;i--){ @@ -234,6 +265,21 @@ export function Jl3dTrafficPlan(dom,skinCode,routegroup,viewMap) { 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 ); @@ -246,32 +292,37 @@ export function Jl3dTrafficPlan(dom,skinCode,routegroup,viewMap) { passerWebWork.onmessage = function (event) { if(aiswitch == 0){ // console.log(humanlist.children.length); - if(humanlist.children.length < 80){ + if(humanlist.children.length < 100){ let direct = Math.floor(Math.random()*(3-1+1))+1; //1--top //2-- down + updatePasserData(humanlist.children.length,topWaitPassers.children.length,downWaitPassers.children.length,outStationPassers.children.length); if(direct == 1){ passerHuman.newHumanCreate(humanlist,passerZone.getzoneposition("enter1"),0); }else{ passerHuman.newHumanCreate(humanlist,passerZone.getzoneposition("enter2"),0); } + + } + + if(outStationPassers.children.length < 100){ if(passerAi.toppasseron){ for(let i=0,leni=passerZone.list["standtop"].doorpoints.length;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.changeTrain = function(trainCode){ + // scope.resetscene(); + scope.nowTrainCode = trainCode; + } + + 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(){ + passerAi.initPasser(humanlist,passerHuman); + aiswitch = 0; + }, 2000); + + } + + function startWorker(){ + passerAi.initPasser(humanlist,passerHuman); + let updateaianimate = setInterval( + function(){ + // console.log("?"); + if(aiswitch == 0){ + passerHuman.moveAnimateUpdate(humanlist,olddataai,passerHuman); + // passerAi.aiUpdate(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=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; + //1--top + //2-- down + if(direct == 1){ + passerHuman.newHumanCreate(humanlist,passerZone.getzoneposition("enter1"),0); + }else{ + passerHuman.newHumanCreate(humanlist,passerZone.getzoneposition("enter2"),0); + } + 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..05ca190a2 --- /dev/null +++ b/src/jlmap3d/jl3dtrafficplan/model/passerstation.js @@ -0,0 +1,176 @@ +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 = null; + + 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, + toppsd:null, + downpsd:null, + topsection:null, + downsection:null, + }; + if(list[k][0].position.y=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 +5; + } + if(name == "standdown"){ + randompoint.x = scope.list[name].doorpoints[n].x + Math.random()*3; + randompoint.z = scope.list[name].doorpoints[n].z -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..ab70fbdaf --- /dev/null +++ b/src/jlmap3d/jl3dtrafficplan/passerai/passerai.js @@ -0,0 +1,273 @@ + + +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){ + for(let i=0;i<3;i++){ + + passerHuman.newHumanCreate(humanlist,passerZone.getinitposition("enter1"),0); + } + for(let i=0;i<3;i++){ + passerHuman.newHumanCreate(humanlist,passerZone.getinitposition("enter2"),0); + } + for(let i=0;i<3;i++){ + passerHuman.newHumanCreate(humanlist,passerZone.getinitposition("security"),1); + } + // for(let i=0;i<2;i++){ + // // passerHuman.newHumanCreate(humanlist,passerZone.getinitposition("entergate"),3); + // } + for(let i=0;i<6;i++){ + let standdata = passerZone.getstandposition("standtop"); + passerHuman.newHumanCreate(topWaitPassers,standdata.point,4,"top",standdata.door); + } + for(let i=0;i<6;i++){ + let standdata = passerZone.getstandposition("standdown"); + passerHuman.newHumanCreate(downWaitPassers,standdata.point,4,"down",standdata.door); + } + } + + //人物站台阶段更新 + this.aiUpdate = function(humanlist,topWaitPassers,downWaitPassers,outStationPassers,passerHuman,passerCheckDoor,deviceaction){ + + for(let i=0;i 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'); @@ -232,6 +233,12 @@ export const constantRoutes = [ component: Jlmap3dTrafficPlan, hidden: true }, + { + path: '/jlmap3d/traffictrain', + component: Jlmap3dTrafficTrain, + hidden: true + }, + { path: '/jlmap3d/devicemodel', component: Jlmap3dModel, diff --git a/src/views/jlmap3d/trafficplan/component/stationdata.vue b/src/views/jlmap3d/trafficplan/component/stationdata.vue new file mode 100644 index 000000000..99777d0ca --- /dev/null +++ b/src/views/jlmap3d/trafficplan/component/stationdata.vue @@ -0,0 +1,123 @@ + + + + + + diff --git a/src/views/jlmap3d/trafficplan/jl3dtrafficplan.vue b/src/views/jlmap3d/trafficplan/jl3dtrafficplan.vue index 783844847..9ec7923bd 100644 --- a/src/views/jlmap3d/trafficplan/jl3dtrafficplan.vue +++ b/src/views/jlmap3d/trafficplan/jl3dtrafficplan.vue @@ -13,13 +13,15 @@ /> + + - + --> + @@ -60,10 +59,9 @@ import { exitFullscreen } from '@/utils/screen'; import { getSimulationQrcode } from '@/api/jointSimulation'; import { getSessionStorage } from '@/utils/auth'; import { refereeExitSimulation, quitCurrentRace, startPracticalCompetition, submitPracticalCompetition } from '@/api/competition'; -import { NoQrcodeList } from '@/scripts/ProjectConfig'; +import { NoSimulationQrCodeList } from '@/scripts/ProjectConfig'; import { getPublishLessonListByMapId } from '@/api/jmap/lesson'; import localStore from 'storejs'; -import { OperateMode } from '@/scripts/ConstDic'; export default { name: 'MenuDemonJoint', @@ -119,12 +117,11 @@ export default { chatShow: true, jsStart: true, isGoback: false, - noQrcodeList: NoQrcodeList, + noSimulationQrCodeList: NoSimulationQrCodeList, isShow3dmodel :false, jl3dname: this.$t('display.demon.threeDimensionalView'), hoverBtn: false, - btnWidth: 0, - faultMode: false + btnWidth: 0 }; }, computed: { @@ -155,7 +152,7 @@ export default { if ((this.isShow3dmodel && this.isShowScheduling) || (this.isShowScheduling || this.isDriver) || (this.isShowScheduling || this.isStationSupervisor) || - (this.isAdmin && !this.noQrcodeList.includes(this.project)) || + (this.isAdmin && !this.noSimulationQrCodeList.includes(this.project)) || (this.isAdmin) || (this.isAdmin && this.isProject) || this.isDeviceLogin || this.$route.query.type === 'IM') { num++; } @@ -165,6 +162,23 @@ export default { const typeList = ['LW', 'CW']; return typeList.includes(this.$route.query.type); }, + examSystemShow() { + const typeList = ['LW', 'CW', 'IM']; + return typeList.includes(this.$route.query.type); + }, + teachSystemShow() { + const typeList = ['LW', 'CW']; + return typeList.includes(this.$route.query.type); + }, + memberManageShow() { + return this.isAdmin && this.$route.query.type !== 'ILW' && this.project !== 'bjd'; + }, + deviceManageShow() { + return (this.isAdmin && this.isProject && this.project !== 'bjd') || this.$route.query.type === 'ILW'; + }, + qrCodeShow() { + return this.isAdmin && !this.noSimulationQrCodeList.includes(this.project) && this.$route.query.type !== 'ILW'; + }, isDisable() { return this.$store.state.training.started; }, @@ -503,14 +517,6 @@ export default { }); } }, - changeOperateMode() { - this.faultMode = !this.faultMode; - let mode = OperateMode.NORMAL; - if (this.faultMode) { - mode = OperateMode.FAULT; - } - this.$store.dispatch('training/changeOperateMode', { mode: mode }); - }, loadRunPlan() { this.$emit('runPlanLoadShow'); }, From d0421ff9fe5b5fdafda35079fe371ef2da992372 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Thu, 12 Nov 2020 14:06:13 +0800 Subject: [PATCH 45/72] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chengdu_03/menus/menuDialog/viewName.vue | 26 +++++++++---------- src/views/publish/publishMap/index.vue | 4 +-- src/views/publish/runPlanCommon/index.vue | 2 +- src/views/publish/runPlanEveryDay/index.vue | 2 +- src/views/publish/runPlanTemplate/index.vue | 2 +- src/views/scriptManage/allScriptRole.vue | 2 +- src/views/scriptManage/home.vue | 2 +- src/views/teach/detail/index.vue | 2 +- src/views/trainingPlatform/demonList.vue | 2 +- 9 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/jmapNew/theme/chengdu_03/menus/menuDialog/viewName.vue b/src/jmapNew/theme/chengdu_03/menus/menuDialog/viewName.vue index e76393b55..01e9d5f65 100644 --- a/src/jmapNew/theme/chengdu_03/menus/menuDialog/viewName.vue +++ b/src/jmapNew/theme/chengdu_03/menus/menuDialog/viewName.vue @@ -159,7 +159,7 @@ export default { const deviceList = []; // 信号机 - let nameShow = this.nameLevels.indexOf(1) !== -1; + let nameShow = this.nameLevels.includes(1); const signalList = this.$store.getters['map/signalList']; if (signalList && signalList.length > 0) { signalList.forEach(elem => { @@ -168,11 +168,11 @@ export default { } // 按钮名称 - nameShow = this.nameLevels.indexOf(3) !== -1; + nameShow = this.nameLevels.includes(3); // 道岔 - nameShow = this.nameLevels.indexOf(7) !== -1; // 道岔名称 - const switchSectionNameShow = this.nameLevels.indexOf(9) !== -1; // 道岔轨名称 + nameShow = this.nameLevels.includes(7); // 道岔名称 + const switchSectionNameShow = this.nameLevels.includes(9); // 道岔轨名称 const switchList = this.$store.getters['map/switchList']; if (switchList && switchList.length > 0) { switchList.forEach(elem => { @@ -181,7 +181,7 @@ export default { } // 控制模式 - const indicatorShow = this.nameLevels.indexOf(8) !== -1; + const indicatorShow = this.nameLevels.includes(8); const control = this.$store.getters['map/stationControlList']; if (control && control.length > 0) { control.forEach(elem => { @@ -204,28 +204,28 @@ export default { nameShow = false; } else if (elem.type === '01') { // 计轴区段名称 - nameShow = this.nameLevels.indexOf(11) !== -1; + nameShow = this.nameLevels.includes(11); } else if (elem.type === '02') { // 轨道轨名称 - nameShow = this.nameLevels.indexOf(5) !== -1; + nameShow = this.nameLevels.includes(5); } else if (elem.type === '04') { // 道岔区段名称 - nameShow = this.nameLevels.indexOf(9) !== -1; + nameShow = this.nameLevels.includes(9); } // 站台轨名称 if (elem.standTrack) { - standTrackNameShow = this.nameLevels.indexOf(2) !== -1; + standTrackNameShow = this.nameLevels.includes(2); } // 折返轨名称 if (elem.reentryTrack) { - reentryTrackNameShow = this.nameLevels.indexOf(4) !== -1; + reentryTrackNameShow = this.nameLevels.includes(4); } // 转换轨名称 if (elem.transferTrack) { - transferTrackNameShow = this.nameLevels.indexOf(6) !== -1; + transferTrackNameShow = this.nameLevels.includes(6); } deviceList.push(Object.assign(this.$jlmap.getDeviceByCode(elem.code), { nameShow, standTrackNameShow, reentryTrackNameShow, transferTrackNameShow })); @@ -233,7 +233,7 @@ export default { } // 停车点 - const destCodeShow = this.nameLevels.indexOf(10) !== -1; + const destCodeShow = this.nameLevels.includes(10); const stopPointList = this.$store.getters['map/stopPointList']; if (stopPointList && stopPointList.length > 0) { stopPointList.forEach(elem => { @@ -242,7 +242,7 @@ export default { } // 车站 - const kmPostShow = this.nameLevels.indexOf(12) !== -1; + const kmPostShow = this.nameLevels.includes(12); const stationList = this.$store.getters['map/stationList']; if (stationList && stationList.length > 0) { stationList.forEach(elem => { diff --git a/src/views/publish/publishMap/index.vue b/src/views/publish/publishMap/index.vue index 69d15c0ff..f3ad09b77 100644 --- a/src/views/publish/publishMap/index.vue +++ b/src/views/publish/publishMap/index.vue @@ -158,8 +158,8 @@ export default { ], actions: [ { text: '地图排序', handler: this.mapSort }, - { text: '导出', handler: this.localExport, show: () => { return this.$store.state.user.roles.indexOf(superAdmin) > 0; }}, - { text: '导入', handler: this.localImport, fileType: 'file', show: () => { return this.$store.state.user.roles.indexOf(superAdmin) > 0; }} + { text: '导出', handler: this.localExport, show: () => { return this.$store.state.user.roles.includes(superAdmin); }}, + { text: '导入', handler: this.localImport, fileType: 'file', show: () => { return this.$store.state.user.roles.includes(superAdmin); }} ] }, diff --git a/src/views/publish/runPlanCommon/index.vue b/src/views/publish/runPlanCommon/index.vue index 79db93f09..1885b5131 100644 --- a/src/views/publish/runPlanCommon/index.vue +++ b/src/views/publish/runPlanCommon/index.vue @@ -56,7 +56,7 @@ export default { type: 'button', title: this.$t('global.operate'), width: '450', - hide: () => { return this.$store.state.user.roles.indexOf(superAdmin) < 0; }, + hide: () => { return !this.$store.state.user.roles.includes(superAdmin); }, buttons: [ { name: this.$t('global.preview'), diff --git a/src/views/publish/runPlanEveryDay/index.vue b/src/views/publish/runPlanEveryDay/index.vue index 6021c0fe9..30b16b6d0 100644 --- a/src/views/publish/runPlanEveryDay/index.vue +++ b/src/views/publish/runPlanEveryDay/index.vue @@ -66,7 +66,7 @@ export default { type: 'button', title: this.$t('global.operate'), width: '250', - hide: (row) => { return this.$store.state.user.roles.indexOf(superAdmin) < 0; }, + hide: (row) => { return !this.$store.state.user.roles.includes(superAdmin); }, buttons: [ { name: this.$t('global.preview'), diff --git a/src/views/publish/runPlanTemplate/index.vue b/src/views/publish/runPlanTemplate/index.vue index 822513796..da6dbdd0f 100644 --- a/src/views/publish/runPlanTemplate/index.vue +++ b/src/views/publish/runPlanTemplate/index.vue @@ -66,7 +66,7 @@ export default { type: 'button', title: this.$t('global.operate'), width: '550', - hide: () => { return this.$store.state.user.roles.indexOf(superAdmin) < 0; }, + hide: () => { return !this.$store.state.user.roles.includes(superAdmin); }, buttons: [ { name: this.$t('publish.generateRunPlan'), diff --git a/src/views/scriptManage/allScriptRole.vue b/src/views/scriptManage/allScriptRole.vue index f32d3ea3f..0b678f8ff 100644 --- a/src/views/scriptManage/allScriptRole.vue +++ b/src/views/scriptManage/allScriptRole.vue @@ -80,7 +80,7 @@ export default { }, methods:{ filterNode(value, data) { - return data.label.indexOf(value) !== -1; + return data.label.includes(value); }, changeRole(member) { if (member) { diff --git a/src/views/scriptManage/home.vue b/src/views/scriptManage/home.vue index 7fbbc7bc6..c76281bd7 100644 --- a/src/views/scriptManage/home.vue +++ b/src/views/scriptManage/home.vue @@ -249,7 +249,7 @@ export default { // } }, covertButtonname() { - if (this.$store.getters.roles.indexOf(admin) >= 0 || this.$store.getters.roles.indexOf(superAdmin) >= 0) { + if (this.$store.getters.roles.includes(admin) || this.$store.getters.roles.includes(superAdmin)) { return this.$t('scriptRecord.publish'); } else { return this.$t('scriptRecord.applyPublish'); diff --git a/src/views/teach/detail/index.vue b/src/views/teach/detail/index.vue index f63dad156..d2fa550e5 100644 --- a/src/views/teach/detail/index.vue +++ b/src/views/teach/detail/index.vue @@ -178,7 +178,7 @@ export default { }, filterNode(value, data) { if (!value) return true; - return data.name.indexOf(value) !== -1; + return data.name.includes(value); }, buy() { // this.disabled = true; diff --git a/src/views/trainingPlatform/demonList.vue b/src/views/trainingPlatform/demonList.vue index 52d541fa0..7b719c46d 100644 --- a/src/views/trainingPlatform/demonList.vue +++ b/src/views/trainingPlatform/demonList.vue @@ -95,7 +95,7 @@ export default { methods: { filterNode(value, data) { if (!value) return true; - return data.name.indexOf(value) !== -1; + return data.name.includes(value); }, showContextMenu(e, obj, node, vueElem) { if (obj) { From 243312ad24826b603dc6f08592ff3e5c2eada086 Mon Sep 17 00:00:00 2001 From: sunzhenyu Date: Thu, 12 Nov 2020 14:59:40 +0800 Subject: [PATCH 46/72] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=89=E7=BB=B4?= =?UTF-8?q?=E5=AE=A2=E6=B5=81=E9=87=8F=E6=A8=A1=E5=9D=97=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=89=E7=BB=B4=E6=B2=99=E7=9B=98=E8=A1=8C=E8=BD=A6?= =?UTF-8?q?=E9=83=A8=E5=88=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/langs/zh/display.js | 1 - .../jl3dtrafficplan/connect/stationconnect.js | 15 +- .../jl3dtrafficplan/connect/trainconnect.js | 11 +- .../jl3dtrafficplan/jl3dtrafficplan.js | 52 ++- .../jl3dtrafficplan/jl3dtraffictrain.js | 108 ++--- src/jlmap3d/jl3dtrafficplan/loader/loader.js | 1 + .../jl3dtrafficplan/loader/stationconfig.js | 85 ++-- .../jl3dtrafficplan/model/passerhuman.js | 5 +- .../jl3dtrafficplan/model/passertrain.js | 149 +++---- .../model/traintrunk/passertrunkhuman.js | 374 ++++++++++++++++++ .../model/traintrunk/passertrunkmanager.js | 126 ++++++ .../jl3dtrafficplan/model/zonemanager.js | 136 ++++--- .../jl3dtrafficplan/passerai/passerai.js | 21 +- .../main/newmodel/StationStandListN.js | 147 ++----- src/utils/baseUrl.js | 4 +- .../trafficplan/component/stationdata.vue | 2 +- .../jlmap3d/trafficplan/jl3dtrafficplan.vue | 175 ++++---- .../jlmap3d/trafficplan/jl3dtraffictrain.vue | 97 ++--- static/trafficplan/station.FBX | Bin 0 -> 3624784 bytes static/trafficplan/train.FBX | Bin 5559984 -> 4113056 bytes .../workertest/trafficplan/trafficstation.js | 34 ++ 21 files changed, 1048 insertions(+), 495 deletions(-) create mode 100644 src/jlmap3d/jl3dtrafficplan/model/traintrunk/passertrunkhuman.js create mode 100644 src/jlmap3d/jl3dtrafficplan/model/traintrunk/passertrunkmanager.js create mode 100644 static/trafficplan/station.FBX create mode 100644 static/workertest/trafficplan/trafficstation.js diff --git a/src/i18n/langs/zh/display.js b/src/i18n/langs/zh/display.js index 72e5b6de4..8afa2346c 100644 --- a/src/i18n/langs/zh/display.js +++ b/src/i18n/langs/zh/display.js @@ -56,7 +56,6 @@ export default { threeDimensionalStation: '三维车站', passengerflow: 'cctv视图', trafficplantext:'客流规划', - traffictraintext:'列车客乘', maintainer: '设备故障视图', deviceView: '设备视图', taskOperateSuccess: '任务操作成功', diff --git a/src/jlmap3d/jl3dtrafficplan/connect/stationconnect.js b/src/jlmap3d/jl3dtrafficplan/connect/stationconnect.js index b6306b47b..0b9ed9b3b 100644 --- a/src/jlmap3d/jl3dtrafficplan/connect/stationconnect.js +++ b/src/jlmap3d/jl3dtrafficplan/connect/stationconnect.js @@ -4,7 +4,7 @@ import { getToken } from '@/utils/auth'; import store from '@/store/index_APP_TARGET'; // 定于仿真socket接口 -export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passerStation,passerAi,passerHuman) { +export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passerStation,passerAi,jl3d) { const scope = this; this.teststomp = new StompClient(); @@ -30,8 +30,11 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe function callback(Response) { const data = JSON.parse(Response.body); + + if(data.type == "DeviceCtrl_3D"){ if(data.body.type == "PSD"){ + jl3d.changespeed(30); if(data.body.code == passerStation.nowStation.toppsd){ if(data.body.open == 0){ passerAi.passerout("top","end"); @@ -50,23 +53,26 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe } if(data.body.code == passerStation.nowStation.downpsd){ if(data.body.open == 0){ - passerAi.passerout("down","end"); + deviceaction.down.action.reset(); deviceaction.down.action.time = deviceaction.down.action._clip.duration; deviceaction.down.action.timeScale = -1; deviceaction.down.action.play(); - + passerAi.passerout("down","end"); }else{ - passerAi.passerout("down","start"); + deviceaction.down.action.reset(); deviceaction.down.action.time = 0; deviceaction.down.action.timeScale = 1; deviceaction.down.action.play(); + passerAi.passerout("down","start"); } } } + if(data.body.type == "TRAIN_DOOR"){ + if(toptrain.nowcode == data.body.code){ if(data.body.open == "0"){ @@ -129,6 +135,7 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe let actions; function opentraindoor(train,doorcode,direct){ + // console.log(train); if(direct == "top"){ if(doorcode == "1"){ actions = train.action.down; diff --git a/src/jlmap3d/jl3dtrafficplan/connect/trainconnect.js b/src/jlmap3d/jl3dtrafficplan/connect/trainconnect.js index 69b7b267c..2409de364 100644 --- a/src/jlmap3d/jl3dtrafficplan/connect/trainconnect.js +++ b/src/jlmap3d/jl3dtrafficplan/connect/trainconnect.js @@ -29,7 +29,7 @@ export function TrainConnect(trafficTrain,deviceaction,toptrain,routegroup,passe // 仿真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); @@ -38,8 +38,10 @@ export function TrainConnect(trafficTrain,deviceaction,toptrain,routegroup,passe if(data.type == "DeviceCtrl_3D"){ if(data.body.type == "TRAIN_DOOR"){ - if(toptrain.nowcode == data.body.code){ + 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"); @@ -62,6 +64,7 @@ export function TrainConnect(trafficTrain,deviceaction,toptrain,routegroup,passe let actions; function opentraindoor(train,doorcode,direct){ + if(direct == "top"){ if(doorcode == "1"){ actions = train.action.down; @@ -79,7 +82,7 @@ export function TrainConnect(trafficTrain,deviceaction,toptrain,routegroup,passe actions = train.action.down; } } - + console.log(actions); for(let an=actions.length-1;an>=0;an--){ actions[an].reset(); actions[an].time = 0; @@ -105,7 +108,7 @@ export function TrainConnect(trafficTrain,deviceaction,toptrain,routegroup,passe 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; diff --git a/src/jlmap3d/jl3dtrafficplan/jl3dtrafficplan.js b/src/jlmap3d/jl3dtrafficplan/jl3dtrafficplan.js index c63b6d250..e2f42d3c8 100644 --- a/src/jlmap3d/jl3dtrafficplan/jl3dtrafficplan.js +++ b/src/jlmap3d/jl3dtrafficplan/jl3dtrafficplan.js @@ -54,7 +54,7 @@ let path; //设备动画action组 let deviceaction = []; //控制帧率的webworker线程 -let passerWebWork = new Worker(JL3D_LOCAL_STATIC+"/workertest/passsimulation/station.js"); +let passerWebWork = new Worker(JL3D_LOCAL_STATIC+"/workertest/trafficplan/trafficstation.js"); //老版本临时ai控制 let olddataai = false; @@ -73,6 +73,11 @@ export function Jl3dTrafficPlan(dom,skinCode,routegroup,viewMap) { this.mixers = []; this.showmodel = null; + this.humanWaitIn = []; + this.humanWaitOut = []; + this.humanInSpeed = 0; + this.humanOutSpeed = 0; + //定义相机 camerass = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 1000); camerass.position.set(0, 80, 40); @@ -127,10 +132,18 @@ export function Jl3dTrafficPlan(dom,skinCode,routegroup,viewMap) { let passerCheckDoor = new PasserCheckDoor(); let passerTrain = new PasserTrain(); + // document.addEventListener( "mousedown", onselect, false ); + getPublish3dMapDetail(skinCode).then(netdata3d => { passerStation.loadMaterial(netdata3d); - this.modelmanager.loadpromise(JSON.parse(netdata3d.data.assets).cctvAssetList, scope.mixers).then(function (data) { - + 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=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 ); - } - } + // 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); @@ -240,13 +243,7 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) { // console.log(humanlist.children.length); if(humanlist.children.length < 80){ let direct = Math.floor(Math.random()*(3-1+1))+1; - //1--top - //2-- down - if(direct == 1){ - passerHuman.newHumanCreate(humanlist,passerZone.getzoneposition("enter1"),0); - }else{ - passerHuman.newHumanCreate(humanlist,passerZone.getzoneposition("enter2"),0); - } + if(passerAi.toppasseron){ for(let i=0,leni=passerZone.list["standtop"].doorpoints.length;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.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 index 5eaa49901..912057e35 100644 --- a/src/jlmap3d/jl3dtrafficplan/model/zonemanager.js +++ b/src/jlmap3d/jl3dtrafficplan/model/zonemanager.js @@ -58,31 +58,49 @@ let standtop = { stage : "3", randompoint : new THREE.Vector3(-64,1.77,0.38), doorpoints:[ - 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) + 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(52.1,1.77,-1.8), + new THREE.Vector3(53.1,1.77,-1.8), new THREE.Vector3(-63.5,1.77,-1.8) ] }; @@ -94,31 +112,49 @@ let standdown = { stage : "3", randompoint : new THREE.Vector3(-64,1.77,21), doorpoints:[ - 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) + 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(52.1,1.77,24), + new THREE.Vector3(53.1,1.77,24), new THREE.Vector3(-64,1.77,24) ] }; @@ -225,22 +261,21 @@ export function ZoneManager() { } this.getstandposition = function(name){ - let n = Math.round(Math.random()*20); + 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 +5; + 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 -5; + randompoint.z = scope.list[name].doorpoints[n].z -4-Math.random()*5; } let standdata = { door:n, @@ -268,6 +303,7 @@ export function ZoneManager() { } 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 ; diff --git a/src/jlmap3d/jl3dtrafficplan/passerai/passerai.js b/src/jlmap3d/jl3dtrafficplan/passerai/passerai.js index ab70fbdaf..7a4c0dd8a 100644 --- a/src/jlmap3d/jl3dtrafficplan/passerai/passerai.js +++ b/src/jlmap3d/jl3dtrafficplan/passerai/passerai.js @@ -252,16 +252,21 @@ export function PasserAi(zone,finder) { path = pathFinder.find(points[0],targetPosition.point); humanlist.children[i].direct = "down"; } - if(path[0].y<9.84){ - points.push(new THREE.Vector3(11.81,9.8,13.11)); - points.push(new THREE.Vector3(29.5,1.77,13.16)); + if(path != null){ + if(path[0].y<9.84){ + points.push(new THREE.Vector3(11.81,9.8,13.11)); + points.push(new THREE.Vector3(29.5,1.77,13.16)); + } + for(let i=0;i val2) { + return 1; + } else { + return 0; + } +} //canvas文字贴图方法 //PS:待提炼 增强功能 var stationcanvas = new Image(); diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index 4bb14fdb5..b7d86343d 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -2,9 +2,9 @@ export function getBaseUrl() { let BASE_API; if (process.env.NODE_ENV === 'development') { // BASE_API = 'https://joylink.club/jlcloud'; - BASE_API = 'https://test.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:9000'; // 杜康 // BASE_API = 'http://b29z135112.zicp.vip'; diff --git a/src/views/jlmap3d/trafficplan/component/stationdata.vue b/src/views/jlmap3d/trafficplan/component/stationdata.vue index 99777d0ca..164086d09 100644 --- a/src/views/jlmap3d/trafficplan/component/stationdata.vue +++ b/src/views/jlmap3d/trafficplan/component/stationdata.vue @@ -96,7 +96,7 @@ export default { this.allPassers = humanlistdata+topWaitPassersdata+downWaitPassersdata+outStationPassersdata+"人"; }, updatePasserSpeed(data){ - this.nowInStationPassers = data.nowInStationPassers+"人/30s"; + this.nowInStationPassers = data+"人/30s"; }, updatePasserOut(data){ diff --git a/src/views/jlmap3d/trafficplan/jl3dtrafficplan.vue b/src/views/jlmap3d/trafficplan/jl3dtrafficplan.vue index 9ec7923bd..68e742aae 100644 --- a/src/views/jlmap3d/trafficplan/jl3dtrafficplan.vue +++ b/src/views/jlmap3d/trafficplan/jl3dtrafficplan.vue @@ -16,11 +16,11 @@ - +