Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
f258d9b0b4
@ -7,6 +7,8 @@ NODE_ENV = 'development'
|
||||
# VUE_APP_BASE_API = 'http://192.168.3.4:9000'
|
||||
VUE_APP_BASE_API = 'http://192.168.3.6:9000'
|
||||
VUE_APP_VOICE_API = 'https://test.joylink.club/jlcloud/'
|
||||
# VUE_APP_VOICE_API = 'http://192.168.8.110:9008'
|
||||
|
||||
|
||||
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
|
||||
# to control whether the babel-plugin-dynamic-import-node plugin is enabled.
|
||||
|
@ -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',
|
||||
|
@ -55,6 +55,7 @@ export default {
|
||||
threeDimensionalView: '数字沙盘',
|
||||
threeDimensionalStation: '三维车站',
|
||||
passengerflow: 'cctv视图',
|
||||
trafficplantext:'客流规划',
|
||||
maintainer: '设备故障视图',
|
||||
deviceView: '设备视图',
|
||||
taskOperateSuccess: '任务操作成功',
|
||||
|
@ -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:'',
|
||||
|
@ -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"
|
||||
|
241
src/jlmap3d/jl3dtrafficplan/connect/stationconnect.js
Normal file
241
src/jlmap3d/jl3dtrafficplan/connect/stationconnect.js
Normal file
@ -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<passerStation.stationlist.length;j++){
|
||||
count = 0;
|
||||
for(let i=0;i<newStandData.length;i++){
|
||||
if(passerStation.stationlist[j].topstand == newStandData[i].standCode){
|
||||
passerStation.stationlist[j].topspeed = newStandData[i].to;
|
||||
passerStation.stationlist[j].toppassers = newStandData[i].num;
|
||||
count++;
|
||||
}
|
||||
if(passerStation.stationlist[j].downstand == newStandData[i].standCode){
|
||||
passerStation.stationlist[j].downspeed = newStandData[i].to;
|
||||
passerStation.stationlist[j].downpassers = newStandData[i].num;
|
||||
count++;
|
||||
}
|
||||
|
||||
if(count == 2){
|
||||
i = newStandData.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jl3d.updateNowStationData();
|
||||
|
||||
if(start){
|
||||
start = false;
|
||||
jl3d.initTrafficStart();
|
||||
}
|
||||
|
||||
// jl3d.allStationData = data.body;
|
||||
}
|
||||
|
||||
if(data.type == "TRAIN_PFI_BL"){
|
||||
|
||||
if(toptrain.nowcode == data.body.code){
|
||||
console.log(data);
|
||||
//根据上下车人数创建人
|
||||
jl3d.updateNowLeaveData("top",data.body.out);
|
||||
}
|
||||
if(downtrain.nowcode == data.body.code){
|
||||
console.log(data);
|
||||
//根据上下车人数创建人
|
||||
jl3d.updateNowLeaveData("down",data.body.out);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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){
|
||||
|
||||
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{
|
||||
|
||||
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"){
|
||||
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<leni;i++){
|
||||
if(data.body[i].section == passerStation.nowStation.topsection){
|
||||
if(toptrain.nowcode != data.body[i].code){
|
||||
toptrain.nowcode = data.body[i].code;
|
||||
}
|
||||
toptrain.position.copy(toptrain.curve.getPointAt(data.body[i].offset));
|
||||
|
||||
}else{
|
||||
if(downtrain.nowcode == data.body[i].code){
|
||||
toptrain.position.x -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(data.body[i].section == passerStation.nowStation.downsection){
|
||||
if(downtrain.nowcode != data.body[i].code){
|
||||
downtrain.nowcode = data.body[i].code;
|
||||
}
|
||||
downtrain.position.copy(downtrain.curve.getPointAt(data.body[i].offset));
|
||||
|
||||
}else{
|
||||
if(downtrain.nowcode == data.body[i].code){
|
||||
downtrain.position.x += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(data.type == 'Simulation_Over') {
|
||||
store.dispatch('LogOut').then(() => {
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
120
src/jlmap3d/jl3dtrafficplan/connect/trainconnect.js
Normal file
120
src/jlmap3d/jl3dtrafficplan/connect/trainconnect.js
Normal file
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
440
src/jlmap3d/jl3dtrafficplan/jl3dtrafficplan.js
Normal file
440
src/jlmap3d/jl3dtrafficplan/jl3dtrafficplan.js
Normal file
@ -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<testtop.children.length;i++){
|
||||
// console.log(testtop.children[i].matrixWorld.elements[12]);
|
||||
// console.log(testtop.children[i].matrixWorld.elements);
|
||||
// }
|
||||
// console.log(scope.modelmanager.station.mesh.getObjectByName("down"));
|
||||
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);
|
||||
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<passerStation.nowStation.topspeed;i++){
|
||||
let newIn = {
|
||||
overGoal:"top",
|
||||
};
|
||||
waitForCreatIn.push(newIn);
|
||||
}
|
||||
for(let i=0;i<passerStation.nowStation.downspeed;i++){
|
||||
let newIn = {
|
||||
overGoal:"down",
|
||||
};
|
||||
waitForCreatIn.push(newIn);
|
||||
}
|
||||
|
||||
|
||||
scope.humanInSpeed = passerStation.nowStation.topspeed+passerStation.nowStation.downspeed;
|
||||
passerHuman.speed = scope.humanInSpeed;
|
||||
passerWebWork.postMessage(["changespeed",scope.humanInSpeed/30]);
|
||||
}
|
||||
|
||||
this.updateNowLeaveData = function(direct,outNum){
|
||||
if(direct == "top"){
|
||||
waitForCreatOutTop = getnum(outNum,17);
|
||||
console.log(waitForCreatOutTop);
|
||||
for(let i=0;i<waitForCreatOutTop.length;i++){
|
||||
for(let j=0;j<waitForCreatOutTop[i];j++){
|
||||
setTimeout(function(){
|
||||
passerHuman.newHumanCreate(outStationPassers,passerZone.list["standtop"].doorpoints[i],5,"top",i);
|
||||
}, Math.random()*1000*j);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
waitForCreatOutDown = getnum(outNum,17);
|
||||
for(let i=0;i<waitForCreatOutDown.length;i++){
|
||||
for(let j=0;j<waitForCreatOutDown[i];j++){
|
||||
setTimeout(function(){
|
||||
passerHuman.newHumanCreate(outStationPassers,passerZone.list["standdown"].doorpoints[j],5,"down",j);
|
||||
}, Math.random()*1000*i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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<humanlist.children.length;j++){
|
||||
|
||||
humanlist.remove(humanlist.children[j]);
|
||||
j--;
|
||||
// j--;
|
||||
}
|
||||
|
||||
for(let j=0; j<topWaitPassers.children.length;j++){
|
||||
|
||||
topWaitPassers.remove(topWaitPassers.children[j]);
|
||||
j--;
|
||||
// j--;
|
||||
}
|
||||
for(let j=0; j<downWaitPassers.children.length;j++){
|
||||
|
||||
downWaitPassers.remove(downWaitPassers.children[j]);
|
||||
j--;
|
||||
// j--;
|
||||
}
|
||||
for(let j=0; j<outStationPassers.children.length;j++){
|
||||
|
||||
outStationPassers.remove(outStationPassers.children[j]);
|
||||
j--;
|
||||
// j--;
|
||||
}
|
||||
|
||||
|
||||
|
||||
passerTrain.toptrain.position.y = -20000;
|
||||
passerTrain.downtrain.position.y = -20000;
|
||||
|
||||
deviceaction.down.action.reset();
|
||||
deviceaction.down.action.time = deviceaction.down.action._clip.duration;
|
||||
deviceaction.down.action.timeScale = -1;
|
||||
deviceaction.down.action.play();
|
||||
|
||||
deviceaction.top.action.reset();
|
||||
deviceaction.top.action.time = deviceaction.down.action._clip.duration;
|
||||
deviceaction.top.action.timeScale = -1;
|
||||
deviceaction.top.action.play();
|
||||
for(let an=passerTrain.toptrain.action.top.length-1;an>=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<pnum;i++){
|
||||
let nownum = base+(i<reset?1:0);
|
||||
re.push(nownum);
|
||||
}
|
||||
return re;
|
||||
}
|
||||
|
||||
}
|
353
src/jlmap3d/jl3dtrafficplan/jl3dtraffictrain.js
Normal file
353
src/jlmap3d/jl3dtrafficplan/jl3dtraffictrain.js
Normal file
@ -0,0 +1,353 @@
|
||||
import { Staticmodel } from '@/jlmap3d/jl3dtrafficplan/loader/trainconfig.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 { PasserTrain } from '@/jlmap3d/jl3dtrafficplan/model/passertrain.js';
|
||||
//cctv行人对象
|
||||
import { PasserHuman } from '@/jlmap3d/jl3dtrafficplan/model/traintrunk/passertrunkhuman.js';
|
||||
//cctv渲染器
|
||||
import { PasserRender } from '@/jlmap3d/jl3dpassflow/passerrender/passerrender.js';
|
||||
//cctv行人ai
|
||||
import { PasserAi } from '@/jlmap3d/jl3dpassflow/passerai/passerai.js';
|
||||
//行人寻路相关工具
|
||||
import { ZoneManager } from '@/jlmap3d/jl3dtrafficplan/model/zonemanager.js';
|
||||
import { PathFinder } from '@/jlmap3d/jl3dpassflow/passerai/pathfinder.js';
|
||||
//cctv通信工具
|
||||
import { TrainConnect } from '@/jlmap3d/jl3dtrafficplan/connect/trainconnect.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 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 Jl3dTrafficTrain(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.nowTrainCode = "";
|
||||
|
||||
this.trainList = [];
|
||||
|
||||
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);
|
||||
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;
|
||||
|
||||
camerass.position.x = 4.78;
|
||||
camerass.position.y = 5.076;
|
||||
camerass.position.z = -0.016;
|
||||
controls.target = new THREE.Vector3(camerass.position.x+0.5,camerass.position.y-0.1,camerass.position.z);
|
||||
controls.update();
|
||||
controls.enabled = false;
|
||||
|
||||
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 passerTrain = new PasserTrain();
|
||||
|
||||
this.modelmanager.loadpromise(Staticmodel, scope.mixers,"2").then(function (data) {
|
||||
console.log(data);
|
||||
passerTrain.initTrain(scope.modelmanager.train.mesh,mixers,deviceaction,scene);
|
||||
passerTrain.toptrain.position.x = 0;
|
||||
passerTrain.toptrain.position.y = 0;
|
||||
passerTrain.toptrain.position.z = 0;
|
||||
// passerTrain.downtrain.position.z = 40;
|
||||
getPublishMapDetail(skinCode).then(netdata => {
|
||||
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<humanlist.children.length;j++){
|
||||
|
||||
humanlist.remove(humanlist.children[j]);
|
||||
j--;
|
||||
// j--;
|
||||
}
|
||||
passerTrain.toptrain.position.y = -20000;
|
||||
passerTrain.downtrain.position.y = -20000;
|
||||
|
||||
deviceaction.down.action.reset();
|
||||
deviceaction.down.action.time = deviceaction.down.action._clip.duration;
|
||||
deviceaction.down.action.timeScale = -1;
|
||||
deviceaction.down.action.play();
|
||||
|
||||
deviceaction.top.action.reset();
|
||||
deviceaction.top.action.time = deviceaction.down.action._clip.duration;
|
||||
deviceaction.top.action.timeScale = -1;
|
||||
deviceaction.top.action.play();
|
||||
for(let an=passerTrain.toptrain.action.top.length-1;an>=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<leni;i++ ){
|
||||
setTimeout(function(){
|
||||
passerHuman.newHumanCreate(humanlist,passerZone.list["standtop"].doorpoints[i],5,"top",i);
|
||||
}, Math.random()*1000);
|
||||
|
||||
}
|
||||
}
|
||||
if(passerAi.downpasseron){
|
||||
|
||||
for(let i=0,leni=passerZone.list["standdown"].doorpoints.length;i<leni;i++ ){
|
||||
setTimeout(function(){
|
||||
passerHuman.newHumanCreate(humanlist,passerZone.list["standdown"].doorpoints[i],5,"down",i);
|
||||
}, Math.random()*1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
//循环渲染函数
|
||||
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.switchcamera = function(trunkNum){
|
||||
// console.log(passerTrain.toptrain);
|
||||
// console.log(camerass.position);
|
||||
console.log(trunkNum);
|
||||
// let test = "";
|
||||
|
||||
passerHuman.nowTrunk = trunkNum;
|
||||
passerHuman.resetPasser(humanlist);
|
||||
passerHuman.setNowTrunkPasser(humanlist,200,trunkNum);
|
||||
switch (trunkNum) {
|
||||
case '0':
|
||||
camerass.position.x = 4.78;
|
||||
camerass.position.y = 5.076;
|
||||
camerass.position.z = -0.016;
|
||||
controls.target = new THREE.Vector3(camerass.position.x+0.5,camerass.position.y-0.1,camerass.position.z);
|
||||
controls.update();
|
||||
break;
|
||||
case '1':
|
||||
camerass.position.x = 26.00;
|
||||
camerass.position.y = 5.076;
|
||||
camerass.position.z = -0.016;
|
||||
controls.target = new THREE.Vector3(camerass.position.x+0.5,camerass.position.y-0.1,camerass.position.z);
|
||||
controls.update();
|
||||
break;
|
||||
case '2':
|
||||
camerass.position.x = 48.71;
|
||||
camerass.position.y = 5.076;
|
||||
camerass.position.z = -0.016;
|
||||
controls.target = new THREE.Vector3(camerass.position.x+0.5,camerass.position.y-0.1,camerass.position.z);
|
||||
controls.update();
|
||||
break;
|
||||
case '3':
|
||||
camerass.position.x = 70.01;
|
||||
camerass.position.y = 5.076;
|
||||
camerass.position.z = -0.016;
|
||||
controls.target = new THREE.Vector3(camerass.position.x+0.5,camerass.position.y-0.1,camerass.position.z);
|
||||
controls.update();
|
||||
break;
|
||||
case '4':
|
||||
camerass.position.x = 92.06;
|
||||
camerass.position.y = 5.076;
|
||||
camerass.position.z = -0.016;
|
||||
controls.target = new THREE.Vector3(camerass.position.x+0.5,camerass.position.y-0.1,camerass.position.z);
|
||||
controls.update();
|
||||
break;
|
||||
case '5':
|
||||
camerass.position.x = 107.30;
|
||||
camerass.position.y = 5.076;
|
||||
camerass.position.z = -0.016;
|
||||
controls.target = new THREE.Vector3(camerass.position.x+0.5,camerass.position.y-0.1,camerass.position.z);
|
||||
controls.update();
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
this.getTrainList = function(){
|
||||
return scope.trainList;
|
||||
}
|
||||
|
||||
this.updateNowTrainCode = function(newCode){
|
||||
passerTrain.toptrain.nowcode = newCode;
|
||||
}
|
||||
|
||||
this.switchviews = function(viewmode){
|
||||
passerRender.changeRenderMode(viewmode);
|
||||
}
|
||||
|
||||
}
|
159
src/jlmap3d/jl3dtrafficplan/loader/loader.js
Normal file
159
src/jlmap3d/jl3dtrafficplan/loader/loader.js
Normal file
@ -0,0 +1,159 @@
|
||||
import { BASE_ASSET_API } from '@/api/jlmap3d/assets3d.js';
|
||||
//模型管理器
|
||||
let mode = "0";
|
||||
export function ModelManager(){
|
||||
let scope = this;
|
||||
this.man1 = {
|
||||
code:null,
|
||||
locateType:"01",
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
this.man2 = {
|
||||
code:null,
|
||||
locateType:"01",
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
|
||||
|
||||
this.station = {
|
||||
code:null,
|
||||
screenDoorOpenStatus:"01",
|
||||
animations:null,
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
|
||||
this.zhajiin = {
|
||||
code:null,
|
||||
screenDoorOpenStatus:"01",
|
||||
animations:null,
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
this.zhajiout = {
|
||||
code:null,
|
||||
screenDoorOpenStatus:"01",
|
||||
animations:null,
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
|
||||
this.monitor = {
|
||||
code:null,
|
||||
screenDoorOpenStatus:"01",
|
||||
animations:null,
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
|
||||
this.train = {
|
||||
code:null,
|
||||
screenDoorOpenStatus:"01",
|
||||
animations:null,
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
|
||||
|
||||
this.section = {
|
||||
code:null,
|
||||
screenDoorOpenStatus:"01",
|
||||
animations:null,
|
||||
mesh:null,
|
||||
action:null
|
||||
};
|
||||
|
||||
//读取模型
|
||||
this.loadpromise = function (data,mixers,loadmode){
|
||||
mode = loadmode;
|
||||
let initlist = [];
|
||||
for(let i=0,leni=data.length;i<leni;i++){
|
||||
if(data[i].type == "man1" || data[i].type == "cctvMan1"){
|
||||
initlist.push(fbxpromise(data[i],mixers,scope.man1));
|
||||
}
|
||||
if(data[i].type == "man2" || data[i].type == "cctvMan2"){
|
||||
initlist.push(fbxpromise(data[i],mixers,scope.man2));
|
||||
}
|
||||
if(data[i].type == "cctvStation"){
|
||||
initlist.push(fbxpromise(data[i],mixers,scope.station));
|
||||
}
|
||||
if(data[i].type == "cctvGateIn"){
|
||||
initlist.push(fbxpromise(data[i],mixers,scope.zhajiin));
|
||||
}
|
||||
if(data[i].type == "cctvGateOut"){
|
||||
initlist.push(fbxpromise(data[i],mixers,scope.zhajiout));
|
||||
}
|
||||
if(data[i].type == "cctvMonitor"){
|
||||
initlist.push(fbxpromise(data[i],mixers,scope.monitor));
|
||||
}
|
||||
if(data[i].type == "cctvTrain"){
|
||||
initlist.push(fbxpromise(data[i],mixers,scope.train));
|
||||
}
|
||||
if(data[i].type == "cctvSection"){
|
||||
initlist.push(fbxpromise(data[i],mixers,scope.section));
|
||||
}
|
||||
}
|
||||
//promise按顺序加载
|
||||
return new Promise(function(resolve, reject){
|
||||
|
||||
Promise.all(initlist).then((result) => {
|
||||
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<object.children.length;i++){
|
||||
if(object.children[i].name == name){
|
||||
|
||||
object.children[i].position.x = object.children[i].position.x;
|
||||
//object.children[i].position.y = j*10;
|
||||
realtrain.add(object.children[i]);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
model.mesh = realtrain;
|
||||
model.mesh.animations = object.animations[0].tracks;
|
||||
//
|
||||
}else{
|
||||
model.mesh = object;
|
||||
|
||||
}
|
||||
|
||||
resolve(asset.deviceType);
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
56
src/jlmap3d/jl3dtrafficplan/loader/stationconfig.js
Normal file
56
src/jlmap3d/jl3dtrafficplan/loader/stationconfig.js
Normal file
@ -0,0 +1,56 @@
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||
var Staticmodel = [
|
||||
{
|
||||
id: "1",
|
||||
name: "人物1",
|
||||
deviceType: "man1",
|
||||
type: "man1",
|
||||
url: "/cbtc/static/MODEL/passflow/man1.FBX"
|
||||
},{
|
||||
id: "2",
|
||||
name: "人物2",
|
||||
deviceType: "man2",
|
||||
type: "man2",
|
||||
url: "/cbtc/static/MODEL/passflow/man2.FBX"
|
||||
},{
|
||||
id: "3",
|
||||
name: "车站",
|
||||
deviceType: "cctvStation",
|
||||
type: "cctvStation",
|
||||
url: "/cbtc/static/trafficplan/station.FBX"
|
||||
},{
|
||||
id: "4",
|
||||
name: "闸机",
|
||||
deviceType: "cctvGateIn",
|
||||
type: "cctvGateIn",
|
||||
url: "/cbtc/static/MODEL/passflow/zhajiin.FBX"
|
||||
},{
|
||||
id: "5",
|
||||
name: "闸机",
|
||||
deviceType: "cctvGateOut",
|
||||
type: "cctvGateOut",
|
||||
url: "/cbtc/static/MODEL/passflow/zhajiout.FBX"
|
||||
},{
|
||||
id: "6",
|
||||
name: "摄像机",
|
||||
deviceType: "cctvMonitor",
|
||||
type: "cctvMonitor",
|
||||
url: "/cbtc/static/MODEL/passflow/monitor.FBX"
|
||||
},{
|
||||
id: "7",
|
||||
name: "列车",
|
||||
deviceType: "cctvTrain",
|
||||
type: "cctvTrain",
|
||||
url: "/cbtc/static/trafficplan/train.FBX"
|
||||
},{
|
||||
id: "8",
|
||||
name: "区段",
|
||||
deviceType: "cctvSection",
|
||||
type: "cctvSection",
|
||||
url: "/cbtc/static/MODEL/passflow/section.FBX"
|
||||
}
|
||||
|
||||
|
||||
];
|
||||
|
||||
export { Staticmodel }
|
27
src/jlmap3d/jl3dtrafficplan/loader/trainconfig.js
Normal file
27
src/jlmap3d/jl3dtrafficplan/loader/trainconfig.js
Normal file
@ -0,0 +1,27 @@
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||
var Staticmodel = [
|
||||
{
|
||||
id: "1",
|
||||
name: "人物1",
|
||||
deviceType: "man1",
|
||||
type: "man1",
|
||||
url: "/cbtc/static/trafficplan/man1.FBX"
|
||||
},
|
||||
{
|
||||
id: "2",
|
||||
name: "人物2",
|
||||
deviceType: "man2",
|
||||
type: "man2",
|
||||
url: "/cbtc/static/trafficplan/man2.FBX"
|
||||
},
|
||||
{
|
||||
id: "7",
|
||||
name: "列车",
|
||||
deviceType: "train",
|
||||
type: "cctvTrain",
|
||||
url: "/cbtc/static/trafficplan/train.FBX"
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
export { Staticmodel }
|
230
src/jlmap3d/jl3dtrafficplan/model/passercheckdoor.js
Normal file
230
src/jlmap3d/jl3dtrafficplan/model/passercheckdoor.js
Normal file
@ -0,0 +1,230 @@
|
||||
export function PasserCheckDoor(data) {
|
||||
var scope = this;
|
||||
//入口闸机组
|
||||
this.zhajiin = [];
|
||||
//出口闸机组
|
||||
this.zhajiout = [];
|
||||
//定义闸机状态
|
||||
for(let i=0;i<5;i++){
|
||||
let zhaji = {
|
||||
id:"in0"+(i+1),
|
||||
status:0,
|
||||
waiting:0
|
||||
}
|
||||
scope.zhajiin.push(zhaji);
|
||||
}
|
||||
for(let i=0;i<5;i++){
|
||||
let zhaji = {
|
||||
id:"out0"+(i+1),
|
||||
status:0,
|
||||
waiting:0
|
||||
}
|
||||
scope.zhajiout.push(zhaji);
|
||||
}
|
||||
//初始化闸机动画
|
||||
this.initCheckDoorInAnimation = function(object,mixers ,deviceaction ,scene){
|
||||
let mixer = new THREE.AnimationMixer( object );
|
||||
let newclip = object.animations[ 0 ];
|
||||
let newzhaji = object;
|
||||
for(let i=0;i<newzhaji.children.length;i++){
|
||||
if(newzhaji.children[i].name == "in01"){
|
||||
newzhaji.children[i].animations = [];
|
||||
newzhaji.children[i].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
|
||||
|
||||
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
|
||||
mixers.push(mixer);
|
||||
let device = {
|
||||
action:action,
|
||||
mixer:mixer,
|
||||
};
|
||||
deviceaction[object.children[i].name] = device;
|
||||
}
|
||||
if(newzhaji.children[i].name == "in02"){
|
||||
newzhaji.children[i].animations = [];
|
||||
newzhaji.children[i].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
|
||||
|
||||
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
|
||||
mixers.push(mixer);
|
||||
let device = {
|
||||
action:action,
|
||||
mixer:mixer,
|
||||
};
|
||||
deviceaction[object.children[i].name] = device;
|
||||
}
|
||||
if(newzhaji.children[i].name == "in03"){
|
||||
newzhaji.children[i].animations = [];
|
||||
newzhaji.children[i].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
|
||||
|
||||
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
|
||||
mixers.push(mixer);
|
||||
let device = {
|
||||
action:action,
|
||||
mixer:mixer,
|
||||
};
|
||||
deviceaction[object.children[i].name] = device;
|
||||
}
|
||||
if(newzhaji.children[i].name == "in04"){
|
||||
newzhaji.children[i].animations = [];
|
||||
newzhaji.children[i].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
|
||||
|
||||
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
|
||||
mixers.push(mixer);
|
||||
let device = {
|
||||
action:action,
|
||||
mixer:mixer,
|
||||
};
|
||||
deviceaction[object.children[i].name] = device;
|
||||
}
|
||||
if(newzhaji.children[i].name == "in05"){
|
||||
newzhaji.children[i].animations = [];
|
||||
newzhaji.children[i].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
|
||||
|
||||
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
|
||||
mixers.push(mixer);
|
||||
let device = {
|
||||
action:action,
|
||||
mixer:mixer,
|
||||
};
|
||||
deviceaction[object.children[i].name] = device;
|
||||
}
|
||||
|
||||
}
|
||||
scene.add(newzhaji);
|
||||
|
||||
}
|
||||
//初始化闸机动画
|
||||
this.initCheckDoorOutAnimation = function(object,mixers ,deviceaction ,scene){
|
||||
let mixer = new THREE.AnimationMixer( object );
|
||||
let newclip = object.animations[ 0 ];
|
||||
let newzhaji = object;
|
||||
for(let i=0;i<newzhaji.children.length;i++){
|
||||
if(newzhaji.children[i].name == "out01"){
|
||||
newzhaji.children[i].animations = [];
|
||||
newzhaji.children[i].animations.push(newclip.clone());
|
||||
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
|
||||
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
mixers.push(mixer);
|
||||
let device = {
|
||||
action:action,
|
||||
mixer:mixer,
|
||||
};
|
||||
deviceaction[object.children[i].name] = device;
|
||||
}
|
||||
if(newzhaji.children[i].name == "out02"){
|
||||
newzhaji.children[i].animations = [];
|
||||
newzhaji.children[i].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
|
||||
|
||||
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
|
||||
mixers.push(mixer);
|
||||
let device = {
|
||||
action:action,
|
||||
mixer:mixer,
|
||||
};
|
||||
deviceaction[object.children[i].name] = device;
|
||||
}
|
||||
if(newzhaji.children[i].name == "out03"){
|
||||
newzhaji.children[i].animations = [];
|
||||
newzhaji.children[i].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
|
||||
|
||||
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
|
||||
mixers.push(mixer);
|
||||
let device = {
|
||||
action:action,
|
||||
mixer:mixer,
|
||||
};
|
||||
deviceaction[object.children[i].name] = device;
|
||||
}
|
||||
if(newzhaji.children[i].name == "out04"){
|
||||
newzhaji.children[i].animations = [];
|
||||
newzhaji.children[i].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
|
||||
|
||||
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
|
||||
mixers.push(mixer);
|
||||
let device = {
|
||||
action:action,
|
||||
mixer:mixer,
|
||||
};
|
||||
deviceaction[object.children[i].name] = device;
|
||||
}
|
||||
if(newzhaji.children[i].name == "out05"){
|
||||
newzhaji.children[i].animations = [];
|
||||
newzhaji.children[i].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newzhaji.children[i] );
|
||||
|
||||
let action =mixer.clipAction( newzhaji.children[i].animations[0]);
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
|
||||
mixers.push(mixer);
|
||||
let device = {
|
||||
action:action,
|
||||
mixer:mixer,
|
||||
};
|
||||
deviceaction[object.children[i].name] = device;
|
||||
}
|
||||
|
||||
}
|
||||
scene.add(newzhaji);
|
||||
}
|
||||
//闸机动画控制
|
||||
this.checkDoorControl = function(type,door,deviceaction){
|
||||
let devicenum = door;
|
||||
|
||||
if(type == "in"){
|
||||
let checkDoorId = scope.zhajiin[devicenum].id;
|
||||
deviceaction[checkDoorId].action.reset();
|
||||
deviceaction[checkDoorId].action.time = 0;
|
||||
deviceaction[checkDoorId].action.timeScale = 1;
|
||||
deviceaction[checkDoorId].action.play();
|
||||
}else if(type == "out"){
|
||||
let checkDoorId = scope.zhajiout[devicenum].id;
|
||||
deviceaction[checkDoorId].action.reset();
|
||||
deviceaction[checkDoorId].action.time = 0;
|
||||
deviceaction[checkDoorId].action.timeScale = 1;
|
||||
deviceaction[checkDoorId].action.play();
|
||||
}
|
||||
}
|
||||
}
|
298
src/jlmap3d/jl3dtrafficplan/model/passerhuman.js
Normal file
298
src/jlmap3d/jl3dtrafficplan/model/passerhuman.js
Normal file
@ -0,0 +1,298 @@
|
||||
export function PasserHuman() {
|
||||
let scope = this;
|
||||
|
||||
|
||||
|
||||
//初始人物模型和动画
|
||||
let originhuman1 = null;
|
||||
let originhuman2 = null;
|
||||
let originanima1 = null;
|
||||
let originanima2 = null;
|
||||
//初始化人物模型动画
|
||||
this.initHumans = function(object1,object2,mixers,deviceaction,scene){
|
||||
originhuman1 = object1;
|
||||
originhuman1.progress = 1;
|
||||
// scene.add(originhuman1);
|
||||
originhuman2 = object2;
|
||||
|
||||
let mixer1 = new THREE.AnimationMixer( originhuman1 );
|
||||
let mixer2 = new THREE.AnimationMixer( originhuman2 );
|
||||
originanima1 = originhuman1.animations[ 0 ];
|
||||
originanima2 = originhuman2.animations[ 0 ];
|
||||
originhuman1.remove(originhuman1.children[2]);
|
||||
|
||||
}
|
||||
//创建新的进站乘客
|
||||
this.newInHuman= function(humanlist,position){
|
||||
if(scope.humanWaitIn.length != 0){
|
||||
let newhuman;
|
||||
createHumanModel(newhuman,humanlist,position,scope.humanWaitIn[0].stage,scope.humanWaitIn[0].direct,scope.humanWaitIn[0].door);
|
||||
scope.humanWaitIn.shift();
|
||||
}
|
||||
}
|
||||
//创建新的出站乘客
|
||||
this.newOutHuman = function(humanlist,position){
|
||||
if(scope.humanWaitOut.length != 0){
|
||||
let newhuman;
|
||||
createHumanModel(newhuman,humanlist,position,scope.humanWaitOut[0].stage,scope.humanWaitOut[0].direct,scope.humanWaitOut[0].door);
|
||||
scope.humanWaitOut.shift();
|
||||
}
|
||||
|
||||
}
|
||||
//创建新的乘客
|
||||
this.newHumanCreate = function(humanlist,position,stage,direct,door,overGoal){
|
||||
let newhuman;
|
||||
createHumanModel(newhuman,humanlist,position,stage,direct,door,overGoal);
|
||||
}
|
||||
|
||||
function createHumanModel(newhuman,humanlist,position,stage,direct,door,overGoal){
|
||||
let mantype = Math.floor(Math.random()*(3-1+1))+1;
|
||||
|
||||
if(mantype == 1){
|
||||
newhuman = THREE.SkeletonUtils.clone( originhuman1 );
|
||||
newhuman.animations = [];
|
||||
newhuman.animations.push(originanima1.clone());
|
||||
}else{
|
||||
newhuman = THREE.SkeletonUtils.clone( originhuman2 );
|
||||
newhuman.animations = [];
|
||||
newhuman.animations.push(originanima2.clone());
|
||||
}
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newhuman );
|
||||
newhuman.position.copy(position);
|
||||
|
||||
if(overGoal){
|
||||
newhuman.overGoal = overGoal;
|
||||
}
|
||||
|
||||
if(newhuman.direct == "top"){
|
||||
newhuman.rotation.y = Math.PI;
|
||||
}
|
||||
newhuman.status = 0;
|
||||
|
||||
newhuman.stage = stage;
|
||||
if(direct){
|
||||
if(direct == "top"){
|
||||
newhuman.rotation.y = Math.PI;
|
||||
}
|
||||
newhuman.direct = direct;
|
||||
}else{
|
||||
newhuman.direct = null;
|
||||
}
|
||||
|
||||
newhuman.doorstatus = null;
|
||||
if(door){
|
||||
newhuman.door = door;
|
||||
}else{
|
||||
newhuman.door = null;
|
||||
}
|
||||
newhuman.action = mixer.clipAction( newhuman.animations[ 0 ] );
|
||||
newhuman.mixer = mixer;
|
||||
newhuman.runrail = null;
|
||||
newhuman.speed = 0;
|
||||
newhuman.mixer = mixer;
|
||||
humanlist.add(newhuman);
|
||||
}
|
||||
//定义新模型走路动画
|
||||
this.initMoveAnimate = function(model,name,points,index){
|
||||
model.status = 1;
|
||||
let curve = new THREE.CatmullRomCurve3(points);
|
||||
curve.curvrtype = "catmullrom";
|
||||
// curve.getLength();
|
||||
// curve动画轨迹
|
||||
// progress动画进度
|
||||
// enable当前动画开关
|
||||
// speed动画速度
|
||||
// console.log(curve);
|
||||
|
||||
model.action.play();
|
||||
model.progress = 0;
|
||||
model.runrail = curve;
|
||||
model.speed = 0.2/curve.getLength();
|
||||
}
|
||||
//更新人物列表中人物的动画
|
||||
this.moveAnimateUpdate = function(humanlist,topWaitPassers,downWaitPassers,outStationPassers,passerHuman){
|
||||
for(let i=0;i<outStationPassers.children.length;i++){
|
||||
if(outStationPassers.children[i].status == 1){
|
||||
if(outStationPassers.children[i].progress>=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<topWaitPassers.children.length;i++){
|
||||
if(topWaitPassers.children[i].status == 1){
|
||||
if(topWaitPassers.children[i].progress>=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<downWaitPassers.children.length;i++){
|
||||
if(downWaitPassers.children[i].status == 1){
|
||||
if(downWaitPassers.children[i].progress>=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<humanlist.children.length;i++){
|
||||
if(humanlist.children[i].status == 1){
|
||||
if(humanlist.children[i].progress>=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();
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
186
src/jlmap3d/jl3dtrafficplan/model/passerstation.js
Normal file
186
src/jlmap3d/jl3dtrafficplan/model/passerstation.js
Normal file
@ -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;j<object.children.length;j++){
|
||||
|
||||
if(object.children[j].name == "top"){
|
||||
// let geometry = new THREE.BoxBufferGeometry( 50, 50, 50 );
|
||||
// let material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
|
||||
// let cube = new THREE.Mesh( geometry, material );
|
||||
// cube.position.copy(object.children[j].position);
|
||||
// scene.add( cube );
|
||||
object.children[j].animations = [];
|
||||
object.children[j].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( object.children[j] );
|
||||
|
||||
let action =mixer.clipAction( object.children[j].animations[0])
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
// action.play();
|
||||
|
||||
mixers.push(mixer);
|
||||
let device = {
|
||||
action:action,
|
||||
mixer:mixer,
|
||||
};
|
||||
deviceaction[object.children[j].name] = device;
|
||||
}
|
||||
if(object.children[j].name == "down"){
|
||||
object.children[j].animations = [];
|
||||
object.children[j].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( object.children[j] );
|
||||
|
||||
|
||||
let action =mixer.clipAction( object.children[j].animations[0])
|
||||
// action.play();
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
|
||||
mixers.push(mixer);
|
||||
let device = {
|
||||
action:action,
|
||||
mixer:mixer,
|
||||
};
|
||||
deviceaction[object.children[j].name] = device;
|
||||
}
|
||||
}
|
||||
object.traverse( function ( child ) {
|
||||
|
||||
if ( child.isMesh ) {
|
||||
child.renderOrder = 9;
|
||||
}
|
||||
|
||||
} );
|
||||
scope.stationMesh = object;
|
||||
// console.log(deviceaction);
|
||||
scene.add(object);
|
||||
|
||||
}
|
||||
//初始化车站名称数据
|
||||
this.initStationList = function(stationdata,standdata,psddata){
|
||||
let list = [];
|
||||
if(psddata){
|
||||
for(let i=0,leni = standdata.length;i<leni;i++){
|
||||
for(let j=0,lenj = psddata.length;j<lenj;j++){
|
||||
if(standdata[i].code == psddata[j].standCode){
|
||||
standdata[i].name = psddata[j].code;
|
||||
}
|
||||
}
|
||||
}
|
||||
for(let i=0,leni = stationdata.length;i<leni;i++){
|
||||
if(stationdata[i].depot == false){
|
||||
list[stationdata[i].name] = [];
|
||||
for(let j=0,lenj = standdata.length;j<lenj;j++){
|
||||
if(standdata[j].stationCode == stationdata[i].code){
|
||||
list[stationdata[i].name].push(standdata[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for(let k in list){
|
||||
if(list[k].length>0){
|
||||
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<list[k][1].position.y){
|
||||
stationobject.toppsd = list[k][0].name;
|
||||
stationobject.downpsd = list[k][1].name;
|
||||
stationobject.topsection = list[k][0].standTrackCode;
|
||||
stationobject.downsection = list[k][1].standTrackCode;
|
||||
stationobject.topstand = list[k][0].code;
|
||||
stationobject.downstand = list[k][1].code;
|
||||
}else{
|
||||
stationobject.toppsd = list[k][1].name;
|
||||
stationobject.downpsd = list[k][0].name;
|
||||
stationobject.topsection = list[k][1].standTrackCode;
|
||||
stationobject.downsection = list[k][0].standTrackCode;
|
||||
stationobject.topstand = list[k][1].code;
|
||||
stationobject.downstand = list[k][0].code;
|
||||
}
|
||||
scope.stationlist.push(stationobject);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
scope.nowStation = scope.stationlist[0];
|
||||
if(scope.stationtexture["stationlist"]){
|
||||
scope.stationMesh.getObjectByName("zhantailiebiao").material.map =scope.stationtexture["stationlist"];
|
||||
scope.stationMesh.getObjectByName("zhantailiebiao").material.map.needsUpdate = true;
|
||||
if(scope.stationMesh.getObjectByName("menkuangyanse")){
|
||||
scope.stationMesh.getObjectByName("menkuangyanse").material.map =scope.stationtexture["pingbimen"];
|
||||
scope.stationMesh.getObjectByName("menkuangyanse").material.map.needsUpdate = true;
|
||||
}
|
||||
scope.stationMesh.getObjectByName("zhantaiming").material.map = scope.stationtexture[scope.nowStation.code];
|
||||
scope.stationMesh.getObjectByName("zhantaiming").material.map.needsUpdate = true;
|
||||
}
|
||||
updatestationlist(scope.stationlist);
|
||||
}else{
|
||||
olddataai = true;
|
||||
}
|
||||
}
|
||||
//加载线路车站名贴图
|
||||
this.loadMaterial = function(netdata3d){
|
||||
Materialload(scope,JSON.parse(netdata3d.data.assets).stationTextureList[0]);
|
||||
}
|
||||
//更换场景车站
|
||||
this.changestation = function(stationname){
|
||||
for(let i=0,leni=scope.stationlist.length;i<leni;i++){
|
||||
if(scope.stationlist[i].name == stationname){
|
||||
scope.nowStation = scope.stationlist[i];
|
||||
|
||||
if(scope.stationtexture["stationlist"]){
|
||||
scope.stationMesh.getObjectByName("zhantaiming").material.map = scope.stationtexture[scope.nowStation.code];
|
||||
scope.stationMesh.getObjectByName("zhantaiming").material.map.needsUpdate = true;
|
||||
}
|
||||
i=leni;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
134
src/jlmap3d/jl3dtrafficplan/model/passertrain.js
Normal file
134
src/jlmap3d/jl3dtrafficplan/model/passertrain.js
Normal file
@ -0,0 +1,134 @@
|
||||
export function PasserTrain() {
|
||||
let scope = this;
|
||||
this.toptrain = null;
|
||||
this.downtrain = null;
|
||||
|
||||
this.dataList = [];
|
||||
//初始化列车模型动画
|
||||
this.initTrain = function(object,mixers,deviceaction,scene){
|
||||
let ntracks1,ntracks2,tclip,fclip;
|
||||
|
||||
if(object.animations){
|
||||
tclip = new THREE.AnimationClip("three",2,object.animations[0].tracks);
|
||||
|
||||
// ntracks1 = object.animations.slice(16,27);
|
||||
//
|
||||
// tclip = new THREE.AnimationClip("three",2,ntracks1);
|
||||
|
||||
// ntracks2 = object.animations.slice(0,15);
|
||||
|
||||
// fclip = new THREE.AnimationClip("four",2,ntracks2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
object.traverse( function ( child ) {
|
||||
|
||||
if ( child.isMesh ) {
|
||||
child.renderOrder = 8;
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
|
||||
scope.toptrain = object.clone(true);
|
||||
scope.toptrain.nowcode = null;
|
||||
scope.toptrain.action = {
|
||||
top:[],
|
||||
down:[]
|
||||
};
|
||||
let points1 = [];
|
||||
points1.push(new THREE.Vector3(-71,0.06,-6.3));
|
||||
points1.push(new THREE.Vector3(60.73,0.06,-6.3));
|
||||
|
||||
|
||||
scope.toptrain.curve = new THREE.CatmullRomCurve3(points1);
|
||||
|
||||
scope.downtrain = object.clone(true);
|
||||
scope.downtrain.nowcode = null;
|
||||
scope.downtrain.action = {
|
||||
top:[],
|
||||
down:[]
|
||||
};
|
||||
let points2 = [];
|
||||
points2.push(new THREE.Vector3(-71,0.06,28.68));
|
||||
points2.push(new THREE.Vector3(60.73,0.06,28.68));
|
||||
scope.downtrain.curve = new THREE.CatmullRomCurve3(points2);
|
||||
// console.log(scope.toptrain);
|
||||
|
||||
inittrainanimation(scope.toptrain,tclip,fclip,mixers);
|
||||
inittrainanimation(scope.downtrain,tclip,fclip,mixers);
|
||||
|
||||
|
||||
scope.toptrain.position.z = -20;
|
||||
scope.toptrain.position.y = -20000;
|
||||
scope.toptrain.rotation.y = Math.PI;
|
||||
scope.downtrain.position.z = 40;
|
||||
scope.downtrain.position.y = -20000;
|
||||
scene.add(scope.toptrain);
|
||||
scene.add(scope.downtrain);
|
||||
}
|
||||
//初始化车门动画
|
||||
function inittrainanimation(train,tclip,fclip,mixers){
|
||||
|
||||
for(let j=0;j<train.children.length;j++){
|
||||
// if(train.children[j].name == "c1" || train.children[j].name == "c6"){
|
||||
// console.log(train.children[j].children);
|
||||
for(let n=0,lenn = train.children[j].children.length;n<lenn;n++){
|
||||
if(train.children[j].children[n].name == "top"){
|
||||
train.children[j].children[n].animations = [];
|
||||
train.children[j].children[n].animations.push(tclip.clone());
|
||||
let mixer = new THREE.AnimationMixer( train.children[j].children[n] );
|
||||
|
||||
let action = mixer.clipAction( train.children[j].children[n].animations[ 0 ] );
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
train.action.top.push(action);
|
||||
mixers.push(mixer);
|
||||
}
|
||||
if(train.children[j].children[n].name == "down"){
|
||||
train.children[j].children[n].animations = [];
|
||||
|
||||
train.children[j].children[n].animations.push(tclip.clone());
|
||||
let mixer = new THREE.AnimationMixer( train.children[j].children[n] );
|
||||
|
||||
let action = mixer.clipAction( train.children[j].children[n].animations[ 0 ] );
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
train.action.down.push(action);
|
||||
mixers.push(mixer);
|
||||
}
|
||||
}
|
||||
|
||||
// }else{
|
||||
// for(let n=0,lenn = train.children[j].children.length;n<lenn;n++){
|
||||
// if(train.children[j].children[n].name == "top"){
|
||||
// train.children[j].children[n].animations = [];
|
||||
// train.children[j].children[n].animations.push(fclip.clone());
|
||||
// let mixer = new THREE.AnimationMixer( train.children[j].children[n] );
|
||||
// mixers.push(mixer);
|
||||
// let action = mixer.clipAction( train.children[j].children[n].animations[ 0 ] );
|
||||
// action.setLoop(THREE.LoopOnce);
|
||||
// action.clampWhenFinished = true;
|
||||
// train.action.top.push(action);
|
||||
// mixers.push(mixer);
|
||||
// }
|
||||
// if(train.children[j].children[n].name == "down"){
|
||||
// train.children[j].children[n].animations = [];
|
||||
// train.children[j].children[n].animations.push(fclip.clone());
|
||||
// let mixer = new THREE.AnimationMixer( train.children[j].children[n] );
|
||||
// mixers.push(mixer);
|
||||
// let action = mixer.clipAction( train.children[j].children[n].animations[ 0 ] );
|
||||
// action.setLoop(THREE.LoopOnce);
|
||||
// action.clampWhenFinished = true;
|
||||
// train.action.down.push(action);
|
||||
// mixers.push(mixer);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
374
src/jlmap3d/jl3dtrafficplan/model/traintrunk/passertrunkhuman.js
Normal file
374
src/jlmap3d/jl3dtrafficplan/model/traintrunk/passertrunkhuman.js
Normal file
@ -0,0 +1,374 @@
|
||||
import { PasserTrunkManager } from '@/jlmap3d/jl3dtrafficplan/model/traintrunk/passertrunkmanager.js';
|
||||
export function PasserHuman() {
|
||||
let scope = this;
|
||||
let trunkManager = new PasserTrunkManager();
|
||||
let waitGroup = new THREE.Group();
|
||||
|
||||
this.nowTrunk = "";
|
||||
|
||||
this.speed = "0";
|
||||
|
||||
//初始人物模型和动画
|
||||
let originhuman1 = null;
|
||||
let originhuman2 = null;
|
||||
let originanima1 = null;
|
||||
let originanima2 = null;
|
||||
//初始化人物模型动画
|
||||
this.initHumans = function(object1,object2,mixers,deviceaction,scene){
|
||||
originhuman1 = object1;
|
||||
originhuman1.progress = 1;
|
||||
// scene.add(originhuman1);
|
||||
originhuman2 = object2;
|
||||
|
||||
let mixer1 = new THREE.AnimationMixer( originhuman1 );
|
||||
let mixer2 = new THREE.AnimationMixer( originhuman2 );
|
||||
originanima1 = originhuman1.animations[ 0 ];
|
||||
originanima2 = originhuman2.animations[ 0 ];
|
||||
originhuman1.remove(originhuman1.children[2]);
|
||||
|
||||
for(let i=0;i<220;i++){
|
||||
let newhuman;
|
||||
createHumanModel(newhuman,waitGroup,new THREE.Vector3(0,0,0));
|
||||
}
|
||||
// console.log(waitGroup);
|
||||
}
|
||||
//创建新的进站乘客
|
||||
// this.newInHuman= function(humanlist,position){
|
||||
// if(scope.humanWaitIn.length != 0){
|
||||
// let newhuman;
|
||||
// createHumanModel(newhuman,humanlist,position,scope.humanWaitIn[0].stage,scope.humanWaitIn[0].direct,scope.humanWaitIn[0].door);
|
||||
// scope.humanWaitIn.shift();
|
||||
// }
|
||||
// }
|
||||
// //创建新的出站乘客
|
||||
// this.newOutHuman = function(humanlist,position){
|
||||
// if(scope.humanWaitOut.length != 0){
|
||||
// let newhuman;
|
||||
// createHumanModel(newhuman,humanlist,position,scope.humanWaitOut[0].stage,scope.humanWaitOut[0].direct,scope.humanWaitOut[0].door);
|
||||
// scope.humanWaitOut.shift();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//创建新的乘客
|
||||
// this.newHumanCreate = function(humanlist,position,stage,direct,door){
|
||||
// let newhuman;
|
||||
// createHumanModel(newhuman,humanlist,position,stage,direct,door);
|
||||
// }
|
||||
|
||||
function createHumanModel(newhuman,humanlist,position,stage,direct,door){
|
||||
let mantype = Math.floor(Math.random()*(3-1+1))+1;
|
||||
|
||||
if(mantype == 1){
|
||||
newhuman = THREE.SkeletonUtils.clone( originhuman1 );
|
||||
newhuman.animations = [];
|
||||
newhuman.animations.push(originanima1.clone());
|
||||
}else{
|
||||
newhuman = THREE.SkeletonUtils.clone( originhuman2 );
|
||||
newhuman.animations = [];
|
||||
newhuman.animations.push(originanima2.clone());
|
||||
}
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newhuman );
|
||||
newhuman.position.copy(position);
|
||||
|
||||
newhuman.status = 0;
|
||||
|
||||
newhuman.stage = stage;
|
||||
if(direct){
|
||||
if(direct == "top"){
|
||||
newhuman.rotation.y = Math.PI;
|
||||
}
|
||||
newhuman.direct = direct;
|
||||
}else{
|
||||
newhuman.direct = null;
|
||||
}
|
||||
|
||||
newhuman.doorstatus = null;
|
||||
if(door){
|
||||
newhuman.door = door;
|
||||
}else{
|
||||
newhuman.door = null;
|
||||
}
|
||||
newhuman.action = mixer.clipAction( newhuman.animations[ 0 ] );
|
||||
newhuman.mixer = mixer;
|
||||
newhuman.runrail = null;
|
||||
newhuman.speed = 0;
|
||||
newhuman.mixer = mixer;
|
||||
humanlist.add(newhuman);
|
||||
}
|
||||
//定义新模型走路动画
|
||||
this.initMoveAnimate = function(model,name,points,index){
|
||||
model.status = 1;
|
||||
let curve = new THREE.CatmullRomCurve3(points);
|
||||
curve.curvrtype = "catmullrom";
|
||||
// curve.getLength();
|
||||
// curve动画轨迹
|
||||
// progress动画进度
|
||||
// enable当前动画开关
|
||||
// speed动画速度
|
||||
// console.log(curve);
|
||||
|
||||
model.action.play();
|
||||
model.progress = 0;
|
||||
model.runrail = curve;
|
||||
model.speed = 0.2/curve.getLength();
|
||||
}
|
||||
//更新人物列表中人物的动画
|
||||
this.moveAnimateUpdate = function(humanlist,topWaitPassers,downWaitPassers,outStationPassers,passerHuman){
|
||||
for(let i=0;i<outStationPassers.children.length;i++){
|
||||
if(outStationPassers.children[i].status == 1){
|
||||
if(outStationPassers.children[i].progress>=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<topWaitPassers.children.length;i++){
|
||||
if(topWaitPassers.children[i].status == 1){
|
||||
if(topWaitPassers.children[i].progress>=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<downWaitPassers.children.length;i++){
|
||||
if(downWaitPassers.children[i].status == 1){
|
||||
if(downWaitPassers.children[i].progress>=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<humanlist.children.length;i++){
|
||||
if(humanlist.children[i].status == 1){
|
||||
if(humanlist.children[i].progress>=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<passerlength;i++){
|
||||
waitGroup.add(humanlist.children[0]);
|
||||
}
|
||||
}
|
||||
|
||||
this.inTrainRail = function(inNum,direct){
|
||||
for(let i=0;i<leaceNum;i++){
|
||||
if(direct == 1){
|
||||
|
||||
}else if(direct == 2){
|
||||
|
||||
}
|
||||
|
||||
let pos = trunkManager.getTrunkRandomPos(trunknum);
|
||||
trunkManager.getRail(direct,scope.nowTrunk,pos);
|
||||
humanlist.add(waitGroup.children[0]);
|
||||
}
|
||||
}
|
||||
|
||||
this.leaveTrainRail = function(leaveNum,doorCode){
|
||||
for(let i=0;i<leaceNum;i++){
|
||||
trunkManager.getRail(direct,scope.nowTrunk,humanlist.children[i]);
|
||||
}
|
||||
}
|
||||
|
||||
this.setNowTrunkPasser = function(humanlist,num,trunknum){
|
||||
// let array = getnum(num,6);
|
||||
// console.log(array);
|
||||
if(num){
|
||||
// for(let i=0;i<array.length;i++){
|
||||
for(let j=0;j<num;j++){
|
||||
let pos = trunkManager.getTrunkRandomPos(trunknum);
|
||||
waitGroup.children[0].zone = trunkManager.trunk[trunknum].name;
|
||||
waitGroup.children[0].position.x = pos.x;
|
||||
waitGroup.children[0].position.y = pos.y;
|
||||
waitGroup.children[0].position.z = pos.z;
|
||||
|
||||
if(pos.z<0){
|
||||
waitGroup.children[0].rotation.y = Math.PI;
|
||||
}else{
|
||||
waitGroup.children[0].rotation.y = 0;
|
||||
}
|
||||
humanlist.add(waitGroup.children[0]);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
//计算距离
|
||||
//let dx = Math.abs(point1.x - point2.x);
|
||||
//let dy = Math.abs(point1.y - point2.y);
|
||||
//let distance = Math.sqrt(Math.pow(dx,2)+Math.pow(dy,2));
|
||||
//寻找最小距离
|
||||
// var x = 9 ,y = 12 , c = 50;
|
||||
// var max = x > 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<pnum;i++){
|
||||
let nownum = base+(i<reset?1:0);
|
||||
let newtraindata = {
|
||||
num:nownum,
|
||||
}
|
||||
re.push(newtraindata);
|
||||
}
|
||||
return re;
|
||||
}
|
||||
//离开车站释放缓存
|
||||
this.uncache = function(uncachemodel){
|
||||
if(uncachemodel){
|
||||
uncachemodel.mixer.uncacheAction();
|
||||
uncachemodel.traverse( function ( child ) {
|
||||
if ( child.isMesh ) {
|
||||
child.geometry.dispose();
|
||||
child.material.dispose();
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
export function PasserTrunkManager(data) {
|
||||
var scope = this;
|
||||
|
||||
this.trunk = [
|
||||
{
|
||||
name:"trunk1",
|
||||
position:new THREE.Vector3(11.6,1.22,0),
|
||||
leftdoor:[
|
||||
new THREE.Vector3(7.12,1.22,-1.6),
|
||||
new THREE.Vector3(11.6,1.22,-1.6),
|
||||
new THREE.Vector3(16,1.22,-1.6)
|
||||
],
|
||||
|
||||
rightdoor:[
|
||||
new THREE.Vector3(7.12,1.22,1.6),
|
||||
new THREE.Vector3(11.6,1.22,1.6),
|
||||
new THREE.Vector3(16,1.22,1.6)
|
||||
],
|
||||
},
|
||||
{
|
||||
name:"trunk2",
|
||||
position:new THREE.Vector3(33,1.22,0),
|
||||
leftdoor:[
|
||||
new THREE.Vector3(28.4,1.22,-1.6),
|
||||
new THREE.Vector3(33,1.22,-1.6),
|
||||
new THREE.Vector3(37,1.22,-1.6),
|
||||
],
|
||||
|
||||
rightdoor:[
|
||||
new THREE.Vector3(28.4,1.22,1.6),
|
||||
new THREE.Vector3(33,1.22,1.6),
|
||||
new THREE.Vector3(37,1.22,1.6),
|
||||
],
|
||||
},
|
||||
{
|
||||
name:"trunk3",
|
||||
position:new THREE.Vector3(54,1.22,0),
|
||||
leftdoor:[
|
||||
new THREE.Vector3(50,1.22,-1.6),
|
||||
new THREE.Vector3(54,1.22,-1.6),
|
||||
new THREE.Vector3(58,1.22,-1.6),
|
||||
],
|
||||
|
||||
rightdoor:[
|
||||
new THREE.Vector3(50,1.22,1.6),
|
||||
new THREE.Vector3(54,1.22,1.6),
|
||||
new THREE.Vector3(58,1.22,1.6)
|
||||
],
|
||||
},
|
||||
{
|
||||
name:"trunk4",
|
||||
position:new THREE.Vector3(75.7,1.22,0),
|
||||
leftdoor:[
|
||||
new THREE.Vector3(71,1.22,-1.6),
|
||||
new THREE.Vector3(75,1.22,-1.6),
|
||||
new THREE.Vector3(79,1.22,-1.6)
|
||||
],
|
||||
|
||||
rightdoor:[
|
||||
new THREE.Vector3(71,1.22,1.6),
|
||||
new THREE.Vector3(75,1.22,1.6),
|
||||
new THREE.Vector3(79,1.22,1.6)
|
||||
],
|
||||
},
|
||||
{
|
||||
name:"trunk5",
|
||||
position:new THREE.Vector3(97.1,1.22,0),
|
||||
leftdoor:[
|
||||
new THREE.Vector3(93,1.22,-1.6),
|
||||
new THREE.Vector3(97,1.22,-1.6),
|
||||
new THREE.Vector3(101,1.22,-1.6),
|
||||
],
|
||||
|
||||
rightdoor:[
|
||||
new THREE.Vector3(93,1.22,1.6),
|
||||
new THREE.Vector3(97,1.22,1.6),
|
||||
new THREE.Vector3(101,1.22,1.6)
|
||||
],
|
||||
},
|
||||
{
|
||||
name:"trunk6",
|
||||
position:new THREE.Vector3(118.5,1.22,0),
|
||||
leftdoor:[
|
||||
new THREE.Vector3(114.5,1.22,-1.6),
|
||||
new THREE.Vector3(118.5,1.22,-1.6),
|
||||
new THREE.Vector3(122.5,1.22,-1.6),
|
||||
],
|
||||
|
||||
rightdoor:[
|
||||
new THREE.Vector3(114.5,1.22,1.6),
|
||||
new THREE.Vector3(118.5,1.22,1.6),
|
||||
new THREE.Vector3(122.5,1.22,1.6),
|
||||
],
|
||||
}
|
||||
|
||||
];
|
||||
var rand = (min,max) => 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;
|
||||
}
|
||||
}
|
331
src/jlmap3d/jl3dtrafficplan/model/zonemanager.js
Normal file
331
src/jlmap3d/jl3dtrafficplan/model/zonemanager.js
Normal file
@ -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(){
|
||||
|
||||
}
|
||||
|
||||
}
|
20
src/jlmap3d/jl3dtrafficplan/model/zonemodel.js
Normal file
20
src/jlmap3d/jl3dtrafficplan/model/zonemodel.js
Normal file
@ -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;
|
||||
}
|
||||
}
|
267
src/jlmap3d/jl3dtrafficplan/passerai/passerai.js
Normal file
267
src/jlmap3d/jl3dtrafficplan/passerai/passerai.js
Normal file
@ -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<jl3d.humanWaitTop;i++){
|
||||
let standdata = passerZone.getstandposition("standtop");
|
||||
passerHuman.newHumanCreate(topWaitPassers,standdata.point,4,"top",standdata.door);
|
||||
}
|
||||
for(let i=0;i<jl3d.humanWaitDown;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<outStationPassers.children.length;i++){
|
||||
if(outStationPassers.children[i].status == 0){
|
||||
//stage = 5 下车
|
||||
if(outStationPassers.children[i].stage == 5){
|
||||
let points = [];
|
||||
points.push(new THREE.Vector3(outStationPassers.children[i].position.x,outStationPassers.children[i].position.y,outStationPassers.children[i].position.z));
|
||||
if(outStationPassers.children[i].direct == "top"){
|
||||
points.push(new THREE.Vector3(outStationPassers.children[i].position.x,outStationPassers.children[i].position.y,outStationPassers.children[i].position.z+5));
|
||||
}
|
||||
if(outStationPassers.children[i].direct == "down"){
|
||||
points.push(new THREE.Vector3(outStationPassers.children[i].position.x,outStationPassers.children[i].position.y,outStationPassers.children[i].position.z-5));
|
||||
}
|
||||
targetPosition = passerZone.getgateposition("exitgate");
|
||||
path = pathFinder.find(points[1],targetPosition.point);
|
||||
outStationPassers.children[i].door = targetPosition.door;
|
||||
for(let i=0;i<path.length;i++){
|
||||
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
|
||||
}
|
||||
passerHuman.initMoveAnimate(outStationPassers.children[i],i,points,i);
|
||||
}
|
||||
|
||||
//stage = 7 出闸机
|
||||
if(outStationPassers.children[i].stage == 7){
|
||||
let points = [];
|
||||
points.push(new THREE.Vector3(outStationPassers.children[i].position.x,outStationPassers.children[i].position.y,outStationPassers.children[i].position.z));
|
||||
points.push(new THREE.Vector3(outStationPassers.children[i].position.x+5,outStationPassers.children[i].position.y,outStationPassers.children[i].position.z));
|
||||
|
||||
passerCheckDoor.checkDoorControl("out",outStationPassers.children[i].door,deviceaction)
|
||||
passerHuman.initMoveAnimate(outStationPassers.children[i],i,points,i);
|
||||
}
|
||||
|
||||
//stage = 8 出站
|
||||
if(outStationPassers.children[i].stage == 8){
|
||||
let direct = Math.floor(Math.random()*(3-1+1))+1;
|
||||
let points = [];
|
||||
points.push(new THREE.Vector3(outStationPassers.children[i].position.x,outStationPassers.children[i].position.y,outStationPassers.children[i].position.z));
|
||||
|
||||
//1--top
|
||||
//2-- down
|
||||
if(direct == 1){
|
||||
targetPosition = passerZone.getzoneposition("exit1");
|
||||
path = pathFinder.find(points[0],targetPosition);
|
||||
}else{
|
||||
targetPosition = passerZone.getzoneposition("exit2");
|
||||
path = pathFinder.find(points[0],targetPosition);
|
||||
}
|
||||
|
||||
for(let i=0;i<path.length;i++){
|
||||
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
|
||||
}
|
||||
passerHuman.initMoveAnimate(outStationPassers.children[i],i,points,i);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(let i=0;i<topWaitPassers.children.length;i++){
|
||||
if(topWaitPassers.children[i].status == 0){
|
||||
//stage = 4 上车
|
||||
if(topWaitPassers.children[i].stage == 4){
|
||||
if(scope.toppasserin && topWaitPassers.children[i].direct == "top"){
|
||||
|
||||
|
||||
let points = [];
|
||||
points.push(new THREE.Vector3(topWaitPassers.children[i].position.x,topWaitPassers.children[i].position.y,topWaitPassers.children[i].position.z));
|
||||
|
||||
points.push(passerZone.list["standtop"].doorpoints[topWaitPassers.children[i].door]);
|
||||
|
||||
if(points[1] == undefined){
|
||||
|
||||
}else{
|
||||
passerHuman.initMoveAnimate(topWaitPassers.children[i],i,points,i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(let i=0;i<downWaitPassers.children.length;i++){
|
||||
if(downWaitPassers.children[i].status == 0){
|
||||
//stage = 4 上车
|
||||
if(downWaitPassers.children[i].stage == 4){
|
||||
|
||||
if(scope.downpasserin && downWaitPassers.children[i].direct == "down"){
|
||||
let points = [];
|
||||
points.push(new THREE.Vector3(downWaitPassers.children[i].position.x,downWaitPassers.children[i].position.y,downWaitPassers.children[i].position.z));
|
||||
|
||||
points.push(passerZone.list["standdown"].doorpoints[downWaitPassers.children[i].door]);
|
||||
|
||||
if(points[1] == undefined){
|
||||
|
||||
}else{
|
||||
passerHuman.initMoveAnimate(downWaitPassers.children[i],i,points,i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(let i=0;i<humanlist.children.length;i++){
|
||||
// console.log(humans[i]);
|
||||
|
||||
if(humanlist.children[i].status == 0){
|
||||
//stage = 0 进入车站
|
||||
if(humanlist.children[i].stage == 0){
|
||||
let points = [];
|
||||
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
|
||||
|
||||
targetPosition = passerZone.getzoneposition("security");
|
||||
|
||||
path = pathFinder.find(points[0],targetPosition);
|
||||
|
||||
for(let i=0;i<path.length;i++){
|
||||
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
|
||||
}
|
||||
passerHuman.initMoveAnimate(humanlist.children[i],i,points,i);
|
||||
// console.log(path);
|
||||
}
|
||||
|
||||
//stage = 1 前往进站闸机
|
||||
if(humanlist.children[i].stage == 1){
|
||||
let points = [];
|
||||
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
|
||||
|
||||
targetPosition = passerZone.getgateposition("entergate");
|
||||
|
||||
path = pathFinder.find(points[0],targetPosition.point);
|
||||
|
||||
humanlist.children[i].door = targetPosition.door;
|
||||
for(let i=0;i<path.length;i++){
|
||||
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
|
||||
}
|
||||
passerHuman.initMoveAnimate(humanlist.children[i],i,points,i);
|
||||
}
|
||||
|
||||
//stage = 2 过闸机
|
||||
if(humanlist.children[i].stage == 2){
|
||||
let points = [];
|
||||
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
|
||||
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z-5));
|
||||
|
||||
passerCheckDoor.checkDoorControl("in",humanlist.children[i].door,deviceaction)
|
||||
passerHuman.initMoveAnimate(humanlist.children[i],i,points,i);
|
||||
}
|
||||
|
||||
//stage = 3 前往站台
|
||||
if(humanlist.children[i].stage == 3){
|
||||
|
||||
let direct = Math.floor(Math.random()*(2))+1;
|
||||
// console.log(direct);
|
||||
let points = [];
|
||||
points.push(new THREE.Vector3(humanlist.children[i].position.x,humanlist.children[i].position.y,humanlist.children[i].position.z));
|
||||
// points.push(new THREE.Vector3(11.81,9.8,13.11));
|
||||
|
||||
//1--top
|
||||
//2-- down
|
||||
if(humanlist.children[i].overGoal == "top"){
|
||||
targetPosition = passerZone.getstandposition("standtop");
|
||||
path = pathFinder.find(points[0],targetPosition.point);
|
||||
humanlist.children[i].direct = "top";
|
||||
}else{
|
||||
targetPosition = passerZone.getstandposition("standdown");
|
||||
path = pathFinder.find(points[0],targetPosition.point);
|
||||
humanlist.children[i].direct = "down";
|
||||
}
|
||||
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<path.length;i++){
|
||||
points.push(new THREE.Vector3(path[i].x,path[i].y,path[i].z));
|
||||
}
|
||||
humanlist.children[i].door = targetPosition.door;
|
||||
passerHuman.initMoveAnimate(humanlist.children[i],i,points,i);
|
||||
}else{
|
||||
humanlist.children[i].position.x += 0.05;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
69
src/jlmap3d/jl3dtrafficplan/passerai/pathfinder.js
Normal file
69
src/jlmap3d/jl3dtrafficplan/passerai/pathfinder.js
Normal file
@ -0,0 +1,69 @@
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||
import { Pathfinding } from '@/jlmap3d/utils/pathfinder/Pathfinding.js';
|
||||
import { OBJLoader } from '@/jlmap3d/main/loaders/OBJLoader';
|
||||
|
||||
export function PathFinder(){
|
||||
let scope = this;
|
||||
this.navmesh = null;
|
||||
|
||||
const ZONE = 'level';
|
||||
const SPEED = 10;
|
||||
const OFFSET = 0.2;
|
||||
THREE.Pathfinding = Pathfinding;
|
||||
let groupID,path,level;
|
||||
let playerPosition = new THREE.Vector3( -3.5, 0.5, 5.5 );
|
||||
|
||||
let pathFinder = new THREE.Pathfinding();
|
||||
|
||||
|
||||
|
||||
let loaderObj = new THREE.OBJLoader();
|
||||
|
||||
// load a resource
|
||||
loaderObj.load(
|
||||
// resource URL
|
||||
JL3D_LOCAL_STATIC+'/jl3d/path/path.obj',
|
||||
// called when resource is loaded
|
||||
function ( object ) {
|
||||
|
||||
|
||||
// console.time('createZone()');
|
||||
|
||||
const zone = THREE.Pathfinding.createZone(object.children[0].geometry);
|
||||
// console.timeEnd('createZone()');
|
||||
|
||||
pathFinder.setZoneData( ZONE, zone );
|
||||
|
||||
const navWireframe = new THREE.Mesh(object.children[0].geometry, new THREE.MeshBasicMaterial({
|
||||
color: 0x808080,
|
||||
wireframe: true
|
||||
}));
|
||||
navWireframe.position.y = OFFSET / 2;
|
||||
// scene.add(navWireframe);
|
||||
|
||||
scope.navmesh = object;
|
||||
|
||||
|
||||
groupID = pathFinder.getGroup( ZONE, playerPosition );
|
||||
|
||||
},
|
||||
// called when loading is in progresses
|
||||
function ( xhr ) {
|
||||
|
||||
console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
|
||||
|
||||
},
|
||||
// called when loading has errors
|
||||
function ( error ) {
|
||||
|
||||
console.log( 'An error happened' );
|
||||
|
||||
}
|
||||
);
|
||||
this.find = function(startPoint,targetPosition){
|
||||
groupID = pathFinder.getGroup( ZONE, startPoint );
|
||||
let resultPath = pathFinder.findPath( startPoint, targetPosition, ZONE, groupID );
|
||||
|
||||
return resultPath;
|
||||
}
|
||||
}
|
@ -43,7 +43,7 @@ let waicestation = {
|
||||
}
|
||||
let station3 = {
|
||||
id:"10000",
|
||||
name:"三站台",
|
||||
name:"特殊站台",
|
||||
deviceType:"station3",
|
||||
type:"num4",
|
||||
picUrl:"",
|
||||
|
@ -180,11 +180,33 @@ export function StationStandListN() {
|
||||
|
||||
} );
|
||||
|
||||
let allClear = 0;
|
||||
for(let j=0;j<standsdata.length;j++){
|
||||
|
||||
allClear = 0;
|
||||
for(let i=0;i<psddata.length;i++){
|
||||
|
||||
for(let n=0;n<standsdata[j].stands.length;n++){
|
||||
if(psddata[i].standCode == standsdata[j].stands[n].code){
|
||||
allClear++;
|
||||
standsdata[j].stands[n].position = psddata[i].position;
|
||||
}
|
||||
}
|
||||
|
||||
if(allClear == standsdata[j].stands.length){
|
||||
standsdata[j].stands.sort(compare);
|
||||
i = psddata.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
console.log(standsdata);
|
||||
console.log(psddata);
|
||||
for(let i=0;i<standsdata.length;i++){
|
||||
let newstationstand = new StationStandModel(standsdata[i]);
|
||||
// console.log(standsdata[i]);
|
||||
if(standsdata[i].code != "Station96090"){
|
||||
console.log("3");
|
||||
newstationstand.code = standsdata[i].code;
|
||||
newstationstand.name = standsdata[i].name;
|
||||
newstationstand.type = "station";
|
||||
@ -236,6 +258,7 @@ export function StationStandListN() {
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newstationmesh.children[j] );
|
||||
|
||||
|
||||
for(let n=0;n<psddata.length;n++){
|
||||
for(let m=0;m<newstationstand.stands.length;m++){
|
||||
|
||||
@ -304,118 +327,6 @@ export function StationStandListN() {
|
||||
textt.dispose();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
newstationstand.code = standsdata[i].code;
|
||||
newstationstand.name = standsdata[i].name;
|
||||
newstationstand.type = "station";
|
||||
newstationstand.num = i;
|
||||
newstationstand.stand = [];
|
||||
// newstationstand.direction1.code = standsdata[i].direction1.code;
|
||||
// newstationstand.direction1.name = standsdata[i].direction1.name;
|
||||
// newstationstand.direction1.screenDoorOpenStatus = "01";
|
||||
//
|
||||
// newstationstand.direction2.code = standsdata[i].direction2.code;
|
||||
// newstationstand.direction2.name = standsdata[i].direction2.name;
|
||||
// newstationstand.direction2.screenDoorOpenStatus = "01";
|
||||
let newstationmesh = null;
|
||||
newstationmesh = selectmesh3.clone(true);
|
||||
newstationmesh.code = standsdata[i].code;
|
||||
newstationmesh.name = standsdata[i].code;
|
||||
newstationmesh.position.x = standsdata[i].position.x;
|
||||
newstationmesh.position.y = standsdata[i].position.y;
|
||||
newstationmesh.position.z = standsdata[i].position.z;
|
||||
// newstationmesh.rotation.x = standsdata[i].rotation._x;
|
||||
// newstationmesh.rotation.y = standsdata[i].rotation._y;
|
||||
// newstationmesh.rotation.z = standsdata[i].rotation._z;
|
||||
newstationstand.mesh = newstationmesh;
|
||||
scope.group.add(newstationmesh);
|
||||
//
|
||||
scope.list[standsdata[i].code] = newstationstand;
|
||||
//
|
||||
let newclip =null;
|
||||
newclip = selectmesh3.animations[ 0 ];
|
||||
for(let j=0;j<newstationmesh.children.length;j++){
|
||||
|
||||
if(newstationmesh.children[j].name == "top"){
|
||||
newstationmesh.children[j].animations = [];
|
||||
newstationmesh.children[j].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newstationmesh.children[j] );
|
||||
|
||||
for(let n=0;n<psddata.length;n++){
|
||||
for(let n=0;n<psddata.length;n++){
|
||||
for(let m=0;m<newstationstand.stands.length;m++){
|
||||
console.log("====================");
|
||||
console.log(newstationstand.stands[m]);
|
||||
console.log(psddata[n]);
|
||||
if(psddata[n].standCode == newstationstand.stands[m].code && newstationstand.stands[m].right == false){
|
||||
let key = psddata[n].code;
|
||||
actionss[key] = {
|
||||
status:"01",
|
||||
action:mixer.clipAction( newstationmesh.children[j].animations[0])
|
||||
};
|
||||
actionss[key].action.setLoop(THREE.LoopOnce);
|
||||
actionss[key].action.clampWhenFinished = true;
|
||||
//actionss[key].play();
|
||||
mixers.push(mixer);
|
||||
n = psddata.length;
|
||||
m = newstationstand.stands.length;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(newstationmesh.children[j].name == "down"){
|
||||
newstationmesh.children[j].animations = [];
|
||||
newstationmesh.children[j].animations.push(newclip.clone());
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newstationmesh.children[j] );
|
||||
for(let n=0;n<psddata.length;n++){
|
||||
for(let n=0;n<psddata.length;n++){
|
||||
for(let m=0;m<newstationstand.stands.length;m++){
|
||||
console.log("====================");
|
||||
console.log(newstationstand.stands[m]);
|
||||
console.log(psddata[n]);
|
||||
if(psddata[n].standCode == newstationstand.stands[m].code && newstationstand.stands[m].right == true){
|
||||
let key = psddata[n].code;
|
||||
actionss[key] = {
|
||||
status:"01",
|
||||
action:mixer.clipAction( newstationmesh.children[j].animations[0])
|
||||
};
|
||||
actionss[key].action.setLoop(THREE.LoopOnce);
|
||||
actionss[key].action.clampWhenFinished = true;
|
||||
//actionss[key].play();
|
||||
mixers.push(mixer);
|
||||
n = psddata.length;
|
||||
m = newstationstand.stands.length;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(mode){
|
||||
if(mode == "02"){
|
||||
let textgeometry = new THREE.PlaneBufferGeometry( 65, 90, 1 );
|
||||
let textt = new THREE.CanvasTexture(getTextCanvas(standsdata[i]));
|
||||
let textmaterial = new THREE.MeshBasicMaterial( { side: THREE.DoubleSide,map:textt ,transparent: true} );
|
||||
let textplane = new THREE.Mesh( textgeometry, textmaterial );
|
||||
textplane.name = standsdata[i].code;
|
||||
textplane.position.y = 70;
|
||||
textplane.rotation.x = Math.PI/2;
|
||||
textplane.position.z = 50;
|
||||
scope.textlist.push(textplane);
|
||||
newstationmesh.add(textplane);
|
||||
textgeometry.dispose();
|
||||
textmaterial.dispose();
|
||||
textt.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -428,6 +339,17 @@ export function StationStandListN() {
|
||||
|
||||
}
|
||||
}
|
||||
var compare = function (obj1, obj2) {
|
||||
var val1 = obj1.position.y;
|
||||
var val2 = obj2.position.y;
|
||||
if (val1 < val2) {
|
||||
return -1;
|
||||
} else if (val1 > val2) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
//canvas文字贴图方法
|
||||
//PS:待提炼 增强功能
|
||||
var stationcanvas = new Image();
|
||||
|
@ -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 => {
|
||||
|
@ -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');
|
||||
@ -231,6 +233,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',
|
||||
|
@ -4,9 +4,15 @@ 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.119:9000'; // 张赛
|
||||
<<<<<<< HEAD
|
||||
// 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://192.168.8.114:9000'; // 旭强
|
||||
// BASE_API = 'http://192.168.8.109:9000'; // 张赛
|
||||
// BASE_API = 'http://192.168.8.110:9008'; // 杜康
|
||||
>>>>>>> 009f7b57a22a8c59a26fe0b2be01d24377f37873
|
||||
// BASE_API = 'http://b29z135112.zicp.vip';
|
||||
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
|
||||
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="mapDraft" id="mapMain">
|
||||
sssssssssssssssssssssss
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
|
125
src/views/jlmap3d/trafficplan/component/stationdata.vue
Normal file
125
src/views/jlmap3d/trafficplan/component/stationdata.vue
Normal file
@ -0,0 +1,125 @@
|
||||
<template>
|
||||
<div class="stationdata">
|
||||
<el-row class="tac">
|
||||
<el-col :span="12">
|
||||
<el-menu
|
||||
default-active="2"
|
||||
class="el-menu-vertical-demo datatab"
|
||||
@open="handleOpen"
|
||||
@close="handleClose"
|
||||
background-color="#545c64"
|
||||
text-color="#fff"
|
||||
active-text-color="#ffd04b">
|
||||
|
||||
<el-submenu index="1">
|
||||
<template slot="title">
|
||||
<span>当前车站总人数:</span>
|
||||
<span>{{allPassers}}</span>
|
||||
</template>
|
||||
</el-submenu>
|
||||
|
||||
<el-submenu index="2">
|
||||
<template slot="title">
|
||||
<span>当前进站流量:</span>
|
||||
<span>{{nowInStationPassers}}</span>
|
||||
</template>
|
||||
</el-submenu>
|
||||
|
||||
<!-- <el-submenu index="3">
|
||||
<template slot="title">
|
||||
<span>当前出站客流:</span>
|
||||
<span>{{nowOutStationPassers}}</span>
|
||||
</template>
|
||||
</el-submenu> -->
|
||||
|
||||
<el-submenu index="4">
|
||||
<template slot="title">
|
||||
<span>上行站台等待旅客:</span>
|
||||
<span>{{topWaitPassers}}</span>
|
||||
</template>
|
||||
</el-submenu>
|
||||
|
||||
<el-submenu index="5">
|
||||
<template slot="title">
|
||||
<span>下行站台等待旅客:</span>
|
||||
<span>{{downWaitPassers}}</span>
|
||||
</template>
|
||||
</el-submenu>
|
||||
|
||||
<el-submenu index="6">
|
||||
<template slot="title">
|
||||
<span>其他数据</span>
|
||||
</template>
|
||||
</el-submenu>
|
||||
</el-menu>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'StationData',
|
||||
components: {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
allPassers:"30人",
|
||||
topWaitPassers:"12人",
|
||||
downWaitPassers:"13人",
|
||||
nowInStationPassers:"0 人/30s",
|
||||
nowOutStationPassers:"0 人",
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
|
||||
|
||||
},
|
||||
watch: {
|
||||
|
||||
},
|
||||
methods: {
|
||||
handleOpen(key, keyPath) {
|
||||
console.log(key, keyPath);
|
||||
},
|
||||
handleClose(key, keyPath) {
|
||||
console.log(key, keyPath);
|
||||
},
|
||||
updatePasserData(humanlistdata,topWaitPassersdata,downWaitPassersdata,outStationPassersdata,speed){
|
||||
this.topWaitPassers = topWaitPassersdata+"人";
|
||||
this.downWaitPassers = downWaitPassersdata+"人";
|
||||
// this.nowOutStationPassers = outStationPassersdata+"人";
|
||||
|
||||
if(speed == undefined){
|
||||
this.nowInStationPassers = 0 + "人/30s";
|
||||
}else{
|
||||
this.nowInStationPassers = speed + "人/30s";
|
||||
}
|
||||
this.allPassers = humanlistdata+topWaitPassersdata+downWaitPassersdata+outStationPassersdata+"人";
|
||||
},
|
||||
updatePasserOut(data){
|
||||
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
//this.init();
|
||||
window.updatePasserData = this.updatePasserData;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
.stationdata{
|
||||
top:100px;
|
||||
left:0;
|
||||
position: absolute;
|
||||
}
|
||||
.datatab{
|
||||
width:250px;
|
||||
}
|
||||
</style>
|
235
src/views/jlmap3d/trafficplan/jl3dtrafficplan.vue
Normal file
235
src/views/jlmap3d/trafficplan/jl3dtrafficplan.vue
Normal file
@ -0,0 +1,235 @@
|
||||
<template>
|
||||
<div class="jl3dtrafficplan">
|
||||
<div id="jl3d" :class="lineCode=='07'?'jl3ddraw':'jl3ddraw1'" />
|
||||
<div class="station" :style="{'background-image': 'url('+localStatic+'/texture/scene.png)'}">
|
||||
<div style="margin-top:5%;font-size: 30px;">当前车站:</div>
|
||||
<el-select v-model="value" class="listmenu" placeholder="当前车站" @change="currentsel">
|
||||
<el-option
|
||||
v-for="item in stationlist"
|
||||
:key="item.name"
|
||||
:label="item.name"
|
||||
:value="item.name"
|
||||
:disabled="item.disabled"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
<Station-Data>
|
||||
</Station-Data>
|
||||
|
||||
<div class="menutop">
|
||||
<el-button-group>
|
||||
<el-button type="primary" @click="switchauto">列车车厢视角</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
|
||||
<div class="menudown">
|
||||
<el-button-group>
|
||||
<el-button v-show="isCctv" type="primary" @click="back">退出</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import Vue from 'vue';
|
||||
import { Jl3dTrafficPlan } from '@/jlmap3d/jl3dtrafficplan/jl3dtrafficplan.js';
|
||||
import { ProjectIcon, loginInfo } from '@/scripts/ProjectConfig';
|
||||
|
||||
import { getSessionStorage } from '@/utils/auth';
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||
|
||||
import StationData from '@/views/jlmap3d/trafficplan/component/stationdata';
|
||||
|
||||
export default {
|
||||
name: 'TrafficPlan',
|
||||
components: {
|
||||
StationData,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
localStatic:JL3D_LOCAL_STATIC,
|
||||
jl3d: null,
|
||||
rendermode:'监控视角',
|
||||
renderswitch:false,
|
||||
stationlist:[],
|
||||
value:'',
|
||||
isCctv:true,
|
||||
group:'',
|
||||
mapId:'',
|
||||
lineCode:'',
|
||||
loadingProjectList: ['login', 'design', 'xty', 'designxty', 'gzb', 'designxty', 'xadt', 'designxadt', 'drts', 'designdrts']
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
code() {
|
||||
return this.$route.query.code;
|
||||
},
|
||||
project() {
|
||||
return getSessionStorage('project');
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
|
||||
},
|
||||
created() {
|
||||
if (this.loadingProjectList.includes(this.$route.query.project)) {
|
||||
this.$store.dispatch('app/transitionAnimations');
|
||||
}
|
||||
document.querySelector("link[rel*='icon']").href = loginInfo[this.$route.query.project].linkIcon || ProjectIcon[this.$route.query.project];
|
||||
},
|
||||
mounted() {
|
||||
this.group = this.$route.query.group;
|
||||
this.mapId = this.$route.query.mapId;
|
||||
this.lineCode = this.$route.query.lineCode;
|
||||
this.init();
|
||||
window.updatestationlist = this.updatestationlist;
|
||||
if (this.$route.query.type == 'CCTV') {
|
||||
this.isCctv = false;
|
||||
}
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
},
|
||||
methods: {
|
||||
init: function () {
|
||||
// let mapdata = this.$store.state.socket.device;
|
||||
const dom = document.getElementById('jl3d');
|
||||
this.jl3d = new Jl3dTrafficPlan(dom, this.$route.query.mapid, this.$route.query.group, 'normal');
|
||||
},
|
||||
switchrender() {
|
||||
if (this.renderswitch == true) {
|
||||
this.rendermode = '退出监控';
|
||||
this.renderswitch = false;
|
||||
this.jl3d.switchviews('freeview');
|
||||
} else {
|
||||
this.rendermode = '监控视角';
|
||||
this.renderswitch = true;
|
||||
this.jl3d.switchviews('4views');
|
||||
}
|
||||
},
|
||||
|
||||
switchauto() {
|
||||
const routeData = this.$router.resolve({
|
||||
path:'/jlmap3d/traffictrain',
|
||||
query:{
|
||||
mapid:this.$route.query.mapid,
|
||||
group:this.group,
|
||||
project: this.project,
|
||||
noPreLogout: true,
|
||||
lineCode:this.lineCode
|
||||
}
|
||||
});
|
||||
window.open(routeData.href, '_blank', 'noopener noreferrer');
|
||||
},
|
||||
updatestationlist(list) {
|
||||
// console.log(list);
|
||||
this.value = list[0].name;
|
||||
this.stationlist = list;
|
||||
},
|
||||
currentsel(selVal) {
|
||||
this.jl3d.changestation(selVal);
|
||||
// let oldgroupnum = this.groupnum;
|
||||
// this.value = selVal;
|
||||
},
|
||||
back() {
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
/* #jl3d {
|
||||
width: 937px;
|
||||
height: 937px;
|
||||
} */
|
||||
.jl3dtrafficplan{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.jl3ddraw1{
|
||||
position: absolute;
|
||||
float: right;
|
||||
top:0%;
|
||||
/* left: 0; */
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 0;
|
||||
}
|
||||
.jl3ddraw {
|
||||
position: absolute;
|
||||
float: right;
|
||||
top:0%;
|
||||
/* left: 0; */
|
||||
width: 50%;
|
||||
height: 100%;
|
||||
z-index: 0;
|
||||
}
|
||||
.jlReal3d{
|
||||
position: absolute;
|
||||
top:0%;
|
||||
left: 50%;
|
||||
width: 50%;
|
||||
height: 100%;
|
||||
z-index: 0;
|
||||
font-size:0;
|
||||
}
|
||||
.realCctv1{
|
||||
position: absolute;
|
||||
width:50%;
|
||||
height:50%;
|
||||
left:0;
|
||||
top:0;
|
||||
}
|
||||
.realCctv2{
|
||||
position: absolute;
|
||||
width:50%;
|
||||
height:50%;
|
||||
left:50%;
|
||||
top:0;
|
||||
}
|
||||
.realCctv3{
|
||||
position: absolute;
|
||||
width:50%;
|
||||
height:50%;
|
||||
left:0;
|
||||
top:50%;
|
||||
}
|
||||
.realCctv4{
|
||||
position: absolute;
|
||||
width:50%;
|
||||
height:50%;
|
||||
left:50%;
|
||||
top:50%;
|
||||
}
|
||||
.station{
|
||||
width:250px;
|
||||
height:100px;
|
||||
top:0;
|
||||
left:0;
|
||||
text-align: center;
|
||||
/* right:500px; */
|
||||
/* bottom:0; */
|
||||
position: absolute;
|
||||
background-size: 100% 100%;
|
||||
border-radius:10px;
|
||||
}
|
||||
.listmenu{
|
||||
/* top:50%; */
|
||||
}
|
||||
.menutop{
|
||||
top:0;
|
||||
right:0;
|
||||
position:absolute;
|
||||
}
|
||||
.menudown{
|
||||
bottom:0;
|
||||
right:0;
|
||||
position:absolute;
|
||||
}
|
||||
#canvastexture {
|
||||
position: absolute;
|
||||
float: left;
|
||||
left: 0;
|
||||
z-index: -12;
|
||||
}
|
||||
</style>
|
330
src/views/jlmap3d/trafficplan/jl3dtraffictrain.vue
Normal file
330
src/views/jlmap3d/trafficplan/jl3dtraffictrain.vue
Normal file
@ -0,0 +1,330 @@
|
||||
<template>
|
||||
<div class="jl3dtrafficplan">
|
||||
<div id="jl3d" :class="lineCode=='07'?'jl3ddraw':'jl3ddraw1'" />
|
||||
<div class="station" :style="{'background-image': 'url('+localStatic+'/texture/scene.png)'}">
|
||||
<div style="margin-top:5%;font-size: 30px;">当前列车:</div>
|
||||
<el-select v-model="value" class="listmenu" placeholder="请选择列车" @visible-change="updateTrainList" @change="updateTrainCode">
|
||||
<el-option
|
||||
v-for="item in trainlist"
|
||||
:key="item.code"
|
||||
:label="item.code"
|
||||
:value="item.code"
|
||||
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="trunklist">
|
||||
<div class="trunk" :class="{active:index==isActive}"
|
||||
:style="{'background-image': 'url('+localStatic+trunkAsse+')'}"
|
||||
v-for="(trunkAsse,index) in trunkAssetList" @click="assetSelect(index)" >
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="traindata">
|
||||
<el-row class="tac">
|
||||
<el-col :span="12">
|
||||
<el-menu
|
||||
default-active="2"
|
||||
class="el-menu-vertical-demo datatab"
|
||||
|
||||
|
||||
background-color="#545c64"
|
||||
text-color="#fff"
|
||||
active-text-color="#ffd04b">
|
||||
|
||||
<el-submenu index="1">
|
||||
<template slot="title">
|
||||
<span>当前列车乘客总数:{{allPassers}}人</span>
|
||||
</template>
|
||||
</el-submenu>
|
||||
|
||||
<el-submenu index="2">
|
||||
<template slot="title">
|
||||
<span>车厢一</span>
|
||||
</template>
|
||||
<p class = "takedata">车厢乘客数:{{takelist[0].num}}人</p>
|
||||
<p class = "takedata">车厢载客率:{{takelist[0].percent}}</p>
|
||||
</el-submenu>
|
||||
|
||||
<el-submenu index="3">
|
||||
<template slot="title">
|
||||
<span>车厢二</span>
|
||||
</template>
|
||||
<p class = "takedata">车厢乘客数:{{takelist[1].num}}人</p>
|
||||
<p class = "takedata">车厢载客率:{{takelist[1].percent}}</p>
|
||||
</el-submenu>
|
||||
|
||||
<el-submenu index="4">
|
||||
<template slot="title">
|
||||
<span>车厢三</span>
|
||||
</template>
|
||||
<p class = "takedata">车厢乘客数:{{takelist[2].num}}人</p>
|
||||
<p class = "takedata">车厢载客率:{{takelist[2].percent}}</p>
|
||||
</el-submenu>
|
||||
|
||||
<el-submenu index="5">
|
||||
<template slot="title">
|
||||
<span>车厢四</span>
|
||||
</template>
|
||||
<p class = "takedata">车厢乘客数:{{takelist[3].num}}人</p>
|
||||
<p class = "takedata">车厢载客率:{{takelist[3].percent}}</p>
|
||||
</el-submenu>
|
||||
|
||||
<el-submenu index="6">
|
||||
<template slot="title">
|
||||
<span>车厢五</span>
|
||||
</template>
|
||||
<p class = "takedata">车厢乘客数:{{takelist[4].num}}人</p>
|
||||
<p class = "takedata">车厢载客率:{{takelist[4].percent}}</p>
|
||||
</el-submenu>
|
||||
|
||||
<el-submenu index="7">
|
||||
<template slot="title">
|
||||
<span>车厢六</span>
|
||||
</template>
|
||||
<p class = "takedata">车厢乘客数:{{takelist[5].num}}人</p>
|
||||
<p class = "takedata">车厢载客率:{{takelist[5].percent}}</p>
|
||||
</el-submenu>
|
||||
|
||||
</el-menu>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="menudown">
|
||||
<el-button-group>
|
||||
<el-button v-show="isCctv" type="primary" @click="back">退出</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import Vue from 'vue';
|
||||
import { Jl3dTrafficTrain } from '@/jlmap3d/jl3dtrafficplan/jl3dtraffictrain.js';
|
||||
import { ProjectIcon, loginInfo } from '@/scripts/ProjectConfig';
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||
export default {
|
||||
name: 'TrafficTrain',
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
isActive:0,
|
||||
localStatic:JL3D_LOCAL_STATIC,
|
||||
trunkAssetList:[
|
||||
'/trafficplan/trunkhead.png',
|
||||
'/trafficplan/trunkbody.png',
|
||||
'/trafficplan/trunkbody.png',
|
||||
'/trafficplan/trunkbody.png',
|
||||
'/trafficplan/trunkbody.png',
|
||||
'/trafficplan/trunkback.png'
|
||||
],
|
||||
jl3d: null,
|
||||
rendermode:'监控视角',
|
||||
renderswitch:false,
|
||||
takelimit:220,
|
||||
takelist:[
|
||||
{num:'',percent:''},{num:'',percent:''},{num:'',percent:''},{num:'',percent:''},{num:'',percent:''},{num:'',percent:''},
|
||||
],
|
||||
trainlist:[],
|
||||
value:'',
|
||||
isCctv:true,
|
||||
allPassers:890,
|
||||
loadingProjectList: ['login', 'design', 'xty', 'designxty', 'gzb', 'designxty', 'xadt', 'designxadt', 'drts', 'designdrts']
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
code() {
|
||||
return this.$route.query.code;
|
||||
},
|
||||
lineCode() {
|
||||
return this.$route.query.lineCode;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
},
|
||||
|
||||
created() {
|
||||
if (this.loadingProjectList.includes(this.$route.query.project)) {
|
||||
this.$store.dispatch('app/transitionAnimations');
|
||||
}
|
||||
document.querySelector("link[rel*='icon']").href = loginInfo[this.$route.query.project].linkIcon || ProjectIcon[this.$route.query.project];
|
||||
},
|
||||
mounted() {
|
||||
|
||||
this.init();
|
||||
this.takelist = this.getnum(this.allPassers,6);
|
||||
console.log(this.takelist);
|
||||
if (this.$route.query.type == 'CCTV') {
|
||||
this.isCctv = false;
|
||||
}
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
},
|
||||
methods: {
|
||||
init: function () {
|
||||
// let mapdata = this.$store.state.socket.device;
|
||||
const dom = document.getElementById('jl3d');
|
||||
this.jl3d = new Jl3dTrafficTrain(dom, this.$route.query.mapid, this.$route.query.group, 'normal');
|
||||
},
|
||||
assetSelect(index){
|
||||
console.log(index);
|
||||
this.isActive=index;
|
||||
this.jl3d.switchcamera(index+'');
|
||||
},
|
||||
|
||||
switchrender() {
|
||||
if (this.renderswitch == true) {
|
||||
this.rendermode = '退出监控';
|
||||
this.renderswitch = false;
|
||||
this.jl3d.switchviews('freeview');
|
||||
} else {
|
||||
this.rendermode = '监控视角';
|
||||
this.renderswitch = true;
|
||||
this.jl3d.switchviews('4views');
|
||||
}
|
||||
},
|
||||
updateTrainCode(codeData){
|
||||
this.jl3d.updateNowTrainCode(codeData);
|
||||
},
|
||||
updateTrainList(){
|
||||
this.trainlist = this.jl3d.getTrainList();
|
||||
// console.log(this.trainlist);
|
||||
},
|
||||
updateTrainCode(selVal) {
|
||||
// this.jl3d.changeTrain(selVal);
|
||||
this.isActive=0;
|
||||
this.jl3d.switchcamera(0+'');
|
||||
|
||||
this.jl3d.updateNowTrainCode(selVal);
|
||||
// let oldgroupnum = this.groupnum;
|
||||
// this.value = selVal;
|
||||
},
|
||||
getnum(num,pnum){
|
||||
let re = [];
|
||||
let base = Math.floor(num/pnum);
|
||||
let reset = num%pnum;
|
||||
for(let i=0;i<pnum;i++){
|
||||
let nownum = base+(i<reset?1:0);
|
||||
let newtraindata = {
|
||||
num:nownum,
|
||||
percent:parseInt(nownum/this.takelimit*100)+"%",
|
||||
}
|
||||
re.push(newtraindata);
|
||||
}
|
||||
return re;
|
||||
},
|
||||
back() {
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
/* #jl3d {
|
||||
width: 937px;
|
||||
height: 937px;
|
||||
} */
|
||||
.jl3dtrafficplan{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.jl3ddraw1{
|
||||
position: absolute;
|
||||
float: right;
|
||||
top:0%;
|
||||
/* left: 0; */
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 0;
|
||||
}
|
||||
.jl3ddraw {
|
||||
position: absolute;
|
||||
float: right;
|
||||
top:0%;
|
||||
/* left: 0; */
|
||||
width: 50%;
|
||||
height: 100%;
|
||||
z-index: 0;
|
||||
}
|
||||
.jlReal3d{
|
||||
position: absolute;
|
||||
top:0%;
|
||||
left: 50%;
|
||||
width: 50%;
|
||||
height: 100%;
|
||||
z-index: 0;
|
||||
font-size:0;
|
||||
}
|
||||
|
||||
.station{
|
||||
width:250px;
|
||||
height:100px;
|
||||
top:0;
|
||||
left:0;
|
||||
text-align: center;
|
||||
/* right:500px; */
|
||||
/* bottom:0; */
|
||||
position: absolute;
|
||||
background-size: 100% 100%;
|
||||
border-radius:10px;
|
||||
}
|
||||
|
||||
.trunklist{
|
||||
width:3%;
|
||||
height:70%;
|
||||
top:150px;
|
||||
left:1%;
|
||||
position: absolute;
|
||||
background-color: #ffffff;
|
||||
border-radius:10px;
|
||||
|
||||
}
|
||||
.trunk{
|
||||
width:95%;
|
||||
height:16.6%;
|
||||
top:0.2%;
|
||||
left:2.5%;
|
||||
position:relative;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
.active{
|
||||
border-style:solid;
|
||||
border-color: blue;
|
||||
}
|
||||
|
||||
.takedata{
|
||||
text-align: center;
|
||||
color: rgb(255, 255, 255);
|
||||
}
|
||||
|
||||
.listmenu{
|
||||
/* top:50%; */
|
||||
}
|
||||
.menutop{
|
||||
top:0;
|
||||
right:0;
|
||||
position:absolute;
|
||||
}
|
||||
.menudown{
|
||||
bottom:0;
|
||||
right:0;
|
||||
position:absolute;
|
||||
}
|
||||
.traindata{
|
||||
top:0;
|
||||
right:0;
|
||||
position: absolute;
|
||||
}
|
||||
.datatab{
|
||||
width:250px;
|
||||
}
|
||||
|
||||
</style>
|
@ -10,6 +10,8 @@
|
||||
<el-button v-if="jl3dnameShow && !isContest" size="small" @click="jumpjlmap3d">{{ jl3dname }}</el-button>
|
||||
<!-- cctv视图 -->
|
||||
<el-button v-if="cctvShow && !isContest" size="small" @click="jumpjl3dpassflow">{{ jl3dpassflow }}</el-button>
|
||||
<!-- 客流规划视图 -->
|
||||
<el-button v-if="trafficplanShow && !isContest" size="small" @click="jumpjl3dtrafficplan">{{ jl3dtrafficplan }}</el-button>
|
||||
<!-- 故障设备视图 -->
|
||||
<el-button v-if="jlmap3dFaultShow" size="small" @click="jumpjlmap3dFault">故障设备</el-button>
|
||||
<!-- 司机视角 -->
|
||||
@ -71,6 +73,14 @@ export default {
|
||||
type:Boolean,
|
||||
require:true
|
||||
},
|
||||
trafficplanShow:{
|
||||
type:Boolean,
|
||||
require:true
|
||||
},
|
||||
traffictrainShow:{
|
||||
type:Boolean,
|
||||
require:true
|
||||
},
|
||||
scheduleLoadShow:{
|
||||
type:Boolean,
|
||||
require:true
|
||||
@ -104,6 +114,8 @@ export default {
|
||||
practiceDisabled:false,
|
||||
deviceShow: false,
|
||||
drivingShow: false,
|
||||
jl3dtrafficplan:this.$t('display.demon.trafficplantext'),
|
||||
jl3dtraffictrain:this.$t('display.demon.traffictraintext'),
|
||||
jl3dpassflow:this.$t('display.demon.passengerflow'),
|
||||
jl3dname: this.$t('display.demon.threeDimensionalView'),
|
||||
jl3dmodel: this.$t('display.demon.deviceView')
|
||||
@ -178,6 +190,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',
|
||||
|
@ -37,9 +37,12 @@
|
||||
<el-button type="danger" size="small" @click="handleQuitQuest">退出场景</el-button>
|
||||
<el-button type="success" size="small" :disabled="!isScriptRun" @click="endTraining">结束</el-button>
|
||||
<el-button type="primary" size="small" :disabled="isScriptRun" @click="startTraining">开始</el-button>
|
||||
<el-button type="" size="small" @click="handleExplain">说明</el-button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<!-- 初始化 -->
|
||||
<el-button type="danger" size="small" @click="end">{{ $t('display.demon.initialize') }}</el-button>
|
||||
<!-- 按计划行车 -->
|
||||
<el-button type="success" :disabled="isDisable" size="small" @click="selectBeginTime">{{ $t('display.demon.drivingByPlan') }}</el-button>
|
||||
</template>
|
||||
</template>
|
||||
@ -177,7 +180,21 @@ export default {
|
||||
'02': '02', // 行调 => 行调
|
||||
'04': '02', // 司机 => 行调
|
||||
'05': '' // 派班 => null
|
||||
}
|
||||
},
|
||||
ossList: [
|
||||
{ name: '场景1', url: '场景1—桂花园道岔故障(配分版60分).pdf' },
|
||||
{ name: '场景2', url: '场景2—体育馆道岔故障(配分版60分).pdf' },
|
||||
{ name: '场景3', url: '场景3—火车站道岔故障(配分版60分).pdf' },
|
||||
{ name: '场景4', url: '场景4—列车救援(配分版60分).pdf' },
|
||||
{ name: '场景5', url: '场景5—接触网无电(配分版60分).pdf' },
|
||||
{ name: '场景6', url: '场景6—计轴故障试题(配分版60分).pdf' },
|
||||
{ name: '场景7', url: '场景7—大学城道岔故障(配分版40分).pdf' },
|
||||
{ name: '场景8', url: '场景8—车站照明故障(配分版40分).pdf' },
|
||||
{ name: '场景9', url: '场景9—车站站台门故障(配分版40分).pdf' },
|
||||
{ name: '场景10', url: '场景10—列车限速(配分版40分).pdf' },
|
||||
{ name: '场景11', url: '场景11—区间疏导乘客(配分版40分).pdf' },
|
||||
{ name: '场景12', url: '场景12—区域控制器故障(配分版40分).pdf' }
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -458,6 +475,12 @@ export default {
|
||||
(this.$store.state.training.memberData[role.id] || {}).disabled = true;
|
||||
this.runScriptMode(memberId);
|
||||
},
|
||||
handleExplain() {
|
||||
const name = this.$store.state.training.notifySelected.title;
|
||||
const ossData = this.ossList.find(ele => { return ele.name == name; });
|
||||
const href = `https://joylink.club/oss/cbtc/race/${ossData.url}`;
|
||||
window.open(href, '_blank');
|
||||
},
|
||||
finishTraining(data) {
|
||||
this.isScriptRun = false;
|
||||
this.showResultData(data);
|
||||
|
@ -1,19 +1,28 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog v-dialogDrag title="场景列表" :visible.sync="dialogVisible" width="900px" center>
|
||||
<el-dialog v-dialogDrag title="场景列表" :visible.sync="dialogVisible" width="1150px" center>
|
||||
<el-tabs v-model="activeName" type="card" style="height: 500px;">
|
||||
<el-tab-pane label="主场景列表" name="first">
|
||||
<el-table :data="mainSceneData" border :span-method="objectSpanMethod" style="overflow: auto;height: 440px;" stripe :cell-style="{padding: '8px 0'}">
|
||||
<el-table :data="mainSceneData" border :span-method="objectSpanMethod" style="overflow: auto;height: 436px;" stripe :cell-style="{padding: '8px 0'}">
|
||||
<el-table-column type="index" width="50" label="序号" />
|
||||
<el-table-column prop="type" width="200" label="类别" />
|
||||
<el-table-column prop="scene" width="350" label="场景" />
|
||||
<el-table-column label="操作">
|
||||
<el-table-column label="操作" width="240">
|
||||
<template slot-scope="scope">
|
||||
<div v-if="scope.row.result">
|
||||
<template v-for="(each,index) in scope.row.result">
|
||||
<el-tooltip :key="index" class="item" effect="dark" :content="'场景描述: '+ each.description + '\n' + '处置流程: ' +each.disposalProcesses" popper-class="tooltip-box" placement="top">
|
||||
<el-button type="primary" size="small" @click="handleLoad(each)">{{ each.name }}</el-button>
|
||||
</el-tooltip>
|
||||
<!-- <el-tooltip :key="index" class="item" effect="dark" :content="'场景描述: '+ each.description + '\n' + '处置流程: ' +each.disposalProcesses" popper-class="tooltip-box" placement="top"> -->
|
||||
<el-button :key="index" type="primary" size="small" @click="handleLoad(each)">{{ each.name }}</el-button>
|
||||
<!-- </el-tooltip> -->
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="说明" width="240">
|
||||
<template slot-scope="scope">
|
||||
<div v-if="scope.row.result">
|
||||
<template v-for="(each,index) in scope.row.result">
|
||||
<el-button :key="index" type="primary" size="small" @click="handleExplain(each)">{{ each.name }}</el-button>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
@ -76,6 +85,20 @@ export default {
|
||||
{ scene: '站台门关不上(单个或多个)' },
|
||||
{ scene: '客流激增行车处置' },
|
||||
{ scene: '路网协调请求(限流、换乘站通过)' }
|
||||
],
|
||||
ossList: [
|
||||
{ name: '场景1', url: '场景1—桂花园道岔故障(配分版60分).pdf' },
|
||||
{ name: '场景2', url: '场景2—体育馆道岔故障(配分版60分).pdf' },
|
||||
{ name: '场景3', url: '场景3—火车站道岔故障(配分版60分).pdf' },
|
||||
{ name: '场景4', url: '场景4—列车救援(配分版60分).pdf' },
|
||||
{ name: '场景5', url: '场景5—接触网无电(配分版60分).pdf' },
|
||||
{ name: '场景6', url: '场景6—计轴故障试题(配分版60分).pdf' },
|
||||
{ name: '场景7', url: '场景7—大学城道岔故障(配分版40分).pdf' },
|
||||
{ name: '场景8', url: '场景8—车站照明故障(配分版40分).pdf' },
|
||||
{ name: '场景9', url: '场景9—车站站台门故障(配分版40分).pdf' },
|
||||
{ name: '场景10', url: '场景10—列车限速(配分版40分).pdf' },
|
||||
{ name: '场景11', url: '场景11—区间疏导乘客(配分版40分).pdf' },
|
||||
{ name: '场景12', url: '场景12—区域控制器故障(配分版40分).pdf' }
|
||||
]
|
||||
};
|
||||
},
|
||||
@ -218,6 +241,11 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
async handleExplain(row) {
|
||||
const ossData = this.ossList.find(ele => { return ele.name == row.name; });
|
||||
const href = `https://joylink.club/oss/cbtc/race/${ossData.url}`;
|
||||
window.open(href, '_blank');
|
||||
},
|
||||
confirm(playerList) {
|
||||
// this.$store.dispatch('training/setScriptOperationType', this.operationType);
|
||||
// operationType:ScriptMode[this.operationType]
|
||||
|
@ -9,6 +9,7 @@
|
||||
<menu-exam v-if="isExam" ref="menuExam" :offset="offset" :data-error="dataError" :offset-bottom="offsetBottom" />
|
||||
<menu-script v-if="isScript" ref="menuScript" :offset-bottom="offsetBottom" :offset="offset" :text-status-height="textStatusHeight" :data-error="dataError" />
|
||||
<menu-dispather-contest v-if="isContest" ref="menuDispatherContest" :offset="offset" :offset-bottom="offsetBottom" :data-error="dataError" :text-status-height="textStatusHeight" />
|
||||
<menu-runplan v-if="isPlan" ref="menuPlan" />
|
||||
</template>
|
||||
<menu-train-list v-if="isDemon||isContest||isScript" @setCenter="setCenter" />
|
||||
<menu-system-time ref="menuSystemTime" :offset="offset" :group="group" />
|
||||
@ -26,6 +27,7 @@ import MenuDemon from './menuDemon';
|
||||
import MenuExam from './exam/index';
|
||||
import MenuScript from './scriptDisplay/scriptRecord/index';
|
||||
import MenuDispatherContest from './dispatherContest/index';
|
||||
import MenuRunplan from './menuRunplan';
|
||||
|
||||
import MenuTrainList from '@/views/newMap/displayNew/menuTrainList';
|
||||
import MenuSystemTime from '@/views/newMap/displayNew/menuSystemTime';
|
||||
@ -44,7 +46,8 @@ export default {
|
||||
MenuSystemTime,
|
||||
MenuTrainList,
|
||||
MenuDispatherContest,
|
||||
MenuScript
|
||||
MenuScript,
|
||||
MenuRunplan
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -82,6 +85,9 @@ export default {
|
||||
isScript() {
|
||||
return this.mode === 'script';
|
||||
},
|
||||
isPlan() {
|
||||
return this.mode === 'plan';
|
||||
},
|
||||
mapId() {
|
||||
return this.$route.query.mapId;
|
||||
},
|
||||
|
@ -14,6 +14,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"
|
||||
|
102
src/views/newMap/displayNew/menuRunplan.vue
Normal file
102
src/views/newMap/displayNew/menuRunplan.vue
Normal file
@ -0,0 +1,102 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="display-draft">
|
||||
<el-button-group>
|
||||
<el-button type="primary" size="small" @click="back">返回</el-button>
|
||||
<el-button type="danger" size="small" @click="end">{{ $t('display.demon.initialize') }}</el-button>
|
||||
<el-button type="success" :disabled="isDisable" size="small" @click="selectBeginTime">{{ $t('display.demon.drivingByPlan') }}</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
<set-time ref="setTime" @ConfirmSelectBeginTime="start" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import SetTime from './demon/setTime';
|
||||
import { Notification } from 'element-ui';
|
||||
import { ranAsPlan, exitRunPlan } from '@/api/simulation';
|
||||
export default {
|
||||
name:'MenuPlan',
|
||||
components: {
|
||||
SetTime
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
computed:{
|
||||
group() {
|
||||
return this.$route.query.group;
|
||||
},
|
||||
isDisable() {
|
||||
return this.$store.state.training.started;
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
back() {
|
||||
this.$store.dispatch('map/setShowCentralizedStationCode', '');
|
||||
history.go(-1);
|
||||
Notification.closeAll();
|
||||
},
|
||||
selectBeginTime() {
|
||||
this.$refs.setTime.doShow();
|
||||
},
|
||||
end() {
|
||||
exitRunPlan(this.group).then(() => {
|
||||
this.$store.dispatch('training/over').then(() => {
|
||||
this.$store.dispatch('training/setMapDefaultState').then(() => {
|
||||
this.$store.dispatch('map/resetActiveTrainList', false);
|
||||
this.$store.dispatch('map/clearJlmapTrainView');
|
||||
this.$store.dispatch('map/setTrainWindowShow', false);
|
||||
});
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('display.demon.endSimulationFail'));
|
||||
});
|
||||
},
|
||||
start(model) { // 开始仿真
|
||||
const data = {
|
||||
time: model.initTime
|
||||
};
|
||||
// if (this.$route.query.prdType === '04') {
|
||||
// data.loadNumber = model.loadNum;
|
||||
// }
|
||||
ranAsPlan(data, this.group).then(res => {
|
||||
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`));
|
||||
}).catch(error => {
|
||||
if (error.code == '5001') {
|
||||
this.$messageBox(this.$t('error.mapDataError') + ',' + this.$t('error.startSimulationFailed'));
|
||||
} else if (error.code == '5002') {
|
||||
this.$messageBox(this.$t('error.runningChartDataError') + ',' + this.$t('error.startSimulationFailed'));
|
||||
} else if (error.code == '5003') {
|
||||
this.$messageBox(this.$t('error.runningChartIsNotLoaded') + ',' + this.$t('error.startSimulationFailed'));
|
||||
} else if (error.code == '5004') {
|
||||
this.$messageBox(this.$t('error.runningDataError') + ',' + this.$t('error.startSimulationFailed'));
|
||||
} else if (error.code == '5000') {
|
||||
this.$messageBox(this.$t('error.systemError') + ',' + this.$t('error.startSimulationFailed'));
|
||||
} else if (error.code == '4000') {
|
||||
this.$messageBox(this.$t('error.simulationDoesNotExist') + ',' + this.$t('error.startSimulationFailed'));
|
||||
} else if (error.code == '4001') {
|
||||
this.$messageBox(this.$t('error.simulationOperationIsNotDefined') + ',' + this.$t('error.startSimulationFailed'));
|
||||
} else if (error.code == '4002') {
|
||||
this.$messageBox(this.$t('error.simulationOperationProcessingMethodNotFound') + ',' + this.$t('error.startSimulationFailed'));
|
||||
} else if (error.code == '4003') {
|
||||
this.$messageBox(this.$t('error.simulationOperationFailed') + ',' + this.$t('error.startSimulationFailed'));
|
||||
} else if (error.code == '4004') {
|
||||
this.$messageBox(this.$t('error.operationConflict') + ',' + this.$t('error.startSimulationFailed'));
|
||||
} else {
|
||||
this.$messageBox('按计划行车异常,请退出重试!');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.display-draft {
|
||||
position: absolute;
|
||||
float: right;
|
||||
right: 15px;
|
||||
bottom: 15px;
|
||||
}
|
||||
</style>
|
@ -462,7 +462,8 @@ export default {
|
||||
const query = {
|
||||
prdType: '01', group: resp.data, mapId: this.$route.query.mapId, planId: this.$route.query.planId
|
||||
};
|
||||
this.$router.push({ path: `${UrlConfig.display}/plan`, query: query });
|
||||
// this.$router.push({ path: `${UrlConfig.display}/plan`, query: query });
|
||||
this.$router.push({ path: `${UrlConfig.displayNew}/plan`, query: query });
|
||||
launchFullscreen();
|
||||
}).catch(error => {
|
||||
this.$messageBox(this.$t('tip.createSimulationFaild') + this.$t('global.colon') + error.message);
|
||||
|
@ -151,7 +151,8 @@ export default {
|
||||
const query = {
|
||||
prdType: '01', group: resp.data, mapId: this.$route.query.mapId, planId: this.$route.query.planId
|
||||
};
|
||||
this.$router.push({ path: `${UrlConfig.display}/plan`, query: query });
|
||||
// this.$router.push({ path: `${UrlConfig.display}/plan`, query: query });
|
||||
this.$router.push({ path: `${UrlConfig.displayNew}/plan`, query: query });
|
||||
launchFullscreen();
|
||||
} else {
|
||||
this.$messageBox(this.$t('error.checkTheValidityFirst'));
|
||||
|
@ -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); }}
|
||||
]
|
||||
},
|
||||
|
||||
|
@ -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'),
|
||||
|
@ -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'),
|
||||
|
@ -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'),
|
||||
|
@ -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) {
|
||||
|
@ -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');
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
BIN
static/trafficplan/man1.FBX
Normal file
BIN
static/trafficplan/man1.FBX
Normal file
Binary file not shown.
BIN
static/trafficplan/man2.FBX
Normal file
BIN
static/trafficplan/man2.FBX
Normal file
Binary file not shown.
BIN
static/trafficplan/station.FBX
Normal file
BIN
static/trafficplan/station.FBX
Normal file
Binary file not shown.
BIN
static/trafficplan/train.FBX
Normal file
BIN
static/trafficplan/train.FBX
Normal file
Binary file not shown.
BIN
static/trafficplan/trunkback.png
Normal file
BIN
static/trafficplan/trunkback.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 MiB |
BIN
static/trafficplan/trunkbody.png
Normal file
BIN
static/trafficplan/trunkbody.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 MiB |
BIN
static/trafficplan/trunkhead.png
Normal file
BIN
static/trafficplan/trunkhead.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 MiB |
41
static/workertest/trafficplan/trafficstation.js
Normal file
41
static/workertest/trafficplan/trafficstation.js
Normal file
@ -0,0 +1,41 @@
|
||||
var i=0;
|
||||
var update = null;
|
||||
function timedCount(){
|
||||
|
||||
onmessage = (e) => {
|
||||
|
||||
|
||||
if(e.data[0] == "on"){
|
||||
// console.log("on");
|
||||
update = "1";
|
||||
}
|
||||
|
||||
if(e.data[0] == "off"){
|
||||
clearInterval(update);
|
||||
}
|
||||
// console.log(e.data);
|
||||
if(e.data[0] == "changespeed"){
|
||||
if(update){
|
||||
console.log(e.data[1]);
|
||||
clearInterval(update);
|
||||
if(e.data[1] == 0){
|
||||
|
||||
}else{
|
||||
let speed = 900/e.data[1];
|
||||
console.log(speed);
|
||||
update = setInterval("stationupdate()", speed);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function stationupdate(){
|
||||
|
||||
postMessage("up");
|
||||
}
|
||||
|
||||
timedCount();
|
Loading…
Reference in New Issue
Block a user