南京二 实训问题处理 - 替代信号机
This commit is contained in:
parent
f7cb5fca15
commit
18533b2fbc
@ -9,6 +9,7 @@ import club.joylink.rtss.services.training.generatornew.GeneratorNew;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.build.SimulationBuildParams;
|
||||
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Signal;
|
||||
import club.joylink.rtss.vo.client.CommandDefinitionVO;
|
||||
import club.joylink.rtss.vo.client.LessonChapterTrainingRelVO;
|
||||
import club.joylink.rtss.vo.client.LessonVO;
|
||||
@ -77,6 +78,18 @@ public class GenerateTask {
|
||||
// 构造仿真数据
|
||||
// 根据操作定义生成实训
|
||||
definitionVOList.forEach(operateDefinitionVO -> {
|
||||
if (operateDefinitionVO.useReplaceSignal()) {
|
||||
mapVO.getGraphDataNew().getSignalList().stream()
|
||||
.filter(signalVO -> Signal.SignalType.TRANSMISSION.equals(signalVO.getType()))
|
||||
.forEach(signalVO -> {
|
||||
Signal signal = new Signal(signalVO.getCode(), signalVO.getUniqueName());
|
||||
signal.setShowName(signalVO.getName());
|
||||
Signal linkSignal = simulation.getRepository().getByCode(signalVO.getLinkSignalCode(), Signal.class);
|
||||
signal.setLinkSignal(linkSignal);
|
||||
linkSignal.addReplaceSignal(signal);
|
||||
simulation.getRepository().getSignalList().add(signal);
|
||||
});
|
||||
}
|
||||
try {
|
||||
List<TrainingNewVO> trainingVOList = generator.generate(config, simulation, operateDefinitionVO);
|
||||
if (CollectionUtils.isEmpty(trainingVOList)) {
|
||||
|
@ -48,7 +48,10 @@ public interface TrainingConsts {
|
||||
/** 终端按钮信号机 */
|
||||
END_BUTTON_SIGNAL,
|
||||
/** 终端按钮信号机 */
|
||||
BUTTON;
|
||||
BUTTON,
|
||||
/** 终端替代信号机 */
|
||||
END_REPLACE_SIGNAL,
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package club.joylink.rtss.services.training.generatornew;
|
||||
|
||||
import club.joylink.rtss.constants.BusinessConsts;
|
||||
import club.joylink.rtss.constants.MapPrdTypeEnum;
|
||||
import club.joylink.rtss.services.training.constant.TrainingConsts;
|
||||
import club.joylink.rtss.services.training.data.GenerateConfig;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
@ -91,6 +92,23 @@ public interface GeneratorNew {
|
||||
case END_SIGNAL:
|
||||
s.setDeviceCode(((Route) mapDevice).getDestination().getCode());
|
||||
break;
|
||||
case END_REPLACE_SIGNAL:
|
||||
Route route = (Route) mapDevice;
|
||||
List<Signal> replaceSignals = route.getDestination().getReplaceSignals();
|
||||
if (replaceSignals != null) {
|
||||
Signal signal;
|
||||
if (MapPrdTypeEnum.LOCAL.equals(MapPrdTypeEnum.getMapPrdTypeEnumByCode(config.getPrdType()))) {
|
||||
signal = replaceSignals.stream().filter(ss -> ss.getShowName().startsWith("F")).findFirst().orElse(null);
|
||||
} else {
|
||||
signal = replaceSignals.stream().filter(ss -> ss.getShowName().startsWith("T")).findFirst().orElse(null);
|
||||
}
|
||||
if (signal != null) {
|
||||
s.setDeviceCode(signal.getCode());
|
||||
break;
|
||||
}
|
||||
}
|
||||
s.setDeviceCode(route.getDestination().getCode());
|
||||
break;
|
||||
case END_BUTTON_SIGNAL:
|
||||
s.setDeviceCode(((Route) mapDevice).getDestinationButtonSignal().getCode());
|
||||
break;
|
||||
|
@ -147,6 +147,11 @@ public class Signal extends DelayUnlockDevice {
|
||||
*/
|
||||
private Signal linkSignal;
|
||||
|
||||
/**
|
||||
* 替代信号机
|
||||
*/
|
||||
private List<Signal> replaceSignals;
|
||||
|
||||
// ------------------状态属性---------------------
|
||||
|
||||
private int mode;
|
||||
@ -615,6 +620,13 @@ public class Signal extends DelayUnlockDevice {
|
||||
return this.signalModel.getGuideAspect();
|
||||
}
|
||||
|
||||
public void addReplaceSignal(Signal signal) {
|
||||
if (replaceSignals == null) {
|
||||
replaceSignals = new ArrayList<>();
|
||||
}
|
||||
replaceSignals.add(signal);
|
||||
}
|
||||
|
||||
public enum LightColor {
|
||||
RED,
|
||||
YELLOW,
|
||||
|
@ -26,6 +26,8 @@ public class OperateDefinitionConfig {
|
||||
|
||||
private List<String> sectionTypes;//区段生成指定类型
|
||||
|
||||
public Boolean useReplaceSignal;
|
||||
|
||||
public boolean isAtp() {
|
||||
return RouteType.ATP.equals(this.routeType);
|
||||
}
|
||||
|
@ -198,4 +198,12 @@ public class OperateDefinitionVO {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean useReplaceSignal() {
|
||||
OperateDefinitionConfig routeSettingConfig = this.getRouteSettingConfig();
|
||||
if (Objects.nonNull(routeSettingConfig)) {
|
||||
return routeSettingConfig.getUseReplaceSignal();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user