From cc1af295458c9ad057cdd3ffb3792b747b1828a0 Mon Sep 17 00:00:00 2001 From: sunzhenyu Date: Wed, 15 Sep 2021 10:53:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=89=E7=BB=B4=E4=BB=BF?= =?UTF-8?q?=E7=9C=9F=E9=80=9A=E4=BF=A1=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jlmap3d/jl3ddevice/jl3ddeviceNew.js | 98 +++++++--- .../jl3ddrive/moveupdate/DrivingConnectNew.js | 172 +++++++++++------- src/jlmap3d/jl3dmaintainer/Jl3dfaultdevice.js | 93 +++++++--- .../jl3dpassflow/connect/passflowconnect.js | 20 +- .../connect/Jlmap3dSubscribeNew.js | 153 ++++++++++------ .../jl3dstationmanager/jl3dstationmanager.js | 1 + .../jl3dtrafficplan/jl3dtraffictrain.js | 2 + src/jlmap3d/main/newmodel/SwitchListN.js | 1 + src/utils/baseUrl.js | 9 +- static/workertest/driverWebWorker.js | 4 +- 10 files changed, 354 insertions(+), 199 deletions(-) diff --git a/src/jlmap3d/jl3ddevice/jl3ddeviceNew.js b/src/jlmap3d/jl3ddevice/jl3ddeviceNew.js index b6f250ed7..492348927 100644 --- a/src/jlmap3d/jl3ddevice/jl3ddeviceNew.js +++ b/src/jlmap3d/jl3ddevice/jl3ddeviceNew.js @@ -662,15 +662,16 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) { } //根据数据切换设备样式 this.updateaction = function (data) { + if (data.type == "SWITCH") { - if (data.normal == "0") { - scope.modelmanager.switchmodel.normalPosition = "0"; + if (data.command == 'NP') { + scope.modelmanager.switchmodel.normalPosition = data.command; scope.modelmanager.switchmodel.action.reset(); scope.modelmanager.switchmodel.action.time = 0; scope.modelmanager.switchmodel.action.timeScale = 1; scope.modelmanager.switchmodel.action.play(); - } else if (data.normal == "1") { - scope.modelmanager.switchmodel.normalPosition = "1"; + } else if (data.command == 'RP') { + scope.modelmanager.switchmodel.normalPosition = data.command; scope.modelmanager.switchmodel.action.reset(); scope.modelmanager.switchmodel.action.time = scope.modelmanager.switchmodel.action._clip.duration; scope.modelmanager.switchmodel.action.timeScale = -1; @@ -678,36 +679,79 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) { } } + if (data.type == "SIGNAL") {//从上往下红绿黄 - - if(data.red == 1){ - scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map = scope.signallights["red"]; + /** 无显示,灭灯 */ + if(data.command == 'No'){ + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map = materials["black"]; scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map.needsUpdate = true; - }else{ - scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map.needsUpdate = true; - } - if(data.yellow == 1){ - scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map = scope.signallights["yellow"]; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map = materials["black"]; scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map.needsUpdate = true; - }else{ - scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map.needsUpdate = true; - } - if(data.green == 1){ - - scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map = scope.signallights["green"]; - scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map.needsUpdate = true; - }else{ - scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map = scope.signallights["black"]; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map = materials["black"]; scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map.needsUpdate = true; } + /** 红 */ + if(data.command == 'R'){ + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map = materials["red"]; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map.needsUpdate = true; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map.needsUpdate = true; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map.needsUpdate = true; + } + /** 绿 */ + if(data.command == 'G'){ + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map.needsUpdate = true; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map.needsUpdate = true; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map = materials["green"]; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map.needsUpdate = true; + } + /** 黄 */ + if(data.command == 'Y'){ + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map.needsUpdate = true; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map = materials["yellow"]; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map.needsUpdate = true; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map.needsUpdate = true; + } + /** 月白 */ + if(data.command == 'W'){ + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map.needsUpdate = true; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map.needsUpdate = true; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map.needsUpdate = true; + } + /** 蓝 */ + if(data.command == 'B'){ + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map.needsUpdate = true; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map.needsUpdate = true; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map.needsUpdate = true; + } + /** 红黄 */ + if(data.command == 'RY'){ + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map = materials["red"]; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d001").material.map.needsUpdate = true; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map = materials["yellow"]; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d002").material.map.needsUpdate = true; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.getObjectByName("d3d003").material.map.needsUpdate = true; + } + } if (data.type == "PSD" || data.type == "STAND") { + if (data.code == scope.nowcode) { - if (data.open == "1" ) { - scope.modelmanager.standmodel.screenDoorOpenStatus = "0"; + if (data.command == 'K' ) { + scope.modelmanager.standmodel.screenDoorOpenStatus = data.command; scope.modelmanager.standmodel.action.reset(); scope.modelmanager.standmodel.action.time = 0; @@ -717,8 +761,8 @@ export function Jl3ddeviceNew(dom,group,token,skinCode) { localVoicePlay("开往"+psdVoiceStationList[data.code].finlStationName+"方向的列车进站了!"); } - if (data.open == "0" ) { - scope.modelmanager.standmodel.screenDoorOpenStatus = "1"; + if (data.command == 'G' ) { + scope.modelmanager.standmodel.screenDoorOpenStatus = data.command; scope.modelmanager.standmodel.action.reset(); scope.modelmanager.standmodel.action.time = scope.modelmanager.standmodel.action._clip.duration; diff --git a/src/jlmap3d/jl3ddrive/moveupdate/DrivingConnectNew.js b/src/jlmap3d/jl3ddrive/moveupdate/DrivingConnectNew.js index d9d2f377d..b9523ead7 100644 --- a/src/jlmap3d/jl3ddrive/moveupdate/DrivingConnectNew.js +++ b/src/jlmap3d/jl3ddrive/moveupdate/DrivingConnectNew.js @@ -81,7 +81,6 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri return; } - if(data.type == "DeviceCtrl_3D"){ // console.log(data); if (data.body.type== 'SIGNAL' && signallist) { @@ -822,12 +821,12 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri // console.log("direct:"+trainmodel.right); // console.log(trainmodel.openleft); // console.log(trainmodel.openright); - if(trainmodel.code == data.code){ + if(trainmodel.code == data.trainCode){ if(trainmodel.right == "0"){ - if(data.doorCode == "2"){ + if(data.code == "2"){ - if(trainmodel.openleft != data.open && data.open == "0"){ - trainmodel.openleft = "0"; + if(trainmodel.openleft != data.command && data.command == "G"){ + trainmodel.openleft = data.command; for(let an=actions["traindoor"].top.length-1;an>=0;an--){ actions["traindoor"].top[an].reset(); actions["traindoor"].top[an].time = actions["traindoor"].top[an]._clip.duration; @@ -835,8 +834,8 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri actions["traindoor"].top[an].play(); } - }else if(trainmodel.openleft != data.open && data.open == "1"){ - trainmodel.openleft = "1"; + }else if(trainmodel.openleft != data.command && data.command == "K"){ + trainmodel.openleft = data.command; for(let an=actions["traindoor"].top.length-1;an>=0;an--){ actions["traindoor"].top[an].reset(); actions["traindoor"].top[an].time = 0; @@ -847,16 +846,16 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri }else{ - if (trainmodel.openright != data.open && data.open == '0') { - trainmodel.openright = '0'; + if (trainmodel.openright != data.command && data.command == 'G') { + trainmodel.openright = data.command; for (let an=actions["traindoor"].down.length-1; an>=0; an--) { actions["traindoor"].down[an].reset(); actions["traindoor"].down[an].time = actions["traindoor"].down[an]._clip.duration; actions["traindoor"].down[an].timeScale = -1; actions["traindoor"].down[an].play(); } - } else if (trainmodel.openright != data.open && data.open == '1') { - trainmodel.openright = "1"; + } else if (trainmodel.openright != data.command && data.command == 'K') { + trainmodel.openright = data.command; for(let an=actions["traindoor"].down.length-1;an>=0;an--){ actions["traindoor"].down[an].reset(); actions["traindoor"].down[an].time = 0; @@ -867,18 +866,18 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri } }else{ - if(data.doorCode == "1"){ + if(data.code == "1"){ - if(trainmodel.openleft != data.open && data.open == "0"){ - trainmodel.openleft = "0"; + if(trainmodel.openleft != data.command && data.command == "G"){ + trainmodel.openleft = data.command; for(let an=actions["traindoor"].top.length-1;an>=0;an--){ actions["traindoor"].top[an].reset(); actions["traindoor"].top[an].time = actions["traindoor"].top[an]._clip.duration; actions["traindoor"].top[an].timeScale = -1; actions["traindoor"].top[an].play(); } - }else if(trainmodel.openleft != data.open && data.open == "1"){ - trainmodel.openleft = "1"; + }else if(trainmodel.openleft != data.command && data.command == "K"){ + trainmodel.openleft = data.command; for(let an=actions["traindoor"].top.length-1;an>=0;an--){ actions["traindoor"].top[an].reset(); actions["traindoor"].top[an].time = 0; @@ -887,16 +886,16 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri } } }else{ - if (trainmodel.openright != data.open && data.open == '0') { - trainmodel.openright = '0'; + if (trainmodel.openright != data.command && data.command == 'G') { + trainmodel.openright = data.command; for (let an=actions["traindoor"].down.length-1; an>=0; an--) { actions["traindoor"].down[an].reset(); actions["traindoor"].down[an].time = actions["traindoor"].down[an]._clip.duration; actions["traindoor"].down[an].timeScale = -1; actions["traindoor"].down[an].play(); } - } else if (trainmodel.openright != data.open && data.open == '1') { - trainmodel.openright = "1"; + } else if (trainmodel.openright != data.command && data.command == 'K') { + trainmodel.openright = data.command; for(let an=actions["traindoor"].down.length-1;an>=0;an--){ actions["traindoor"].down[an].reset(); actions["traindoor"].down[an].time = 0; @@ -969,15 +968,15 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri function initstand(data) { code = data.code; if ( actions[code]) { - if (data.close == '1') { - actions[code].status = '1'; + if (data.command == 'K') { + actions[code].status = data.command; actions[code].action.reset(); actions[code].action.time = 0; actions[code].action.timeScale = 1; actions[code].action.play(); } - if (data.close == '0') { - actions[code].status = '0'; + if (data.command == 'G') { + actions[code].status = data.command; actions[code].action.reset(); actions[code].action.time = actions[code].action._clip.duration; actions[code].action.timeScale = -1; @@ -987,17 +986,17 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri } function standupdate(data) { code = data.code; - + console.log(data); if ( actions[code]) { - if (data.open == '1') { - actions[code].status = '1'; + if (data.command == 'K') { + actions[code].status = data.command; actions[code].action.reset(); actions[code].action.time = 0; actions[code].action.timeScale = 1; actions[code].action.play(); } - if (data.open == '0') { - actions[code].status = '0'; + if (data.command == 'G') { + actions[code].status = data.command; actions[code].action.reset(); actions[code].action.time = actions[code].action._clip.duration; actions[code].action.timeScale = -1; @@ -1008,72 +1007,107 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri function signalupdate(data) { code = data.code; console.log(data); - if(data.red == 1){ - signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"]; - signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true; - }else{ + if(data.command == 'No'){ signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"]; signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true; - } - - if(data.yellow == 1){ - signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"]; - signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true; - - }else{ signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"]; signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true; - - } - - if(data.green == 1){ - signallist.list[code].mesh.getObjectByName("green").material.map = materials["green"]; - signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true; - - }else{ signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"]; signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true; - + } + /** 红 */ + if(data.command == 'R'){ + signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"]; + signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true; + signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true; + signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true; + } + /** 绿 */ + if(data.command == 'G'){ + signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true; + signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true; + signallist.list[code].mesh.getObjectByName("green").material.map = materials["green"]; + signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true; + } + /** 黄 */ + if(data.command == 'Y'){ + signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true; + signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"]; + signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true; + signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true; + } + /** 月白 */ + if(data.command == 'W'){ + signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true; + signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true; + signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true; + } + /** 蓝 */ + if(data.command == 'B'){ + signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true; + signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true; + signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true; + } + /** 红黄 */ + if(data.command == 'RY'){ + signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"]; + signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true; + signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"]; + signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true; + signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true; } } function initswitch(data) { code = data.code; - if (data.routeLock == '0') { - // sectionlist.switchs.modellist[j].normal = data.normal; - actions[code].action.reset(); - actions[code].action.time = 0; - actions[code].action.timeScale = 1; - actions[code].action.play(); - actions[code].normal = "02"; - } else if (data.routeLock == '1') { - // sectionlist.switchs.modellist[j].normal = data.normal; - actions[code].action.reset(); - actions[code].action.time = actions[code].action._clip.duration; - actions[code].action.timeScale = -1; - actions[code].action.play(); - actions[code].normal = "01"; - } + if (data.command == 'NP') { + // sectionlist.switchs.modellist[j].normal = data.normal; + actions[code].action.reset(); + actions[code].action.time = 0; + actions[code].action.timeScale = 1; + actions[code].action.play(); + actions[code].command = data.command; + } else if (data.command == 'RP') { + // sectionlist.switchs.modellist[j].normal = data.normal; + actions[code].action.reset(); + actions[code].action.time = actions[code].action._clip.duration; + actions[code].action.timeScale = -1; + actions[code].action.play(); + actions[code].command = data.command; + } } function switchupdate(data) { code = data.code; - if (actions[code].normal != data.normal) { - if (data.normal == '02') { + if (actions[code].command != data.command) { + if (data.command == 'NP') { // sectionlist.switchs.modellist[j].normal = data.normal; actions[code].action.reset(); actions[code].action.time = 0; actions[code].action.timeScale = 1; actions[code].action.play(); - actions[code].normal = "02"; - } else if (data.normal == '01') { + actions[code].command = data.command; + } else if (data.command == 'RP') { // sectionlist.switchs.modellist[j].normal = data.normal; actions[code].action.reset(); actions[code].action.time = actions[code].action._clip.duration; actions[code].action.timeScale = -1; actions[code].action.play(); - actions[code].normal = "01"; + actions[code].command = data.command; } } } diff --git a/src/jlmap3d/jl3dmaintainer/Jl3dfaultdevice.js b/src/jlmap3d/jl3dmaintainer/Jl3dfaultdevice.js index 943821e8c..39e88e2db 100644 --- a/src/jlmap3d/jl3dmaintainer/Jl3dfaultdevice.js +++ b/src/jlmap3d/jl3dmaintainer/Jl3dfaultdevice.js @@ -434,14 +434,14 @@ export function Jl3dfaultdevice(dom,group,token,skinCode) { this.updateaction = function (data) { if (data.type == "SWITCH") { - if (data.normal == "0") { - scope.modelmanager.switchmodel.normalPosition = "0"; + if (data.command == 'NP') { + scope.modelmanager.switchmodel.normalPosition = data.command; scope.modelmanager.switchmodel.action.reset(); scope.modelmanager.switchmodel.action.time = 0; scope.modelmanager.switchmodel.action.timeScale = 1; scope.modelmanager.switchmodel.action.play(); - } else if (data.normal == "1") { - scope.modelmanager.switchmodel.normalPosition = "1"; + } else if (data.command == 'RP') { + scope.modelmanager.switchmodel.normalPosition = data.command; scope.modelmanager.switchmodel.action.reset(); scope.modelmanager.switchmodel.action.time = scope.modelmanager.switchmodel.action._clip.duration; scope.modelmanager.switchmodel.action.timeScale = -1; @@ -450,34 +450,77 @@ export function Jl3dfaultdevice(dom,group,token,skinCode) { } if (data.type == "SIGNAL") {//从上往下红绿黄 - if(data.red == 1){ - scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["red"]; + + if(data.command == 'No'){ + scope.modelmanager.signalmodel.mesh.children[0].material.map = materials["black"]; scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true; - }else{ - scope.modelmanager.signalmodel.mesh.children[0].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true; - } - if(data.yellow == 1){ - scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["yellow"]; + scope.modelmanager.signalmodel.mesh.children[2].material.map = materials["black"]; scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true; - }else{ - scope.modelmanager.signalmodel.mesh.children[2].material.map = scope.signallights["black"]; - scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true; - } - if(data.green == 1){ - scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["green"]; - scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true; - }else{ - scope.modelmanager.signalmodel.mesh.children[1].material.map = scope.signallights["black"]; + scope.modelmanager.signalmodel.mesh.children[1].material.map = materials["black"]; scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true; } + /** 红 */ + if(data.command == 'R'){ + scope.modelmanager.signalmodel.mesh.children[0].material.map = materials["red"]; + scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true; + scope.modelmanager.signalmodel.mesh.children[2].material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true; + scope.modelmanager.signalmodel.mesh.children[1].material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true; + } + /** 绿 */ + if(data.command == 'G'){ + scope.modelmanager.signalmodel.mesh.children[0].material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true; + scope.modelmanager.signalmodel.mesh.children[2].material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true; + scope.modelmanager.signalmodel.mesh.children[1].material.map = materials["green"]; + scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true; + } + /** 黄 */ + if(data.command == 'Y'){ + scope.modelmanager.signalmodel.mesh.children[0].material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true; + scope.modelmanager.signalmodel.mesh.children[2].material.map = materials["yellow"]; + scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true; + scope.modelmanager.signalmodel.mesh.children[1].material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true; + } + /** 月白 */ + if(data.command == 'W'){ + scope.modelmanager.signalmodel.mesh.children[0].material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true; + scope.modelmanager.signalmodel.mesh.children[2].material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true; + scope.modelmanager.signalmodel.mesh.children[1].material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true; + } + /** 蓝 */ + if(data.command == 'B'){ + scope.modelmanager.signalmodel.mesh.children[0].material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true; + scope.modelmanager.signalmodel.mesh.children[2].material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true; + scope.modelmanager.signalmodel.mesh.children[1].material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true; + } + /** 红黄 */ + if(data.command == 'RY'){ + scope.modelmanager.signalmodel.mesh.children[0].material.map = materials["red"]; + scope.modelmanager.signalmodel.mesh.children[0].material.map.needsUpdate = true; + scope.modelmanager.signalmodel.mesh.children[2].material.map = materials["yellow"]; + scope.modelmanager.signalmodel.mesh.children[2].material.map.needsUpdate = true; + scope.modelmanager.signalmodel.mesh.children[1].material.map = materials["black"]; + scope.modelmanager.signalmodel.mesh.children[1].material.map.needsUpdate = true; + } + } if (data.type == "PSD") { if (data.code == scope.nowcode) { - if (data.open == "1" ) { - scope.modelmanager.standmodel.screenDoorOpenStatus = "0"; + if (data.command == 'K' ) { + scope.modelmanager.standmodel.screenDoorOpenStatus = data.command; scope.modelmanager.standmodel.action.reset(); scope.modelmanager.standmodel.action.time = 0; @@ -485,8 +528,8 @@ export function Jl3dfaultdevice(dom,group,token,skinCode) { scope.modelmanager.standmodel.action.play(); } - if (data.open == "0" ) { - scope.modelmanager.standmodel.screenDoorOpenStatus = "1"; + if (data.command == 'G' ) { + scope.modelmanager.standmodel.screenDoorOpenStatus = data.command; scope.modelmanager.standmodel.action.reset(); scope.modelmanager.standmodel.action.time = scope.modelmanager.standmodel.action._clip.duration; diff --git a/src/jlmap3d/jl3dpassflow/connect/passflowconnect.js b/src/jlmap3d/jl3dpassflow/connect/passflowconnect.js index 9c9e856bf..a480927db 100644 --- a/src/jlmap3d/jl3dpassflow/connect/passflowconnect.js +++ b/src/jlmap3d/jl3dpassflow/connect/passflowconnect.js @@ -33,7 +33,7 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe if(data.type == "DeviceCtrl_3D"){ if(data.body.type == "PSD"){ if(data.body.code == passerStation.nowStation.toppsd){ - if(data.body.open == 0){ + if(data.body.command == 'G'){ deviceaction.top.action.reset(); deviceaction.top.action.time =deviceaction.top.action._clip.duration; @@ -48,7 +48,7 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe } } if(data.body.code == passerStation.nowStation.downpsd){ - if(data.body.open == 0){ + if(data.body.command == 'G'){ deviceaction.down.action.reset(); deviceaction.down.action.time = deviceaction.down.action._clip.duration; deviceaction.down.action.timeScale = -1; @@ -64,24 +64,24 @@ export function PassflowConnect(deviceaction,toptrain,downtrain,routegroup,passe } } if(data.body.type == "TRAIN_DOOR"){ - if(toptrain.nowcode == data.body.code){ + if(toptrain.nowcode == data.body.trainCode){ - if(data.body.open == "0"){ - closetraindoor(toptrain,data.body.doorCode,"top"); + if(data.body.command == 'G'){ + closetraindoor(toptrain,data.body.code,"top"); }else{ - opentraindoor(toptrain,data.body.doorCode,"top"); + opentraindoor(toptrain,data.body.code,"top"); } } - if(downtrain.nowcode == data.body.code){ + if(downtrain.nowcode == data.body.trainCode){ // console.log(data.body); - if(data.body.open == "0"){ - closetraindoor(downtrain,data.body.doorCode,"down"); + if(data.body.command == 'G'){ + closetraindoor(downtrain,data.body.code,"down"); }else{ - opentraindoor(downtrain,data.body.doorCode,"down"); + opentraindoor(downtrain,data.body.code,"down"); } diff --git a/src/jlmap3d/jl3dsimulation/connect/Jlmap3dSubscribeNew.js b/src/jlmap3d/jl3dsimulation/connect/Jlmap3dSubscribeNew.js index 3f5b1d6f3..4e65a0c66 100644 --- a/src/jlmap3d/jl3dsimulation/connect/Jlmap3dSubscribeNew.js +++ b/src/jlmap3d/jl3dsimulation/connect/Jlmap3dSubscribeNew.js @@ -165,7 +165,6 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) { function trainRunNew(data){ let code = data.code; - if(trainlisttest.list[code].right != data.right){ if(data.right == "0"){ @@ -609,20 +608,20 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) { } function traindoorupdate(data){ - let code = data.code; + let code = data.trainCode; if(trainlisttest.list[code].right == "0"){ - if(data.doorCode == "2"){ + if(data.code == "2"){ - if(trainlisttest.list[code].openleft != data.open && data.open == "0"){ - trainlisttest.list[code].openleft = "0"; + if(trainlisttest.list[code].openleft != data.command && data.command == "G"){ + trainlisttest.list[code].openleft = data.command; for(let an=actions[code].top.length-1;an>=0;an--){ actions[code].top[an].reset(); actions[code].top[an].time = actions[code].top[an]._clip.duration; actions[code].top[an].timeScale = -1; actions[code].top[an].play(); } - }else if(trainlisttest.list[code].openleft != data.open && data.open == "1"){ - trainlisttest.list[code].openleft = "1"; + }else if(trainlisttest.list[code].openleft != data.command && data.command == "K"){ + trainlisttest.list[code].openleft = data.command; for(let an=actions[code].top.length-1;an>=0;an--){ actions[code].top[an].reset(); actions[code].top[an].time = 0; @@ -633,16 +632,16 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) { }else{ - if (trainlisttest.list[code].openright != data.open && data.open == '0') { - trainlisttest.list[code].openright = '0'; + if (trainlisttest.list[code].openright != data.command && data.command == 'G') { + trainlisttest.list[code].openright = data.command; for (let an=actions[code].down.length-1; an>=0; an--) { actions[code].down[an].reset(); actions[code].down[an].time = actions[code].down[an]._clip.duration; actions[code].down[an].timeScale = -1; actions[code].down[an].play(); } - } else if (trainlisttest.list[code].openright != data.open && data.open == '1') { - trainlisttest.list[code].openright = "1"; + } else if (trainlisttest.list[code].openright != data.command && data.command == 'K') { + trainlisttest.list[code].openright = data.command; for(let an=actions[code].down.length-1;an>=0;an--){ actions[code].down[an].reset(); actions[code].down[an].time = 0; @@ -653,18 +652,18 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) { } }else{ - if(data.doorCode == "1"){ + if(data.code == "1"){ - if(trainlisttest.list[code].openleft != data.open && data.open == "0"){ - trainlisttest.list[code].openleft = "0"; + if(trainlisttest.list[code].openleft != data.command && data.command == "G"){ + trainlisttest.list[code].openleft = data.command; for(let an=actions[code].top.length-1;an>=0;an--){ actions[code].top[an].reset(); actions[code].top[an].time = actions[code].top[an]._clip.duration; actions[code].top[an].timeScale = -1; actions[code].top[an].play(); } - }else if(trainlisttest.list[code].openleft != data.open && data.open == "1"){ - trainlisttest.list[code].openleft = "1"; + }else if(trainlisttest.list[code].openleft != data.command && data.command == "K"){ + trainlisttest.list[code].openleft = data.command; for(let an=actions[code].top.length-1;an>=0;an--){ actions[code].top[an].reset(); actions[code].top[an].time = 0; @@ -675,16 +674,16 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) { }else{ - if (trainlisttest.list[code].openright != data.open && data.open == '0') { - trainlisttest.list[code].openright = '0'; + if (trainlisttest.list[code].openright != data.command && data.command == 'G') { + trainlisttest.list[code].openright = data.command; for (let an=actions[code].down.length-1; an>=0; an--) { actions[code].down[an].reset(); actions[code].down[an].time = actions[code].down[an]._clip.duration; actions[code].down[an].timeScale = -1; actions[code].down[an].play(); } - } else if (trainlisttest.list[code].openright != data.open && data.open == '1') { - trainlisttest.list[code].openright = "1"; + } else if (trainlisttest.list[code].openright != data.command && data.command == 'K') { + trainlisttest.list[code].openright = data.command; for(let an=actions[code].down.length-1;an>=0;an--){ actions[code].down[an].reset(); actions[code].down[an].time = 0; @@ -696,6 +695,8 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) { } } + + } function trainstatus(data){ @@ -758,15 +759,15 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) { function initstand(data) { code = data.code; if ( actions[code]) { - if (data.close == '1') { - actions[code].status = '1'; + if (data.command == 'K') { + actions[code].status = data.command; actions[code].action.reset(); actions[code].action.time = 0; actions[code].action.timeScale = 1; actions[code].action.play(); } - if (data.close == '0') { - actions[code].status = '0'; + if (data.command == 'G') { + actions[code].status = data.command; actions[code].action.reset(); actions[code].action.time = actions[code].action._clip.duration; actions[code].action.timeScale = -1; @@ -776,17 +777,16 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) { } function standupdate(data) { code = data.code; - if ( actions[code]) { - if (data.open == '1') { - actions[code].status = '1'; + if (data.command == 'K') { + actions[code].status = data.command; actions[code].action.reset(); actions[code].action.time = 0; actions[code].action.timeScale = 1; actions[code].action.play(); } - if (data.open == '0') { - actions[code].status = '0'; + if (data.command == 'G') { + actions[code].status = data.command; actions[code].action.reset(); actions[code].action.time = actions[code].action._clip.duration; actions[code].action.timeScale = -1; @@ -797,33 +797,70 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) { function signalupdate(data) { code = data.code; if(signallist.list[code]){ - if(data.red == 1){ - signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"]; - signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true; - }else{ + /** 无显示,灭灯 */ + if(data.command == 'No'){ signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"]; signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true; - } - - if(data.yellow == 1){ - signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"]; - signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true; - - }else{ signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"]; signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true; - - } - - if(data.green == 1){ - signallist.list[code].mesh.getObjectByName("green").material.map = materials["green"]; - signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true; - - }else{ signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"]; signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true; - } + /** 红 */ + if(data.command == 'R'){ + signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"]; + signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true; + signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true; + signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true; + } + /** 绿 */ + if(data.command == 'G'){ + signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true; + signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true; + signallist.list[code].mesh.getObjectByName("green").material.map = materials["green"]; + signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true; + } + /** 黄 */ + if(data.command == 'Y'){ + signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true; + signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"]; + signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true; + signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true; + } + /** 月白 */ + if(data.command == 'W'){ + signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true; + signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true; + signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true; + } + /** 蓝 */ + if(data.command == 'B'){ + signallist.list[code].mesh.getObjectByName("red").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true; + signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true; + signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true; + } + /** 红黄 */ + if(data.command == 'RY'){ + signallist.list[code].mesh.getObjectByName("red").material.map = materials["red"]; + signallist.list[code].mesh.getObjectByName("red").material.map.needsUpdate = true; + signallist.list[code].mesh.getObjectByName("yellow").material.map = materials["yellow"]; + signallist.list[code].mesh.getObjectByName("yellow").material.map.needsUpdate = true; + signallist.list[code].mesh.getObjectByName("green").material.map = materials["black"]; + signallist.list[code].mesh.getObjectByName("green").material.map.needsUpdate = true; + } + } @@ -831,40 +868,40 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) { function initswitch(data) { code = data.code; - if (data.routeLock == '0') { + if (data.command == 'NP') { // sectionlist.switchs.modellist[j].normal = data.normal; actions[code].action.reset(); actions[code].action.time = 0; actions[code].action.timeScale = 1; actions[code].action.play(); - actions[code].normal = "02"; - } else if (data.routeLock == '1') { + actions[code].command = data.command; + } else if (data.command == 'RP') { // sectionlist.switchs.modellist[j].normal = data.normal; actions[code].action.reset(); actions[code].action.time = actions[code].action._clip.duration; actions[code].action.timeScale = -1; actions[code].action.play(); - actions[code].normal = "01"; + actions[code].command = data.command; } } function switchupdate(data) { code = data.code; - if (actions[code].normal != data.normal) { - if (data.normal == '1') { + if (actions[code].command != data.command) { + if (data.command == 'NP') { // sectionlist.switchs.modellist[j].normal = data.normal; actions[code].action.reset(); actions[code].action.time = 0; actions[code].action.timeScale = 1; actions[code].action.play(); - actions[code].normal = "1"; - } else if (data.normal == '0') { + actions[code].command = data.command; + } else if (data.command == 'RP') { // sectionlist.switchs.modellist[j].normal = data.normal; actions[code].action.reset(); actions[code].action.time = actions[code].action._clip.duration; actions[code].action.timeScale = -1; actions[code].action.play(); - actions[code].normal = "0"; + actions[code].command = data.command; } } } diff --git a/src/jlmap3d/jl3dstationmanager/jl3dstationmanager.js b/src/jlmap3d/jl3dstationmanager/jl3dstationmanager.js index d284adab7..9725866f4 100644 --- a/src/jlmap3d/jl3dstationmanager/jl3dstationmanager.js +++ b/src/jlmap3d/jl3dstationmanager/jl3dstationmanager.js @@ -60,6 +60,7 @@ let passerWebWork = new Worker(JL3D_LOCAL_STATIC+"/workertest/trafficplan/traffi //老版本临时ai控制 let olddataai = false; +//北交大车站管理 export function Jl3dStationManager(dom,skinCode,routegroup,initCode) { // let stats = new Stats(); diff --git a/src/jlmap3d/jl3dtrafficplan/jl3dtraffictrain.js b/src/jlmap3d/jl3dtrafficplan/jl3dtraffictrain.js index 022bcb3af..416affeda 100644 --- a/src/jlmap3d/jl3dtrafficplan/jl3dtraffictrain.js +++ b/src/jlmap3d/jl3dtrafficplan/jl3dtraffictrain.js @@ -60,6 +60,8 @@ let passerWebWork = new Worker(JL3D_LOCAL_STATIC+"/workertest/passsimulation/sta //老版本临时ai控制 let olddataai = false; + +//北交大列车管理 export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap,initCode) { // let stats = new Stats(); diff --git a/src/jlmap3d/main/newmodel/SwitchListN.js b/src/jlmap3d/main/newmodel/SwitchListN.js index 121bcd544..97ae60643 100644 --- a/src/jlmap3d/main/newmodel/SwitchListN.js +++ b/src/jlmap3d/main/newmodel/SwitchListN.js @@ -52,6 +52,7 @@ export function SwitchListN() { let mixer = new THREE.AnimationMixer( autoswitch ); actions[autoswitch.code] = { normal:"00", + command:"", action:mixer.clipAction( autoswitch.animations[0]) }; actions[autoswitch.code].action.setLoop(THREE.LoopOnce); diff --git a/src/utils/baseUrl.js b/src/utils/baseUrl.js index 24ced2811..0ce0f8d5c 100644 --- a/src/utils/baseUrl.js +++ b/src/utils/baseUrl.js @@ -2,15 +2,10 @@ 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'; -<<<<<<< HEAD + // BASE_API = 'https://test.joylink.club/jlcloud'; // BASE_API = 'http://192.168.8.107:9000'; // 袁琪 // BASE_API = 'http://192.168.2.175:9000'; // 旭强 有线 - // BASE_API = 'http://192.168.8.167:9000'; // 旭强 无线 -======= - // BASE_API = 'http://192.168.8.152:9000'; // 袁琪 - // BASE_API = 'http://192.168.8.177:9000'; // 旭强 ->>>>>>> 79439f4a2895543c4db07d0c52dd059c1935b2d7 + BASE_API = 'http://192.168.8.177:9000'; // 旭强 无线 // BASE_API = 'http://192.168.2.183:9000'; // 张赛 // BASE_API = 'http://192.168.8.140:9000'; // 杜康 // BASE_API = 'http://b29z135112.zicp.vip'; diff --git a/static/workertest/driverWebWorker.js b/static/workertest/driverWebWorker.js index 0beceac53..30e7a0dab 100644 --- a/static/workertest/driverWebWorker.js +++ b/static/workertest/driverWebWorker.js @@ -687,8 +687,6 @@ function timedCount() { function callback(Response) { data = JSON.parse(Response.body); - // - // console.log(data); // console.log(data.type); if(data.type == "Train_Position"){ postMessage(data); @@ -716,7 +714,7 @@ function timedCount() { return; } - if (data.body.type== "PSD") { + if (data.body.deviceType== "PSD") { postMessage(data); return; }