From 690acdba5f75205c82f5abb7c6f4999a19726509 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Mon, 13 Dec 2021 10:38:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=97=E8=BD=A6=E7=8A=B6=E6=80=81=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=A2=9E=E5=8A=A0=E9=A2=84=E9=80=89=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cbtc/data/status/TrainStatus.java | 33 +++++-------------- .../simulation/cbtc/data/vo/TrainInfo.java | 3 ++ .../cbtc/data/vo/TrainStatusVO.java | 5 +++ 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/TrainStatus.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/TrainStatus.java index fb8077329..1caf40d3b 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/TrainStatus.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/TrainStatus.java @@ -8,6 +8,7 @@ import club.joylink.rtss.simulation.cbtc.data.map.MapElement; import club.joylink.rtss.simulation.cbtc.data.vo.DeviceStatusVO; import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo; import club.joylink.rtss.simulation.cbtc.data.vo.TrainStatusVO; +import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import lombok.Getter; @@ -125,6 +126,8 @@ public class TrainStatus extends DeviceStatus { private Boolean autoTrigger; + private VirtualRealityTrain.PreselectionMode preselectionMode; + public TrainStatus(TrainInfo train) { super(train.getGroupNumber(), MapElement.DeviceType.TRAIN); this.groupNumber = train.getGroupNumber(); @@ -160,6 +163,7 @@ public class TrainStatus extends DeviceStatus { this.turnBackStrategy = train.getTurnBackStrategy(); this.turnBackStatus = train.getTurnBackStatus(); this.autoTrigger = train.isAtsAutoTrigger(); + this.preselectionMode = train.getPreselectionMode(); } /** @@ -325,36 +329,17 @@ public class TrainStatus extends DeviceStatus { status.setAutoTrigger(this.autoTrigger); change = true; } + if (!Objects.equals(this.preselectionMode, train.getPreselectionMode())) { + this.preselectionMode = train.getPreselectionMode(); + status.setPreselectionMode(train.getPreselectionMode()); + change = true; + } return change; } @Override public DeviceStatusVO convert2VO(MapElement device) { return new TrainStatusVO(this); -// TrainStatusVO statusVO = new TrainStatusVO((TrainInfo) device); -// statusVO.setDt(dt); -// statusVO.setHold(hold); -// statusVO.setJump(jump); -// statusVO.setSpeed(speed); -// statusVO.setDoorCloseLock(doorCloseLock); -// statusVO.setDriveMode(driveMode); -// statusVO.setRunLevel(runLevel); -// statusVO.setRight(right); -// statusVO.setOffsetp(offsetp); -// statusVO.setPhysicalCode(physicalCode); -// statusVO.setSectionCode(sectionCode); -// statusVO.setType(type); -// statusVO.setDestinationCode(destinationCode); -// statusVO.setPlanRoutingType(planRoutingType); -// statusVO.setTripNumber(tripNumber); -// statusVO.setServiceNumber(serviceNumber); -// statusVO.setGroupNumber(groupNumber); -// statusVO.setDispose(dispose); -// statusVO.setStop(stop); -// statusVO.setBackUp(backUp); -// statusVO.setOrderStop(orderStop); -// statusVO.setCrewNumber(crewNumber); -// return statusVO; } @Override diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainInfo.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainInfo.java index e564cd0e9..e06919bb6 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainInfo.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainInfo.java @@ -268,6 +268,8 @@ public class TrainInfo extends MapElement { /** 调度参数 */ private RegulationParam regulationParam; + private VirtualRealityTrain.PreselectionMode preselectionMode; + public TrainInfo(String groupNumber) { super(groupNumber, DeviceType.TRAIN); this.groupNumber = groupNumber; @@ -416,6 +418,7 @@ public class TrainInfo extends MapElement { } else if (speed != 0 && this.turnBackStatus.equals(STOP)) { this.turnBackStatus = EXIT; } + this.preselectionMode = train.getPreselectionMode(); } public boolean isCtcLevel() { diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainStatusVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainStatusVO.java index c2d3ca17a..e12025405 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainStatusVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainStatusVO.java @@ -6,6 +6,7 @@ import club.joylink.rtss.simulation.cbtc.constant.RunLevel; import club.joylink.rtss.simulation.cbtc.constant.TrainType; import club.joylink.rtss.simulation.cbtc.data.map.MapElement; import club.joylink.rtss.simulation.cbtc.data.status.TrainStatus; +import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.annotation.JsonSerialize; @@ -123,8 +124,11 @@ public class TrainStatusVO extends DeviceStatusVO { private String turnBackStatus; + @JsonSerialize(using = Boolean2NumSerializer.class) private Boolean autoTrigger; + private VirtualRealityTrain.PreselectionMode preselectionMode; + public TrainStatusVO(TrainInfo train) { super(train.getGroupNumber(), MapElement.DeviceType.TRAIN); } @@ -159,6 +163,7 @@ public class TrainStatusVO extends DeviceStatusVO { this.turnBackStrategy = train.getTurnBackStrategy(); this.turnBackStatus = train.getTurnBackStatus(); this.autoTrigger = train.getAutoTrigger(); + this.preselectionMode = train.getPreselectionMode(); }