Search in sources :

Example 1 with GenericLocation

use of org.opentripplanner.model.GenericLocation in project OpenTripPlanner by opentripplanner.

the class LocationStringParserTest method testWithId.

@Test
public void testWithId() {
    GenericLocation loc = LocationStringParser.fromOldStyleString("name::aFeed:A1B2C3");
    assertEquals("name", loc.label);
    assertEquals(loc.stopId, new FeedScopedId("aFeed", "A1B2C3"));
    assertNull(loc.lat);
    assertNull(loc.lng);
    assertNull(loc.getCoordinate());
    loc = LocationStringParser.fromOldStyleString("feed:4321");
    assertNull(loc.label);
    assertEquals(loc.stopId, new FeedScopedId("feed", "4321"));
    assertNull(loc.lat);
    assertNull(loc.lng);
    assertNull(loc.getCoordinate());
}
Also used : GenericLocation(org.opentripplanner.model.GenericLocation) FeedScopedId(org.opentripplanner.model.FeedScopedId) Test(org.junit.Test)

Example 2 with GenericLocation

use of org.opentripplanner.model.GenericLocation in project OpenTripPlanner by opentripplanner.

the class LocationStringParserTest method testFromOldStyleString.

@Test
public void testFromOldStyleString() {
    GenericLocation loc = LocationStringParser.fromOldStyleString("name::12345");
    assertEquals("name", loc.label);
    assertNull(loc.stopId);
    assertNull(loc.lat);
    assertNull(loc.lng);
    assertNull(loc.getCoordinate());
}
Also used : GenericLocation(org.opentripplanner.model.GenericLocation) Test(org.junit.Test)

Example 3 with GenericLocation

use of org.opentripplanner.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, new TraverseModeSet(TraverseMode.TRANSIT), false);
    handleRequest(fromLocation, toLocation, intermediateLocations, new TraverseModeSet(TraverseMode.TRANSIT), true);
}
Also used : GenericLocation(org.opentripplanner.model.GenericLocation) TraverseModeSet(org.opentripplanner.routing.core.TraverseModeSet) Test(org.junit.Test)

Example 4 with GenericLocation

use of org.opentripplanner.model.GenericLocation in project OpenTripPlanner by opentripplanner.

the class TestIntermediatePlaces method testTwoIntermediatePlaces.

@Test
@Ignore
public void testTwoIntermediatePlaces() {
    GenericLocation fromLocation = new GenericLocation(39.93080, -82.98522);
    GenericLocation toLocation = new GenericLocation(39.96383, -82.96291);
    GenericLocation[] intermediateLocations = new GenericLocation[2];
    intermediateLocations[0] = new GenericLocation(39.92099, -82.95570);
    intermediateLocations[1] = new GenericLocation(39.96146, -82.99552);
    handleRequest(fromLocation, toLocation, intermediateLocations, new TraverseModeSet(TraverseMode.CAR), false);
    handleRequest(fromLocation, toLocation, intermediateLocations, new TraverseModeSet(TraverseMode.CAR), true);
}
Also used : GenericLocation(org.opentripplanner.model.GenericLocation) TraverseModeSet(org.opentripplanner.routing.core.TraverseModeSet) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 5 with GenericLocation

use of org.opentripplanner.model.GenericLocation in project OpenTripPlanner by opentripplanner.

the class TestIntermediatePlaces method testTransitTwoIntermediatePlaces.

@Test
public void testTransitTwoIntermediatePlaces() {
    GenericLocation fromLocation = new GenericLocation(39.9908, -83.0118);
    GenericLocation toLocation = new GenericLocation(39.9998, -83.0198);
    GenericLocation[] intermediateLocations = new GenericLocation[2];
    intermediateLocations[0] = new GenericLocation(40.0000, -82.900);
    intermediateLocations[1] = new GenericLocation(39.9100, -83.100);
    handleRequest(fromLocation, toLocation, intermediateLocations, new TraverseModeSet(TraverseMode.TRANSIT, TraverseMode.WALK), false);
    handleRequest(fromLocation, toLocation, intermediateLocations, new TraverseModeSet(TraverseMode.TRANSIT, TraverseMode.WALK), true);
}
Also used : GenericLocation(org.opentripplanner.model.GenericLocation) TraverseModeSet(org.opentripplanner.routing.core.TraverseModeSet) Test(org.junit.Test)

Aggregations

GenericLocation (org.opentripplanner.model.GenericLocation)19 Test (org.junit.Test)14 TraverseModeSet (org.opentripplanner.routing.core.TraverseModeSet)8 RoutingRequest (org.opentripplanner.routing.api.request.RoutingRequest)4 FeedScopedId (org.opentripplanner.model.FeedScopedId)3 Ignore (org.junit.Ignore)2 Coordinate (org.locationtech.jts.geom.Coordinate)2 GraphPath (org.opentripplanner.routing.spt.GraphPath)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Matcher (java.util.regex.Matcher)1 Itinerary (org.opentripplanner.model.plan.Itinerary)1 Leg (org.opentripplanner.model.plan.Leg)1 TripPlan (org.opentripplanner.model.plan.TripPlan)1 AStar (org.opentripplanner.routing.algorithm.astar.AStar)1 TrivialRemainingWeightHeuristic (org.opentripplanner.routing.algorithm.astar.strategies.TrivialRemainingWeightHeuristic)1 State (org.opentripplanner.routing.core.State)1 StreetEdge (org.opentripplanner.routing.edgetype.StreetEdge)1 Edge (org.opentripplanner.routing.graph.Edge)1 Vertex (org.opentripplanner.routing.graph.Vertex)1