列车图例显示位置调整

This commit is contained in:
tiger_zhou 2023-05-04 15:53:09 +08:00
parent 943c46bda7
commit 8bd766a301

View File

@ -24,30 +24,31 @@ public class PackingService implements CalculateDiagram{
Section trainSection = train.getHeadPosition().getSection();
Long mapId = simulation.getBuildParams().getMap().getId();
LocalDateTime simulationDateTime = simulation.getCorrectSystemTime();
if(train.isParkingAt()){
Station startStation = diagramStation.findFirstNotDepotStation(train.isRight());
Station lastStation = diagramStation.findLastNotDepotStation(train.isRight());
if(trainSection.isStandTrack() && Objects.equals(trainSection.getStation().getCode(),startStation.getCode())){
//停留在始发站
StationDiagram sd = new StationDiagram(train);
sd.setStartStation(trainSection.getStation());
Station nextStation = diagramStation.findNext(trainSection.getStation(),train.isRight());
sd.setEndStation(nextStation);
sd.setShowTrainDiagram(true);
log.debug("仿真id[{}] 仿真时间[{}] 列车[{}] 方向[{}] 停靠车站[{}] 查找前方车站[{}]",mapId,simulationDateTime,train.getGroupNumber(),train.isRight(),trainSection.getStation().getCode(),nextStation.getCode());
return Optional.of(sd);
}else if(trainSection.isStandTrack() || (trainSection.isStandTrack() && Objects.equals(trainSection.getStation().getCode(),lastStation.getCode()))){
//列车停靠车站或到终点站
StationDiagram sd = new StationDiagram(train,true,1F,true);
Station preStation = diagramStation.findPre(trainSection.getStation(),train.isRight());
sd.setStartStation(preStation);
sd.setEndStation(trainSection.getStation());
log.debug("仿真id[{}] 仿真时间[{}] 列车[{}] 方向[{}] 停靠车站[{}] 查找前方车站[{}]",mapId,simulationDateTime,train.getGroupNumber(),train.isRight(),trainSection.getStation().getCode(),preStation.getCode());
return Optional.of(sd);
}
//中途停靠站不处理
if(!train.isParkingAt()){
return Optional.empty();
}
Station startStation = diagramStation.findFirstNotDepotStation(train.isRight());
Station lastStation = diagramStation.findLastNotDepotStation(train.isRight());
if(trainSection.isStandTrack() && Objects.equals(trainSection.getStation().getCode(),startStation.getCode())){
//停留在始发站
StationDiagram sd = new StationDiagram(train);
sd.setStartStation(trainSection.getStation());
Station nextStation = diagramStation.findNext(trainSection.getStation(),train.isRight());
sd.setEndStation(nextStation);
sd.setShowTrainDiagram(true);
log.debug("仿真id[{}] 仿真时间[{}] 列车[{}] 方向[{}] 停靠车站[{}] 查找前方车站[{}]",mapId,simulationDateTime,train.getGroupNumber(),train.isRight(),trainSection.getStation().getCode(),nextStation.getCode());
return Optional.of(sd);
}else if(trainSection.isStandTrack() || (trainSection.isStandTrack() && Objects.equals(trainSection.getStation().getCode(),lastStation.getCode()))){
//列车停靠车站或到终点站
StationDiagram sd = new StationDiagram(train,true,1F,true);
Station preStation = diagramStation.findPre(trainSection.getStation(),train.isRight());
sd.setStartStation(preStation);
sd.setEndStation(trainSection.getStation());
log.debug("仿真id[{}] 仿真时间[{}] 列车[{}] 方向[{}] 停靠车站[{}] 查找前方车站[{}]",mapId,simulationDateTime,train.getGroupNumber(),train.isRight(),trainSection.getStation().getCode(),preStation.getCode());
return Optional.of(sd);
}
//中途停靠站不处理
return Optional.empty();
}
}