【增加实训生成名称解析规则】

This commit is contained in:
weizhihong 2023-05-05 18:28:24 +08:00
parent fba36af273
commit 6a969fe843

View File

@ -7,7 +7,7 @@ import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import club.joylink.rtss.vo.map.graph.MapSignalButtonVO;
import club.joylink.rtss.vo.map.graph.MapStationNewVO;
import lombok.Getter;
import org.springframework.util.StringUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.*;
import java.util.regex.Matcher;
@ -19,22 +19,7 @@ public enum PropertyValueRule {
NAME("地图设备名称") {
@Override
public String resolve(Simulation simulation, Object mapElement) {
if (mapElement instanceof Signal) {
return ((Signal) mapElement).getShowName();
} else if (mapElement instanceof Stand) {
boolean upRight = simulation.getBuildParams().getMap().getConfigVO().getUpRight();
Stand stand = (Stand) mapElement;
return stand.getStation().getName() + (Objects.equals(upRight, stand.isRight()) ? "上行站台" : "下行站台");
} else if (mapElement instanceof Section) {
Section section = (Section) mapElement;
if (section.isLogicSection() && section.getParent() != null && StringUtils.hasText(section.getParent().getName())) {
return section.getParent().getName() + "_" + section.getName();
} else {
return section.getName();
}
} else {
return ((MapNamedElement) mapElement).getName();
}
return ((MapNamedElement) mapElement).getName();
}
},
CODE("地图设备编码") {
@ -70,6 +55,16 @@ public enum PropertyValueRule {
return stationNewVO.getJp();
}
},
STAND_UP_DOWN("站台上下行名称") {
@Override
public Object resolve(Simulation simulation, Object mapElement) {
if (mapElement instanceof Stand) {
boolean upRight = simulation.getBuildParams().getMap().getConfigVO().getUpRight();
return (Objects.equals(upRight, ((Stand) mapElement).isRight()) ? "上行" : "下行");
}
return StringUtils.EMPTY;
}
},
ROUTE_START_SIGNAL_NAME("进路起始名称") {
@Override
public String resolve(Simulation simulation, Object mapElement) {
@ -145,6 +140,15 @@ public enum PropertyValueRule {
return buttonVO.getCode();
}
},
SIGNAL_SHOW_NAME("信号机显示名称") {
@Override
public Object resolve(Simulation simulation, Object mapElement) {
if (mapElement instanceof Signal) {
return ((Signal) mapElement).getShowName();
}
return StringUtils.EMPTY;
}
},
SIGNAL_BUTTON_CODE("信号机按钮编码") {
@Override
public String resolve(Simulation simulation, Object mapElement) {
@ -201,6 +205,16 @@ public enum PropertyValueRule {
return ((Station) mapElement).getName();
}
},
SECTION_LOGIC_PARENT_NAME("逻辑区段父级名称") {
@Override
public Object resolve(Simulation simulation, Object mapElement) {
Section section = (Section) mapElement;
if (section.isLogicSection() && section.getParent() != null && StringUtils.isNotEmpty(section.getParent().getName())) {
return section.getParent().getName();
}
return StringUtils.EMPTY;
}
},
SWITCH_PHYSICAL_SECTION_CODE("道岔关联的物理区段编码") {
@Override
public Object resolve(Simulation simulation, Object mapElement) {