Search in sources :

Example 6 with GeometryAndBlockProcessor

use of org.opentripplanner.graph_builder.module.geometry.GeometryAndBlockProcessor in project OpenTripPlanner by opentripplanner.

the class TestHopFactory method setUp.

public void setUp() throws Exception {
    GtfsContext context = contextBuilder(ConstantsForTests.FAKE_GTFS).build();
    graph = new Graph();
    GeometryAndBlockProcessor factory = new GeometryAndBlockProcessor(context);
    factory.run(graph);
    graph.putService(CalendarServiceData.class, context.getCalendarServiceData());
    feedId = context.getFeedId().getId();
}
Also used : GeometryAndBlockProcessor(org.opentripplanner.graph_builder.module.geometry.GeometryAndBlockProcessor) Graph(org.opentripplanner.routing.graph.Graph) GtfsContext(org.opentripplanner.gtfs.GtfsContext)

Example 7 with GeometryAndBlockProcessor

use of org.opentripplanner.graph_builder.module.geometry.GeometryAndBlockProcessor in project OpenTripPlanner by opentripplanner.

the class TimetableSnapshotSourceTest method setUpClass.

@BeforeClass
public static void setUpClass() throws Exception {
    // The ".turnOnSetAgencyToFeedIdForAllElements()" is commented out so it can be
    // removed from the code, it in no longer in use. It is not deleted here to better
    // allow the reader of the test understand how the test once worked. There should
    // be new test to replace this one.
    context = contextBuilder(ConstantsForTests.FAKE_GTFS).withIssueStoreAndDeduplicator(graph).build();
    feedId = context.getFeedId().getId();
    GeometryAndBlockProcessor factory = new GeometryAndBlockProcessor(context);
    factory.run(graph);
    graph.index();
    final TripDescriptor.Builder tripDescriptorBuilder = TripDescriptor.newBuilder();
    tripDescriptorBuilder.setTripId("1.1");
    tripDescriptorBuilder.setScheduleRelationship(TripDescriptor.ScheduleRelationship.CANCELED);
    final TripUpdate.Builder tripUpdateBuilder = TripUpdate.newBuilder();
    tripUpdateBuilder.setTrip(tripDescriptorBuilder);
    cancellation = tripUpdateBuilder.build().toByteArray();
}
Also used : GeometryAndBlockProcessor(org.opentripplanner.graph_builder.module.geometry.GeometryAndBlockProcessor) TripUpdate(com.google.transit.realtime.GtfsRealtime.TripUpdate) TripDescriptor(com.google.transit.realtime.GtfsRealtime.TripDescriptor) BeforeClass(org.junit.BeforeClass)

Example 8 with GeometryAndBlockProcessor

use of org.opentripplanner.graph_builder.module.geometry.GeometryAndBlockProcessor in project OpenTripPlanner by opentripplanner.

the class TestFares method testKCM.

public void testKCM() throws Exception {
    Graph gg = new Graph();
    GtfsContext context = contextBuilder(ConstantsForTests.KCM_GTFS).build();
    GeometryAndBlockProcessor factory = new GeometryAndBlockProcessor(context);
    factory.setFareServiceFactory(new SeattleFareServiceFactory());
    factory.run(gg);
    gg.putService(CalendarServiceData.class, context.getCalendarServiceData());
    RoutingRequest options = new RoutingRequest();
    String feedId = gg.getFeedIds().iterator().next();
    String vertex0 = feedId + ":2010";
    String vertex1 = feedId + ":2140";
    ShortestPathTree spt;
    GraphPath path = null;
    FareService fareService = gg.getService(FareService.class);
    options.dateTime = TestUtils.dateInSeconds("America/Los_Angeles", 2016, 5, 24, 5, 0, 0);
    options.setRoutingContext(gg, vertex0, vertex1);
    spt = aStar.getShortestPathTree(options);
    path = spt.getPath(gg.getVertex(vertex1), true);
    // was: fareService.getCost(path);
    Fare costOffPeak = null;
    assertEquals(costOffPeak.getFare(FareType.regular), new Money(new WrappedCurrency("USD"), 250));
    long onPeakStartTime = TestUtils.dateInSeconds("America/Los_Angeles", 2016, 5, 24, 8, 0, 0);
    options.dateTime = onPeakStartTime;
    options.setRoutingContext(gg, vertex0, vertex1);
    spt = aStar.getShortestPathTree(options);
    path = spt.getPath(gg.getVertex(vertex1), true);
    // was: fareService.getCost(path);
    Fare costOnPeak = null;
    assertEquals(costOnPeak.getFare(FareType.regular), new Money(new WrappedCurrency("USD"), 275));
}
Also used : GeometryAndBlockProcessor(org.opentripplanner.graph_builder.module.geometry.GeometryAndBlockProcessor) SeattleFareServiceFactory(org.opentripplanner.routing.impl.SeattleFareServiceFactory) GtfsContext(org.opentripplanner.gtfs.GtfsContext) GraphPath(org.opentripplanner.routing.spt.GraphPath) WrappedCurrency(org.opentripplanner.routing.core.WrappedCurrency) FareService(org.opentripplanner.routing.services.FareService) Fare(org.opentripplanner.routing.core.Fare) Money(org.opentripplanner.routing.core.Money) Graph(org.opentripplanner.routing.graph.Graph) ShortestPathTree(org.opentripplanner.routing.spt.ShortestPathTree) RoutingRequest(org.opentripplanner.routing.api.request.RoutingRequest)

Example 9 with GeometryAndBlockProcessor

use of org.opentripplanner.graph_builder.module.geometry.GeometryAndBlockProcessor in project OpenTripPlanner by opentripplanner.

the class TestFares method testBasic.

public void testBasic() throws Exception {
    Graph gg = new Graph();
    GtfsContext context = contextBuilder(ConstantsForTests.CALTRAIN_GTFS).build();
    GeometryAndBlockProcessor factory = new GeometryAndBlockProcessor(context);
    factory.run(gg);
    gg.putService(CalendarServiceData.class, context.getCalendarServiceData());
    RoutingRequest options = new RoutingRequest();
    String feedId = gg.getFeedIds().iterator().next();
    options.dateTime = TestUtils.dateInSeconds("America/Los_Angeles", 2009, 8, 7, 12, 0, 0);
    options.setRoutingContext(gg, feedId + ":Millbrae Caltrain", feedId + ":Mountain View Caltrain");
    ShortestPathTree spt;
    GraphPath path = null;
    spt = aStar.getShortestPathTree(options);
    path = spt.getPath(gg.getVertex(feedId + ":Mountain View Caltrain"), true);
    FareService fareService = gg.getService(FareService.class);
    // was: fareService.getCost(path);
    Fare cost = null;
    assertEquals(cost.getFare(FareType.regular), new Money(new WrappedCurrency("USD"), 425));
}
Also used : GeometryAndBlockProcessor(org.opentripplanner.graph_builder.module.geometry.GeometryAndBlockProcessor) Money(org.opentripplanner.routing.core.Money) Graph(org.opentripplanner.routing.graph.Graph) ShortestPathTree(org.opentripplanner.routing.spt.ShortestPathTree) GtfsContext(org.opentripplanner.gtfs.GtfsContext) GraphPath(org.opentripplanner.routing.spt.GraphPath) RoutingRequest(org.opentripplanner.routing.api.request.RoutingRequest) WrappedCurrency(org.opentripplanner.routing.core.WrappedCurrency) FareService(org.opentripplanner.routing.services.FareService) Fare(org.opentripplanner.routing.core.Fare)

Example 10 with GeometryAndBlockProcessor

use of org.opentripplanner.graph_builder.module.geometry.GeometryAndBlockProcessor in project OpenTripPlanner by opentripplanner.

the class TestGraphPath method setUp.

public void setUp() throws Exception {
    GtfsContext context = contextBuilder(ConstantsForTests.FAKE_GTFS).build();
    graph = new Graph();
    GeometryAndBlockProcessor hl = new GeometryAndBlockProcessor(context);
    hl.run(graph);
    graph.putService(CalendarServiceData.class, context.getCalendarServiceData());
}
Also used : GeometryAndBlockProcessor(org.opentripplanner.graph_builder.module.geometry.GeometryAndBlockProcessor) Graph(org.opentripplanner.routing.graph.Graph) GtfsContext(org.opentripplanner.gtfs.GtfsContext)

Aggregations

GeometryAndBlockProcessor (org.opentripplanner.graph_builder.module.geometry.GeometryAndBlockProcessor)14 Graph (org.opentripplanner.routing.graph.Graph)12 GtfsContext (org.opentripplanner.gtfs.GtfsContext)10 RoutingRequest (org.opentripplanner.routing.api.request.RoutingRequest)4 GraphPath (org.opentripplanner.routing.spt.GraphPath)4 ShortestPathTree (org.opentripplanner.routing.spt.ShortestPathTree)4 BeforeClass (org.junit.BeforeClass)3 AddTransitModelEntitiesToGraph (org.opentripplanner.graph_builder.module.AddTransitModelEntitiesToGraph)3 Fare (org.opentripplanner.routing.core.Fare)3 Money (org.opentripplanner.routing.core.Money)3 WrappedCurrency (org.opentripplanner.routing.core.WrappedCurrency)3 FareService (org.opentripplanner.routing.services.FareService)3 IOException (java.io.IOException)2 StreetLinkerModule (org.opentripplanner.graph_builder.module.StreetLinkerModule)2 TripDescriptor (com.google.transit.realtime.GtfsRealtime.TripDescriptor)1 TripUpdate (com.google.transit.realtime.GtfsRealtime.TripUpdate)1 File (java.io.File)1 HashMap (java.util.HashMap)1 Before (org.junit.Before)1 DataImportIssueStore (org.opentripplanner.graph_builder.DataImportIssueStore)1