use of org.opentripplanner.routing.graph.TemporaryConcreteEdge in project OpenTripPlanner by opentripplanner.
the class AStarTest method testBackExtraEdges.
@Test
public void testBackExtraEdges() {
RoutingRequest options = new RoutingRequest();
options.walkSpeed = 1.0;
options.setArriveBy(true);
TemporaryStreetLocation from = new TemporaryStreetLocation("near_shilshole_22nd", new Coordinate(-122.385050, 47.666620), new NonLocalizedString("near_shilshole_22nd"), false);
new TemporaryConcreteEdge(from, _graph.getVertex("shilshole_22nd"));
TemporaryStreetLocation to = new TemporaryStreetLocation("near_56th_20th", new Coordinate(-122.382347, 47.669518), new NonLocalizedString("near_56th_20th"), true);
new TemporaryConcreteEdge(_graph.getVertex("56th_20th"), to);
options.setRoutingContext(_graph, from, to);
ShortestPathTree tree = new AStar().getShortestPathTree(options);
options.cleanup();
GraphPath path = tree.getPath(from, false);
List<State> states = path.states;
assertEquals(9, states.size());
assertEquals("near_shilshole_22nd", states.get(0).getVertex().getLabel());
assertEquals("shilshole_22nd", states.get(1).getVertex().getLabel());
assertEquals("ballard_22nd", states.get(2).getVertex().getLabel());
assertEquals("market_22nd", states.get(3).getVertex().getLabel());
assertEquals("market_leary", states.get(4).getVertex().getLabel());
assertEquals("market_russell", states.get(5).getVertex().getLabel());
assertEquals("market_20th", states.get(6).getVertex().getLabel());
assertEquals("56th_20th", states.get(7).getVertex().getLabel());
assertEquals("near_56th_20th", states.get(8).getVertex().getLabel());
}
use of org.opentripplanner.routing.graph.TemporaryConcreteEdge in project OpenTripPlanner by opentripplanner.
the class AStarTest method testForwardExtraEdges.
@Test
public void testForwardExtraEdges() {
RoutingRequest options = new RoutingRequest();
options.walkSpeed = 1.0;
TemporaryStreetLocation from = new TemporaryStreetLocation("near_shilshole_22nd", new Coordinate(-122.385050, 47.666620), new NonLocalizedString("near_shilshole_22nd"), false);
new TemporaryConcreteEdge(from, _graph.getVertex("shilshole_22nd"));
TemporaryStreetLocation to = new TemporaryStreetLocation("near_56th_20th", new Coordinate(-122.382347, 47.669518), new NonLocalizedString("near_56th_20th"), true);
new TemporaryConcreteEdge(_graph.getVertex("56th_20th"), to);
options.setRoutingContext(_graph, from, to);
ShortestPathTree tree = new AStar().getShortestPathTree(options);
options.cleanup();
GraphPath path = tree.getPath(to, false);
List<State> states = path.states;
assertEquals(9, states.size());
assertEquals("near_shilshole_22nd", states.get(0).getVertex().getLabel());
assertEquals("shilshole_22nd", states.get(1).getVertex().getLabel());
assertEquals("ballard_22nd", states.get(2).getVertex().getLabel());
assertEquals("market_22nd", states.get(3).getVertex().getLabel());
assertEquals("market_leary", states.get(4).getVertex().getLabel());
assertEquals("market_russell", states.get(5).getVertex().getLabel());
assertEquals("market_20th", states.get(6).getVertex().getLabel());
assertEquals("56th_20th", states.get(7).getVertex().getLabel());
assertEquals("near_56th_20th", states.get(8).getVertex().getLabel());
}
Aggregations