assertNotSame(left, traversedOne.getBackEdge().getFromVertex());
assertNotSame(leftBack, traversedOne.getBackEdge().getFromVertex());
}
public void testStreetLocationFinder() {
StreetVertexIndexServiceImpl finder = new StreetVertexIndexServiceImpl(graph);
// test that the local stop finder finds stops
GenericLocation loc = new GenericLocation(40.01, -74.005000001);
assertTrue(finder.getNearbyTransitStops(loc.getCoordinate(), 100).size() > 0);
// test that the closest vertex finder returns the closest vertex
StreetLocation some = (StreetLocation) finder.getVertexForLocation(new GenericLocation(
40.00, -74.00), null);
assertNotNull(some);
// test that the closest vertex finder correctly splits streets
StreetLocation start = (StreetLocation) finder.getVertexForLocation(new GenericLocation(
40.004, -74.01), null);
assertNotNull(start);
assertTrue("wheelchair accessibility is correctly set (splitting)",
start.isWheelchairAccessible());
List<Edge> extras = start.getExtra();
assertEquals(4, extras.size());
RoutingRequest biking = new RoutingRequest(new TraverseModeSet(TraverseMode.BICYCLE));
StreetLocation end = (StreetLocation) finder.getVertexForLocation(new GenericLocation(
40.008, -74.0), biking);
assertNotNull(end);
extras = end.getExtra();
assertEquals(4, extras.size());
// test that the closest vertex finder also adds an edge to transit
// stops (if you are really close to the transit stop relative to the
// street)
StreetLocation location = (StreetLocation) finder.getVertexForLocation(new GenericLocation(
40.00999, -74.004999), new RoutingRequest());
assertTrue(location.isWheelchairAccessible());
boolean found = false;
for (Edge extra : location.getExtra()) {
if (extra instanceof FreeEdge && ((FreeEdge) extra).getToVertex().equals(station1)) {
found = true;
}
}
assertTrue(found);
// test that it is possible to travel between two splits on the same street
RoutingRequest walking = new RoutingRequest(TraverseMode.WALK);
start = (StreetLocation) finder.getVertexForLocation(new GenericLocation(40.004, -74.0),
walking);
end = (StreetLocation) finder.getVertexForLocation(new GenericLocation(40.008, -74.0),
walking);
assertNotNull(end);
// The visibility for temp edges for start and end is set in the setRoutingContext call
walking.setRoutingContext(graph, start, end);
ShortestPathTree spt = aStar.getShortestPathTree(walking);