修改:进路路径构建

This commit is contained in:
joylink_zhangsai 2021-06-03 17:57:19 +08:00
parent af554059fa
commit 4f5d79f008

View File

@ -615,7 +615,7 @@ public class InterlockBuilder2 {
Section endSection4RoutePath = selectSection4DestinationCode(rightStation, rightFrontTurnBack, necessarySectionSet, false); //查询路径的终点区段
routes = new ArrayList<>();
//选择并添加进路
selectAndAddRoutes(startSection4RoutePath, endSection4RoutePath,true, stationList, standTrackAdjoinMap, routes, necessaryRoutes, necessarySectionSet);
selectAndAddRoutes(startSection4RoutePath, endSection4RoutePath, true, stationList, standTrackAdjoinMap, routes, necessaryRoutes, necessarySectionSet);
//选择并添加反向的进路
selectAndAddRoutes(endSection4RoutePath, startSection4RoutePath, false, stationList, standTrackAdjoinMap, routes, necessaryRoutes, necessarySectionSet);
runPath = routes.stream().flatMap(route -> route.getSectionList().stream()).distinct().collect(Collectors.toList());
@ -886,6 +886,23 @@ public class InterlockBuilder2 {
routePathMap.put(routePaths.get(0).getKey(), routePaths);
}
}
long l = System.currentTimeMillis();
/* 根据交路数据,构建缺失的进路路径 */
for (Routing routing : buildResult.getRoutingList()) {
List<Section> allSections = routing.getAllSections().stream().distinct().collect(Collectors.toList());
for (int i = 0, size = allSections.size(); i < size - 1; i++) {
Section one = allSections.get(i);
Section two = allSections.get(i + 1);
String key = RoutePath.buildKey(one, two);
if (!routePathMap.containsKey(key)) {
List<RoutePath> routePaths = CalculateService.queryRoutePathsOnDirection(one, two, routing.isRight(), 10);
if (!CollectionUtils.isEmpty(routePaths)) {
routePathMap.put(routePaths.get(0).getKey(), routePaths);
}
}
}
}
System.out.println("用时" + (System.currentTimeMillis() - l));
log.debug("构建进路路径耗时:" + (System.currentTimeMillis() - start));
}