【实训生成设备筛选、背景生成逻辑修改】
This commit is contained in:
parent
0ac1c36177
commit
1fbe684487
@ -386,7 +386,7 @@ public enum BgSceneStatusRule {
|
|||||||
STATION_POWER_ON_UNLOCK("车站上电解锁背景") {
|
STATION_POWER_ON_UNLOCK("车站上电解锁背景") {
|
||||||
@Override
|
@Override
|
||||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
Station station = (Station) mapElement;
|
Station station = MapElementRule.queryStation(mapElement);
|
||||||
restartInterlock(simulation, station);
|
restartInterlock(simulation, station);
|
||||||
return getBgScene(simulation);
|
return getBgScene(simulation);
|
||||||
}
|
}
|
||||||
@ -394,7 +394,7 @@ public enum BgSceneStatusRule {
|
|||||||
STATION_OPEN_AUTO_SETTING_BG_SCENE("全站进路交ATS自动控背景") {
|
STATION_OPEN_AUTO_SETTING_BG_SCENE("全站进路交ATS自动控背景") {
|
||||||
@Override
|
@Override
|
||||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
Station station = (Station) mapElement;
|
Station station = MapElementRule.queryStation(mapElement);
|
||||||
if(!station.isInterlock()) {
|
if(!station.isInterlock()) {
|
||||||
throw new SimulationException(SimulationExceptionType.Simulation_Map_Data_Error);
|
throw new SimulationException(SimulationExceptionType.Simulation_Map_Data_Error);
|
||||||
}
|
}
|
||||||
@ -419,7 +419,7 @@ public enum BgSceneStatusRule {
|
|||||||
STATION_CENTER_CONTROL_BG_SCENE ("车站设置中控背景") {
|
STATION_CENTER_CONTROL_BG_SCENE ("车站设置中控背景") {
|
||||||
@Override
|
@Override
|
||||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
Station station = (Station) mapElement;
|
Station station = MapElementRule.queryStation(mapElement);
|
||||||
station.setControlMode(Station.ControlMode.Local);
|
station.setControlMode(Station.ControlMode.Local);
|
||||||
return getBgScene(simulation);
|
return getBgScene(simulation);
|
||||||
}
|
}
|
||||||
@ -427,7 +427,7 @@ public enum BgSceneStatusRule {
|
|||||||
STATION_STATION_CONTROL_BG_SCENE("车站转为站控背景") {
|
STATION_STATION_CONTROL_BG_SCENE("车站转为站控背景") {
|
||||||
@Override
|
@Override
|
||||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
Station station = (Station) mapElement;
|
Station station = MapElementRule.queryStation(mapElement);
|
||||||
station.setControlMode(Station.ControlMode.Center);
|
station.setControlMode(Station.ControlMode.Center);
|
||||||
return getBgScene(simulation);
|
return getBgScene(simulation);
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,33 @@ public enum MapDeviceRule {
|
|||||||
return MapDeviceRule.generateRandomElement(standList, NUMBER);
|
return MapDeviceRule.generateRandomElement(standList, NUMBER);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
CONTROL_STATION_STAND_LIST("控制模式车站的站台列表") {
|
||||||
|
@Override
|
||||||
|
public List<Stand> filterMapDeviceList(Simulation simulation) {
|
||||||
|
// 车站列表
|
||||||
|
List<Station> stationList = simulation.getRepository().getStationList().stream()
|
||||||
|
.filter(station -> !station.isDepot()).sorted(Comparator.comparingInt(Station::getSn))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
Station firstStation = stationList.get(0);
|
||||||
|
Station lastStation = stationList.get(stationList.size() - 1);
|
||||||
|
List<Stand> standList = simulation.getRepository().getStandList().stream().filter(stand -> {
|
||||||
|
if (stand.getStation() != null && stand.getStation().isDepot())
|
||||||
|
return false;
|
||||||
|
// 去除第一个与最后一个站的站台
|
||||||
|
if (firstStation.equals(stand.getStation()) || lastStation.equals(stand.getStation())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!stand.isVisible() || !stand.hasDoor() || stand.isSmall()) { // 特殊站台
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!stand.getStation().isHasControlMode()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}).sorted(Comparator.comparingInt(stand -> stand.getStation().getSn())).collect(Collectors.toList());
|
||||||
|
return MapDeviceRule.generateRandomElement(standList, NUMBER);
|
||||||
|
}
|
||||||
|
},
|
||||||
ROUTE_LIST("进路列表") {
|
ROUTE_LIST("进路列表") {
|
||||||
@Override
|
@Override
|
||||||
public List<Route> filterMapDeviceList(Simulation simulation) {
|
public List<Route> filterMapDeviceList(Simulation simulation) {
|
||||||
@ -104,6 +131,25 @@ public enum MapDeviceRule {
|
|||||||
return generateRandomElement(switchList, 1);
|
return generateRandomElement(switchList, 1);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
CONTROL_STATION_SWITCH_LIST("控制模式车站的道岔列表") {
|
||||||
|
@Override
|
||||||
|
public List<Switch> filterMapDeviceList(Simulation simulation) {
|
||||||
|
List<Switch> switchList = simulation.getRepository().getSwitchList().stream()
|
||||||
|
.filter(aSwitch -> {
|
||||||
|
if (aSwitch.getDeviceStation() != null && aSwitch.getDeviceStation().isDepot())
|
||||||
|
return false;
|
||||||
|
if (!aSwitch.getDeviceStation().isHasControlMode()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (aSwitch.isSingleLock()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
aSwitch.setSingleLock(false);
|
||||||
|
return true;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
return generateRandomElement(switchList, 1);
|
||||||
|
}
|
||||||
|
},
|
||||||
SIGNAL_LIST("信号机列表") {
|
SIGNAL_LIST("信号机列表") {
|
||||||
@Override
|
@Override
|
||||||
public List<Signal> filterMapDeviceList(Simulation simulation) {
|
public List<Signal> filterMapDeviceList(Simulation simulation) {
|
||||||
|
@ -11,10 +11,7 @@ import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
|||||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||||
import club.joylink.rtss.util.JsonUtils;
|
import club.joylink.rtss.util.JsonUtils;
|
||||||
import club.joylink.rtss.vo.map.MapGraphDataNewVO;
|
import club.joylink.rtss.vo.map.MapGraphDataNewVO;
|
||||||
import club.joylink.rtss.vo.map.graph.MapSignalNewVO;
|
import club.joylink.rtss.vo.map.graph.*;
|
||||||
import club.joylink.rtss.vo.map.graph.MapStationNewVO;
|
|
||||||
import club.joylink.rtss.vo.map.graph.MapStationStandNewVO;
|
|
||||||
import club.joylink.rtss.vo.map.graph.Point;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
@ -65,6 +62,17 @@ public enum MapLocationRule {
|
|||||||
return stationStandNewVO.getPosition();
|
return stationStandNewVO.getPosition();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
SECTION_MAP_LOCATION("使用区段定位") {
|
||||||
|
@Override
|
||||||
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
|
return calcMapLocation(simulation, () -> {
|
||||||
|
MapGraphDataNewVO mapGraphDataNewVO = simulation.getBuildParams().getMap().getGraphDataNew();
|
||||||
|
MapSectionNewVO sectionNewVO = mapGraphDataNewVO.getSectionList().stream()
|
||||||
|
.filter(s -> s.getCode().equals(mapElement.getCode())).findFirst().get();
|
||||||
|
return sectionNewVO.getPoints().get(0);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ public enum PropertyValueRule {
|
|||||||
CENTER_CONTROL_STATION_CODE_LIST("站控转中控时车站列表") {
|
CENTER_CONTROL_STATION_CODE_LIST("站控转中控时车站列表") {
|
||||||
@Override
|
@Override
|
||||||
public Object resolve(Simulation simulation, Object mapElement) {
|
public Object resolve(Simulation simulation, Object mapElement) {
|
||||||
Station station = (Station) mapElement;
|
Station station = MapElementRule.queryStation(mapElement);
|
||||||
return List.of(station.getCode());
|
return List.of(station.getCode());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user