Skip to content

Commit

Permalink
Merge pull request #278 from HSLdevcom/fix-thrutraffic
Browse files Browse the repository at this point in the history
Fix thru-traffic edges handling
  • Loading branch information
optionsome authored Dec 20, 2018
2 parents 80b0daa + 3d8ea1e commit 4d61e54
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions src/main/java/org/opentripplanner/routing/edgetype/StreetEdge.java
Original file line number Diff line number Diff line change
Expand Up @@ -401,19 +401,22 @@ private StateEditor doTraverse(State s0, RoutingRequest options, TraverseMode tr
s1.setBackWalkingBike(walkingBike);

/* Handle no through traffic areas. */
if (this.isNoThruTraffic()) {
// Record transition into no-through-traffic area.
if (backEdge instanceof StreetEdge && !((StreetEdge)backEdge).isNoThruTraffic()) {
s1.setEnteredNoThroughTrafficArea();
}
// If we transitioned into a no-through-traffic area at some point, check if we are exiting it.
if (s1.hasEnteredNoThroughTrafficArea()) {
// Only Edges are marked as no-thru, but really we need to avoid creating dominant, pruned states
// on thru _Vertices_. This could certainly be improved somehow.
for (StreetEdge se : Iterables.filter(s1.getVertex().getOutgoing(), StreetEdge.class)) {
if (!se.isNoThruTraffic()) {
// This vertex has at least one through-traffic edge. We can't dominate it with a no-thru state.
return null;
if (!s0.getReverseOptimizing()) {
if (this.isNoThruTraffic()) {
// Record transition into no-through-traffic area.
if (backEdge instanceof StreetEdge && !((StreetEdge) backEdge).isNoThruTraffic()) {
s1.setEnteredNoThroughTrafficArea();
}
// If we transitioned into a no-through-traffic area at some point, check if we are exiting it.
if (s1.hasEnteredNoThroughTrafficArea()) {
// Only Edges are marked as no-thru, but really we need to avoid creating dominant, pruned states
// on thru _Vertices_. This could certainly be improved somehow.
for (StreetEdge se : Iterables.filter(s1.getVertex().getOutgoing(), StreetEdge.class)) {
if (!se.isNoThruTraffic()) {

// This vertex has at least one through-traffic edge. We can't dominate it with a no-thru state.
return null;
}
}
}
}
Expand Down Expand Up @@ -616,7 +619,7 @@ private void writeObject(ObjectOutputStream out) throws IOException {
public String toString() {
return "StreetEdge(" + getId() + ", " + name + ", " + fromv + " -> " + tov
+ " length=" + this.getDistance() + " carSpeed=" + this.getCarSpeed()
+ " permission=" + this.getPermission() + " ref=" + this.getRef() + ")";
+ " permission=" + this.getPermission() + " ref=" + this.getRef() + " NTT=" + this.isNoThruTraffic() + ")";
}

@Override
Expand Down

0 comments on commit 4d61e54

Please sign in to comment.