Fixed route direction bug for transfer routes

This commit is contained in:
dkeen@dkeen-laptop 2012-04-30 15:02:14 -07:00
parent 6e11ad7afb
commit f2ec482603

View File

@ -152,13 +152,28 @@ public enum Station {
List<Route> returnList = new ArrayList<Route>(); List<Route> returnList = new ArrayList<Route>();
final Collection<Line> applicableLines = Line.getLinesWithStations( final Collection<Line> applicableLines = Line.getLinesWithStations(
this, dest); this, dest);
for (Line line : applicableLines) { if (transferLines != null && !transferLines.isEmpty()) {
int origIndex = line.stations.indexOf(this); for (Line transferLine : transferLines) {
int destIndex = line.stations.indexOf(dest); int origIndex = transferLine.stations.indexOf(origin);
int destIndex = transferLine.stations.indexOf(origin
.getOutboundTransferStation());
isNorth = (origIndex < destIndex); isNorth = (origIndex < destIndex);
if (line.directionMayInvert && this.invertDirection) { if (origin.invertDirection && transferLine.directionMayInvert) {
isNorth = !isNorth; isNorth = !isNorth;
break;
}
}
}
for (Line line : applicableLines) {
if (transferLines == null || transferLines.isEmpty()) {
int origIndex = line.stations.indexOf(this);
int destIndex = line.stations.indexOf(dest);
isNorth = (origIndex < destIndex);
if (line.directionMayInvert && this.invertDirection) {
isNorth = !isNorth;
}
} }
Route route = new Route(); Route route = new Route();
route.setOrigin(origin); route.setOrigin(origin);