目的地码数据构建bug修改
This commit is contained in:
parent
783db4fa0f
commit
7b426cbf45
@ -5,8 +5,6 @@ import club.joylink.rtss.simulation.cbtc.GroupSimulationService;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
||||
import club.joylink.rtss.simulation.cbtc.data.plan.StationPlan;
|
||||
import club.joylink.rtss.simulation.cbtc.data.plan.TripPlan;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.RoutePath;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||
@ -18,7 +16,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 仿真操作支持
|
||||
@ -45,7 +42,7 @@ public class SimulationSupportService {
|
||||
|
||||
List<RoutePath> routePaths = CalculateService.queryRoutePathsOnDirection(startSection, destination, train.isRight(), 10);
|
||||
return routePaths.stream()
|
||||
.map(routePath -> CalculateService.selectUniqueRoutes(routePath, false)
|
||||
.map(routePath -> CalculateService.selectUniqueRoutes(routePath, null, false)
|
||||
.stream().map(MapElement::getCode).collect(Collectors.toList()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
@ -613,9 +613,9 @@ public class InterlockBuilder2 {
|
||||
Section endSection4RoutePath = selectSection4DestinationCode(rightStation, rightFrontTurnBack, necessarySectionSet, false); //查询路径的终点区段
|
||||
routes = new ArrayList<>();
|
||||
//选择并添加进路
|
||||
selectAndAddRoutes(stationList, standTrackAdjoinMap, routes, necessarySectionSet, startSection4RoutePath, endSection4RoutePath);
|
||||
selectAndAddRoutes(startSection4RoutePath, endSection4RoutePath,true, stationList, standTrackAdjoinMap, routes, necessaryRoutes, necessarySectionSet);
|
||||
//选择并添加反向的进路
|
||||
selectAndAddRoutes(stationList, standTrackAdjoinMap, routes, necessarySectionSet, endSection4RoutePath, startSection4RoutePath);
|
||||
selectAndAddRoutes(endSection4RoutePath, startSection4RoutePath, false, stationList, standTrackAdjoinMap, routes, necessaryRoutes, necessarySectionSet);
|
||||
runPath = routes.stream().flatMap(route -> route.getSectionList().stream()).distinct().collect(Collectors.toList());
|
||||
break;
|
||||
}
|
||||
@ -632,7 +632,7 @@ public class InterlockBuilder2 {
|
||||
}
|
||||
if (startSection != null) {
|
||||
routes = new ArrayList<>();
|
||||
selectAndAddRoutes(stationList, standTrackAdjoinMap, routes, necessarySectionSet, startSection, section);
|
||||
selectAndAddRoutes(startSection, section, true, stationList, standTrackAdjoinMap, routes, necessaryRoutes, necessarySectionSet);
|
||||
runPath = routes.stream().flatMap(route -> route.getSectionList().stream()).distinct().collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@ -800,12 +800,12 @@ public class InterlockBuilder2 {
|
||||
/**
|
||||
* 筛选并添加进路到进路列表中
|
||||
*/
|
||||
private static void selectAndAddRoutes(List<Station> stationList, Map<String, Set<Section>> standTrackAdjoinMap, List<Route> routes,
|
||||
Set<Section> necessarySectionSet, Section start, Section end) {
|
||||
private static void selectAndAddRoutes(Section start, Section end, boolean right, List<Station> stationList, Map<String, Set<Section>> standTrackAdjoinMap, List<Route> routes,
|
||||
List<Route> necessaryRoutes, Set<Section> necessarySectionSet) {
|
||||
List<List<Section>> pathsList = new ArrayList<>();
|
||||
List<Section> paths = new ArrayList<>();
|
||||
paths.add(start);
|
||||
RoutingGenerator.getRoutingPath2(start, end, true, stationList, standTrackAdjoinMap, paths, pathsList);
|
||||
RoutingGenerator.getRoutingPath2(start, end, right, stationList, standTrackAdjoinMap, paths, pathsList);
|
||||
List<Section> path = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(pathsList)) {
|
||||
if (!CollectionUtils.isEmpty(necessarySectionSet)) {
|
||||
@ -819,12 +819,12 @@ public class InterlockBuilder2 {
|
||||
for (int i = 0; i < path.size() - 1; i++) {
|
||||
Section localStart = path.get(i);
|
||||
Section localEnd = path.get(i + 1);
|
||||
RoutePath routePath = CalculateService.queryLeastSwitchRoutePath(localStart, localEnd, necessarySectionSet, true);
|
||||
RoutePath routePath = CalculateService.queryLeastSwitchRoutePath(localStart, localEnd, necessarySectionSet, right);
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(routePath, String.format("从%s到%s的进路路径找不到", localStart.debugStr(), localEnd.debugStr()));
|
||||
if (i == path.size() - 2) {
|
||||
routes.addAll(CalculateService.selectUniqueRoutes(routePath, true));
|
||||
routes.addAll(CalculateService.selectUniqueRoutes(routePath, necessaryRoutes, true));
|
||||
} else {
|
||||
routes.addAll(CalculateService.selectUniqueRoutes(routePath, false));
|
||||
routes.addAll(CalculateService.selectUniqueRoutes(routePath, necessaryRoutes, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1162,16 +1162,18 @@ public class CalculateService {
|
||||
* 进路路径的routeList中可能包含同一信号机下的多个进路,本方法将筛选掉多余的进路
|
||||
*
|
||||
* @param routePath
|
||||
* @param necessaryRoutes
|
||||
* @param tb 是否要在进路路径的终点区段折返
|
||||
* @return
|
||||
*/
|
||||
public static List<Route> selectUniqueRoutes(RoutePath routePath, boolean tb) {
|
||||
public static List<Route> selectUniqueRoutes(RoutePath routePath, List<Route> necessaryRoutes, boolean tb) {
|
||||
List<Route> routes = new ArrayList<>();
|
||||
List<Route> routeList = routePath.getRouteList();
|
||||
List<Section> runPath = new ArrayList<>();
|
||||
runPath.add(routePath.getStart());
|
||||
runPath.addAll(routePath.getSectionList());
|
||||
runPath.add(routePath.getEnd());
|
||||
if (CollectionUtils.isEmpty(necessaryRoutes)) {
|
||||
for (int i = 0; i < routeList.size(); i++) {
|
||||
Route route = routeList.get(i);
|
||||
Route last = i > 0 ? routeList.get(i - 1) : null;
|
||||
@ -1194,6 +1196,7 @@ public class CalculateService {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return routes;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user