列车状态信息增加预选模式

This commit is contained in:
joylink_zhangsai 2021-12-13 10:38:05 +08:00
parent 46acce3f6b
commit 690acdba5f
3 changed files with 17 additions and 24 deletions

View File

@ -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.DeviceStatusVO;
import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo; 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.vo.TrainStatusVO;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Getter; import lombok.Getter;
@ -125,6 +126,8 @@ public class TrainStatus extends DeviceStatus {
private Boolean autoTrigger; private Boolean autoTrigger;
private VirtualRealityTrain.PreselectionMode preselectionMode;
public TrainStatus(TrainInfo train) { public TrainStatus(TrainInfo train) {
super(train.getGroupNumber(), MapElement.DeviceType.TRAIN); super(train.getGroupNumber(), MapElement.DeviceType.TRAIN);
this.groupNumber = train.getGroupNumber(); this.groupNumber = train.getGroupNumber();
@ -160,6 +163,7 @@ public class TrainStatus extends DeviceStatus {
this.turnBackStrategy = train.getTurnBackStrategy(); this.turnBackStrategy = train.getTurnBackStrategy();
this.turnBackStatus = train.getTurnBackStatus(); this.turnBackStatus = train.getTurnBackStatus();
this.autoTrigger = train.isAtsAutoTrigger(); this.autoTrigger = train.isAtsAutoTrigger();
this.preselectionMode = train.getPreselectionMode();
} }
/** /**
@ -325,36 +329,17 @@ public class TrainStatus extends DeviceStatus {
status.setAutoTrigger(this.autoTrigger); status.setAutoTrigger(this.autoTrigger);
change = true; change = true;
} }
if (!Objects.equals(this.preselectionMode, train.getPreselectionMode())) {
this.preselectionMode = train.getPreselectionMode();
status.setPreselectionMode(train.getPreselectionMode());
change = true;
}
return change; return change;
} }
@Override @Override
public DeviceStatusVO convert2VO(MapElement device) { public DeviceStatusVO convert2VO(MapElement device) {
return new TrainStatusVO(this); 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 @Override

View File

@ -268,6 +268,8 @@ public class TrainInfo extends MapElement {
/** 调度参数 */ /** 调度参数 */
private RegulationParam regulationParam; private RegulationParam regulationParam;
private VirtualRealityTrain.PreselectionMode preselectionMode;
public TrainInfo(String groupNumber) { public TrainInfo(String groupNumber) {
super(groupNumber, DeviceType.TRAIN); super(groupNumber, DeviceType.TRAIN);
this.groupNumber = groupNumber; this.groupNumber = groupNumber;
@ -416,6 +418,7 @@ public class TrainInfo extends MapElement {
} else if (speed != 0 && this.turnBackStatus.equals(STOP)) { } else if (speed != 0 && this.turnBackStatus.equals(STOP)) {
this.turnBackStatus = EXIT; this.turnBackStatus = EXIT;
} }
this.preselectionMode = train.getPreselectionMode();
} }
public boolean isCtcLevel() { public boolean isCtcLevel() {

View File

@ -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.constant.TrainType;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement; 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.status.TrainStatus;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@ -123,8 +124,11 @@ public class TrainStatusVO extends DeviceStatusVO {
private String turnBackStatus; private String turnBackStatus;
@JsonSerialize(using = Boolean2NumSerializer.class)
private Boolean autoTrigger; private Boolean autoTrigger;
private VirtualRealityTrain.PreselectionMode preselectionMode;
public TrainStatusVO(TrainInfo train) { public TrainStatusVO(TrainInfo train) {
super(train.getGroupNumber(), MapElement.DeviceType.TRAIN); super(train.getGroupNumber(), MapElement.DeviceType.TRAIN);
} }
@ -159,6 +163,7 @@ public class TrainStatusVO extends DeviceStatusVO {
this.turnBackStrategy = train.getTurnBackStrategy(); this.turnBackStrategy = train.getTurnBackStrategy();
this.turnBackStatus = train.getTurnBackStatus(); this.turnBackStatus = train.getTurnBackStatus();
this.autoTrigger = train.getAutoTrigger(); this.autoTrigger = train.getAutoTrigger();
this.preselectionMode = train.getPreselectionMode();
} }