use of org.opentripplanner.common.TurnRestriction in project OpenTripPlanner by opentripplanner.
the class PlainStreetEdgeTest method testTurnRestriction.
@Test
public void testTurnRestriction() {
StreetEdge e0 = edge(v0, v1, 50.0, StreetTraversalPermission.ALL);
StreetEdge e1 = edge(v1, v2, 18.4, StreetTraversalPermission.ALL);
State state = new State(v2, 0, proto.clone());
state.getOptions().setArriveBy(true);
_graph.addTurnRestriction(e1, new TurnRestriction(e1, e0, null, TraverseModeSet.allModes()));
assertNotNull(e0.traverse(e1.traverse(state)));
}
use of org.opentripplanner.common.TurnRestriction in project OpenTripPlanner by opentripplanner.
the class TurnRestrictionTest method DisallowTurn.
private void DisallowTurn(StreetEdge from, StreetEdge to) {
TurnRestrictionType rType = TurnRestrictionType.NO_TURN;
TraverseModeSet restrictedModes = new TraverseModeSet(TraverseMode.CAR);
TurnRestriction restrict = new TurnRestriction(from, to, rType, restrictedModes);
_graph.addTurnRestriction(from, restrict);
}
use of org.opentripplanner.common.TurnRestriction in project OpenTripPlanner by opentripplanner.
the class TurnCostTest method DisallowTurn.
private void DisallowTurn(StreetEdge from, StreetEdge to) {
TurnRestrictionType rType = TurnRestrictionType.NO_TURN;
TraverseModeSet restrictedModes = new TraverseModeSet(TraverseMode.CAR);
TurnRestriction restrict = new TurnRestriction(from, to, rType, restrictedModes);
_graph.addTurnRestriction(from, restrict);
}
use of org.opentripplanner.common.TurnRestriction in project OpenTripPlanner by opentripplanner.
the class Graph method removeEdge.
/**
* Removes an edge from the graph. This method is not thread-safe.
* @param e The edge to be removed
*/
public void removeEdge(Edge e) {
if (e != null) {
synchronized (alertPatches) {
// This synchronization is somewhat silly because this
// method isn't thread-safe anyway, but it is consistent
alertPatches.remove(e);
}
turnRestrictions.remove(e);
streetNotesService.removeStaticNotes(e);
edgeById.remove(e.getId());
if (e instanceof EdgeWithCleanup)
((EdgeWithCleanup) e).detach();
if (e.fromv != null) {
e.fromv.removeOutgoing(e);
for (Edge otherEdge : e.fromv.getIncoming()) {
for (TurnRestriction turnRestriction : getTurnRestrictions(otherEdge)) {
if (turnRestriction.to == e) {
removeTurnRestriction(otherEdge, turnRestriction);
}
}
}
e.fromv = null;
}
if (e.tov != null) {
e.tov.removeIncoming(e);
e.tov = null;
}
}
}
Aggregations