增加三维沙盘和驾驶中停站倒计时TDT
This commit is contained in:
parent
dcc1bb4506
commit
83a01ddf8c
@ -93,10 +93,9 @@ export function StationStandList() {
|
||||
let jlmapstationdata = jlmapdata.stationList;
|
||||
let jlmapstanddata = jlmapdata.stationStandList;
|
||||
// jlmapstationdata.splice(0,1);
|
||||
console.log(standsdata);
|
||||
console.log(jlmapstationdata);
|
||||
for(let i=0;i<jlmapstationdata.length;i++){
|
||||
if(jlmapstationdata[i].visible == false || jlmapstationdata[i].subheadDisplay == false){
|
||||
//|| jlmapstationdata[i].subheadDisplay == false
|
||||
if(jlmapstationdata[i].visible == false ){
|
||||
jlmapstationdata.splice(i,1);
|
||||
i--;
|
||||
}else{
|
||||
@ -107,7 +106,6 @@ export function StationStandList() {
|
||||
}
|
||||
|
||||
// console.log(jlmapstationdata);
|
||||
console.log(standsdata);
|
||||
let stations = jlmap3ddata.stationstandlist.list;
|
||||
let num;
|
||||
let num2;
|
||||
|
@ -18,6 +18,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
|
||||
var actions = null;
|
||||
var rails = null;
|
||||
var links = null;
|
||||
let tdt = null;
|
||||
|
||||
let trainmodel = null;
|
||||
var scenes = null;
|
||||
@ -50,7 +51,10 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
|
||||
driverWebWorker.onmessage = function (event) {
|
||||
|
||||
let data = event.data;
|
||||
// console.log(data);
|
||||
|
||||
if(data.type == "TDT_3D"){
|
||||
tdtUpdate(data);
|
||||
}
|
||||
|
||||
if(data.type == "Train_Position"){
|
||||
|
||||
@ -185,7 +189,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
|
||||
}
|
||||
|
||||
}
|
||||
this.updatamap = function(newsectionlist,newlinklist,newsignallist,newstationstandlist,newtrainlisttest,newrealsectionlist,newrails, materiallist, nowaction, scene) {
|
||||
this.updatamap = function(newsectionlist,newlinklist,newsignallist,newstationstandlist,newtrainlisttest,newrealsectionlist,newrails,newtdt, materiallist, nowaction, scene) {
|
||||
// console.log(mapdata);
|
||||
// console.log(newtrainlisttest);
|
||||
trainmodel = newtrainlisttest.group.children[0];
|
||||
@ -198,6 +202,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
|
||||
actions = nowaction;
|
||||
links = newlinklist;
|
||||
rails = newrails;
|
||||
tdt = newtdt;
|
||||
};
|
||||
|
||||
this.initdrivercode = function(code) {
|
||||
@ -245,7 +250,8 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
|
||||
let data = JSON.parse(Response.body);
|
||||
// stats.update();
|
||||
// 遍历后台数据
|
||||
console.log(data);
|
||||
// console.log(data);
|
||||
|
||||
if(data.type == "Train_Position"){
|
||||
nowTrainRun(data.body);
|
||||
return;
|
||||
@ -306,6 +312,12 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function tdtUpdate(data){
|
||||
|
||||
tdt.updateTdt(data.body);
|
||||
}
|
||||
|
||||
function otherTrainRun(data){
|
||||
|
||||
if(data.length != trainlisttest.otherTrainmodels.length && trainlisttest.updatStatus == false){
|
||||
|
@ -20,6 +20,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
||||
var actions = null;
|
||||
var rails = null;
|
||||
var links = null;
|
||||
var tdt = null;
|
||||
|
||||
var scenes = null;
|
||||
|
||||
@ -83,6 +84,10 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(event.data.type == "TDT_3D"){
|
||||
tdtUpdate(event.data);
|
||||
}
|
||||
|
||||
if (event.data.type== "PSD" && actions) {
|
||||
standupdate(event.data);
|
||||
return;
|
||||
@ -110,7 +115,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
||||
}
|
||||
};
|
||||
|
||||
this.updatamap = function(newsectionlist,newlinklist,newsignallist,newstationstandlist,newtrainlisttest,newrealsectionlist,newrails, materiallist, nowaction, scene) {
|
||||
this.updatamap = function(newsectionlist,newlinklist,newsignallist,newstationstandlist,newtrainlisttest,newrealsectionlist,newrails,newtdt, materiallist, nowaction, scene) {
|
||||
trainlisttest = newtrainlisttest;
|
||||
sectionlist = newsectionlist;
|
||||
signallist = newsignallist;
|
||||
@ -120,6 +125,7 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
||||
actions = nowaction;
|
||||
links = newlinklist;
|
||||
rails = newrails;
|
||||
tdt = newtdt;
|
||||
};
|
||||
|
||||
this.socketon = function(topic) {
|
||||
@ -152,6 +158,11 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
|
||||
}
|
||||
};
|
||||
|
||||
function tdtUpdate(data){
|
||||
|
||||
tdt.updateTdt(data.body);
|
||||
}
|
||||
|
||||
function trainRunNew(data){
|
||||
let code = data.code;
|
||||
|
||||
|
@ -26,7 +26,7 @@ export function PasserHuman() {
|
||||
originanima2 = originhuman2.animations;
|
||||
originhuman1.remove(originhuman1.children[2]);
|
||||
|
||||
for(let i=0;i<220;i++){
|
||||
for(let i=0;i<250;i++){
|
||||
let newhuman;
|
||||
createHumanModel(newhuman,waitGroup,mixers,new THREE.Vector3(0,0,0));
|
||||
}
|
||||
@ -123,9 +123,6 @@ export function PasserHuman() {
|
||||
}
|
||||
|
||||
if(humanlist.children[i].status == 1){
|
||||
|
||||
|
||||
|
||||
waitGroup.add(humanlist.children[i]);
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ import {StationStandListN} from '@/jlmap3d/main/newmodel/StationStandListN';
|
||||
import {SwitchListN} from '@/jlmap3d/main/newmodel/SwitchListN';
|
||||
import {RailListN} from '@/jlmap3d/main/newmodel/RailListN.js';
|
||||
import {TrainListN} from '@/jlmap3d/main/newmodel/TrainListN.js';
|
||||
import {TdtList} from '@/jlmap3d/main/newmodel/TdtList.js';
|
||||
|
||||
import { Loading } from 'element-ui';
|
||||
// import {SwitchModel} from '@/jlmap3d/model/SwitchModel.js';
|
||||
@ -62,6 +63,7 @@ export function DriverLoadNew(data,scope,netdata,mapdata,sectionlist,signallist,
|
||||
// realsectionlist = new RealSectionList();
|
||||
|
||||
rails = new RailListN();
|
||||
let tdt = new TdtList();
|
||||
|
||||
let sectiondata = JSON.parse(netdata.sections);
|
||||
let switchdata = JSON.parse(netdata.switchs);
|
||||
@ -86,6 +88,12 @@ export function DriverLoadNew(data,scope,netdata,mapdata,sectionlist,signallist,
|
||||
.then(function(data){
|
||||
return trainlisttest.drivertrain(mapdata.trainList,sceneload,assetloader,mixers,actions,"01");
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
//console.log(assetloader);
|
||||
console.log(stationstandlist);
|
||||
return tdt.initTdt(stationstandlist.list,mapdata.sectionList,rails.sectionrail,sceneload);
|
||||
})
|
||||
.then(function(data){
|
||||
return new Promise(function(resolve, reject){
|
||||
|
||||
@ -134,7 +142,7 @@ export function DriverLoadNew(data,scope,netdata,mapdata,sectionlist,signallist,
|
||||
|
||||
scope.animateswitch = true;
|
||||
backdata.loaderdata(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails);
|
||||
scope.Subscribe.updatamap(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails,scope.materiallist,scope.actions,scope.sceneload);
|
||||
scope.Subscribe.updatamap(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails,tdt,scope.materiallist,scope.actions,scope.sceneload);
|
||||
scope.webwork.postMessage("on");
|
||||
loadingInstance.close();
|
||||
});
|
||||
|
@ -6,6 +6,7 @@ import {SignalListN} from '@/jlmap3d/main/newmodel/SignalListN';
|
||||
import {StationStandListN} from '@/jlmap3d/main/newmodel/StationStandListN';
|
||||
import {SwitchListN} from '@/jlmap3d/main/newmodel/SwitchListN';
|
||||
import {RailListN} from '@/jlmap3d/main/newmodel/RailListN.js';
|
||||
import {TdtList} from '@/jlmap3d/main/newmodel/TdtList.js';
|
||||
|
||||
|
||||
import {Materialload} from '@/jlmap3d/main/loaders/Materialload.js';
|
||||
@ -58,6 +59,8 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce
|
||||
|
||||
rails = new RailListN();
|
||||
|
||||
let tdt = new TdtList();
|
||||
|
||||
let sectiondata = JSON.parse(netdata.sections);
|
||||
let switchdata = JSON.parse(netdata.switchs);
|
||||
let signaldata = JSON.parse(netdata.signals);
|
||||
@ -103,6 +106,12 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce
|
||||
//console.log(assetloader);
|
||||
return trainlisttest.initpromise(mapdata.trainList,sceneload,assetloader,mixers,actions,"02");
|
||||
})
|
||||
.then(function(data){
|
||||
//console.log(data);
|
||||
//console.log(assetloader);
|
||||
console.log(stationstandlist);
|
||||
return tdt.initTdt(stationstandlist.list,mapdata.sectionList,rails.sectionrail,sceneload);
|
||||
})
|
||||
.then(function(data){
|
||||
return new Promise(function(resolve, reject){
|
||||
|
||||
@ -163,7 +172,7 @@ export function SimulationLoadNew(data,scope,netdata,mapdata,camera,controls,sce
|
||||
controls.update();
|
||||
|
||||
backdata.loaderdata(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails);
|
||||
scope.Subscribe.updatamap(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails,scope.materiallist,scope.actions,scope.sceneload);
|
||||
scope.Subscribe.updatamap(sectionlist,linklist,signallist,stationstandlist,trainlisttest,realsectionlist,rails,tdt,scope.materiallist,scope.actions,scope.sceneload);
|
||||
scope.webwork.postMessage("on");
|
||||
scope.jsonwebworknew.postMessage("connect");
|
||||
updatemenulist(stationstandlist.list,trainlisttest.list);
|
||||
|
@ -27,7 +27,6 @@ export function StationStandListN() {
|
||||
|
||||
|
||||
|
||||
|
||||
for(let i=0;i<standsdata.length;i++){
|
||||
let newstationstand = new StationStandModel(standsdata[i]);
|
||||
|
||||
@ -201,7 +200,6 @@ export function StationStandListN() {
|
||||
}
|
||||
//
|
||||
//
|
||||
// console.log(standsdata);
|
||||
// console.log(psddata);
|
||||
for(let i=0;i<standsdata.length;i++){
|
||||
let newstationstand = new StationStandModel(standsdata[i]);
|
||||
|
100
src/jlmap3d/main/newmodel/TdtList.js
Normal file
100
src/jlmap3d/main/newmodel/TdtList.js
Normal file
@ -0,0 +1,100 @@
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||
export function TdtList() {
|
||||
let scope = this;
|
||||
|
||||
let materialList = [];
|
||||
|
||||
this.initTdt = function(stationData,sectionData,railData,scene){
|
||||
|
||||
return new Promise(function(resolve, reject){
|
||||
var loader = new THREE.FBXLoader();
|
||||
|
||||
loader.load( JL3D_LOCAL_STATIC+"/test/TDTModel.FBX" , function ( object ) {
|
||||
|
||||
let stopSections = [];
|
||||
for(let i=0;i<sectionData.length;i++){
|
||||
if(sectionData[i].standTrack == true){
|
||||
stopSections[sectionData[i].code] = sectionData[i];
|
||||
}
|
||||
}
|
||||
|
||||
for(let k in stationData){
|
||||
for(let i=0;i<stationData[k].stands.length;i++){
|
||||
let newmesh = object.clone(true);
|
||||
|
||||
newmesh.canvas = document.createElement("canvas");
|
||||
newmesh.canvas.width = 128;
|
||||
newmesh.canvas.height = 64;
|
||||
newmesh.getObjectByName("TDT").material = new THREE.MeshPhongMaterial();
|
||||
let newImg = new THREE.CanvasTexture(getTextCanvas(newmesh.canvas,"",30));
|
||||
newmesh.getObjectByName("TDT").material.map = newImg;
|
||||
newmesh.getObjectByName("TDT").material.needsUpdate = true;
|
||||
|
||||
materialList[stationData[k].stands[i].code] = newmesh;
|
||||
let sectionCode = stationData[k].stands[i].section;
|
||||
if(stationData[k].stands[i].right == true){
|
||||
newmesh.rotation.y = -Math.PI/2;
|
||||
let pos = railData[sectionCode].lineleft.getPointAt(stopSections[sectionCode].rightStopPointOffset/stopSections[sectionCode].lengthFact);
|
||||
newmesh.position.set(pos.x+10,0,pos.z-3);
|
||||
|
||||
}else{
|
||||
newmesh.rotation.y = Math.PI/2;
|
||||
let pos = railData[sectionCode].lineright.getPointAt(stopSections[sectionCode].rightStopPointOffset/stopSections[sectionCode].lengthFact);
|
||||
newmesh.position.set(pos.x-10,0,pos.z+3);
|
||||
|
||||
}
|
||||
|
||||
|
||||
scene.add(newmesh);
|
||||
}
|
||||
}
|
||||
|
||||
resolve("TdtLoad");
|
||||
} );
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
this.updateTdt = function(data){
|
||||
for(let i=0;i<data.length;i++){
|
||||
let newImg = null;
|
||||
|
||||
if(data[i].hold == true){
|
||||
newImg = new THREE.CanvasTexture(getTextCanvas(materialList[data[i].standCode].canvas,"H",30));
|
||||
}else if(data[i].jump == true){
|
||||
newImg = new THREE.CanvasTexture(getTextCanvas(materialList[data[i].standCode].canvas,"=",30));
|
||||
}else{
|
||||
newImg = new THREE.CanvasTexture(getTextCanvas(materialList[data[i].standCode].canvas,data[i].remain,30));
|
||||
}
|
||||
|
||||
materialList[data[i].standCode].getObjectByName("TDT").material.map = newImg;
|
||||
materialList[data[i].standCode].getObjectByName("TDT").material.map.needsUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
var beauty = new Image();
|
||||
beauty.src = JL3D_LOCAL_STATIC+"/test/tdttexture.jpg";
|
||||
//canvas文字贴图方法
|
||||
//PS:待提炼 增强功能
|
||||
function getTextCanvas(canvas,text,font){
|
||||
// let canvas = document.getElementById('canvastexture');
|
||||
|
||||
|
||||
|
||||
let ctx = canvas.getContext('2d');
|
||||
|
||||
ctx.fillRect(0, 0,128,64);
|
||||
ctx.font = font+"px Verdana";
|
||||
ctx.fillStyle = '#e9a26a';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.textBaseline = 'middle';
|
||||
ctx.clearRect(0,0,128,64);
|
||||
//console.log(text.groupNumber);
|
||||
ctx.drawImage(beauty,0,0,128, 64);
|
||||
ctx.fillText(text, 64,32);
|
||||
return canvas;
|
||||
}
|
||||
|
||||
|
||||
}
|
BIN
static/test/TDTModel.FBX
Normal file
BIN
static/test/TDTModel.FBX
Normal file
Binary file not shown.
BIN
static/test/tdttexture.jpg
Normal file
BIN
static/test/tdttexture.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
@ -687,7 +687,7 @@ function timedCount() {
|
||||
function callback(Response) {
|
||||
|
||||
data = JSON.parse(Response.body);
|
||||
|
||||
|
||||
|
||||
if(data.type == "Train_Position"){
|
||||
postMessage(data);
|
||||
@ -704,6 +704,10 @@ function timedCount() {
|
||||
return;
|
||||
}
|
||||
|
||||
if(data.type == 'TDT_3D'){
|
||||
postMessage(data);
|
||||
return;
|
||||
}
|
||||
|
||||
if(data.type == "DeviceCtrl_3D"){
|
||||
if (data.body.type== 'SIGNAL') {
|
||||
|
@ -725,6 +725,11 @@ function timedCount() {
|
||||
postMessage(data);
|
||||
return;
|
||||
}
|
||||
|
||||
if(data.type == 'TDT_3D'){
|
||||
postMessage(data);
|
||||
return;
|
||||
}
|
||||
if ( data.body.length > 300) {
|
||||
// console.log(data);
|
||||
postMessage(data);
|
||||
|
Loading…
Reference in New Issue
Block a user