diff --git a/src/main/java/club/joylink/rtss/services/draftData/DraftMapCiDataGeneratorImpl.java b/src/main/java/club/joylink/rtss/services/draftData/DraftMapCiDataGeneratorImpl.java index 292803a2c..7917c72ec 100644 --- a/src/main/java/club/joylink/rtss/services/draftData/DraftMapCiDataGeneratorImpl.java +++ b/src/main/java/club/joylink/rtss/services/draftData/DraftMapCiDataGeneratorImpl.java @@ -1074,9 +1074,40 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator { private RouteFls buildNpFls(Switch aSwitch) { RouteFls fls = new RouteFls(new SwitchElement(aSwitch, true)); + // 暂时只生成一级侧防 Switch linkedSwitch = aSwitch.queryLinkedSwitch(); if (Objects.nonNull(linkedSwitch)) { - + // 联动道岔存在,联动道岔定位即为一级侧防 + RouteFls.FlsElement flsElement = new RouteFls.FlsElement(new SwitchElement(linkedSwitch, true)); + fls.addLevel1(flsElement); + } else { + // 无联动道岔,则从道岔B区段向外查询,第一个反向信号机和经过的路径道岔位置构成一级侧防 + Section c = aSwitch.getC(); + if (c.getLeftSection() == null && c.getRightSection() == null) { + // 尽头区段,不需构成侧防 + return null; + } + BusinessExceptionAssertEnum.DATA_ERROR.assertNotTrue(c.getLeftSection() != null && c.getRightSection() != null, + String.format("道岔区段[%s]关联区段关系异常,只能最多一边关联,实际两边都关联了区段", c.debugStr())); + boolean right = true; + Section section = c.getRightSection(); + if (c.getLeftSection() != null) { // 左向区段存在,方向向左 + right = false; + section = c.getLeftSection(); + } + while (Objects.nonNull(section)) { + Signal oppositeSignal = section.getSignalOf(!right); + if (Objects.nonNull(oppositeSignal)) { + Section firstSection = oppositeSignal.getSection().getSectionOf(oppositeSignal.isRight()); + RouteFls.FlsElement flsElement; + if (firstSection.isSwitchTrack()) { + flsElement = new RouteFls.FlsElement(oppositeSignal, new SwitchElement(firstSection.getRelSwitch(), true)); + } else { + flsElement = new RouteFls.FlsElement(oppositeSignal); + } + fls.addLevel1(flsElement); + } + } } return null; } diff --git a/src/main/java/club/joylink/rtss/simulation/SimulationUser.java b/src/main/java/club/joylink/rtss/simulation/SimulationUser.java index 8c3a659ea..8fc896b28 100644 --- a/src/main/java/club/joylink/rtss/simulation/SimulationUser.java +++ b/src/main/java/club/joylink/rtss/simulation/SimulationUser.java @@ -3,6 +3,9 @@ package club.joylink.rtss.simulation; import java.util.Set; public class SimulationUser { + /** + * 仿真用户唯一标识,并且是发布订阅消息时的用户唯一标识 + */ private String id; /** * 用户仿真消息订阅 diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/RouteFls.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/RouteFls.java index 7144df032..55bb4a7b2 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/RouteFls.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/RouteFls.java @@ -3,6 +3,7 @@ package club.joylink.rtss.simulation.cbtc.data.map; import lombok.Getter; import lombok.Setter; +import java.util.ArrayList; import java.util.List; /** @@ -26,6 +27,13 @@ public class RouteFls { this.base = base; } + public void addLevel1(FlsElement flsElement) { + if (level1List == null) { + level1List = new ArrayList<>(); + } + level1List.add(flsElement); + } + /** * 侧防元件 */ @@ -48,6 +56,18 @@ public class RouteFls { */ private SwitchElement fpae; + public FlsElement(SwitchElement switchElement) { + this.pSwitch = switchElement; + } + + public FlsElement(Signal pSignal) { + this.pSignal = pSignal; + } + + public FlsElement(Signal pSignal, SwitchElement fpae) { + this.pSignal = pSignal; + this.fpae = fpae; + } } }