加载列车——构建列车监控信息,站间情况判断调整为列车位置是否在进路路径中
This commit is contained in:
parent
3316c11fed
commit
bffa883703
@ -428,7 +428,7 @@ public class AtsTrainLoadService {
|
||||
break;
|
||||
} else {
|
||||
RoutePath routePath = this.selectDefaultRoutePath(repository, startStationPlan.getSection(), endStationPlan.getSection());
|
||||
if (routePath.containsSection(headPosition.getSection())) {
|
||||
if (routePath.containsPosition(headPosition)) {
|
||||
// 站间运行
|
||||
train.setSpeed(0.1f);
|
||||
trainInfo.updatePlanInfo(endStationPlan);
|
||||
|
@ -308,6 +308,35 @@ public class RoutePath {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean containsPosition(SectionPosition position) {
|
||||
if (this.sectionList.contains(position.getSection())) {
|
||||
return true;
|
||||
}
|
||||
if (Objects.equals(position.getSection(), this.start)) {
|
||||
if (this.isRight()) {
|
||||
if (this.start.getStopPointRight() < position.getOffset()) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (position.getOffset() < this.start.getStopPointLeft()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Objects.equals(position.getSection(), this.end)) {
|
||||
if (this.isRight()) {
|
||||
if (this.end.getStopPointRight() >= position.getOffset()) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (position.getOffset() >= this.end.getStopPointLeft()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isStartSection(Section section) {
|
||||
return Objects.equals(this.start, section);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user