加载列车——构建列车监控信息,站间情况判断调整为列车位置是否在进路路径中

This commit is contained in:
walker-sheng 2021-01-28 18:09:50 +08:00
parent 3316c11fed
commit bffa883703
2 changed files with 30 additions and 1 deletions

View File

@ -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);

View File

@ -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);
}