Merge remote-tracking branch 'origin/test2' into test2
This commit is contained in:
commit
bc2451cc18
@ -22,6 +22,7 @@ import lombok.Setter;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -94,50 +95,67 @@ public class SimulationBuilder {
|
|||||||
parkingTracksMap.forEach((station, secs) -> {
|
parkingTracksMap.forEach((station, secs) -> {
|
||||||
if (station.isDepot()) {// 车站为车辆段
|
if (station.isDepot()) {// 车站为车辆段
|
||||||
List<Section> transferList = station.getTransferList();// 转换轨列表
|
List<Section> transferList = station.getTransferList();// 转换轨列表
|
||||||
if(!CollectionUtils.isEmpty(transferList)) {
|
if (!CollectionUtils.isEmpty(transferList)) {
|
||||||
transferList.forEach(transSec->{
|
transferList.forEach(transSec -> {
|
||||||
//停车轨到转换轨
|
// 停车轨到转换轨
|
||||||
secs.forEach(parkSec->{
|
secs.forEach(parkSec -> {
|
||||||
final String rpKey=RoutePath.buildKey(parkSec, transSec);
|
final String rpKey = RoutePath.buildKey(parkSec, transSec);
|
||||||
List<RoutePath> nrp=tryFindRoutePathByDirection(parkSec, transSec,10);
|
List<RoutePath> nrp = tryFindRoutePathForOutByDirection(parkSec, transSec, 20);
|
||||||
List<RoutePath> srp=srps.get(rpKey);
|
List<RoutePath> srp = srps.get(rpKey);
|
||||||
if(null==srp) {
|
if (null == srp) {
|
||||||
srp=new ArrayList<RoutePath>();
|
srp = new ArrayList<RoutePath>();
|
||||||
srps.put(rpKey, srp);
|
srps.put(rpKey, srp);
|
||||||
}
|
}
|
||||||
if(!CollectionUtils.isEmpty(nrp)) {
|
if (!CollectionUtils.isEmpty(nrp)) {
|
||||||
srp.addAll(nrp);
|
srp.addAll(nrp);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//转换轨到停车轨
|
// 转换轨到停车轨
|
||||||
secs.forEach(parkSec->{
|
secs.forEach(parkSec -> {
|
||||||
final String rpKey=RoutePath.buildKey(transSec, parkSec);
|
final String rpKey = RoutePath.buildKey(transSec, parkSec);
|
||||||
List<RoutePath> nrp=tryFindRoutePathByDirection(transSec, parkSec,10);
|
List<RoutePath> nrp = tryFindRoutePathByDirection(transSec, parkSec, 20);
|
||||||
List<RoutePath> srp=srps.get(rpKey);
|
List<RoutePath> srp = srps.get(rpKey);
|
||||||
if(null==srp) {
|
if (null == srp) {
|
||||||
srp=new ArrayList<RoutePath>();
|
srp = new ArrayList<RoutePath>();
|
||||||
srps.put(rpKey, srp);
|
srps.put(rpKey, srp);
|
||||||
}
|
}
|
||||||
if(!CollectionUtils.isEmpty(nrp)) {
|
if (!CollectionUtils.isEmpty(nrp)) {
|
||||||
srp.addAll(nrp);
|
srp.addAll(nrp);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}else {
|
} else {
|
||||||
log.info("仿真数据有问题,车辆段[{}]没有转换轨",station.getName());
|
log.info("仿真数据有问题,车辆段[{}]没有转换轨", station.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*当方向未知时,起点终点不变,不同方向搜索route path
|
* 当方向未知时,起点终点不变,不同方向搜索route path
|
||||||
*/
|
*/
|
||||||
private static List<RoutePath> tryFindRoutePathByDirection(Section start, Section end,int iterTimes) {
|
private static List<RoutePath> tryFindRoutePathForOutByDirection(Section start, Section end, int iterTimes) {
|
||||||
List<RoutePath> r= CalculateService.queryRoutePathsOnDirection(start, end,true, iterTimes);
|
List<RoutePath> r = tryFindRoutePathByDirection(start, end, iterTimes);
|
||||||
if(!CollectionUtils.isEmpty(r)) {
|
if (r.size() == 2) {
|
||||||
|
return r.stream().sorted((RoutePath r1, RoutePath r2) -> {
|
||||||
|
return r1.getSignalList().size() - r2.getSignalList().size();
|
||||||
|
}).findFirst().stream().collect(Collectors.toList());
|
||||||
|
|
||||||
|
} else if (r.size() > 2) {
|
||||||
|
log.warn("获取车辆段从停车轨到转换轨的路径, routeKey = {} , 路径数量大于2异常 !!!");
|
||||||
|
}
|
||||||
return r;
|
return r;
|
||||||
}else {
|
}
|
||||||
return CalculateService.queryRoutePathsOnDirection(start, end,false, iterTimes);
|
|
||||||
|
/**
|
||||||
|
* 当方向未知时,起点终点不变,不同方向搜索route path
|
||||||
|
*/
|
||||||
|
private static List<RoutePath> tryFindRoutePathByDirection(Section start, Section end, int iterTimes) {
|
||||||
|
List<RoutePath> r = CalculateService.queryRoutePathsOnDirection(start, end, true, iterTimes);
|
||||||
|
if (!CollectionUtils.isEmpty(r)) {
|
||||||
|
return r;
|
||||||
|
} else {
|
||||||
|
return CalculateService.queryRoutePathsOnDirection(start, end, false, iterTimes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static void buildIbpData(SimulationDeviceBuildResult mapDataBuildResult, List<Ibp> ibpList) {
|
private static void buildIbpData(SimulationDeviceBuildResult mapDataBuildResult, List<Ibp> ibpList) {
|
||||||
|
Loading…
Reference in New Issue
Block a user