增加三维客流量模块,修改三维沙盘行车部分代码
This commit is contained in:
parent
3a76731646
commit
243312ad24
@ -56,7 +56,6 @@ export default {
|
||||
threeDimensionalStation: '三维车站',
|
||||
passengerflow: 'cctv视图',
|
||||
trafficplantext:'客流规划',
|
||||
traffictraintext:'列车客乘',
|
||||
maintainer: '设备故障视图',
|
||||
deviceView: '设备视图',
|
||||
taskOperateSuccess: '任务操作成功',
|
||||
|
@ -4,7 +4,7 @@ import { getToken } from '@/utils/auth';
|
||||
import store from '@/store/index_APP_TARGET';
|
||||
|
||||
// 定于仿真socket接口
|
||||
export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passerStation,passerAi,passerHuman) {
|
||||
export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passerStation,passerAi,jl3d) {
|
||||
const scope = this;
|
||||
this.teststomp = new StompClient();
|
||||
|
||||
@ -30,8 +30,11 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe
|
||||
function callback(Response) {
|
||||
const data = JSON.parse(Response.body);
|
||||
|
||||
|
||||
|
||||
if(data.type == "DeviceCtrl_3D"){
|
||||
if(data.body.type == "PSD"){
|
||||
jl3d.changespeed(30);
|
||||
if(data.body.code == passerStation.nowStation.toppsd){
|
||||
if(data.body.open == 0){
|
||||
passerAi.passerout("top","end");
|
||||
@ -50,23 +53,26 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe
|
||||
}
|
||||
if(data.body.code == passerStation.nowStation.downpsd){
|
||||
if(data.body.open == 0){
|
||||
passerAi.passerout("down","end");
|
||||
|
||||
deviceaction.down.action.reset();
|
||||
deviceaction.down.action.time = deviceaction.down.action._clip.duration;
|
||||
deviceaction.down.action.timeScale = -1;
|
||||
deviceaction.down.action.play();
|
||||
|
||||
passerAi.passerout("down","end");
|
||||
}else{
|
||||
passerAi.passerout("down","start");
|
||||
|
||||
deviceaction.down.action.reset();
|
||||
deviceaction.down.action.time = 0;
|
||||
deviceaction.down.action.timeScale = 1;
|
||||
deviceaction.down.action.play();
|
||||
passerAi.passerout("down","start");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(data.body.type == "TRAIN_DOOR"){
|
||||
|
||||
if(toptrain.nowcode == data.body.code){
|
||||
|
||||
if(data.body.open == "0"){
|
||||
@ -129,6 +135,7 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe
|
||||
let actions;
|
||||
|
||||
function opentraindoor(train,doorcode,direct){
|
||||
// console.log(train);
|
||||
if(direct == "top"){
|
||||
if(doorcode == "1"){
|
||||
actions = train.action.down;
|
||||
|
@ -29,7 +29,7 @@ export function TrainConnect(trafficTrain,deviceaction,toptrain,routegroup,passe
|
||||
// 仿真socket接口回调函数
|
||||
function callback(Response) {
|
||||
const data = JSON.parse(Response.body);
|
||||
|
||||
// console.log(data);
|
||||
if(data.type == "TrainRun_3D"){
|
||||
trafficTrain.trainList = data.body;
|
||||
// console.log(trafficTrain.nowTrainCode);
|
||||
@ -38,8 +38,10 @@ export function TrainConnect(trafficTrain,deviceaction,toptrain,routegroup,passe
|
||||
if(data.type == "DeviceCtrl_3D"){
|
||||
|
||||
if(data.body.type == "TRAIN_DOOR"){
|
||||
if(toptrain.nowcode == data.body.code){
|
||||
|
||||
if(toptrain.nowcode == data.body.code){
|
||||
console.log(data.body);
|
||||
console.log(toptrain.nowcode);
|
||||
if(data.body.open == "0"){
|
||||
closetraindoor(toptrain,data.body.doorCode,"top");
|
||||
|
||||
@ -62,6 +64,7 @@ export function TrainConnect(trafficTrain,deviceaction,toptrain,routegroup,passe
|
||||
let actions;
|
||||
|
||||
function opentraindoor(train,doorcode,direct){
|
||||
|
||||
if(direct == "top"){
|
||||
if(doorcode == "1"){
|
||||
actions = train.action.down;
|
||||
@ -79,7 +82,7 @@ export function TrainConnect(trafficTrain,deviceaction,toptrain,routegroup,passe
|
||||
actions = train.action.down;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(actions);
|
||||
for(let an=actions.length-1;an>=0;an--){
|
||||
actions[an].reset();
|
||||
actions[an].time = 0;
|
||||
@ -105,7 +108,7 @@ export function TrainConnect(trafficTrain,deviceaction,toptrain,routegroup,passe
|
||||
actions = train.action.down;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(actions);
|
||||
for(let an=actions.length-1;an>=0;an--){
|
||||
actions[an].reset();
|
||||
actions[an].time = actions[an]._clip.duration;
|
||||
|
@ -54,7 +54,7 @@ let path;
|
||||
//设备动画action组
|
||||
let deviceaction = [];
|
||||
//控制帧率的webworker线程
|
||||
let passerWebWork = new Worker(JL3D_LOCAL_STATIC+"/workertest/passsimulation/station.js");
|
||||
let passerWebWork = new Worker(JL3D_LOCAL_STATIC+"/workertest/trafficplan/trafficstation.js");
|
||||
|
||||
//老版本临时ai控制
|
||||
let olddataai = false;
|
||||
@ -73,6 +73,11 @@ export function Jl3dTrafficPlan(dom,skinCode,routegroup,viewMap) {
|
||||
this.mixers = [];
|
||||
this.showmodel = null;
|
||||
|
||||
this.humanWaitIn = [];
|
||||
this.humanWaitOut = [];
|
||||
this.humanInSpeed = 0;
|
||||
this.humanOutSpeed = 0;
|
||||
|
||||
//定义相机
|
||||
camerass = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 1000);
|
||||
camerass.position.set(0, 80, 40);
|
||||
@ -127,10 +132,18 @@ export function Jl3dTrafficPlan(dom,skinCode,routegroup,viewMap) {
|
||||
let passerCheckDoor = new PasserCheckDoor();
|
||||
let passerTrain = new PasserTrain();
|
||||
|
||||
// document.addEventListener( "mousedown", onselect, false );
|
||||
|
||||
getPublish3dMapDetail(skinCode).then(netdata3d => {
|
||||
passerStation.loadMaterial(netdata3d);
|
||||
this.modelmanager.loadpromise(JSON.parse(netdata3d.data.assets).cctvAssetList, scope.mixers).then(function (data) {
|
||||
|
||||
this.modelmanager.loadpromise(Staticmodel, scope.mixers,"2").then(function (data) {
|
||||
// console.log(scope.modelmanager.station.mesh.getObjectByName("top"));
|
||||
// let testtop = scope.modelmanager.station.mesh.getObjectByName("down");
|
||||
// for(let i=0;i<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);
|
||||
@ -150,7 +163,7 @@ export function Jl3dTrafficPlan(dom,skinCode,routegroup,viewMap) {
|
||||
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,passerHuman);
|
||||
socktest = new PassflowConnect(deviceaction,passerTrain.toptrain,passerTrain.downtrain,routegroup,passerStation,passerAi,scope);
|
||||
|
||||
store.dispatch('app/animationsClose');
|
||||
|
||||
@ -159,8 +172,7 @@ export function Jl3dTrafficPlan(dom,skinCode,routegroup,viewMap) {
|
||||
clearInterval(checkobject);
|
||||
//进站控制
|
||||
startWorker();
|
||||
passerWebWork.postMessage("on");
|
||||
|
||||
passerWebWork.postMessage(["on"]);
|
||||
},1000);
|
||||
});
|
||||
|
||||
@ -173,6 +185,12 @@ export function Jl3dTrafficPlan(dom,skinCode,routegroup,viewMap) {
|
||||
scope.resetscene();
|
||||
}
|
||||
|
||||
this.changespeed = function(creatspeed){
|
||||
scope.humanInSpeed = creatspeed;
|
||||
updatePasserSpeed(creatspeed);
|
||||
passerWebWork.postMessage(["changespeed",creatspeed/30]);
|
||||
}
|
||||
|
||||
this.resetscene = function(){
|
||||
aiswitch = 1;
|
||||
passerAi.toppasserin = false;
|
||||
@ -292,11 +310,12 @@ export function Jl3dTrafficPlan(dom,skinCode,routegroup,viewMap) {
|
||||
passerWebWork.onmessage = function (event) {
|
||||
if(aiswitch == 0){
|
||||
// console.log(humanlist.children.length);
|
||||
updatePasserData(humanlist.children.length,topWaitPassers.children.length,downWaitPassers.children.length,outStationPassers.children.length);
|
||||
|
||||
if(humanlist.children.length < 100){
|
||||
let direct = Math.floor(Math.random()*(3-1+1))+1;
|
||||
//1--top
|
||||
//2-- down
|
||||
updatePasserData(humanlist.children.length,topWaitPassers.children.length,downWaitPassers.children.length,outStationPassers.children.length);
|
||||
if(direct == 1){
|
||||
passerHuman.newHumanCreate(humanlist,passerZone.getzoneposition("enter1"),0);
|
||||
}else{
|
||||
@ -326,6 +345,23 @@ export function Jl3dTrafficPlan(dom,skinCode,routegroup,viewMap) {
|
||||
}
|
||||
};
|
||||
}
|
||||
//
|
||||
// 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);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
//循环渲染函数
|
||||
|
@ -15,7 +15,7 @@ import { getPublishMapVersion, getPublishMapDetail,getPublish3dMapDetail} from '
|
||||
//cctv列车对象
|
||||
import { PasserTrain } from '@/jlmap3d/jl3dtrafficplan/model/passertrain.js';
|
||||
//cctv行人对象
|
||||
import { PasserHuman } from '@/jlmap3d/jl3dpassflow/model/passerhuman.js';
|
||||
import { PasserHuman } from '@/jlmap3d/jl3dtrafficplan/model/traintrunk/passertrunkhuman.js';
|
||||
//cctv渲染器
|
||||
import { PasserRender } from '@/jlmap3d/jl3dpassflow/passerrender/passerrender.js';
|
||||
//cctv行人ai
|
||||
@ -72,6 +72,11 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) {
|
||||
|
||||
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);
|
||||
@ -95,10 +100,10 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) {
|
||||
controls.maxDistance = 800;
|
||||
controls.screenSpacePanning = true;
|
||||
|
||||
camerass.position.x = 21.83;
|
||||
camerass.position.y = 5.29;
|
||||
camerass.position.z = 17.36;
|
||||
controls.target = new THREE.Vector3(camerass.position.x-0.1,camerass.position.y-0.1,camerass.position.z);
|
||||
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;
|
||||
|
||||
@ -151,10 +156,7 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) {
|
||||
|
||||
})
|
||||
|
||||
this.changeTrain = function(trainCode){
|
||||
// scope.resetscene();
|
||||
scope.nowTrainCode = trainCode;
|
||||
}
|
||||
|
||||
|
||||
this.resetscene = function(){
|
||||
aiswitch = 1;
|
||||
@ -204,33 +206,34 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) {
|
||||
// actions[an].play();
|
||||
// }
|
||||
setTimeout(function(){
|
||||
passerAi.initPasser(humanlist,passerHuman);
|
||||
passerHuman.setNowTrunkPasser(humanlist);
|
||||
aiswitch = 0;
|
||||
}, 2000);
|
||||
|
||||
}
|
||||
|
||||
function startWorker(){
|
||||
passerAi.initPasser(humanlist,passerHuman);
|
||||
passerHuman.setNowTrunkPasser(humanlist,200,0);
|
||||
let updateaianimate = setInterval(
|
||||
function(){
|
||||
// console.log("?");
|
||||
if(aiswitch == 0){
|
||||
passerHuman.moveAnimateUpdate(humanlist,olddataai,passerHuman);
|
||||
// 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 );
|
||||
}
|
||||
}
|
||||
// for(let i=humanlist.children.length-1;i>=0;i--){
|
||||
// if(humanlist.children[i].mixer._actions[0].isRunning()){
|
||||
// humanlist.children[i].mixer.update( delta );
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
, 100);
|
||||
@ -240,13 +243,7 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) {
|
||||
// console.log(humanlist.children.length);
|
||||
if(humanlist.children.length < 80){
|
||||
let direct = Math.floor(Math.random()*(3-1+1))+1;
|
||||
//1--top
|
||||
//2-- down
|
||||
if(direct == 1){
|
||||
passerHuman.newHumanCreate(humanlist,passerZone.getzoneposition("enter1"),0);
|
||||
}else{
|
||||
passerHuman.newHumanCreate(humanlist,passerZone.getzoneposition("enter2"),0);
|
||||
}
|
||||
|
||||
if(passerAi.toppasseron){
|
||||
for(let i=0,leni=passerZone.list["standtop"].doorpoints.length;i<leni;i++ ){
|
||||
setTimeout(function(){
|
||||
@ -286,50 +283,55 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) {
|
||||
}
|
||||
|
||||
this.switchcamera = function(trunkNum){
|
||||
console.log(passerTrain.toptrain);
|
||||
console.log(camerass.position);
|
||||
// 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 = 21.83;
|
||||
camerass.position.y = 5.29;
|
||||
camerass.position.z = 17.36;
|
||||
controls.target = new THREE.Vector3(camerass.position.x-0.1,camerass.position.y-0.1,camerass.position.z);
|
||||
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 = 39.83;
|
||||
camerass.position.y = 5.29;
|
||||
camerass.position.z = 17.36;
|
||||
controls.target = new THREE.Vector3(camerass.position.x-0.1,camerass.position.y-0.1,camerass.position.z);
|
||||
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 = 60.71;
|
||||
camerass.position.y = 5.29;
|
||||
camerass.position.z = 17.36;
|
||||
controls.target = new THREE.Vector3(camerass.position.x-0.1,camerass.position.y-0.1,camerass.position.z);
|
||||
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 = 82.01;
|
||||
camerass.position.y = 5.29;
|
||||
camerass.position.z = 17.36;
|
||||
controls.target = new THREE.Vector3(camerass.position.x-0.1,camerass.position.y-0.1,camerass.position.z);
|
||||
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 = 104.06;
|
||||
camerass.position.y = 5.29;
|
||||
camerass.position.z = 17.36;
|
||||
controls.target = new THREE.Vector3(camerass.position.x-0.1,camerass.position.y-0.1,camerass.position.z);
|
||||
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 = 120.30;
|
||||
camerass.position.y = 5.29;
|
||||
camerass.position.z = 17.36;
|
||||
controls.target = new THREE.Vector3(camerass.position.x-0.1,camerass.position.y-0.1,camerass.position.z);
|
||||
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:
|
||||
@ -340,6 +342,10 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) {
|
||||
return scope.trainList;
|
||||
}
|
||||
|
||||
this.updateNowTrainCode = function(newCode){
|
||||
passerTrain.toptrain.nowcode = newCode;
|
||||
}
|
||||
|
||||
this.switchviews = function(viewmode){
|
||||
passerRender.changeRenderMode(viewmode);
|
||||
}
|
||||
|
@ -113,6 +113,7 @@ export function ModelManager(){
|
||||
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 ) {
|
||||
|
@ -1,71 +1,56 @@
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||
var Staticmodel = {
|
||||
man1: {
|
||||
var Staticmodel = [
|
||||
{
|
||||
id: "1",
|
||||
name: "人物1",
|
||||
deviceType: "man",
|
||||
type: "man",
|
||||
picUrl: "",
|
||||
assetUrl: JL3D_LOCAL_STATIC+"/MODEL/passflow/man1.FBX"
|
||||
},//"https://joylink.club/oss/wx/switch/switch.FBX"
|
||||
man2: {
|
||||
deviceType: "man1",
|
||||
type: "man1",
|
||||
url: "/cbtc/static/MODEL/passflow/man1.FBX"
|
||||
},{
|
||||
id: "2",
|
||||
name: "人物2",
|
||||
deviceType: "man",
|
||||
type: "man",
|
||||
picUrl: "",
|
||||
assetUrl: JL3D_LOCAL_STATIC+"/MODEL/passflow/man2.FBX"
|
||||
},
|
||||
station: {
|
||||
deviceType: "man2",
|
||||
type: "man2",
|
||||
url: "/cbtc/static/MODEL/passflow/man2.FBX"
|
||||
},{
|
||||
id: "3",
|
||||
name: "车站",
|
||||
deviceType: "station",
|
||||
type: "hrb",
|
||||
picUrl: "",
|
||||
assetUrl: JL3D_LOCAL_STATIC+"/MODEL/passflow/station.FBX"
|
||||
},
|
||||
zhajiin: {
|
||||
deviceType: "cctvStation",
|
||||
type: "cctvStation",
|
||||
url: "/cbtc/static/trafficplan/station.FBX"
|
||||
},{
|
||||
id: "4",
|
||||
name: "闸机",
|
||||
deviceType: "zhajiin",
|
||||
type: "hrb",
|
||||
picUrl: "",
|
||||
assetUrl: JL3D_LOCAL_STATIC+"/MODEL/passflow/zhajiin.FBX"
|
||||
},
|
||||
zhajiout: {
|
||||
deviceType: "cctvGateIn",
|
||||
type: "cctvGateIn",
|
||||
url: "/cbtc/static/MODEL/passflow/zhajiin.FBX"
|
||||
},{
|
||||
id: "5",
|
||||
name: "闸机",
|
||||
deviceType: "zhajiout",
|
||||
type: "hrb",
|
||||
picUrl: "",
|
||||
assetUrl: JL3D_LOCAL_STATIC+"/MODEL/passflow/zhajiout.FBX"
|
||||
},
|
||||
monitor: {
|
||||
deviceType: "cctvGateOut",
|
||||
type: "cctvGateOut",
|
||||
url: "/cbtc/static/MODEL/passflow/zhajiout.FBX"
|
||||
},{
|
||||
id: "6",
|
||||
name: "摄像机",
|
||||
deviceType: "monitor",
|
||||
type: "hrb",
|
||||
picUrl: "",
|
||||
assetUrl: JL3D_LOCAL_STATIC+"/MODEL/passflow/monitor.FBX"
|
||||
},
|
||||
train: {
|
||||
deviceType: "cctvMonitor",
|
||||
type: "cctvMonitor",
|
||||
url: "/cbtc/static/MODEL/passflow/monitor.FBX"
|
||||
},{
|
||||
id: "7",
|
||||
name: "列车",
|
||||
deviceType: "train",
|
||||
type: "hrb",
|
||||
picUrl: "",
|
||||
assetUrl: JL3D_LOCAL_STATIC+"/MODEL/train/train.FBX"
|
||||
},
|
||||
section: {
|
||||
deviceType: "cctvTrain",
|
||||
type: "cctvTrain",
|
||||
url: "/cbtc/static/trafficplan/train.FBX"
|
||||
},{
|
||||
id: "8",
|
||||
name: "区段",
|
||||
deviceType: "section",
|
||||
type: "hrb",
|
||||
picUrl: "",
|
||||
assetUrl: JL3D_LOCAL_STATIC+"/MODEL/passflow/section.FBX"
|
||||
},
|
||||
deviceType: "cctvSection",
|
||||
type: "cctvSection",
|
||||
url: "/cbtc/static/MODEL/passflow/section.FBX"
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
];
|
||||
|
||||
export { Staticmodel }
|
||||
|
@ -1,10 +1,7 @@
|
||||
export function PasserHuman() {
|
||||
let scope = this;
|
||||
|
||||
this.humanWaitIn = [];
|
||||
this.humanWaitOut = [];
|
||||
this.humanInSpeed = 0;
|
||||
this.humanOutSpeed = 0;
|
||||
|
||||
|
||||
//初始人物模型和动画
|
||||
let originhuman1 = null;
|
||||
|
@ -2,17 +2,26 @@ 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;
|
||||
//
|
||||
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 ) {
|
||||
|
||||
@ -46,10 +55,10 @@ export function PasserTrain() {
|
||||
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);
|
||||
inittrainanimation(scope.toptrain,tclip,fclip,mixers);
|
||||
inittrainanimation(scope.downtrain,tclip,fclip,mixers);
|
||||
|
||||
|
||||
scope.toptrain.position.z = -20;
|
||||
@ -62,14 +71,16 @@ export function PasserTrain() {
|
||||
}
|
||||
//初始化车门动画
|
||||
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"){
|
||||
// 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] );
|
||||
mixers.push(mixer);
|
||||
|
||||
let action = mixer.clipAction( train.children[j].children[n].animations[ 0 ] );
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
@ -78,9 +89,10 @@ export function PasserTrain() {
|
||||
}
|
||||
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] );
|
||||
mixers.push(mixer);
|
||||
|
||||
let action = mixer.clipAction( train.children[j].children[n].animations[ 0 ] );
|
||||
action.setLoop(THREE.LoopOnce);
|
||||
action.clampWhenFinished = true;
|
||||
@ -88,32 +100,33 @@ export function PasserTrain() {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// }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 = "";
|
||||
|
||||
|
||||
|
||||
//初始人物模型和动画
|
||||
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;
|
||||
}
|
||||
}
|
@ -58,31 +58,49 @@ let standtop = {
|
||||
stage : "3",
|
||||
randompoint : new THREE.Vector3(-64,1.77,0.38),
|
||||
doorpoints:[
|
||||
new THREE.Vector3(-62.84,1.77,-4.38),
|
||||
new THREE.Vector3(-58.11,1.77,-4.38),
|
||||
new THREE.Vector3(-53.47,1.77,-4.38),
|
||||
new THREE.Vector3(-45.45,1.77,-4.38),
|
||||
new THREE.Vector3(-41.1,1.77,-4.38),
|
||||
new THREE.Vector3(-36.33,1.77,-4.38),
|
||||
new THREE.Vector3(-31.5,1.77,-4.38),
|
||||
new THREE.Vector3(-23.65,1.77,-4.38),
|
||||
new THREE.Vector3(-18.98,1.77,-4.38),
|
||||
new THREE.Vector3(-14.46,1.77,-4.38),
|
||||
new THREE.Vector3(-10,1.77,-4.38),
|
||||
new THREE.Vector3(-2.2,1.77,-4.38),
|
||||
new THREE.Vector3(2.49,1.77,-4.38),
|
||||
new THREE.Vector3(7.17,1.77,-4.38),
|
||||
new THREE.Vector3(11.8,1.77,-4.38),
|
||||
new THREE.Vector3(19.41,1.77,-4.38),
|
||||
new THREE.Vector3(24.09,1.77,-4.38),
|
||||
new THREE.Vector3(28.72,1.77,-4.38),
|
||||
new THREE.Vector3(33.46,1.77,-4.38),
|
||||
new THREE.Vector3(41.24,1.77,-4.38),
|
||||
new THREE.Vector3(45.82,1.77,-4.38),
|
||||
new THREE.Vector3(50.69,1.77,-4.38)
|
||||
new THREE.Vector3(-62.1,1.77,-4.38),
|
||||
new THREE.Vector3(-57.54,1.77,-4.38),
|
||||
new THREE.Vector3(-53.1,1.77,-4.38),
|
||||
new THREE.Vector3(-42.5,1.77,-4.38),
|
||||
new THREE.Vector3(-37.6,1.77,-4.38),
|
||||
new THREE.Vector3(-33.6,1.77,-4.38),
|
||||
new THREE.Vector3(-20.8,1.77,-4.38),
|
||||
new THREE.Vector3(-16.6,1.77,-4.38),
|
||||
new THREE.Vector3(-12,1.77,-4.38),
|
||||
new THREE.Vector3(0.5,1.77,-4.38),
|
||||
new THREE.Vector3(4.8,1.77,-4.38),
|
||||
new THREE.Vector3(9.27,1.77,-4.38),
|
||||
new THREE.Vector3(21.6,1.77,-4.38),
|
||||
new THREE.Vector3(26.2,1.77,-4.38),
|
||||
new THREE.Vector3(30.48,1.77,-4.38),
|
||||
new THREE.Vector3(43.2,1.77,-4.38),
|
||||
new THREE.Vector3(47.5,1.77,-4.38),
|
||||
new THREE.Vector3(51.9,1.77,-4.38)
|
||||
],
|
||||
// new THREE.Vector3(-62.84,1.77,-4.38),
|
||||
// new THREE.Vector3(-58.11,1.77,-4.38),
|
||||
// new THREE.Vector3(-53.47,1.77,-4.38),
|
||||
// new THREE.Vector3(-45.45,1.77,-4.38),
|
||||
// new THREE.Vector3(-41.1,1.77,-4.38),
|
||||
// new THREE.Vector3(-36.33,1.77,-4.38),
|
||||
// new THREE.Vector3(-31.5,1.77,-4.38),
|
||||
// new THREE.Vector3(-23.65,1.77,-4.38),
|
||||
// new THREE.Vector3(-18.98,1.77,-4.38),
|
||||
// new THREE.Vector3(-14.46,1.77,-4.38),
|
||||
// new THREE.Vector3(-10,1.77,-4.38),
|
||||
// new THREE.Vector3(-2.2,1.77,-4.38),
|
||||
// new THREE.Vector3(2.49,1.77,-4.38),
|
||||
// new THREE.Vector3(7.17,1.77,-4.38),
|
||||
// new THREE.Vector3(11.8,1.77,-4.38),
|
||||
// new THREE.Vector3(19.41,1.77,-4.38),
|
||||
// new THREE.Vector3(24.09,1.77,-4.38),
|
||||
// new THREE.Vector3(28.72,1.77,-4.38),
|
||||
// new THREE.Vector3(33.46,1.77,-4.38),
|
||||
// new THREE.Vector3(41.24,1.77,-4.38),
|
||||
// new THREE.Vector3(45.82,1.77,-4.38),
|
||||
// new THREE.Vector3(50.69,1.77,-4.38)
|
||||
railpoints : [
|
||||
new THREE.Vector3(52.1,1.77,-1.8),
|
||||
new THREE.Vector3(53.1,1.77,-1.8),
|
||||
new THREE.Vector3(-63.5,1.77,-1.8)
|
||||
]
|
||||
};
|
||||
@ -94,31 +112,49 @@ let standdown = {
|
||||
stage : "3",
|
||||
randompoint : new THREE.Vector3(-64,1.77,21),
|
||||
doorpoints:[
|
||||
new THREE.Vector3(-62.84,1.77,27),
|
||||
new THREE.Vector3(-58.11,1.77,27),
|
||||
new THREE.Vector3(-53.47,1.77,27),
|
||||
new THREE.Vector3(-45.45,1.77,27),
|
||||
new THREE.Vector3(-41.1,1.77,27),
|
||||
new THREE.Vector3(-36.33,1.77,27),
|
||||
new THREE.Vector3(-31.5,1.77,27),
|
||||
new THREE.Vector3(-23.65,1.77,27),
|
||||
new THREE.Vector3(-18.98,1.77,27),
|
||||
new THREE.Vector3(-14.46,1.77,27),
|
||||
new THREE.Vector3(-10,1.77,27),
|
||||
new THREE.Vector3(-2.2,1.77,27),
|
||||
new THREE.Vector3(2.49,1.77,27),
|
||||
new THREE.Vector3(7.17,1.77,27),
|
||||
new THREE.Vector3(11.8,1.77,27),
|
||||
new THREE.Vector3(19.41,1.77,27),
|
||||
new THREE.Vector3(24.09,1.77,27),
|
||||
new THREE.Vector3(28.72,1.77,27),
|
||||
new THREE.Vector3(33.46,1.77,27),
|
||||
new THREE.Vector3(41.24,1.77,27),
|
||||
new THREE.Vector3(45.82,1.77,27),
|
||||
new THREE.Vector3(50.69,1.77,27)
|
||||
new THREE.Vector3(-62.1,1.77,27),
|
||||
new THREE.Vector3(-57.54,1.77,27),
|
||||
new THREE.Vector3(-53.1,1.77,27),
|
||||
new THREE.Vector3(-42.5,1.77,27),
|
||||
new THREE.Vector3(-37.6,1.77,27),
|
||||
new THREE.Vector3(-33.6,1.77,27),
|
||||
new THREE.Vector3(-20.8,1.77,27),
|
||||
new THREE.Vector3(-16.6,1.77,27),
|
||||
new THREE.Vector3(-12,1.77,27),
|
||||
new THREE.Vector3(0.5,1.77,27),
|
||||
new THREE.Vector3(4.8,1.77,27),
|
||||
new THREE.Vector3(9.27,1.77,27),
|
||||
new THREE.Vector3(21.6,1.77,27),
|
||||
new THREE.Vector3(26.2,1.77,27),
|
||||
new THREE.Vector3(30.48,1.77,27),
|
||||
new THREE.Vector3(43.2,1.77,27),
|
||||
new THREE.Vector3(47.5,1.77,27),
|
||||
new THREE.Vector3(51.9,1.77,27)
|
||||
],
|
||||
// new THREE.Vector3(-62.84,1.77,27),
|
||||
// new THREE.Vector3(-58.11,1.77,27),
|
||||
// new THREE.Vector3(-53.47,1.77,27),
|
||||
// new THREE.Vector3(-45.45,1.77,27),
|
||||
// new THREE.Vector3(-41.1,1.77,27),
|
||||
// new THREE.Vector3(-36.33,1.77,27),
|
||||
// new THREE.Vector3(-31.5,1.77,27),
|
||||
// new THREE.Vector3(-23.65,1.77,27),
|
||||
// new THREE.Vector3(-18.98,1.77,27),
|
||||
// new THREE.Vector3(-14.46,1.77,27),
|
||||
// new THREE.Vector3(-10,1.77,27),
|
||||
// new THREE.Vector3(-2.2,1.77,27),
|
||||
// new THREE.Vector3(2.49,1.77,27),
|
||||
// new THREE.Vector3(7.17,1.77,27),
|
||||
// new THREE.Vector3(11.8,1.77,27),
|
||||
// new THREE.Vector3(19.41,1.77,27),
|
||||
// new THREE.Vector3(24.09,1.77,27),
|
||||
// new THREE.Vector3(28.72,1.77,27),
|
||||
// new THREE.Vector3(33.46,1.77,27),
|
||||
// new THREE.Vector3(41.24,1.77,27),
|
||||
// new THREE.Vector3(45.82,1.77,27),
|
||||
// new THREE.Vector3(50.69,1.77,27)
|
||||
railpoints : [
|
||||
new THREE.Vector3(52.1,1.77,24),
|
||||
new THREE.Vector3(53.1,1.77,24),
|
||||
new THREE.Vector3(-64,1.77,24)
|
||||
]
|
||||
};
|
||||
@ -225,22 +261,21 @@ export function ZoneManager() {
|
||||
}
|
||||
|
||||
this.getstandposition = function(name){
|
||||
let n = Math.round(Math.random()*20);
|
||||
let n = Math.round(Math.random()*17);
|
||||
if(n>=1){
|
||||
n=n;
|
||||
}else{
|
||||
n=0;
|
||||
}
|
||||
|
||||
let randompoint = new THREE.Vector3(0,scope.list[name].doorpoints[n].y,0);
|
||||
|
||||
if(name == "standtop"){
|
||||
randompoint.x = scope.list[name].doorpoints[n].x + Math.random()*3;
|
||||
randompoint.z = scope.list[name].doorpoints[n].z +5;
|
||||
randompoint.z = scope.list[name].doorpoints[n].z +4+Math.random()*5;
|
||||
}
|
||||
if(name == "standdown"){
|
||||
randompoint.x = scope.list[name].doorpoints[n].x + Math.random()*3;
|
||||
randompoint.z = scope.list[name].doorpoints[n].z -5;
|
||||
randompoint.z = scope.list[name].doorpoints[n].z -4-Math.random()*5;
|
||||
}
|
||||
let standdata = {
|
||||
door:n,
|
||||
@ -268,6 +303,7 @@ export function ZoneManager() {
|
||||
}
|
||||
|
||||
if(name == "exitgate"){
|
||||
|
||||
randompoint.x = scope.list[name].railpoints[exitnum].x ;
|
||||
randompoint.y = scope.list[name].railpoints[exitnum].y ;
|
||||
randompoint.z = scope.list[name].railpoints[exitnum].z ;
|
||||
|
@ -252,6 +252,7 @@ export function PasserAi(zone,finder) {
|
||||
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));
|
||||
@ -262,6 +263,10 @@ export function PasserAi(zone,finder) {
|
||||
}
|
||||
humanlist.children[i].door = targetPosition.door;
|
||||
passerHuman.initMoveAnimate(humanlist.children[i],i,points,i);
|
||||
}else{
|
||||
humanlist.children[i].position.x += 0.05;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -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,7 +258,7 @@ export function StationStandListN() {
|
||||
|
||||
let mixer = new THREE.AnimationMixer( newstationmesh.children[j] );
|
||||
|
||||
console.log(newstationstand.stands);
|
||||
|
||||
for(let n=0;n<psddata.length;n++){
|
||||
for(let m=0;m<newstationstand.stands.length;m++){
|
||||
|
||||
@ -305,116 +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 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 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -427,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();
|
||||
|
@ -2,9 +2,9 @@ export function getBaseUrl() {
|
||||
let BASE_API;
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// BASE_API = 'https://joylink.club/jlcloud';
|
||||
BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
// BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
// BASE_API = 'http://192.168.8.107:9000'; // 袁琪
|
||||
// BASE_API = 'http://192.168.8.114:9000'; // 旭强
|
||||
BASE_API = 'http://192.168.8.129:9000'; // 旭强
|
||||
// BASE_API = 'http://192.168.8.109:9000'; // 张赛
|
||||
// BASE_API = 'http://192.168.8.110:9000'; // 杜康
|
||||
// BASE_API = 'http://b29z135112.zicp.vip';
|
||||
|
@ -96,7 +96,7 @@ export default {
|
||||
this.allPassers = humanlistdata+topWaitPassersdata+downWaitPassersdata+outStationPassersdata+"人";
|
||||
},
|
||||
updatePasserSpeed(data){
|
||||
this.nowInStationPassers = data.nowInStationPassers+"人/30s";
|
||||
this.nowInStationPassers = data+"人/30s";
|
||||
},
|
||||
updatePasserOut(data){
|
||||
|
||||
|
@ -16,11 +16,11 @@
|
||||
<Station-Data>
|
||||
</Station-Data>
|
||||
|
||||
<!-- <div class="menutop">
|
||||
<div class="menutop">
|
||||
<el-button-group>
|
||||
<el-button type="primary" @click="switchauto">列车车厢视角</el-button>
|
||||
</el-button-group>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
<div class="menudown">
|
||||
<el-button-group>
|
||||
@ -108,7 +108,6 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
switchauto() {
|
||||
const routeData = this.$router.resolve({
|
||||
path:'/jlmap3d/traffictrain',
|
||||
|
@ -3,7 +3,7 @@
|
||||
<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="currentsel">
|
||||
<el-select v-model="value" class="listmenu" placeholder="请选择列车" @visible-change="updateTrainList" @change="updateTrainCode">
|
||||
<el-option
|
||||
v-for="item in trainlist"
|
||||
:key="item.code"
|
||||
@ -26,16 +26,15 @@
|
||||
<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>
|
||||
<span>当前列车乘客总数:{{allPassers}}人</span>
|
||||
</template>
|
||||
</el-submenu>
|
||||
|
||||
@ -43,36 +42,48 @@
|
||||
<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>
|
||||
@ -103,7 +114,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
isActive:-1,
|
||||
isActive:0,
|
||||
localStatic:JL3D_LOCAL_STATIC,
|
||||
trunkAssetList:[
|
||||
'/trafficplan/trunkhead.png',
|
||||
@ -116,10 +127,14 @@ export default {
|
||||
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:0+'人',
|
||||
allPassers:890,
|
||||
loadingProjectList: ['login', 'design', 'xty', 'designxty', 'gzb', 'designxty', 'xadt', 'designxadt', 'drts', 'designdrts']
|
||||
};
|
||||
},
|
||||
@ -144,6 +159,8 @@ export default {
|
||||
mounted() {
|
||||
|
||||
this.init();
|
||||
this.takelist = this.getnum(this.allPassers,6);
|
||||
console.log(this.takelist);
|
||||
if (this.$route.query.type == 'CCTV') {
|
||||
this.isCctv = false;
|
||||
}
|
||||
@ -158,7 +175,7 @@ export default {
|
||||
this.jl3d = new Jl3dTrafficTrain(dom, this.$route.query.mapid, this.$route.query.group, 'normal');
|
||||
},
|
||||
assetSelect(index){
|
||||
// console.log(index);
|
||||
console.log(index);
|
||||
this.isActive=index;
|
||||
this.jl3d.switchcamera(index+'');
|
||||
},
|
||||
@ -174,17 +191,36 @@ export default {
|
||||
this.jl3d.switchviews('4views');
|
||||
}
|
||||
},
|
||||
updateTrainCode(codeData){
|
||||
this.jl3d.updateNowTrainCode(codeData);
|
||||
},
|
||||
updateTrainList(){
|
||||
this.trainlist = this.jl3d.getTrainList();
|
||||
// console.log(this.trainlist);
|
||||
},
|
||||
currentsel(selVal) {
|
||||
this.jl3d.changeTrain(selVal);
|
||||
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();
|
||||
}
|
||||
@ -227,34 +263,7 @@ export default {
|
||||
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;
|
||||
@ -291,6 +300,11 @@ export default {
|
||||
border-color: blue;
|
||||
}
|
||||
|
||||
.takedata{
|
||||
text-align: center;
|
||||
color: rgb(255, 255, 255);
|
||||
}
|
||||
|
||||
.listmenu{
|
||||
/* top:50%; */
|
||||
}
|
||||
@ -312,10 +326,5 @@ export default {
|
||||
.datatab{
|
||||
width:250px;
|
||||
}
|
||||
#canvastexture {
|
||||
position: absolute;
|
||||
float: left;
|
||||
left: 0;
|
||||
z-index: -12;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
BIN
static/trafficplan/station.FBX
Normal file
BIN
static/trafficplan/station.FBX
Normal file
Binary file not shown.
Binary file not shown.
34
static/workertest/trafficplan/trafficstation.js
Normal file
34
static/workertest/trafficplan/trafficstation.js
Normal file
@ -0,0 +1,34 @@
|
||||
var i=0;
|
||||
var update = null;
|
||||
function timedCount(){
|
||||
|
||||
onmessage = (e) => {
|
||||
|
||||
|
||||
if(e.data[0] == "on"){
|
||||
// console.log("on");
|
||||
update = setInterval("stationupdate()", 2000);
|
||||
}
|
||||
|
||||
if(e.data[0] == "off"){
|
||||
clearInterval(update);
|
||||
}
|
||||
// console.log(e.data);
|
||||
if(e.data[0] == "changespeed"){
|
||||
if(update){
|
||||
clearInterval(update);
|
||||
let speed = 1000/e.data[1];
|
||||
update = setInterval("stationupdate()", speed);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function stationupdate(){
|
||||
|
||||
postMessage("up");
|
||||
}
|
||||
|
||||
timedCount();
|
Loading…
Reference in New Issue
Block a user