Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/jl-client into test
This commit is contained in:
commit
b68424c3db
@ -236,3 +236,10 @@ export function getNewMapDataByMapId(mapId) {
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
/** 发布地图根据id生成子系统及权限 */
|
||||
export function generateAncillaryData(mapId) {
|
||||
return request({
|
||||
url: `/api/map/${mapId}/function/generate`,
|
||||
method: 'post'
|
||||
});
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -383,9 +383,16 @@ class SkinCode extends defaultStyle {
|
||||
};
|
||||
|
||||
this[deviceType.Station] = {
|
||||
// text: {
|
||||
// show: true // 公里标名称显示
|
||||
// },
|
||||
// 北京线车站元素 车站名称
|
||||
elemnetType:['stationText'],
|
||||
stationText:{
|
||||
z:0,
|
||||
fontWeight:'normal', // 字体粗细
|
||||
textPadding:[0, 0], // 字体边距
|
||||
borderColor:'', // 字体边框颜色
|
||||
textBorderWidth:0 // 字体边框宽度
|
||||
},
|
||||
|
||||
kmPostShow: true, // 公里标显示
|
||||
kilometerPosition: 'down', // 公里标位置
|
||||
fontWeight: 'bold', // 文字错细
|
||||
@ -688,7 +695,6 @@ class SkinCode extends defaultStyle {
|
||||
haveArrowText: true, // 是否需创建arrowText对象
|
||||
textOffset: 4, // 字体偏移(用以控制字体据车头的距离)
|
||||
trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸
|
||||
displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗
|
||||
trainTip:true // 鼠标悬停列车状态信息框是否显示
|
||||
},
|
||||
trainStatusStyle: {
|
||||
|
@ -335,9 +335,16 @@ class SkinCode extends defaultStyle {
|
||||
}
|
||||
};
|
||||
this[deviceType.Station] = {
|
||||
// text: {
|
||||
// show: true // 公里标名称显示
|
||||
// },
|
||||
// 成都一号线车站元素 车站名称
|
||||
elemnetType:['stationText'],
|
||||
stationText:{
|
||||
z:0,
|
||||
fontWeight:'normal', // 字体粗细
|
||||
textPadding:[0, 0], // 字体边距
|
||||
borderColor:'', // 字体边框颜色
|
||||
textBorderWidth:0 // 字体边框宽度
|
||||
},
|
||||
|
||||
kmPostShow: false, // 公里标显示
|
||||
kilometerPosition: 'up', // 公里标朝向
|
||||
text: {
|
||||
@ -612,7 +619,6 @@ class SkinCode extends defaultStyle {
|
||||
haveArrowText: true, // 是否需创建arrowText对象
|
||||
textOffset: 4, // 字体偏移(用以控制字体据车头的距离)
|
||||
trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸
|
||||
displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗
|
||||
trainTip:true // 鼠标悬停列车状态信息框是否显示
|
||||
},
|
||||
trainStatusStyle: {
|
||||
|
@ -332,9 +332,16 @@ class SkinCode extends defaultStyle {
|
||||
};
|
||||
|
||||
this[deviceType.Station] = {
|
||||
// text: {
|
||||
// show: true // 公里标名称显示
|
||||
// },
|
||||
// 成都三号线车站元素 车站名称
|
||||
elemnetType:['stationText'],
|
||||
stationText:{
|
||||
z:0,
|
||||
fontWeight:'normal', // 字体粗细
|
||||
textPadding:[0, 0], // 字体边距
|
||||
borderColor:'', // 字体边框颜色
|
||||
textBorderWidth:0 // 字体边框宽度
|
||||
},
|
||||
|
||||
kmPostShow: false, // 公里标显示
|
||||
kilometerPosition: 'up', // 公里标朝向
|
||||
text: {
|
||||
@ -798,7 +805,6 @@ class SkinCode extends defaultStyle {
|
||||
haveArrowText: true, // 是否需创建arrowText对象
|
||||
textOffset: 4, // 字体偏移(用以控制字体据车头的距离)
|
||||
trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸
|
||||
displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗
|
||||
trainTip:true // 鼠标悬停列车状态信息框是否显示
|
||||
},
|
||||
trainStatusStyle: {
|
||||
|
@ -342,9 +342,16 @@ class SkinCode extends defaultStyle {
|
||||
}
|
||||
};
|
||||
this[deviceType.Station] = {
|
||||
// text: {
|
||||
// show: true // 公里标名称显示
|
||||
// },
|
||||
// 佛山有轨电车 车站元素 车站名称
|
||||
elemnetType:['stationText'],
|
||||
stationText:{
|
||||
z:0,
|
||||
fontWeight:'normal', // 字体粗细
|
||||
textPadding:[0, 0], // 字体边距
|
||||
borderColor:'', // 字体边框颜色
|
||||
textBorderWidth:0 // 字体边框宽度
|
||||
},
|
||||
|
||||
kmPostShow: true, // 公里标显示
|
||||
kilometerPosition: 'up', // 公里标朝向
|
||||
text: {
|
||||
@ -649,7 +656,6 @@ class SkinCode extends defaultStyle {
|
||||
haveArrowText: true, // 是否需创建arrowText对象
|
||||
textOffset: 1, // 字体偏移(用以控制字体据车头的距离)
|
||||
trainWidthMoreText: 2, // 计算列车长度时--列车长比text多出尺寸
|
||||
displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗
|
||||
trainTip:true // 鼠标悬停列车状态信息框是否显示
|
||||
},
|
||||
trainStatusStyle: {
|
||||
|
@ -338,9 +338,16 @@ class SkinCode extends defaultStyle {
|
||||
}
|
||||
};
|
||||
this[deviceType.Station] = {
|
||||
// text: {
|
||||
// show: true // 公里标名称显示
|
||||
// },
|
||||
// 福州一号线 车站元素 车站名称
|
||||
elemnetType:['stationText'],
|
||||
stationText:{
|
||||
z:0,
|
||||
fontWeight:'normal', // 字体粗细
|
||||
textPadding:[0, 0], // 字体边距
|
||||
borderColor:'', // 字体边框颜色
|
||||
textBorderWidth:0 // 字体边框宽度
|
||||
},
|
||||
|
||||
kmPostShow: true, // 公里标显示
|
||||
kilometerPosition: 'up', // 公里标朝向
|
||||
text: {
|
||||
@ -648,7 +655,6 @@ class SkinCode extends defaultStyle {
|
||||
haveArrowText: true, // 是否需创建arrowText对象
|
||||
textOffset: 1, // 字体偏移(用以控制字体据车头的距离)
|
||||
trainWidthMoreText: 2, // 计算列车长度时--列车长比text多出尺寸
|
||||
displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗
|
||||
trainTip:true // 鼠标悬停列车状态信息框是否显示
|
||||
},
|
||||
trainStatusStyle: {
|
||||
|
@ -374,9 +374,16 @@ class SkinCode extends defaultStyle {
|
||||
}
|
||||
};
|
||||
this[deviceType.Station] = {
|
||||
// text: {
|
||||
// show: true // 公里标名称显示
|
||||
// },
|
||||
// 哈尔滨一号线 车站元素 车站名称
|
||||
elemnetType:['stationText'],
|
||||
stationText:{
|
||||
z:0,
|
||||
fontWeight:'normal', // 字体粗细
|
||||
textPadding:[2, 6], // 字体边距
|
||||
borderColor:'', // 字体边框颜色
|
||||
textBorderWidth:1 // 字体边框宽度
|
||||
},
|
||||
|
||||
kmPostShow: true, // 公里标显示
|
||||
kilometerPosition: 'up', // 公里标朝向
|
||||
text: {
|
||||
@ -722,7 +729,6 @@ class SkinCode extends defaultStyle {
|
||||
haveArrowText: true, // 是否需创建arrowText对象
|
||||
textOffset: 1, // 字体偏移(用以控制字体据车头的距离)
|
||||
trainWidthMoreText: 2, // 计算列车长度时--列车长比text多出尺寸
|
||||
displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗,
|
||||
trainTip:true // 鼠标悬停列车状态信息框是否显示
|
||||
},
|
||||
trainStatusStyle: {
|
||||
|
@ -192,9 +192,16 @@ class SkinCode extends defaultStyle {
|
||||
};
|
||||
|
||||
this[deviceType.Station] = {
|
||||
// text: {
|
||||
// show: true // 公里标名称显示
|
||||
// },
|
||||
// 宁波一号线 车站元素 车站名称
|
||||
elemnetType:['stationText'],
|
||||
stationText:{
|
||||
z:0,
|
||||
fontWeight:'normal', // 字体粗细
|
||||
textPadding:[0, 0], // 字体边距
|
||||
borderColor:'', // 字体边框颜色
|
||||
textBorderWidth:0 // 字体边框宽度
|
||||
},
|
||||
|
||||
kmPostShow: false, // 公里标显示
|
||||
kilometerPosition: 'up', // 公里标朝向
|
||||
text: {
|
||||
@ -681,7 +688,6 @@ class SkinCode extends defaultStyle {
|
||||
textOffset: 4, // 字体偏移(用以控制字体据车头的距离)
|
||||
trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸
|
||||
trainHeadColorChangeMode: 1, // 1:driveMode + runlevel
|
||||
displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗
|
||||
trainTip:false // 鼠标悬停列车状态信息框是否显示
|
||||
},
|
||||
mouseOverStyle:{
|
||||
|
@ -231,9 +231,16 @@ class SkinCode extends defaultStyle {
|
||||
};
|
||||
|
||||
this[deviceType.Station] = {
|
||||
// text: {
|
||||
// show: true // 公里标名称显示
|
||||
// },
|
||||
// 宁波三号线 车站元素 车站名称
|
||||
elemnetType:['stationText'],
|
||||
stationText:{
|
||||
z:0,
|
||||
fontWeight:'normal', // 字体粗细
|
||||
textPadding:[0, 0], // 字体边距
|
||||
borderColor:'', // 字体边框颜色
|
||||
textBorderWidth:0 // 字体边框宽度
|
||||
},
|
||||
|
||||
kmPostShow: false, // 公里标显示
|
||||
kilometerPosition: 'up', // 公里标朝向
|
||||
text: {
|
||||
@ -741,7 +748,6 @@ class SkinCode extends defaultStyle {
|
||||
textOffset: 4, // 字体偏移(用以控制字体据车头的距离)
|
||||
trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸
|
||||
trainHeadColorChangeMode: 1, // 1:driveMode + runlevel
|
||||
displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗
|
||||
trainTip:false // 鼠标悬停列车状态信息框是否显示
|
||||
},
|
||||
mouseOverStyle:{
|
||||
|
@ -413,9 +413,16 @@ class SkinCode extends defaultStyle {
|
||||
};
|
||||
|
||||
this[deviceType.Station] = {
|
||||
// text: {
|
||||
// show: true // 公里标名称显示
|
||||
// },
|
||||
// 竞赛线路 车站元素 车站名称
|
||||
elemnetType:['stationText'],
|
||||
stationText:{
|
||||
z:0,
|
||||
fontWeight:'normal', // 字体粗细
|
||||
textPadding:[0, 0], // 字体边距
|
||||
borderColor:'', // 字体边框颜色
|
||||
textBorderWidth:0 // 字体边框宽度
|
||||
},
|
||||
|
||||
kmPostShow: true, // 公里标显示
|
||||
kilometerPosition: 'down', // 公里标位置
|
||||
fontWeight: 'bold', // 文字错细
|
||||
@ -722,7 +729,6 @@ class SkinCode extends defaultStyle {
|
||||
haveArrowText: true, // 是否需创建arrowText对象
|
||||
textOffset: 4, // 字体偏移(用以控制字体据车头的距离)
|
||||
trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸
|
||||
displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗
|
||||
trainTip:true // 鼠标悬停列车状态信息框是否显示
|
||||
},
|
||||
trainStatusStyle: {
|
||||
|
@ -355,9 +355,16 @@ class SkinCode extends defaultStyle {
|
||||
}
|
||||
};
|
||||
this[deviceType.Station] = {
|
||||
// text: {
|
||||
// show: true // 公里标名称显示
|
||||
// },
|
||||
// 西安一号线 车站元素 车站名称
|
||||
elemnetType:['stationText'],
|
||||
stationText:{
|
||||
z:0,
|
||||
fontWeight:'normal', // 字体粗细
|
||||
textPadding:[0, 0], // 字体边距
|
||||
borderColor:'', // 字体边框颜色
|
||||
textBorderWidth:0 // 字体边框宽度
|
||||
},
|
||||
|
||||
kmPostShow: true, // 公里标显示
|
||||
kilometerPosition: 'up', // 公里标朝向
|
||||
text: {
|
||||
@ -713,7 +720,6 @@ class SkinCode extends defaultStyle {
|
||||
haveArrowText: true, // 是否需创建arrowText对象
|
||||
textOffset: 1, // 字体偏移(用以控制字体据车头的距离)
|
||||
trainWidthMoreText: 2, // 计算列车长度时--列车长比text多出尺寸
|
||||
displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗
|
||||
trainTip:true // 鼠标悬停列车状态信息框是否显示
|
||||
},
|
||||
trainStatusStyle: {
|
||||
|
@ -382,9 +382,16 @@ class SkinCode extends defaultStyle {
|
||||
}
|
||||
};
|
||||
this[deviceType.Station] = {
|
||||
// text: {
|
||||
// show: true // 公里标名称显示
|
||||
// },
|
||||
// 西安二号线 车站元素 车站名称
|
||||
elemnetType:['stationText'],
|
||||
stationText:{
|
||||
z:0,
|
||||
fontWeight:'normal', // 字体粗细
|
||||
textPadding:[0, 0], // 字体边距
|
||||
borderColor:'', // 字体边框颜色
|
||||
textBorderWidth:0 // 字体边框宽度
|
||||
},
|
||||
|
||||
kmPostShow: false, // 公里标显示
|
||||
kilometerPosition: 'up', // 公里标朝向
|
||||
text: {
|
||||
@ -793,7 +800,6 @@ class SkinCode extends defaultStyle {
|
||||
haveArrowText: true, // 是否需创建arrowText对象
|
||||
textOffset: 4, // 字体偏移(用以控制字体据车头的距离)
|
||||
trainWidthMoreText: 8, // 计算列车长度时--列车长比text多出尺寸
|
||||
displayPosition: 'margin', // 非同通信车在物理区段(有逻辑区段)上显示的位置 margin:行驶方向边缘车次窗 center: 中间位置车次窗
|
||||
trainTip:true // 鼠标悬停列车状态信息框是否显示
|
||||
},
|
||||
trainStatusStyle: {
|
||||
|
@ -87,41 +87,40 @@ class Painter {
|
||||
}
|
||||
}
|
||||
|
||||
checkIntersect(device) {
|
||||
var intersect = false;
|
||||
var befor = device.instance;
|
||||
var train = shapefactory(device, this.$jmap);
|
||||
|
||||
checkTrainOverlap(device) { // 检查重叠列车
|
||||
const trainWindowCode = device.trainWindowCode;
|
||||
const overlapTrainList = [device.code];
|
||||
this.mapInstanceLevel[deviceType.Train].eachChild(elem => {
|
||||
if (elem !== befor && elem.getBoundingRect().intersect(train.getBoundingRect())) {
|
||||
intersect = true;
|
||||
return;
|
||||
if (elem.model.code !== device.code && elem.model.trainWindowCode === trainWindowCode) {
|
||||
overlapTrainList.push(elem.model.code);
|
||||
}
|
||||
});
|
||||
if (overlapTrainList.length > 1) {
|
||||
this.sortOverLapTrain(overlapTrainList);
|
||||
}
|
||||
return overlapTrainList;
|
||||
}
|
||||
sortOverLapTrain(overlapTrainList) { // 对重叠列车按照区段上的位置进行排序
|
||||
overlapTrainList.sort((a, b) => {
|
||||
const trainA = this.$jmap.getDeviceByCode(a);
|
||||
const trainB = this.$jmap.getDeviceByCode(b);
|
||||
if (trainA.right) {
|
||||
return trainA.offsetp - trainB.offsetp;
|
||||
} else {
|
||||
return trainB.offsetp - trainA.offsetp;
|
||||
}
|
||||
});
|
||||
|
||||
return intersect;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新列车
|
||||
* @param {*} device
|
||||
*/
|
||||
updateTrain(device) {
|
||||
var oldTrainWindowModel = null;
|
||||
var instance = device.instance;
|
||||
var curModel = device;
|
||||
let displayPosition = 'margin';
|
||||
if (instance) {
|
||||
oldTrainWindowModel = device.trainWindowModel;
|
||||
displayPosition = instance.style.Train.common.displayPosition;
|
||||
}
|
||||
const curModel = device;
|
||||
if (curModel.sectionCode) {
|
||||
curModel.sectionModel = this.$jmap.getDeviceByCode(curModel.sectionCode);
|
||||
if (curModel.sectionModel.trainWindowCode) {
|
||||
curModel.trainWindowCode = curModel.sectionModel.trainWindowCode;
|
||||
} else if (displayPosition === 'center' && curModel.sectionModel.logicSectionCodeList && curModel.sectionModel.logicSectionCodeList.length) {
|
||||
const sec = this.$jmap.getDeviceByCode(curModel.sectionModel.logicSectionCodeList[Math.floor(curModel.sectionModel.logicSectionCodeList.length / 2)]);
|
||||
curModel.trainWindowCode = sec.trainWindowCode;
|
||||
} else if (curModel.right && curModel.sectionModel.logicSectionCodeList && curModel.sectionModel.logicSectionCodeList.length) {
|
||||
const sec = this.$jmap.getDeviceByCode(curModel.sectionModel.logicSectionCodeList[curModel.sectionModel.logicSectionCodeList.length - 1]);
|
||||
curModel.trainWindowCode = sec.trainWindowCode;
|
||||
@ -134,13 +133,13 @@ class Painter {
|
||||
if (curModel.trainWindowCode) {
|
||||
curModel.trainWindowModel = this.$jmap.getDeviceByCode(curModel.trainWindowCode);
|
||||
}
|
||||
|
||||
if (instance && oldTrainWindowModel && this.checkIntersect(device)) {
|
||||
device.trainWindowModel = oldTrainWindowModel;
|
||||
}
|
||||
|
||||
instance && this.mapInstanceLevel[deviceType.Train].remove(instance);
|
||||
this.add(device);
|
||||
const overlapTrainList = this.checkTrainOverlap(device);
|
||||
overlapTrainList.forEach((item, index) => {
|
||||
const trainDevice = this.$jmap.getDeviceByCode(item);
|
||||
trainDevice.overLapIndex = index;
|
||||
trainDevice.instance && this.mapInstanceLevel[deviceType.Train].remove(trainDevice.instance);
|
||||
this.add(trainDevice);
|
||||
});
|
||||
|
||||
if (this.screenFlag) {
|
||||
this.$transformHandleScreen.transformView(device.instance);
|
||||
@ -233,7 +232,6 @@ class Painter {
|
||||
y: transPoint[1]
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
67
src/jmapNew/shape/Station/EStationText.js
Normal file
67
src/jmapNew/shape/Station/EStationText.js
Normal file
@ -0,0 +1,67 @@
|
||||
import Group from 'zrender/src/container/Group';
|
||||
import Text from 'zrender/src/graphic/Text';
|
||||
|
||||
class EStationText extends Group {
|
||||
constructor(model) {
|
||||
super();
|
||||
this.model = model;
|
||||
this.create();
|
||||
}
|
||||
|
||||
create() {
|
||||
const model = this.model.modelData;
|
||||
const style = this.model.style;
|
||||
|
||||
// 车站名称
|
||||
this.stationName = new Text({
|
||||
zlevel: this.model.zlevel,
|
||||
z: this.model.z,
|
||||
silent: !model.visible || false,
|
||||
style: {
|
||||
x: model.position.x,
|
||||
y: model.position.y,
|
||||
fontWeight: style.Station.stationText.fontWeight,
|
||||
fontSize: isNaN(Number(model.nameFont)) ? 20 : Number(model.nameFont),
|
||||
fontFamily: style.fontFamily,
|
||||
text: model.number ? model.number + model.name : model.name,
|
||||
textAlign: 'middle',
|
||||
textFill: model.nameFontColor,
|
||||
textVerticalAlign: 'top',
|
||||
textPadding:style.Station.stationText.textPadding,
|
||||
textBorderColor:style.Station.stationText.borderColor || model.nameFontColor,
|
||||
textBorderWidth:style.Station.stationText.textBorderWidth
|
||||
}
|
||||
});
|
||||
this.add(this.stationName);
|
||||
if (model.subheadDisplay) { // 副标题
|
||||
this.subheadText = new Text({
|
||||
zlevel: this.model.zlevel,
|
||||
z: this.model.z,
|
||||
silent: !model.visible || false,
|
||||
style: {
|
||||
x: model.subheadPosition.x,
|
||||
y: model.subheadPosition.y,
|
||||
fontWeight: model.fontWeight,
|
||||
fontSize: model.subheadFont || 18,
|
||||
fontFamily: style.fontFamily,
|
||||
text: model.subhead,
|
||||
textAlign: 'middle',
|
||||
textVerticalAlign: 'top',
|
||||
textFill: model.subheadFontColor,
|
||||
textPadding:style.Station.stationText.textPadding,
|
||||
textBorderColor:style.Station.stationText.borderColor || model.nameFontColor,
|
||||
textBorderWidth:style.Station.stationText.textBorderWidth
|
||||
}
|
||||
});
|
||||
this.add(this.subheadText);
|
||||
}
|
||||
}
|
||||
|
||||
recover() {
|
||||
}
|
||||
|
||||
setState() {
|
||||
}
|
||||
}
|
||||
|
||||
export default EStationText;
|
@ -11,6 +11,10 @@ import { arrow } from '../utils/ShapePoints';
|
||||
import Rect from 'zrender/src/graphic/shape/Rect';
|
||||
import Text from 'zrender/src/graphic/Text';
|
||||
import store from '@/store/index_APP_TARGET';
|
||||
|
||||
import EStationText from './EStationText';
|
||||
import {traverseLineElements, traverseStatusElements} from '../utils/ShapeStatusCovert';
|
||||
|
||||
import Vue from 'vue';
|
||||
|
||||
export default class Station extends Group {
|
||||
@ -28,37 +32,21 @@ export default class Station extends Group {
|
||||
this.createControlMode();
|
||||
this.setState(model);
|
||||
this.checkIsDrawMap();
|
||||
this.setVisible(model.visible);
|
||||
}
|
||||
|
||||
create() {
|
||||
const model = this.model;
|
||||
const style = this.style;
|
||||
|
||||
// 公里标名称是否显示
|
||||
this.stationText = new ETextName({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
x: model.position.x,
|
||||
y: model.position.y,
|
||||
fontWeight: style.Station.text.fontWeight,
|
||||
fontSize: isNaN(Number(model.nameFont)) ? 20 : Number(model.nameFont),
|
||||
fontFamily: style.fontFamily,
|
||||
silent: !model.visible,
|
||||
text: model.number ? model.number + model.name : model.name,
|
||||
textAlign: 'middle',
|
||||
textVerticalAlign: 'top',
|
||||
textFill: model.nameFontColor
|
||||
});
|
||||
this.add(this.stationText);
|
||||
if (style.Station.text.borderShow) { // 哈尔滨线路单独显示
|
||||
this.stationText.attr({
|
||||
style: {
|
||||
textPadding: style.Station.text.textPadding || [2, 6],
|
||||
textBorderColor: style.Station.text.borderColor || model.nameFontColor,
|
||||
textBorderWidth: style.Station.text.textBorderWidth || 1
|
||||
}
|
||||
});
|
||||
}
|
||||
// // 站台所有的绘图元素
|
||||
const elementTypeList = {
|
||||
'stationText':EStationText // 车站名称 (普通站台样式)
|
||||
};
|
||||
|
||||
// 遍历当前线路下的绘图元素 组合模式
|
||||
traverseLineElements(style.Station, elementTypeList, model, style, this);
|
||||
|
||||
const path = window.location.href;
|
||||
if (style.Station.kmPostShow || path.includes('/map/draw')) { // 公里标是否显示
|
||||
let direction = 1;
|
||||
@ -88,37 +76,13 @@ export default class Station extends Group {
|
||||
this.add(this.mileageText);
|
||||
model.kmPostShow ? this.mileageText.show() : this.mileageText.hide();
|
||||
}
|
||||
if (model.subheadDisplay) { // 副标题
|
||||
this.subheadText = new ETextName({
|
||||
zlevel: this.zlevel,
|
||||
z: this.z,
|
||||
x: model.subheadPosition.x,
|
||||
y: model.subheadPosition.y,
|
||||
fontWeight: model.fontWeight,
|
||||
fontSize: model.subheadFont || 18,
|
||||
fontFamily: style.fontFamily,
|
||||
text: model.subhead,
|
||||
silent: !model.visible,
|
||||
textAlign: 'middle',
|
||||
textVerticalAlign: 'top',
|
||||
textFill: model.subheadFontColor
|
||||
});
|
||||
this.add(this.subheadText);
|
||||
if (style.Station.text.borderShow) {
|
||||
this.subheadText.attr({
|
||||
style: {
|
||||
textPadding: [2, 6],
|
||||
textBorderColor: model.nameFontColor,
|
||||
textBorderWidth: 1
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (!model.visible) { // 隐藏车站
|
||||
this.subheadText && this.subheadText.setStyle('textFill', 'rgba(0,0,0,0)');
|
||||
this.mileageText && this.mileageText.setStyle('textFill', 'rgba(0,0,0,0)');
|
||||
this.stationText && this.stationText.setStyle('textFill', 'rgba(0,0,0,0)');
|
||||
}
|
||||
|
||||
// if (!model.visible) { // 隐藏车站
|
||||
// // this.subheadText && this.subheadText.setStyle('textFill', 'rgba(0,0,0,0)');
|
||||
// // this.mileageText && this.mileageText.setStyle('textFill', 'rgba(0,0,0,0)');
|
||||
// // this.stationText && this.stationText.setStyle('textFill', 'rgba(0,0,0,0)');
|
||||
// this.eachChild(elem => { elem.hide(); });
|
||||
// }
|
||||
}
|
||||
createTurnBack() { // 创建按图折返
|
||||
const model = this.model;
|
||||
@ -406,6 +370,13 @@ export default class Station extends Group {
|
||||
}
|
||||
}
|
||||
|
||||
// /** 恢复初始状态*/
|
||||
// recover() {
|
||||
// const currentTypeList = this.style.Station.elemnetType;
|
||||
// currentTypeList.forEach(element => {
|
||||
// this[element].recover();
|
||||
// });
|
||||
// }
|
||||
recover() {
|
||||
this.emergencyControl && this.emergencyControl.setColor(this.style.Station.StationControl.lamp.grayColor);
|
||||
this.emergencyControl && this.emergencyControl.setTextColor(this.style.Station.StationControl.text.fontColor);
|
||||
@ -433,6 +404,18 @@ export default class Station extends Group {
|
||||
}
|
||||
}
|
||||
|
||||
// setState(model) {
|
||||
// if (!this.isShowShape) return;
|
||||
// // // 新版地图使用新版状态变更方式
|
||||
// this.recover();
|
||||
|
||||
// // 更新状态
|
||||
// const currentTypeList = this.style.Station.elemnetType;
|
||||
// currentTypeList.forEach(element => {
|
||||
// this[element].setState(model);
|
||||
// });
|
||||
// }
|
||||
|
||||
getShapeTipPoint(opts) {
|
||||
let rect;
|
||||
if (opts.subDeviceType === 'button') {
|
||||
@ -448,13 +431,14 @@ export default class Station extends Group {
|
||||
|
||||
getBoundingRect() {
|
||||
const rect = this.stationText.getBoundingRect().clone();
|
||||
if (this.model.subheadDisplay) {
|
||||
const subheadText = this.subheadText.getBoundingRect().clone();
|
||||
rect.union(subheadText);
|
||||
return rect;
|
||||
} else {
|
||||
return rect;
|
||||
}
|
||||
// if (this.model.subheadDisplay) {
|
||||
// const subheadText = this.subheadText.getBoundingRect().clone();
|
||||
// rect.union(subheadText);
|
||||
// return rect;
|
||||
// } else {
|
||||
// return rect;
|
||||
// }
|
||||
return rect;
|
||||
}
|
||||
|
||||
drawSelected(selected) {
|
||||
@ -489,4 +473,12 @@ export default class Station extends Group {
|
||||
this.isShowShape = false;
|
||||
}
|
||||
}
|
||||
|
||||
setVisible(visible) {
|
||||
if (visible) {
|
||||
this.eachChild(elem => { elem.show(); });
|
||||
} else {
|
||||
this.eachChild(elem => { elem.hide(); });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ class StationStand extends Group {
|
||||
// 加载皮肤控制的元素
|
||||
const model = this.model;
|
||||
const style = this.style;
|
||||
|
||||
// // 站台所有的绘图元素
|
||||
const elementTypeList = {
|
||||
'solidStand':ESolidStand, // 矩形实心站台 (普通站台样式)
|
||||
|
@ -46,10 +46,10 @@ export default class Train extends Group {
|
||||
};
|
||||
if (model.right) {
|
||||
this.point.x = this.point.x - style.Train.trainHead.trainConntWidth * this.newScale - style.Train.common.trainWidth / 2;
|
||||
this.point.y = this.point.y - style.Train.common.trainHeight / 2;
|
||||
this.point.y = this.point.y - style.Train.common.trainHeight / 2 + model.overLapIndex * (style.Train.common.trainHeight + 5);
|
||||
} else {
|
||||
this.point.x = this.point.x + style.Train.trainHead.trainConntWidth * this.newScale - style.Train.common.trainWidth / 2;
|
||||
this.point.y = this.point.y + model.trainWindowModel.height - style.Train.common.trainHeight / 2;
|
||||
this.point.y = this.point.y + model.trainWindowModel.height - style.Train.common.trainHeight / 2 - model.overLapIndex * (style.Train.common.trainHeight + 5);
|
||||
}
|
||||
} else {
|
||||
this.point = model.position;
|
||||
|
@ -16,6 +16,8 @@ const Jlmap3dAssetManager = () => import('@/views/jlmap3d/jl3dassetmanager/asset
|
||||
const Jlmap3d = () => import('@/views/jlmap3d/drive/jl3ddrive');
|
||||
const Jlmap3dSandbox = () => import('@/views/jlmap3d/simulation/jl3dsimulation');
|
||||
const Jlmap3dPassFlow = () => import('@/views/jlmap3d/passflow/jl3dpassflow');
|
||||
const Jlmap3dTrafficPlan = () => import('@/views/jlmap3d/trafficplan/jl3dtrafficplan');
|
||||
const Jlmap3dTrafficTrain = () => import('@/views/jlmap3d/trafficplan/jl3dtraffictrain');
|
||||
const Jlmap3dModel = () => import('@/views/jlmap3d/device/jl3ddevice');
|
||||
const Jlmap3dMaintainer = () => import('@/views/jlmap3d/maintainer/jl3dmaintainer');
|
||||
const Jlmap3dMaintainerVr = () => import('@/views/jlmap3d/maintainer/jl3dmaintainervr');
|
||||
@ -89,6 +91,7 @@ const DesignPlatform = () => import('@/views/designPlatform/index');
|
||||
const MapPreviewNew = () => import('@/views/designPlatform/mapPreviewNew');
|
||||
const BigScreen = () => import('@/views/designPlatform/bigScreen');
|
||||
const BigSplitScreen = () => import('@/views/designPlatform/bigSplitScreen');
|
||||
const TestRunplan = () => import('@/views/designPlatform/testRunplan');
|
||||
|
||||
const Package = () => import('@/views/package/index');
|
||||
|
||||
@ -205,12 +208,12 @@ export const constantRoutes = [
|
||||
path: '/design/jlmap3d/assetmanager',
|
||||
component: Jlmap3dAssetManager,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/data2json',
|
||||
component: () => import('@/views/planMonitor/data2json/page.vue'),
|
||||
hidden: true
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/data2json',
|
||||
component: () => import('@/views/planMonitor/data2json/page.vue'),
|
||||
hidden: true
|
||||
},
|
||||
{ // 线信息
|
||||
path: '/AUSline',
|
||||
component: PlanMonitorEditAUSLine,
|
||||
@ -231,6 +234,16 @@ export const constantRoutes = [
|
||||
component: Jlmap3dPassFlow,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/jlmap3d/trafficplan',
|
||||
component: Jlmap3dTrafficPlan,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/jlmap3d/traffictrain',
|
||||
component: Jlmap3dTrafficTrain,
|
||||
hidden: true
|
||||
},
|
||||
|
||||
{
|
||||
path: '/jlmap3d/devicemodel',
|
||||
@ -379,6 +392,12 @@ export const publicAsyncRoute = [
|
||||
path: '/planSchedule/window',
|
||||
component: PlanScheduleWicket,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
// 运行图测试(仿真,仅有按计划行车和初始化操作)
|
||||
path: '/design/runPlan/testRunplan',
|
||||
component: TestRunplan,
|
||||
hidden: true
|
||||
}
|
||||
];
|
||||
// 城市轨道项目
|
||||
|
@ -46,6 +46,7 @@ const LessonHome = () => import('@/views/lesson/home');
|
||||
const LessonDetail = () => import('@/views/lesson/details');
|
||||
const BigScreen = () => import('@/views/designPlatform/bigScreen');
|
||||
const BigSplitScreen = () => import('@/views/designPlatform/bigSplitScreen');
|
||||
const TestRunplan = () => import('@/views/designPlatform/testRunplan');
|
||||
|
||||
const ScriptmanageHome = () => import('@/views/scriptManage/home');
|
||||
|
||||
@ -273,6 +274,12 @@ export const publicAsyncRoute = [
|
||||
path: '/device/result/:userExamId',
|
||||
component: ExamResult,
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
// 运行图测试(仿真,仅有按计划行车和初始化操作)
|
||||
path: '/design/runPlan/testRunplan',
|
||||
component: TestRunplan,
|
||||
hidden: true
|
||||
}
|
||||
];
|
||||
export const asyncRouter = [
|
||||
|
@ -2277,6 +2277,7 @@ export const UrlConfig = {
|
||||
lessonTraining: '/design/lesson/training',
|
||||
trainingRecord: '/design/lesson/training',
|
||||
runPlan: '/design/runPlan/detail',
|
||||
testRunPlan: '/design/runPlan/testRunplan',
|
||||
scriptHome: '/design/script/home',
|
||||
display: '/design/display',
|
||||
displayNew: '/design/displayNew',
|
||||
|
@ -2,7 +2,6 @@ import store from '@/store/index_APP_TARGET';
|
||||
|
||||
const exam = {
|
||||
namespaced: true,
|
||||
|
||||
state: {
|
||||
deviceCode: '', // 考试目标code
|
||||
started: false, // 考试状态
|
||||
|
@ -4,9 +4,9 @@ export function getBaseUrl() {
|
||||
// BASE_API = 'https://joylink.club/jlcloud';
|
||||
BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
// BASE_API = 'http://192.168.8.107:9000'; // 袁琪
|
||||
// BASE_API = 'http://192.168.8.114:9000'; // 旭强
|
||||
// BASE_API = 'http://192.168.8.129:9000'; // 旭强
|
||||
// BASE_API = 'http://192.168.8.109:9000'; // 张赛
|
||||
// BASE_API = 'http://192.168.8.110:9008'; // 杜康
|
||||
// BASE_API = 'http://192.168.8.110:9000'; // 杜康
|
||||
// BASE_API = 'http://b29z135112.zicp.vip';
|
||||
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
|
||||
// BASE_API = 'http://2i38984j47.qicp.vip'; // 张赛
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="600px" :before-close="handleClose" center>
|
||||
<div>
|
||||
<el-alert :title="$t('permission.distributeTips')" type="warning" show-icon :closable="closable" style="margin-bottom:10px" />
|
||||
<el-alert :title="$t('permission.distributeTips')" type="warning" show-icon :closable="closable" style="margin-bottom:10px;" />
|
||||
<el-form ref="distributeForm" :rules="rules" :model="formModel">
|
||||
<el-form-item key="date" prop="date" :label="this.$t('global.selectionTime')" :required="false" label-width="140px">
|
||||
<el-date-picker
|
||||
@ -53,9 +53,8 @@
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<!-- :label="$t('global.permissionList')" -->
|
||||
<el-form-item :prop="'permissionList.' + scope.$index + '.chooseNumber'" :required="false" :rules="rules.chooseNumber">
|
||||
<el-input-number v-model="scope.row.chooseNumber" size="mini" :max="scope.row.remains" :min="0" />
|
||||
<el-input-number v-model="scope.row.chooseNumber" size="mini" :max="scope.row.remains - 1" :min="0" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
@ -5,7 +5,7 @@
|
||||
border
|
||||
:summary-method="getSummaries"
|
||||
show-summary
|
||||
style="width: 100%; margin-top: 20px"
|
||||
style="width: 100%; margin-top: 20px;"
|
||||
>
|
||||
<el-table-column prop="index" :label="`${$t('global.index')}`" />
|
||||
<el-table-column prop="startTime" :label="`${$t('permission.startTime')}`" />
|
||||
|
197
src/views/designPlatform/testRunplan.vue
Normal file
197
src/views/designPlatform/testRunplan.vue
Normal file
@ -0,0 +1,197 @@
|
||||
<template>
|
||||
<div class="map-view" :style="{width: canvasWidth+'px',height:'100%',position:'absolute',overflow:'hidden'}">
|
||||
<div v-show="maskOpen" class="mask" :style="{'width': maskWidth}" />
|
||||
<jlmap-visual ref="jlmapVisual" />
|
||||
<div class="display-draft">
|
||||
<el-button-group>
|
||||
<el-button type="success" :disabled="isDisable" size="small" @click="selectBeginTime">{{ $t('display.demon.drivingByPlan') }}</el-button>
|
||||
<el-button type="danger" size="small" @click="end">{{ $t('display.demon.initialize') }}</el-button>
|
||||
<el-button type="small" @click="back">{{ $t('scriptRecord.scriptBack') }}</el-button>
|
||||
</el-button-group>
|
||||
</div>
|
||||
<set-time ref="setTime" @ConfirmSelectBeginTime="start" />
|
||||
<menu-system-time ref="menuSystemTime" :offset="15" :group="group" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import SetTime from '@/views/newMap/displayNew/demon/setTime';
|
||||
import JlmapVisual from '@/views/newMap/jlmapNew/index';
|
||||
import { Notification } from 'element-ui';
|
||||
import { loadNewMapDataByGroup } from '@/utils/loaddata';
|
||||
import { ranAsPlan, exitRunPlan, clearSimulation, getSimulationInfoNew } from '@/api/simulation';
|
||||
import { creatSubscribe, clearSubscribe, displayTopic} from '@/utils/stomp';
|
||||
import MenuSystemTime from '@/views/newMap/displayNew/menuSystemTime';
|
||||
import { getToken } from '@/utils/auth';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { timeFormat } from '@/utils/date';
|
||||
export default {
|
||||
name:'TestRunplan',
|
||||
components: {
|
||||
SetTime,
|
||||
JlmapVisual,
|
||||
MenuSystemTime
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
maskOpen: false,
|
||||
maskWidth: '100%'
|
||||
};
|
||||
},
|
||||
computed:{
|
||||
...mapGetters([
|
||||
'canvasWidth'
|
||||
]),
|
||||
group() {
|
||||
return this.$route.query.group;
|
||||
},
|
||||
isDisable() {
|
||||
return this.$store.state.training.started;
|
||||
},
|
||||
width() {
|
||||
return this.$store.state.app.width;
|
||||
},
|
||||
height() {
|
||||
return this.$store.state.app.height;
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
'$store.state.map.mapViewLoadedCount':function() {
|
||||
this.$store.dispatch('map/setTrainWindowShow', false);
|
||||
this.$jlmap.off('zoom');
|
||||
if (this.group) {
|
||||
this.subscribe();
|
||||
}
|
||||
},
|
||||
'$store.state.app.windowSizeCount': function() { // 窗口缩放
|
||||
this.setWindowSize();
|
||||
},
|
||||
'$store.state.socket.equipmentStatus': function (val) {
|
||||
if (val.length && this.$route.query.group) {
|
||||
this.statusMessage(val);
|
||||
}
|
||||
},
|
||||
'$store.state.socket.simulationStart': function(val) {
|
||||
this.$store.dispatch('training/simulationStart').then(() => {
|
||||
this.$store.dispatch('map/setShowCentralizedStationNum');
|
||||
});
|
||||
}
|
||||
},
|
||||
async beforeDestroy() {
|
||||
await this.$store.dispatch('map/mapClear');
|
||||
},
|
||||
async mounted() {
|
||||
this.setWindowSize();
|
||||
await this.initLoadData();
|
||||
},
|
||||
methods:{
|
||||
async initLoadData() { // 加载地图数据
|
||||
if (this.group) {
|
||||
this.loadSimulationInfo();
|
||||
await loadNewMapDataByGroup(this.group);
|
||||
}
|
||||
},
|
||||
// 缩放设置
|
||||
setWindowSize() {
|
||||
const width = this.width;
|
||||
const height = this.height;
|
||||
this.$store.dispatch('config/resize', { width, height });
|
||||
},
|
||||
async back() {
|
||||
if (this.group) {
|
||||
await clearSimulation(this.group);
|
||||
this.clearSubscribe();
|
||||
}
|
||||
this.$store.dispatch('map/setShowCentralizedStationCode', '');
|
||||
history.go(-1);
|
||||
Notification.closeAll();
|
||||
},
|
||||
selectBeginTime() {
|
||||
this.$refs.setTime.doShow();
|
||||
},
|
||||
async statusMessage(list) {
|
||||
await this.$store.dispatch('training/updateMapState', list);
|
||||
await this.$store.dispatch('socket/setEquipmentStatus');
|
||||
},
|
||||
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'));
|
||||
});
|
||||
},
|
||||
async subscribe() {
|
||||
this.clearSubscribe();
|
||||
const header = { group: this.group || '', 'X-Token': getToken() };
|
||||
creatSubscribe(`${displayTopic}\/${this.$route.query.group}`, header);
|
||||
|
||||
await this.$store.dispatch('training/setHasSubscribed');
|
||||
},
|
||||
clearSubscribe() {
|
||||
clearSubscribe(`${displayTopic}\/${this.group}`);
|
||||
},
|
||||
async loadSimulationInfo() {
|
||||
const resp = await getSimulationInfoNew(this.group);
|
||||
if (resp && resp.code == 200 && resp.data) {
|
||||
if (!resp.data.dataError) {
|
||||
this.$store.dispatch('scriptRecord/updateSimulationPause', resp.data.pause); // 是否暂停判断
|
||||
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${timeFormat(resp.data.systemTime)}`));
|
||||
this.$store.dispatch('training/countTime');
|
||||
this.planRunning = resp.data.planRunning;
|
||||
if (resp.data.planRunning) {
|
||||
this.$store.commit('training/start');
|
||||
}
|
||||
} else {
|
||||
this.$messageBox('此地图数据正在维护中,无法运行!');
|
||||
}
|
||||
this.dataError = resp.data.dataError;
|
||||
}
|
||||
},
|
||||
start(model) { // 开始仿真
|
||||
const data = {
|
||||
time: model.initTime
|
||||
};
|
||||
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>
|
@ -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>
|
@ -554,14 +554,14 @@ export default {
|
||||
}
|
||||
});
|
||||
});
|
||||
} else if (this.project === 'drts') {
|
||||
} else if (this.project === 'drts' || this.project === 'bjd') {
|
||||
getLoginInfo(getToken()).then(res => {
|
||||
getSimulationInfoNew(res.data.group).then(resp => {
|
||||
this.$store.dispatch('app/transitionAnimations');
|
||||
this.$router.push({ path: `/displayNew/demon`, query: {
|
||||
lineCode: resp.data.map.lineCode,
|
||||
group: res.data.group,
|
||||
prdType: '02',
|
||||
prdType: resp.data.prodType,
|
||||
mapId: resp.data.map.id,
|
||||
goodsId:'',
|
||||
try:'0',
|
||||
@ -571,20 +571,20 @@ export default {
|
||||
launchFullscreen();
|
||||
});
|
||||
});
|
||||
} else if (this.project === 'bjd') {
|
||||
getLoginInfo(getToken()).then(res => {
|
||||
getSimulationInfoNew(res.data.group).then(resp => {
|
||||
this.$store.dispatch('app/transitionAnimations');
|
||||
this.$router.push({ path: `/jointTrainingNew`, query: {
|
||||
lineCode: resp.data.map.lineCode,
|
||||
group: res.data.group,
|
||||
mapId: resp.data.map.id,
|
||||
project:this.project
|
||||
}});
|
||||
this.loading = false;
|
||||
launchFullscreen();
|
||||
});
|
||||
});
|
||||
// } else if (this.project === 'bjd') {
|
||||
// getLoginInfo(getToken()).then(res => {
|
||||
// getSimulationInfoNew(res.data.group).then(resp => {
|
||||
// this.$store.dispatch('app/transitionAnimations');
|
||||
// this.$router.push({ path: `/jointTrainingNew`, query: {
|
||||
// lineCode: resp.data.map.lineCode,
|
||||
// group: res.data.group,
|
||||
// mapId: resp.data.map.id,
|
||||
// project:this.project
|
||||
// }});
|
||||
// this.loading = false;
|
||||
// launchFullscreen();
|
||||
// });
|
||||
// });
|
||||
} else if (!this.$route.path.includes('jsxt/login') && !this.$route.path.includes('refereeJsxt/login')) {
|
||||
this.$router.push({ path: this.path });
|
||||
} else {
|
||||
|
@ -5,11 +5,13 @@
|
||||
<el-button-group ref="button_group_box" class="button_group_box" :style="`margin-left:-${btnWidth}px`">
|
||||
<!-- 地图错误判断 -->
|
||||
<!-- 设备视图 -->
|
||||
<el-button v-if="jl3dmodelShow && !isContest" size="small" @click="jumpjlmap3dmodel">{{ jl3dmodel }}</el-button>
|
||||
<el-button v-if="jl3dmodelShow && !isContest && project !== 'bjd'" size="small" @click="jumpjlmap3dmodel">{{ jl3dmodel }}</el-button>
|
||||
<!-- 三维视图/数字沙盘 -->
|
||||
<el-button v-if="jl3dnameShow && !isContest" size="small" @click="jumpjlmap3d">{{ jl3dname }}</el-button>
|
||||
<el-button v-if="jl3dnameShow && !isContest && project !== 'bjd'" 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 && project !== 'bjd'" size="small" @click="jumpjl3dtrafficplan">{{ jl3dtrafficplan }}</el-button>
|
||||
<!-- 故障设备视图 -->
|
||||
<el-button v-if="jlmap3dFaultShow" size="small" @click="jumpjlmap3dFault">故障设备</el-button>
|
||||
<!-- 司机视角 -->
|
||||
@ -22,6 +24,11 @@
|
||||
<!-- <el-button v-if="isContest" size="small" @click=" fieldExam">实操测验</el-button> -->
|
||||
<el-button v-if="isContest" size="small" @click="goTheoryQuiz">理论考试</el-button>
|
||||
<el-button v-if="isContest" size="small" @click="viewChangeMap">切换地图</el-button>
|
||||
<template v-if="project === 'bjd'">
|
||||
<el-button v-if="running" size="small" @click="viewRunPlan">{{ $t('joinTraining.runGraphPreview') }}</el-button>
|
||||
<el-button v-if="!running" size="small" type="warning" @click="loadRunPlan">{{ $t('joinTraining.runGraphLoading') }}</el-button><!-- 运行图加载 -->
|
||||
<el-button size="small" @click="distribute">权限分发</el-button>
|
||||
</template>
|
||||
</el-button-group>
|
||||
</div>
|
||||
<Jl3d-Device
|
||||
@ -30,10 +37,12 @@
|
||||
:panel-show="deviceShow"
|
||||
@closedevice3dview="jumpjlmap3dmodel"
|
||||
/>
|
||||
<distribute-draft ref="distribute" @QrCodeShow="QrCodeShow" />
|
||||
<Jl3d-Drive v-show="drivingShow" ref="Jl3dDrive" :panel-show="drivingShow" @showdriving="showdriving" />
|
||||
<scheduling v-if="scheduleLoadShow" ref="scheduling" :group="group" />
|
||||
<scheduling-view v-if="schedulePreviewShow" ref="schedulingView" :group="group" />
|
||||
<change-map v-if="isContest" ref="changeMap" @changeMap="changeMap" />
|
||||
<qr-code ref="qrCode" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@ -45,6 +54,8 @@ import { getSessionStorage } from '@/utils/auth';
|
||||
import Scheduling from '@/views/newMap/displayNew/demon/scheduling';
|
||||
import SchedulingView from '@/views/newMap/displayNew/demon/schedulingView';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
import DistributeDraft from '@/views/components/limits/distribute';
|
||||
import QrCode from '@/components/QrCode';
|
||||
export default {
|
||||
name:'DemonMenu',
|
||||
components:{
|
||||
@ -52,7 +63,9 @@ export default {
|
||||
Jl3dDrive,
|
||||
Scheduling,
|
||||
SchedulingView,
|
||||
ChangeMap
|
||||
ChangeMap,
|
||||
DistributeDraft,
|
||||
QrCode
|
||||
},
|
||||
props:{
|
||||
isAllShow:{
|
||||
@ -71,6 +84,14 @@ export default {
|
||||
type:Boolean,
|
||||
require:true
|
||||
},
|
||||
trafficplanShow:{
|
||||
type:Boolean,
|
||||
require:true
|
||||
},
|
||||
traffictrainShow:{
|
||||
type:Boolean,
|
||||
require:true
|
||||
},
|
||||
scheduleLoadShow:{
|
||||
type:Boolean,
|
||||
require:true
|
||||
@ -104,6 +125,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')
|
||||
@ -118,6 +141,9 @@ export default {
|
||||
},
|
||||
isContest() {
|
||||
return this.$route.params.mode === 'demon' && this.project == 'drts';
|
||||
},
|
||||
running() {
|
||||
return this.$store.state.training.started;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -178,6 +204,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',
|
||||
@ -217,16 +256,36 @@ export default {
|
||||
},
|
||||
fieldPractice() {
|
||||
this.$emit('fieldPractice');
|
||||
// 'practice'
|
||||
},
|
||||
// fieldTeach() {
|
||||
// this.$emit('fieldPractice', 'teach');
|
||||
// },
|
||||
// fieldExam() {
|
||||
// this.$emit('fieldPractice', 'exam');
|
||||
// },
|
||||
viewRunPlan() {
|
||||
const routeData = this.$router.resolve({
|
||||
path:'/planSchedule/window',
|
||||
query:{
|
||||
mapId:this.$route.query.mapId,
|
||||
group:this.$route.query.group,
|
||||
lineCode: this.$route.query.lineCode,
|
||||
project: this.$route.query.project,
|
||||
noPreLogout: true,
|
||||
initTime: this.$store.state.training.initTime
|
||||
}
|
||||
});
|
||||
window.open(routeData.href, '_blank', 'noopener noreferrer');
|
||||
},
|
||||
loadRunPlan() {
|
||||
this.$emit('runPlanLoadShow');
|
||||
},
|
||||
goTheoryQuiz() {
|
||||
this.$emit('goTheoryQuiz');
|
||||
},
|
||||
QrCodeShow(data) {
|
||||
if (this.$refs && data) {
|
||||
this.$refs.qrCode.doShow(data);
|
||||
}
|
||||
},
|
||||
distribute() {
|
||||
if (this.$refs) {
|
||||
this.$refs.distribute.doShow({PermissionType:'03', mapId: this.$route.query.mapId, prdType: this.$route.query.prdType});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -9,7 +9,6 @@
|
||||
<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" />
|
||||
@ -27,7 +26,6 @@ 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';
|
||||
@ -46,8 +44,7 @@ export default {
|
||||
MenuSystemTime,
|
||||
MenuTrainList,
|
||||
MenuDispatherContest,
|
||||
MenuScript,
|
||||
MenuRunplan
|
||||
MenuScript
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -14,16 +14,18 @@
|
||||
: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"
|
||||
:driver-show="isDrive"
|
||||
:all-style="'top:'+(offset+textStatusHeight)+'px'"
|
||||
@runPlanLoadShow="runPlanLoadShow"
|
||||
/>
|
||||
|
||||
<div class="display-draft" :class="{'haerbin_btn_box': $route.query.lineCode == '07'}" :style="{bottom: offsetBottom + 'px'}">
|
||||
<el-button-group class="button-group-box">
|
||||
<el-button type="primary" size="small" @click="back">{{ projectDevice?'退出':$t('display.demon.back') }}</el-button>
|
||||
<el-button type="primary" size="small" @click="back">{{ projectDevice||project==='bjd'?'退出':$t('display.demon.back') }}</el-button>
|
||||
<template v-if="!dataError">
|
||||
<template v-if="isScriptRun">
|
||||
<el-button type="danger" size="small" @click="handleQuitQuest">退出剧本</el-button>
|
||||
@ -66,6 +68,7 @@ import { setGoodsTryUse } from '@/api/management/goods';
|
||||
import {loadScriptNew } from '@/api/simulation';
|
||||
import StatusIcon from '@/views/components/StatusIcon/statusIcon';
|
||||
import Vue from 'vue';
|
||||
import { getSessionStorage } from '@/utils/auth';
|
||||
import { EventBus } from '@/scripts/event-bus';
|
||||
|
||||
export default {
|
||||
@ -145,6 +148,9 @@ export default {
|
||||
},
|
||||
isDisable() {
|
||||
return this.$store.state.training.started;
|
||||
},
|
||||
project() {
|
||||
return getSessionStorage('project');
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -399,6 +405,9 @@ export default {
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
runPlanLoadShow() {
|
||||
this.$refs.menuSchema.loadRunPlan();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1,102 +0,0 @@
|
||||
<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>
|
@ -2,7 +2,7 @@
|
||||
<div>
|
||||
<div class="schema" :style="{top: offset+'px'}">
|
||||
<select-station v-if="isLocalStation && !isScript" ref="selectStation" :style-css="'width: 100px;'" />
|
||||
<template v-if="!dataError">
|
||||
<template v-if="!dataError&& project !== 'bjd'">
|
||||
<el-button-group>
|
||||
<el-button v-if="isScheduling && isDepot" size="small" type="primary" @click="runPlanEditShow">运行图编辑</el-button>
|
||||
<!-- 加载剧本 -->
|
||||
|
@ -7,22 +7,18 @@
|
||||
<div class="btn_hover" @click="menuClick">菜单</div>
|
||||
<el-button-group ref="button_group_box" class="button_group_box" :style="`margin-left:-${btnWidth}px`">
|
||||
<!-- 设备视图 -->
|
||||
<el-button v-if="(isShow3dmodel && isShowScheduling)&&project !== 'bjd'" size="small" @click="jumpjlmap3dmodel">{{ $t('display.demon.deviceView') }}</el-button>
|
||||
<el-button v-if="isShow3dmodel && isShowScheduling" size="small" @click="jumpjlmap3dmodel">{{ $t('display.demon.deviceView') }}</el-button>
|
||||
<!-- 三维视图 / 司机视角 -->
|
||||
<el-button v-if="(isShowScheduling || isDriver)&&project !== 'bjd'" size="small" @click="jumpjlmap3d">{{ jl3dname }}</el-button>
|
||||
<el-button v-if="isShowScheduling || isDriver" size="small" @click="jumpjlmap3d">{{ jl3dname }}</el-button>
|
||||
<!-- cctv视图 -->
|
||||
<el-button v-if="isShowScheduling || isStationSupervisor" size="small" @click="jumpjl3dpassflow">{{ $t('display.demon.passengerflow') }}</el-button>
|
||||
<el-button v-if="(isShowScheduling || isStationSupervisor)&&project !== 'bjd'" size="small" @click="jumpjl3dfaultdevice">{{ $t('display.demon.maintainer') }}</el-button>
|
||||
<el-button v-if="isShowScheduling || isStationSupervisor" size="small" @click="jumpjl3dfaultdevice">{{ $t('display.demon.maintainer') }}</el-button>
|
||||
<!-- <el-button v-if="isAdmin" size="small" @click="otherVrView">VR第三人称视角</el-button> -->
|
||||
<el-button v-if="qrCodeShow" type="primary" size="small" @click="generateQrCode">生成二维码</el-button>
|
||||
<el-button v-if="memberManageShow" size="small" @click="memberManage">成员管理</el-button>
|
||||
<el-button v-if="deviceManageShow" size="small" @click="handleEquipment">设备管理</el-button>
|
||||
<el-button v-if="teachSystemShow" size="small" @click="handleTeach">教学系统</el-button>
|
||||
<el-button v-if="examSystemShow" size="small" @click="handleExam">考试系统</el-button>
|
||||
<template v-if="project === 'bjd'">
|
||||
<el-button v-if="running" size="small" @click="viewRunPlan">{{ $t('joinTraining.runGraphPreview') }}</el-button>
|
||||
<el-button v-if="!running" size="small" type="warning" @click="loadRunPlan">{{ $t('joinTraining.runGraphLoading') }}</el-button><!-- 运行图加载 -->
|
||||
</template>
|
||||
</el-button-group>
|
||||
</div>
|
||||
<div class="display-draft" :class="{'display-type-hb': lineCode == '07' && $store.state.training.prdType=='01', 'haerbin_btn_box': lineCode == '07'}" :style="{bottom: offsetBottom + 'px'}">
|
||||
@ -171,19 +167,16 @@ export default {
|
||||
return typeList.includes(this.$route.query.type);
|
||||
},
|
||||
memberManageShow() {
|
||||
return this.isAdmin && this.$route.query.type !== 'ILW' && this.project !== 'bjd';
|
||||
return this.isAdmin && this.$route.query.type !== 'ILW';
|
||||
},
|
||||
deviceManageShow() {
|
||||
return (this.isAdmin && this.isProject && this.project !== 'bjd') || this.$route.query.type === 'ILW';
|
||||
return (this.isAdmin && this.isProject) || this.$route.query.type === 'ILW';
|
||||
},
|
||||
qrCodeShow() {
|
||||
return this.isAdmin && !this.noSimulationQrCodeList.includes(this.project) && this.$route.query.type !== 'ILW';
|
||||
},
|
||||
isDisable() {
|
||||
return this.$store.state.training.started;
|
||||
},
|
||||
running() {
|
||||
return this.$store.state.training.started;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -358,7 +351,7 @@ export default {
|
||||
this.$store.dispatch('training/over').then(() => {
|
||||
this.backLoading = true;
|
||||
this.$store.dispatch('map/resetActiveTrainList', true);
|
||||
if (this.$route.query.projectDevice || this.$route.query.project === 'bjd') {
|
||||
if (this.$route.query.projectDevice) {
|
||||
this.$store.dispatch('LogOut').then(() => {
|
||||
location.reload();
|
||||
});
|
||||
@ -516,23 +509,6 @@ export default {
|
||||
this.$message.error('获取课程ID失败!');
|
||||
});
|
||||
}
|
||||
},
|
||||
loadRunPlan() {
|
||||
this.$emit('runPlanLoadShow');
|
||||
},
|
||||
viewRunPlan() {
|
||||
const routeData = this.$router.resolve({
|
||||
path:'/planSchedule/window',
|
||||
query:{
|
||||
mapId:this.$route.query.mapId,
|
||||
group:this.$route.query.group,
|
||||
lineCode: this.$route.query.lineCode,
|
||||
project: this.$route.query.project,
|
||||
noPreLogout: true,
|
||||
initTime: this.$store.state.training.initTime
|
||||
}
|
||||
});
|
||||
window.open(routeData.href, '_blank', 'noopener noreferrer');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div style="height:100%">
|
||||
<div v-if="project !== 'bjd'" class="schema" :style="{top: offset+'px'}">
|
||||
<div class="schema" :style="{top: offset+'px'}">
|
||||
<el-select v-if="showSelectStation" v-model="chiShowStation" style="width: 100px;" size="small" @change="switchStationMode">
|
||||
<el-option v-for="item in stationList" :key="item.value" :label="item.name" :value="item.value" />
|
||||
</el-select>
|
||||
@ -107,14 +107,11 @@ export default {
|
||||
isScreen() {
|
||||
return this.$store.state.training.prdType === '07';
|
||||
},
|
||||
// isCenter() {
|
||||
// return this.$store.state.training.prdType === '02';
|
||||
// },
|
||||
isShowDirective() { // 哈尔滨项目 行调设备显示
|
||||
return this.$route.query.type == 'CW' && getSessionStorage('project') == 'heb';
|
||||
},
|
||||
project() {
|
||||
return getSessionStorage('project');
|
||||
},
|
||||
isShowDirective() { // 哈尔滨项目 行调设备显示
|
||||
return this.$route.query.type == 'CW' && this.project == 'heb';
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -192,22 +189,7 @@ export default {
|
||||
this.$emit('runPlanLoadShow');
|
||||
},
|
||||
viewRunPlan() {
|
||||
if (this.$route.query.project === 'bjd') {
|
||||
const routeData = this.$router.resolve({
|
||||
path:'/planSchedule/window',
|
||||
query:{
|
||||
mapId:this.$route.query.mapId,
|
||||
group:this.$route.query.group,
|
||||
lineCode: this.$route.query.lineCode,
|
||||
project: this.$route.query.project,
|
||||
noPreLogout: true,
|
||||
initTime: this.$store.state.training.initTime
|
||||
}
|
||||
});
|
||||
window.open(routeData.href, '_blank', 'noopener noreferrer');
|
||||
} else {
|
||||
this.$refs.runPlanView.doShow();
|
||||
}
|
||||
this.$refs.runPlanView.doShow();
|
||||
},
|
||||
// 选择车站
|
||||
switchStationMode(stationCode) {
|
||||
|
@ -463,7 +463,7 @@ export default {
|
||||
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.displayNew}/plan`, query: query });
|
||||
this.$router.push({ path: UrlConfig.design.testRunPlan, query: query });
|
||||
launchFullscreen();
|
||||
}).catch(error => {
|
||||
this.$messageBox(this.$t('tip.createSimulationFaild') + this.$t('global.colon') + error.message);
|
||||
|
@ -152,7 +152,7 @@ export default {
|
||||
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.displayNew}/plan`, query: query });
|
||||
this.$router.push({ path: UrlConfig.design.testRunPlan, query: query });
|
||||
launchFullscreen();
|
||||
} else {
|
||||
this.$messageBox(this.$t('error.checkTheValidityFirst'));
|
||||
|
@ -11,7 +11,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getPublishMapList, delPublishMap, putMapOnLine, putMapOffLine, simulationCheck, localImportMap, updatePublishMapInfo, getPublishMapExport, getPublishMapImportNew } from '@/api/jmap/map';
|
||||
import { getPublishMapList, delPublishMap, putMapOnLine, putMapOffLine, simulationCheck, localImportMap, updatePublishMapInfo, getPublishMapExport, getPublishMapImportNew, generateAncillaryData } from '@/api/jmap/map';
|
||||
import { getLineCodeList } from '@/api/management/mapline';
|
||||
import localStore from 'storejs';
|
||||
import UpdateOperate from './draft.vue';
|
||||
@ -136,6 +136,10 @@ export default {
|
||||
name: this.$t('publish.simulationDataCheck'),
|
||||
handleClick: this.handleSimulationCheck
|
||||
},
|
||||
{
|
||||
name: '生成子系统及权限',
|
||||
handleClick: this.handleGenerateAncillaryData
|
||||
},
|
||||
{
|
||||
name: '导入',
|
||||
handleClick: this.handleImportMap,
|
||||
@ -389,6 +393,19 @@ export default {
|
||||
obj.value = '';
|
||||
};
|
||||
});
|
||||
},
|
||||
handleGenerateAncillaryData(index, row) {
|
||||
this.$confirm('是否生成子系统及权限?', this.$t('global.tips'), {
|
||||
confirmButtonText: this.$t('global.confirm'),
|
||||
cancelButtonText: this.$t('global.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
generateAncillaryData(row.id).then(response => {
|
||||
this.$message.success('生成子系统及权限成功!');
|
||||
}).catch(() => {
|
||||
this.$messageBox('生成子系统及权限失败!');
|
||||
});
|
||||
}).catch(() => { });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -11,13 +11,12 @@
|
||||
</template>
|
||||
<script>
|
||||
import ConstConfig from '@/scripts/ConstConfig';
|
||||
import {createMapSubSystem, updateSubSystem, generateMapSystem} from '@/api/trainingPlatform';
|
||||
import { ProjectList} from '@/scripts/ProjectConfig';
|
||||
import Cookies from 'js-cookie';
|
||||
export default {
|
||||
name: 'CreateSubSystem',
|
||||
props: {
|
||||
title: { type:String, required:true },
|
||||
operateType:{ type:String, required:true },
|
||||
mapList:{
|
||||
required:true,
|
||||
type:Array
|
||||
@ -29,6 +28,9 @@ export default {
|
||||
disabled:null,
|
||||
productList:[],
|
||||
typeList:[],
|
||||
title:'',
|
||||
isAdd:true,
|
||||
isGernerate:false,
|
||||
formModel:{
|
||||
customized:'',
|
||||
mapId:'',
|
||||
@ -48,7 +50,8 @@ export default {
|
||||
},
|
||||
form() {
|
||||
let form = {};
|
||||
if (this.operateType == 'add') {
|
||||
if (this.isAdd) {
|
||||
// 新增
|
||||
form = {
|
||||
labelWidth: '150px',
|
||||
items: [
|
||||
@ -59,7 +62,16 @@ export default {
|
||||
{ prop: 'type', label: this.$t('systemGenerate.type'), type: 'select', required: true, options: this.typeList}
|
||||
]
|
||||
};
|
||||
} else if (this.isGernerate) {
|
||||
// 一键生成
|
||||
form = {
|
||||
labelWidth: '150px',
|
||||
items: [
|
||||
{ prop: 'mapId', label: this.$t('systemGenerate.mapName'), type: 'select', required: true, options: this.mapList}
|
||||
]
|
||||
};
|
||||
} else {
|
||||
// 修改
|
||||
form = {
|
||||
labelWidth: '150px',
|
||||
items: [
|
||||
@ -71,32 +83,23 @@ export default {
|
||||
},
|
||||
rules() {
|
||||
let crules = {};
|
||||
if (this.operateType == 'add') {
|
||||
crules = {customized:[
|
||||
{ required: true, message: this.$t('systemGenerate.selectProject'), trigger: 'change'}
|
||||
],
|
||||
mapId:[
|
||||
{ required: true, message: this.$t('systemGenerate.selectMap'), trigger: 'change'}
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: this.$t('systemGenerate.inputName'), trigger: 'blur' },
|
||||
{ required: true, message: this.$t('systemGenerate.inputName'), trigger: 'change' }
|
||||
],
|
||||
type:[
|
||||
{ required: true, message: this.$t('systemGenerate.selectType'), trigger: 'change'}
|
||||
],
|
||||
prdType:[
|
||||
{ required: true, message: this.$t('rules.productTypeInput'), trigger: 'change'}
|
||||
]
|
||||
};
|
||||
} else {
|
||||
crules = {
|
||||
name: [
|
||||
{ required: true, message: this.$t('systemGenerate.inputName'), trigger: 'blur' },
|
||||
{ required: true, message: this.$t('systemGenerate.inputName'), trigger: 'change' }
|
||||
]
|
||||
};
|
||||
}
|
||||
crules = {customized:[
|
||||
{ required: true, message: this.$t('systemGenerate.selectProject'), trigger: 'change'}
|
||||
],
|
||||
mapId:[
|
||||
{ required: true, message: this.$t('systemGenerate.selectMap'), trigger: 'change'}
|
||||
],
|
||||
name: [
|
||||
{ required: true, message: this.$t('systemGenerate.inputName'), trigger: 'blur' },
|
||||
{ required: true, message: this.$t('systemGenerate.inputName'), trigger: 'change' }
|
||||
],
|
||||
type:[
|
||||
{ required: true, message: this.$t('systemGenerate.selectType'), trigger: 'change'}
|
||||
],
|
||||
prdType:[
|
||||
{ required: true, message: this.$t('rules.productTypeInput'), trigger: 'change'}
|
||||
]
|
||||
};
|
||||
return crules;
|
||||
}
|
||||
},
|
||||
@ -110,22 +113,63 @@ export default {
|
||||
? customeredProductType.map(elem => { return { value: elem.value, label: elem.enlabel }; })
|
||||
: customeredProductType.map(elem => { return { value: elem.value, label: elem.label }; });
|
||||
},
|
||||
doShow(data) {
|
||||
if (data) {
|
||||
this.formModel.name = data.name;
|
||||
this.formModel.id = data.id;
|
||||
doShow({type, row}) {
|
||||
if (row) {
|
||||
this.title = this.$t('systemGenerate.modifySubSystem');
|
||||
this.isAdd = false;
|
||||
this.isGernerate = false;
|
||||
this.formModel.name = row.name;
|
||||
this.formModel.id = row.id;
|
||||
} else {
|
||||
if (type == 'add') {
|
||||
this.title = this.$t('systemGenerate.createSubSystem');
|
||||
this.isAdd = true;
|
||||
this.isGernerate = false;
|
||||
this.formModel.mapId = '';
|
||||
this.formModel.name = '';
|
||||
} else {
|
||||
this.title = this.$t('systemGenerate.generation');
|
||||
this.isAdd = false;
|
||||
this.isGernerate = true;
|
||||
this.formModel.mapId = '';
|
||||
}
|
||||
}
|
||||
this.dialogVisible = true;
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.dataform.clearValidate();
|
||||
});
|
||||
},
|
||||
doCreate() {
|
||||
const self = this;
|
||||
this.$refs.dataform.validateForm(() => {
|
||||
self.$emit('create', Object.assign({}, this.formModel));
|
||||
if (this.isAdd) {
|
||||
delete this.formModel.id;
|
||||
createMapSubSystem(this.formModel).then(response => {
|
||||
this.$message.success(this.$t('systemGenerate.createMapSystemSuccess'));
|
||||
self.$emit('reloadTable');
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('systemGenerate.createMapSystemFail'));
|
||||
});
|
||||
} else if (this.isGernerate) {
|
||||
generateMapSystem(this.formModel.mapId).then(response => {
|
||||
this.$message.success(this.$t('systemGenerate.generateSuccess'));
|
||||
self.$emit('reloadTable');
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('systemGenerate.generateFail'));
|
||||
});
|
||||
} else {
|
||||
const datainfo = {'name': this.formModel.name};
|
||||
updateSubSystem(this.formModel.id, datainfo).then(response => {
|
||||
this.$message.success(this.$t('systemGenerate.updateMapSystemSuccess'));
|
||||
self.$emit('reloadTable');
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('systemGenerate.updateMapSystemFail'));
|
||||
});
|
||||
}
|
||||
self.doClose();
|
||||
});
|
||||
},
|
||||
doClose() {
|
||||
this.$refs.dataform.resetForm();
|
||||
this.dialogVisible = false;
|
||||
}
|
||||
}
|
||||
|
@ -1,71 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog :title="title" :visible.sync="dialogVisible" width="500px" :before-close="doClose" center>
|
||||
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="doCreate">{{ $t('global.confirm') }}</el-button>
|
||||
<el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'OnceGenerate',
|
||||
props:{
|
||||
mapList:{
|
||||
required:true,
|
||||
type:Array
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
formModel:{
|
||||
mapId:''
|
||||
},
|
||||
title: this.$t('systemGenerate.generation')
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
form() {
|
||||
const form = {
|
||||
labelWidth: '150px',
|
||||
items: [
|
||||
{ prop: 'mapId', label: this.$t('systemGenerate.mapName'), type: 'select', required: true, options: this.mapList}
|
||||
]
|
||||
};
|
||||
return form;
|
||||
},
|
||||
rules() {
|
||||
const crules = {
|
||||
mapId:[
|
||||
{ required: true, message: this.$t('systemGenerate.selectMap'), trigger: 'change'}
|
||||
]
|
||||
};
|
||||
return crules;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
doShow() {
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
doCreate() {
|
||||
const self = this;
|
||||
this.$refs.dataform.validateForm(() => {
|
||||
self.$emit('create', Object.assign({}, this.formModel));
|
||||
self.doClose();
|
||||
});
|
||||
},
|
||||
doClose() {
|
||||
this.$refs.dataform.resetForm();
|
||||
this.dialogVisible = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
/deep/ .el-dialog--center .el-dialog__body{
|
||||
padding: 25px 55px 20px 30px;
|
||||
}
|
||||
</style>
|
@ -1,25 +1,21 @@
|
||||
<template>
|
||||
<el-card>
|
||||
<QueryListPage ref="subSystemListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
||||
<once-generate ref="generate" :map-list="mapList" @create="generateMapSystem" />
|
||||
<createMapSystem ref="createMapSystem" :map-list="mapList" :title="$t('systemGenerate.createSubSystem')" operate-type="add" @create="handleCreate" />
|
||||
<createMapSystem ref="modifyMapSystem" :map-list="mapList" :title="$t('systemGenerate.modifySubSystem')" operate-type="modify" @create="handleModify" />
|
||||
<mapSystemOperate ref="mapSystemOperate" :map-list="mapList" @reloadTable="reloadTable" />
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Cookies from 'js-cookie';
|
||||
import { getPublishMapListOnline } from '@/api/jmap/map';
|
||||
import { generateMapSystem, getMapSystemPageList, createMapSubSystem, getSubSystemInfo, updateSubSystem, deleteSubSystem} from '@/api/trainingPlatform';
|
||||
import { getMapSystemPageList, deleteSubSystem} from '@/api/trainingPlatform';
|
||||
import ConstConfig from '@/scripts/ConstConfig';
|
||||
import OnceGenerate from './generate';
|
||||
import createMapSystem from './create';
|
||||
import mapSystemOperate from './create';
|
||||
|
||||
export default {
|
||||
name: 'SystemGenerate',
|
||||
components: {
|
||||
OnceGenerate,
|
||||
createMapSystem
|
||||
mapSystemOperate
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -121,11 +117,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
updateData(index, row) {
|
||||
getSubSystemInfo(row.id).then(response => {
|
||||
this.$refs.modifyMapSystem.doShow(response.data);
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('systemGenerate.getSubSystemInfoFail'));
|
||||
});
|
||||
this.$refs.mapSystemOperate.doShow({type:'update', row:row});
|
||||
},
|
||||
deleteData(index, row) {
|
||||
this.$confirm(this.$t('systemGenerate.deleteMapSystemTip'), this.$t('global.tips'), {
|
||||
@ -141,26 +133,8 @@ export default {
|
||||
});
|
||||
}).catch(() => { });
|
||||
},
|
||||
handleCreate(data) {
|
||||
delete data.id;
|
||||
createMapSubSystem(data).then(response => {
|
||||
this.$message.success(this.$t('systemGenerate.createMapSystemSuccess'));
|
||||
this.reloadTable();
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('systemGenerate.createMapSystemFail'));
|
||||
});
|
||||
},
|
||||
handleModify(data) {
|
||||
const datainfo = {'name': data.name};
|
||||
updateSubSystem(data.id, datainfo).then(response => {
|
||||
this.$message.success(this.$t('systemGenerate.updateMapSystemSuccess'));
|
||||
this.reloadTable();
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('systemGenerate.updateMapSystemFail'));
|
||||
});
|
||||
},
|
||||
handleAdd() {
|
||||
this.$refs.createMapSystem.doShow();
|
||||
this.$refs.mapSystemOperate.doShow({type:'add'});
|
||||
},
|
||||
reloadTable() {
|
||||
if (this.queryList && this.queryList.reload) {
|
||||
@ -194,15 +168,7 @@ export default {
|
||||
}
|
||||
},
|
||||
generate() {
|
||||
this.$refs.generate.doShow();
|
||||
},
|
||||
generateMapSystem(data) {
|
||||
generateMapSystem(data.mapId).then(response => {
|
||||
this.reloadTable();
|
||||
this.$message.success(this.$t('systemGenerate.generateSuccess'));
|
||||
}).catch(() => {
|
||||
this.$messageBox(this.$t('systemGenerate.generateFail'));
|
||||
});
|
||||
this.$refs.mapSystemOperate.doShow({type:'generate'});
|
||||
},
|
||||
queryFunction(params) {
|
||||
return getMapSystemPageList(params);
|
||||
|
@ -224,7 +224,6 @@ export default {
|
||||
data = item;
|
||||
}
|
||||
if (checkId === item.key) {
|
||||
console.log(item, {data: data});
|
||||
this.clickEvent(item, {data: data}, null, true);
|
||||
} else {
|
||||
this.findTree(item.children, checkId, data);
|
||||
|
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