列车图例显示位置调整
This commit is contained in:
parent
590bb3181f
commit
786a56b8d1
@ -41,18 +41,18 @@ public class ATSTrainMessageDiagram {
|
||||
|
||||
public void collect(Simulation simulation){
|
||||
|
||||
|
||||
KmStation kmStation = new KmStation(simulation);
|
||||
List<StationDiagram> stationDiagramList = Lists.newArrayList();
|
||||
for (VirtualRealityTrain train : simulation.getRepository().getOnlineTrainList()) {
|
||||
|
||||
TrainInfo trainInfo = simulation.getRepository().findSupervisedTrainByGroup(train.getGroupNumber());
|
||||
|
||||
Section target = train.getTarget();
|
||||
if(ObjectUtils.anyNull(target,train.getNextStation(),train.getTerminalStation())){
|
||||
StationDiagram sd = new StationDiagram(train,0F,false);
|
||||
stationDiagramList.add(sd);
|
||||
continue;
|
||||
}
|
||||
TrainInfo trainInfo = simulation.getRepository().getSupervisedTrainByGroup(train.getGroupNumber());
|
||||
if(Objects.nonNull(trainInfo) && trainInfo.isInbound()){
|
||||
StationDiagram sd = new StationDiagram(train,0F,false);
|
||||
stationDiagramList.add(sd);
|
||||
@ -60,8 +60,9 @@ public class ATSTrainMessageDiagram {
|
||||
}
|
||||
Station nextStation = train.getNextStation();
|
||||
SectionPosition tailPos = train.getTailPosition();
|
||||
|
||||
if(nextStation.isDepot() && !tailPos.getSection().isStandTrack()){
|
||||
//出站
|
||||
//入库
|
||||
StationDiagram sd = new StationDiagram(train,0F,false);
|
||||
stationDiagramList.add(sd);
|
||||
}else if(trainInfo.isTurnBack()){
|
||||
@ -86,10 +87,10 @@ public class ATSTrainMessageDiagram {
|
||||
|
||||
private Optional<StationDiagram> calculateRuning2(Simulation simulation,VirtualRealityTrain train,TrainInfo trainInfo,KmStation kmStation){
|
||||
|
||||
|
||||
Section leaveSeaction = simulation.getRepository().getByCode(Objects.isNull(trainInfo.getEstimatedLeaveStandTrack()) ? trainInfo.getActualLeaveStandTrack() : trainInfo.getEstimatedLeaveStandTrack(),Section.class);
|
||||
Section trainSection = train.getHeadPosition().getSection();
|
||||
|
||||
Section arttiveSection = simulation.getRepository().getByCode(trainInfo.getEstimatedArriveStandTrack(),Section.class);
|
||||
|
||||
if(train.isParkingAt()){
|
||||
if(trainSection.isStandTrack() && Objects.equals(trainSection.getStation().getCode(),trainInfo.getStartStation())){
|
||||
//到达始发站
|
||||
@ -108,10 +109,18 @@ public class ATSTrainMessageDiagram {
|
||||
return Optional.of(sd);
|
||||
}
|
||||
}
|
||||
|
||||
if(Objects.equals(train.getNextStation().getCode(),trainInfo.getStartStation())){
|
||||
StationDiagram sd = new StationDiagram(train,true,0F,false);
|
||||
sd.setStartStation(train.getNextStation());
|
||||
Station nextStation = kmStation.findNext(train.getNextStation(),train.isRight());
|
||||
sd.setEndStation(nextStation);
|
||||
return Optional.of(sd);
|
||||
}
|
||||
|
||||
String d = Objects.isNull(trainInfo.getEstimatedLeaveStandTrack()) ? trainInfo.getActualLeaveStandTrack() : trainInfo.getEstimatedLeaveStandTrack();
|
||||
Section leaveSeaction = simulation.getRepository().getByCode(d,Section.class);
|
||||
Station endStation = simulation.getRepository().getByCode(trainInfo.getEndStation(),Station.class);
|
||||
|
||||
boolean finalStation = true;
|
||||
Section targetStand =endStation.getStandOf(train.isRight()).get(0).getSection();
|
||||
if(Objects.equals(leaveSeaction.getStation().getCode(),trainInfo.getEndStation())){
|
||||
StationDiagram sd = new StationDiagram(train,true,1F,true);
|
||||
Station preStation = kmStation.findPre(leaveSeaction.getStation(),train.isRight());
|
||||
@ -119,16 +128,16 @@ public class ATSTrainMessageDiagram {
|
||||
sd.setEndStation(endStation);
|
||||
return Optional.of(sd);
|
||||
}else{
|
||||
finalStation = false;
|
||||
Station targetStation = kmStation.findNext(leaveSeaction.getStation(),train.isRight());
|
||||
targetStand = targetStation.getStandOf(train.isRight()).get(0).getSection();
|
||||
Section targetStand = targetStation.getStandOf(train.isRight()).get(0).getSection();
|
||||
Float complateDis = this.calculateStationRatio(leaveSeaction,targetStand,train);
|
||||
StationDiagram stationDiagram = new StationDiagram(train,true,complateDis,false);
|
||||
stationDiagram.setStartStation(leaveSeaction.getStation());
|
||||
stationDiagram.setEndStation(targetStand.getStation());
|
||||
return Optional.of(stationDiagram);
|
||||
}
|
||||
|
||||
Float complateDis = this.calculateStationRatio(leaveSeaction,targetStand,train);
|
||||
StationDiagram stationDiagram = new StationDiagram(train,true,complateDis,finalStation);
|
||||
stationDiagram.setStartStation(leaveSeaction.getStation());
|
||||
stationDiagram.setEndStation(targetStand.getStation());
|
||||
return Optional.of(stationDiagram);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user