From f5c711da90e29130b009899343522421d510595d Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Mon, 6 Dec 2021 13:22:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B2=94=E5=BF=83=E6=89=80?= =?UTF-8?q?=E5=9C=A8=E8=AE=A1=E8=BD=B4=E5=8C=BA=E6=AE=B5=E9=A2=84=E5=A4=8D?= =?UTF-8?q?=E4=BD=8D=E6=88=90=E5=8A=9F=E5=90=8E=EF=BC=8C=E9=A2=84=E5=A4=8D?= =?UTF-8?q?=E4=BD=8D=E7=8A=B6=E6=80=81=E6=9C=AA=E6=B8=85=E9=99=A4=E7=9A=84?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/virtual/VRTrainRunningService.java | 25 ++++++------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/device/virtual/VRTrainRunningService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/device/virtual/VRTrainRunningService.java index f37495659..f1622561a 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/device/virtual/VRTrainRunningService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/device/virtual/VRTrainRunningService.java @@ -136,29 +136,20 @@ public class VRTrainRunningService { return; //进入计轴区段判断 - Section headAxleCounterSectionNew = headPositionNew.getSection(); - if (!headAxleCounterSectionNew.isAxleCounter()) { - headAxleCounterSectionNew = headAxleCounterSectionNew.getParent(); - } - if (!headAxleCounterSectionNew.isAxleCounter()) { //当是——物理区段-岔心-道岔计轴区段三层结构的时候需要多这次判断 - headAxleCounterSectionNew = headAxleCounterSectionNew.getParent(); - } - if (headAxleCounterSectionNew != null && headAxleCounterSectionNew.isAxleCounter()) { //新的区段是计轴区段 - Section headSectionOld = headPosition.getSection(); - if (!headAxleCounterSectionNew.equals(headSectionOld) && !headAxleCounterSectionNew.equals(headSectionOld.getParent())) { //新计轴区段和老区段不一样 + Section headAxleCounterSectionNew = headPositionNew.getSection().findAxleCounterSection(); + if (headAxleCounterSectionNew != null) { + Section headAxleCounterSection = headPosition.getSection().findAxleCounterSection(); + if (!headAxleCounterSectionNew.equals(headAxleCounterSection)) { //【车头所在计轴区段】发生变化 headAxleCounterSectionNew.getVirtualAxleCounter().trainIn(trainRight); } } //离开计轴区段判断 SectionPosition tailPositionOld = CalculateService.calculateNextPositionByStartAndLen(headPosition, !trainRight, train.getLen(), true); - Section tailAxleCounterSection = tailPositionOld.getSection(); - if (!tailAxleCounterSection.isAxleCounter()) { - tailAxleCounterSection = tailAxleCounterSection.getParent(); - } - if (tailAxleCounterSection != null && tailAxleCounterSection.isAxleCounter()) { //老的车尾区段是计轴区段 + Section tailAxleCounterSection = tailPositionOld.getSection().findAxleCounterSection(); + if (tailAxleCounterSection != null) { SectionPosition tailPositionNew = CalculateService.calculateNextPositionByStartAndLen(headPositionNew, !trainRight, train.getLen(), true); - Section tailSectionNew = tailPositionNew.getSection(); - if (!tailAxleCounterSection.equals(tailSectionNew) && !tailAxleCounterSection.equals(tailSectionNew.getParent())) { //老车尾计轴区段和新车尾区段不一样 + Section tailAxleCounterSectionNew = tailPositionNew.getSection().findAxleCounterSection(); + if (!tailAxleCounterSection.equals(tailAxleCounterSectionNew)) { //【车尾所在计轴区段】发生变化 tailAxleCounterSection.getVirtualAxleCounter().trainOut(trainRight); } }