【实训设备、定位、属性值】

This commit is contained in:
weizhihong 2022-12-12 16:14:36 +08:00
parent 30ef80efa4
commit 2021702a7d
3 changed files with 13 additions and 8 deletions

View File

@ -7,10 +7,7 @@ import lombok.Getter;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Random;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -121,6 +118,9 @@ public enum MapDeviceRule {
if (route.getInterlockStation().isDepot() || !route.getInterlockStation().isInterlock()) {
return false;
}
if (!Objects.equals(route.getInterlockStation(), route.getStart().getDeviceStation())) {
return false;
}
if (route.getSectionList().size() < 2) {
return false;
}

View File

@ -107,11 +107,13 @@ public enum MapLocationRule {
private static String calcMapLocation(Simulation simulation, Supplier<Point> devicePoint) {
Point point = devicePoint.get();
String s = simulation.getBuildParams().getMap().getGraphDataNew().getScaling(); // 默认缩放比
s = StringUtils.isEmpty(s) ? "1" : s;
MapStationNewVO stationNewVO = simulation.getBuildParams().getMap().getGraphDataNew().getStationList().stream()
.filter(mapStationNewVO -> !mapStationNewVO.isDepot()).findFirst().get();
// 横向偏差
int x = point.getX() - 960; // 屏幕一般宽度
int y = stationNewVO.getPosition().getY();
int y = stationNewVO.getPosition().getY() - 540;
return String.format("{\"x\":%d,\"y\":%d,\"scale\":\"%s\"}", x, y, s);
}
}

View File

@ -17,8 +17,12 @@ public enum PropertyValueRule {
NAME("地图设备名称") {
@Override
public String resolve(Simulation simulation, Object mapElement) {
if (mapElement instanceof Signal) {
return ((Signal) mapElement).getShowName();
} else {
return ((MapNamedElement) mapElement).getName();
}
}
},
CODE("地图设备编码") {
@Override
@ -136,8 +140,7 @@ public enum PropertyValueRule {
SIGNAL_ROUTE_CODE_LIST("信号机关联的所有进路编码") {
@Override
public Object resolve(Simulation simulation, Object mapElement) {
Signal signal = (Signal) mapElement;
return signal.getRouteList().stream().map(Route::getCode).collect(Collectors.toList());
return ((Signal) mapElement).getRouteList().stream().map(Route::getCode).sorted().collect(Collectors.toList());
}
},
CENTER_CONTROL_STATION_CODE_LIST("站控转中控时车站列表") {