车辆段联锁生成
This commit is contained in:
parent
c2a00f26e9
commit
a8d47ee567
@ -133,22 +133,31 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
.filter(signal -> signal.getInterlockStation().getCode().equals(stationCode))
|
||||
.collect(Collectors.toList());
|
||||
log.info(String.format("共有信号机[%s]个", signalList.size()));
|
||||
signalList.sort((signal1, signal2) -> {
|
||||
String s1 = signal1.getShowName();
|
||||
String s2 = signal2.getShowName();
|
||||
return s1.length() != s2.length() ? s1.length() - s2.length() : s1.compareTo(s2);
|
||||
});
|
||||
for (Signal signal : signalList) {
|
||||
// 信号机接近区段构建
|
||||
// this.generateApproachSection(signal, generateConfig);
|
||||
// 列车兼调车信号机、调车信号机
|
||||
if (signal.getType().equals(Signal.SignalType.SHUNTING2)) {
|
||||
signal.setType(Signal.SignalType.SHUNTING);
|
||||
generatedRouteList.addAll(this.generateRouteDepot(signal, routeCodeGenerator, generateConfig, errorList));
|
||||
signal.setType(Signal.SignalType.SHUNTING2);
|
||||
generatedRouteList.addAll(this.generateRouteDepot(signal, routeCodeGenerator, generateConfig, errorList));
|
||||
} else if (signal.getType().equals(Signal.SignalType.SHUNTING)) {
|
||||
generatedRouteList.addAll(this.generateRouteDepot(signal, routeCodeGenerator, generateConfig, errorList));
|
||||
}
|
||||
}
|
||||
log.info(String.format("生成一般进路[%s]条", generatedRouteList.size()));
|
||||
// 进路敌对关系构建
|
||||
// this.buildRouteConflict(generatedRouteList);
|
||||
this.buildRouteConflict(generatedRouteList);
|
||||
|
||||
if (!CollectionUtils.isEmpty(errorList)) {
|
||||
for (String errMsg : errorList) {
|
||||
log.warn(String.format("联锁数据生成警告信息:[%s]", errMsg));
|
||||
}
|
||||
}
|
||||
// // 清除不需要的基本进路
|
||||
// this.deleteBaseRoute(signalList, generatedRouteList);
|
||||
// 删除旧数据,保存新数据
|
||||
this.draftMapRouteService.deleteRoutes(deletingList);
|
||||
this.draftMapRouteService.createRoutes(mapId, generatedRouteList.stream()
|
||||
@ -714,9 +723,6 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
MapCiGenerateConfig config, List<String> errorList) {
|
||||
boolean right = start.isRight();
|
||||
Section startSection = start.getSection().getSectionOf(right);
|
||||
if (Objects.isNull(startSection)) {
|
||||
System.out.println(start.getShowName());
|
||||
}
|
||||
List<SectionPath> routePathList = new ArrayList<>();
|
||||
getRoutePathOfDepot(start, startSection, new SectionPath(right), routePathList, config, errorList);
|
||||
return buildRouteFromPathDepot(start, routeCodeGenerator, routePathList, config, errorList);
|
||||
@ -730,23 +736,17 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
for (SectionPath sectionPath : routePathList) {
|
||||
Section lastSection = sectionPath.getLastSection();
|
||||
Signal end = lastSection.getSignalOf(right);
|
||||
// 根据配置取进路终端信号机名称
|
||||
Signal clickEnd = Objects.nonNull(end) ? end : null;
|
||||
String endName = Objects.nonNull(end) ? end.getShowName() : lastSection.getName();
|
||||
Signal clickEnd = null;
|
||||
if (config.isRouteButton() && config.isGetNearlySignal()) {
|
||||
// 进路按钮取最近的信号机
|
||||
clickEnd = this.queryNearlySignalOf(start, sectionPath);
|
||||
}
|
||||
// 构建进路
|
||||
String code = routeCodeGenerator.next();
|
||||
String name = String.format("%s-%s", start.getShowName(), endName);
|
||||
Route route = this.buildRoute(code, name, start, end, clickEnd, sectionPath,
|
||||
null, config.isRouteSignalAlwaysGreen(), config.isRouteInterlockDoNotIncludeStandHoldTrain());
|
||||
routeList.add(route);
|
||||
|
||||
}
|
||||
} else {
|
||||
errorList.add(String.format("以[%s(%s)]为始端信号的进路未搜索到", start.getName(), start.getCode()));
|
||||
errorList.add(String.format("以[%s(%s)]为始端信号的进路未搜索到", start.getShowName(), start.getCode()));
|
||||
}
|
||||
return routeList;
|
||||
}
|
||||
@ -1889,16 +1889,29 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
MapCiGenerateConfig config, List<String> errorList) {
|
||||
boolean right = startSignal.isRight();
|
||||
if (!CollectionUtils.isEmpty(tempPath.getSectionList())) {
|
||||
if (Objects.isNull(section)) {
|
||||
// if (routePathList.size() > 1) {
|
||||
Signal signal = tempPath.getLastSection().getSignalOf(right);
|
||||
if (startSignal.getType().equals(Signal.SignalType.SHUNTING2)) {
|
||||
// 同向类型相同信号机
|
||||
if (Objects.nonNull(signal) && signal.getType().equals(startSignal.getType())) {
|
||||
routePathList.add(tempPath);
|
||||
// }
|
||||
return;
|
||||
}
|
||||
// 兼容在道岔区段的信号机
|
||||
Signal signal = tempPath.getLastSection().getSignalOf(right);
|
||||
if (Objects.isNull(section)) {
|
||||
Signal lastSignal = tempPath.getLastSection().getSignalOf(!right);
|
||||
if (Objects.nonNull(lastSignal) && lastSignal.getType().equals(startSignal.getType())) {
|
||||
routePathList.add(tempPath);
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// 同向类型相同信号机
|
||||
if (Objects.nonNull(signal)) { // 找到,添加路径,返回
|
||||
if (signal.isDepotSameSignal(startSignal)) {
|
||||
if (signal.getType().equals(startSignal.getType()) || signal.getType().equals(Signal.SignalType.SHUNTING2)) {
|
||||
routePathList.add(tempPath);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Objects.isNull(section)) {
|
||||
routePathList.add(tempPath);
|
||||
return;
|
||||
}
|
||||
|
@ -452,9 +452,6 @@ public class Signal extends MayOutOfOrderDevice {
|
||||
|
||||
public boolean isDepotSameSignal(Signal signal) {
|
||||
return this.type.equals(signal.getType())
|
||||
|| (this.type.equals(SignalType.PROTECTION) && signal.getType().equals(SignalType.SHUNTING2))
|
||||
|| (this.type.equals(SignalType.SHUNTING) && signal.getType().equals(SignalType.SHUNTING2))
|
||||
|| (this.type.equals(SignalType.SHUNTING2) && signal.getType().equals(SignalType.PROTECTION))
|
||||
|| (this.type.equals(SignalType.SHUNTING2) && signal.getType().equals(SignalType.SHUNTING));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user