use of org.opentripplanner.common.model.GenericLocation in project OpenTripPlanner by opentripplanner.
the class TestIntermediatePlaces method testThreeBusStopPlaces.
@Test
public void testThreeBusStopPlaces() {
GenericLocation fromLocation = new GenericLocation(39.9058, -83.1341);
GenericLocation toLocation = new GenericLocation(39.9058, -82.8841);
GenericLocation[] intermediateLocations = { new GenericLocation(39.9058, -82.9841) };
handleRequest(fromLocation, toLocation, intermediateLocations, "TRANSIT", false);
handleRequest(fromLocation, toLocation, intermediateLocations, "TRANSIT", true);
}
use of org.opentripplanner.common.model.GenericLocation in project OpenTripPlanner by opentripplanner.
the class TestHalfEdges method testStreetLocationFinder.
@Test
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
TemporaryStreetLocation some = (TemporaryStreetLocation) finder.getVertexForLocation(new GenericLocation(40.00, -74.00), null, true);
assertNotNull(some);
some.dispose();
// test that the closest vertex finder correctly splits streets
TemporaryStreetLocation start = (TemporaryStreetLocation) finder.getVertexForLocation(new GenericLocation(40.004, -74.01), null, false);
assertNotNull(start);
assertTrue("wheelchair accessibility is correctly set (splitting)", start.isWheelchairAccessible());
Collection<Edge> edges = start.getOutgoing();
start.dispose();
assertEquals(2, edges.size());
RoutingRequest biking = new RoutingRequest(new TraverseModeSet(TraverseMode.BICYCLE));
TemporaryStreetLocation end = (TemporaryStreetLocation) finder.getVertexForLocation(new GenericLocation(40.008, -74.0), biking, true);
assertNotNull(end);
edges = end.getIncoming();
end.dispose();
assertEquals(2, edges.size());
// test that it is possible to travel between two splits on the same street
RoutingRequest walking = new RoutingRequest(TraverseMode.WALK);
start = (TemporaryStreetLocation) finder.getVertexForLocation(new GenericLocation(40.004, -74.0), walking, false);
exception.expect(TrivialPathException.class);
end = (TemporaryStreetLocation) finder.getVertexForLocation(new GenericLocation(40.008, -74.0), walking, true);
/*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);
GraphPath path = spt.getPath(end, false);
for (State s : path.states) {
assertFalse(s.getBackEdge() == top);
}
walking.cleanup();*/
}
use of org.opentripplanner.common.model.GenericLocation in project OpenTripPlanner by opentripplanner.
the class SimpleStreetSplitterTest method testFindEndVertexForParkAndRide.
/**
* Tests that traverse mode WALK is used when getting closest end vertex for park and ride.
*/
@Test
public void testFindEndVertexForParkAndRide() {
GenericLocation genericLocation = new GenericLocation(10, 23);
RoutingRequest routingRequest = new RoutingRequest();
routingRequest.setMode(TraverseMode.CAR);
routingRequest.parkAndRide = true;
spySimpleStreetSplitter.getClosestVertex(genericLocation, routingRequest, true);
verify(spySimpleStreetSplitter).link(any(Vertex.class), eq(TraverseMode.WALK), eq(routingRequest));
}
use of org.opentripplanner.common.model.GenericLocation in project OpenTripPlanner by opentripplanner.
the class BatchProcessor method buildRequest.
private RoutingRequest buildRequest(Individual i) {
RoutingRequest req = prototypeRoutingRequest.clone();
req.setDateTime(date, time, timeZone);
if (searchCutoffSeconds > 0) {
req.worstTime = req.dateTime + (req.arriveBy ? -searchCutoffSeconds : searchCutoffSeconds);
}
GenericLocation latLon = new GenericLocation(i.lat, i.lon);
req.batch = true;
if (req.arriveBy)
req.to = latLon;
else
req.from = latLon;
try {
req.setRoutingContext(graphService.getRouter(req.routerId).graph);
return req;
} catch (VertexNotFoundException vnfe) {
LOG.debug("no vertex could be created near the origin point");
return null;
}
}
use of org.opentripplanner.common.model.GenericLocation in project OpenTripPlanner by opentripplanner.
the class TestIntermediatePlaces method testWithoutIntermediatePlaces.
@Test
public void testWithoutIntermediatePlaces() {
GenericLocation fromLocation = new GenericLocation(39.93080, -82.98522);
GenericLocation toLocation = new GenericLocation(39.96383, -82.96291);
GenericLocation[] intermediateLocations = {};
handleRequest(fromLocation, toLocation, intermediateLocations, "WALK", false);
handleRequest(fromLocation, toLocation, intermediateLocations, "WALK", true);
}
Aggregations