【实训设备、定位、属性值】
This commit is contained in:
parent
30ef80efa4
commit
2021702a7d
@ -7,10 +7,7 @@ import lombok.Getter;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -121,6 +118,9 @@ public enum MapDeviceRule {
|
|||||||
if (route.getInterlockStation().isDepot() || !route.getInterlockStation().isInterlock()) {
|
if (route.getInterlockStation().isDepot() || !route.getInterlockStation().isInterlock()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (!Objects.equals(route.getInterlockStation(), route.getStart().getDeviceStation())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (route.getSectionList().size() < 2) {
|
if (route.getSectionList().size() < 2) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -107,11 +107,13 @@ public enum MapLocationRule {
|
|||||||
private static String calcMapLocation(Simulation simulation, Supplier<Point> devicePoint) {
|
private static String calcMapLocation(Simulation simulation, Supplier<Point> devicePoint) {
|
||||||
Point point = devicePoint.get();
|
Point point = devicePoint.get();
|
||||||
String s = simulation.getBuildParams().getMap().getGraphDataNew().getScaling(); // 默认缩放比
|
String s = simulation.getBuildParams().getMap().getGraphDataNew().getScaling(); // 默认缩放比
|
||||||
|
s = StringUtils.isEmpty(s) ? "1" : s;
|
||||||
MapStationNewVO stationNewVO = simulation.getBuildParams().getMap().getGraphDataNew().getStationList().stream()
|
MapStationNewVO stationNewVO = simulation.getBuildParams().getMap().getGraphDataNew().getStationList().stream()
|
||||||
.filter(mapStationNewVO -> !mapStationNewVO.isDepot()).findFirst().get();
|
.filter(mapStationNewVO -> !mapStationNewVO.isDepot()).findFirst().get();
|
||||||
// 横向偏差
|
// 横向偏差
|
||||||
int x = point.getX() - 960; // 屏幕一般宽度
|
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);
|
return String.format("{\"x\":%d,\"y\":%d,\"scale\":\"%s\"}", x, y, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,12 @@ public enum PropertyValueRule {
|
|||||||
NAME("地图设备名称") {
|
NAME("地图设备名称") {
|
||||||
@Override
|
@Override
|
||||||
public String resolve(Simulation simulation, Object mapElement) {
|
public String resolve(Simulation simulation, Object mapElement) {
|
||||||
|
if (mapElement instanceof Signal) {
|
||||||
|
return ((Signal) mapElement).getShowName();
|
||||||
|
} else {
|
||||||
return ((MapNamedElement) mapElement).getName();
|
return ((MapNamedElement) mapElement).getName();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
CODE("地图设备编码") {
|
CODE("地图设备编码") {
|
||||||
@Override
|
@Override
|
||||||
@ -136,8 +140,7 @@ public enum PropertyValueRule {
|
|||||||
SIGNAL_ROUTE_CODE_LIST("信号机关联的所有进路编码") {
|
SIGNAL_ROUTE_CODE_LIST("信号机关联的所有进路编码") {
|
||||||
@Override
|
@Override
|
||||||
public Object resolve(Simulation simulation, Object mapElement) {
|
public Object resolve(Simulation simulation, Object mapElement) {
|
||||||
Signal signal = (Signal) mapElement;
|
return ((Signal) mapElement).getRouteList().stream().map(Route::getCode).sorted().collect(Collectors.toList());
|
||||||
return signal.getRouteList().stream().map(Route::getCode).collect(Collectors.toList());
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
CENTER_CONTROL_STATION_CODE_LIST("站控转中控时车站列表") {
|
CENTER_CONTROL_STATION_CODE_LIST("站控转中控时车站列表") {
|
||||||
|
Loading…
Reference in New Issue
Block a user