Examples of RoutingRequest


Examples of org.opentripplanner.routing.core.RoutingRequest

    @Test
    public void testTraverseAsCar() {
        StreetEdge e1 = edge(v1, v2, 100.0, StreetTraversalPermission.ALL);
        e1.setCarSpeed(10.0f);

        RoutingRequest options = proto.clone();
        options.setMode(TraverseMode.CAR);
        options.setRoutingContext(_graph, v1, v2);
       
        State s0 = new State(options);
        State s1 = e1.traverse(s0);
       
        // Should use the speed on the edge.
View Full Code Here

Examples of org.opentripplanner.routing.core.RoutingRequest

    @Test
    public void testTraverseAsCustomMotorVehicle() {
        StreetEdge e1 = edge(v1, v2, 100.0, StreetTraversalPermission.ALL);
        e1.setCarSpeed(10.0f);

        RoutingRequest options = proto.clone();
        options.setMode(TraverseMode.CUSTOM_MOTOR_VEHICLE);
        options.setRoutingContext(_graph, v1, v2);
       
        State s0 = new State(options);
        State s1 = e1.traverse(s0);
       
        // Should use the speed on the edge.
View Full Code Here

Examples of org.opentripplanner.routing.core.RoutingRequest

        StreetEdge e0 = edge(v0, v1, 50.0, StreetTraversalPermission.PEDESTRIAN);
        StreetEdge e1 = edge(v1, v2, 18.4, StreetTraversalPermission.PEDESTRIAN_AND_BICYCLE);

        v1.trafficLight = (true);

        RoutingRequest forward = proto.clone();
        forward.setMode(TraverseMode.BICYCLE);
        forward.bikeSpeed = 3.0f;
        forward.setRoutingContext(_graph, v0, v2);

        State s0 = new State(forward);
        State s1 = e0.traverse(s0);
        State s2 = e1.traverse(s1);

        RoutingRequest reverse = proto.clone();
        reverse.setMode(TraverseMode.BICYCLE);
        reverse.setArriveBy(true);
        reverse.bikeSpeed = 3.0f;
        reverse.setRoutingContext(_graph, v0, v2);

        State s3 = new State(reverse);
        State s4 = e1.traverse(s3);
        State s5 = e0.traverse(s4);
View Full Code Here

Examples of org.opentripplanner.routing.core.RoutingRequest

        StreetEdge e0 = edge(v0, v1, 50.0, StreetTraversalPermission.PEDESTRIAN_AND_BICYCLE);
        StreetEdge e1 = edge(v1, v2, 18.4, StreetTraversalPermission.PEDESTRIAN);

        v1.trafficLight = (true);

        RoutingRequest forward = proto.clone();
        forward.setMode(TraverseMode.BICYCLE);
        forward.setRoutingContext(_graph, v0, v2);

        State s0 = new State(forward);
        State s1 = e0.traverse(s0);
        State s2 = e1.traverse(s1);

        RoutingRequest reverse = proto.clone();
        reverse.setMode(TraverseMode.BICYCLE);
        reverse.setArriveBy(true);
        reverse.setRoutingContext(_graph, v0, v2);

        State s3 = new State(reverse);
        State s4 = e1.traverse(s3);
        State s5 = e0.traverse(s4);
View Full Code Here

Examples of org.opentripplanner.routing.core.RoutingRequest

    public void testBikeSwitch() {
        StreetEdge e0 = edge(v0, v1, 0.0, StreetTraversalPermission.PEDESTRIAN);
        StreetEdge e1 = edge(v1, v2, 0.0, StreetTraversalPermission.BICYCLE);
        StreetEdge e2 = edge(v2, v0, 0.0, StreetTraversalPermission.PEDESTRIAN_AND_BICYCLE);

        RoutingRequest noPenalty = proto.clone();
        noPenalty.setMode(TraverseMode.BICYCLE);
        noPenalty.setRoutingContext(_graph, v0, v0);

        State s0 = new State(noPenalty);
        State s1 = e0.traverse(s0);
        State s2 = e1.traverse(s1);
        State s3 = e2.traverse(s2);

        RoutingRequest withPenalty = proto.clone();
        withPenalty.bikeSwitchTime = (42);
        withPenalty.bikeSwitchCost = (23);
        withPenalty.setMode(TraverseMode.BICYCLE);
        withPenalty.setRoutingContext(_graph, v0, v0);

        State s4 = new State(withPenalty);
        State s5 = e0.traverse(s4);
        State s6 = e1.traverse(s5);
        State s7 = e2.traverse(s6);
View Full Code Here

Examples of org.opentripplanner.routing.core.RoutingRequest

        Graph gg = new Graph();
        GtfsContext context = GtfsLibrary.readGtfs(new File(ConstantsForTests.CALTRAIN_GTFS));
        GTFSPatternHopFactory factory = new GTFSPatternHopFactory(context);
        factory.run(gg);
        gg.putService(CalendarServiceData.class, GtfsLibrary.createCalendarServiceData(context.getDao()));
        RoutingRequest options = new RoutingRequest();
        long startTime = TestUtils.dateInSeconds("America/Los_Angeles", 2009, 8, 7, 12, 0, 0);
        options.dateTime = startTime;
        options.setRoutingContext(gg, "Caltrain:Millbrae Caltrain", "Caltrain:Mountain View Caltrain");
        ShortestPathTree spt;
        GraphPath path = null;
        spt = aStar.getShortestPathTree(options);

        path = spt.getPath(gg.getVertex("Caltrain:Mountain View Caltrain"), true);
View Full Code Here

Examples of org.opentripplanner.routing.core.RoutingRequest

    }

    public void testPortland() throws Exception {

        Graph gg = ConstantsForTests.getInstance().getPortlandGraph();
        RoutingRequest options = new RoutingRequest();
        ShortestPathTree spt;
        GraphPath path = null;
        long startTime = TestUtils.dateInSeconds("America/Los_Angeles", 2009, 11, 1, 12, 0, 0);
        options.dateTime = startTime;
        options.setRoutingContext(gg, "TriMet:10579", "TriMet:8371");
        // from zone 3 to zone 2
        spt = aStar.getShortestPathTree(options);

        path = spt.getPath(gg.getVertex("TriMet:8371"), true);
        assertNotNull(path);

        FareService fareService = gg.getService(FareService.class);
        Fare cost = fareService.getCost(path);
        assertEquals(new Money(new WrappedCurrency("USD"), 200), cost.getFare(FareType.regular));

        // long trip

        startTime = TestUtils.dateInSeconds("America/Los_Angeles", 2009, 11, 1, 14, 0, 0);
        options.dateTime = startTime;
        options.setRoutingContext(gg, "TriMet:8389", "TriMet:1252");
        spt = aStar.getShortestPathTree(options);

        path = spt.getPath(gg.getVertex("TriMet:1252"), true);
        assertNotNull(path);
        cost = fareService.getCost(path);
       
        //assertEquals(cost.getFare(FareType.regular), new Money(new WrappedCurrency("USD"), 460));
       
        // complex trip
        options.maxTransfers = 5;
        startTime = TestUtils.dateInSeconds("America/Los_Angeles", 2009, 11, 1, 14, 0, 0);
        options.dateTime = startTime;
        options.setRoutingContext(gg, "TriMet:10428", "TriMet:4231");
        spt = aStar.getShortestPathTree(options);

        path = spt.getPath(gg.getVertex("TriMet:4231"), true);
        assertNotNull(path);
        cost = fareService.getCost(path);
View Full Code Here

Examples of org.opentripplanner.routing.core.RoutingRequest

import com.vividsolutions.jts.geom.LineString;

public class StreetfulStopLinkerTest {
    @Test
    public final void testStreetfulStopLinker() {
        final double speed = new RoutingRequest().walkSpeed;

        Graph graph = new Graph();

        Stop stopA = new Stop();
        Stop stopB = new Stop();
View Full Code Here

Examples of org.opentripplanner.routing.core.RoutingRequest

        Graph gg = new Graph();
        GTFSPatternHopFactory factory = new GTFSPatternHopFactory(context);
        factory.run(gg);
        gg.putService(CalendarServiceData.class, GtfsLibrary.createCalendarServiceData(context.getDao()));
        RoutingRequest options = new RoutingRequest();
       
        ShortestPathTree spt;
        GraphPath path = null;

        options.dateTime = TestUtils.dateInSeconds("America/Los_Angeles", 2009, 8, 7, 12, 0, 0);
        options.setRoutingContext(gg, "Caltrain:Millbrae Caltrain", "Caltrain:Mountain View Caltrain");
        spt = aStar.getShortestPathTree(options);
        path = spt.getPath(gg.getVertex("Caltrain:Mountain View Caltrain"), true);

        long endTime = TestUtils.dateInSeconds("America/Los_Angeles", 2009, 8, 7, 13, 29, 0);

        assertEquals(path.getEndTime(), endTime);

        /* test backwards traversal */
        options.setArriveBy(true);
        options.dateTime = endTime;
        options.setRoutingContext(gg, "Caltrain:Millbrae Caltrain", "Caltrain:Mountain View Caltrain");
        spt = aStar.getShortestPathTree(options);
        path = spt.getPath(gg.getVertex("Caltrain:Millbrae Caltrain"), true);

        long expectedStartTime = TestUtils.dateInSeconds("America/Los_Angeles", 2009, 8, 7, 12, 39, 0);

View Full Code Here

Examples of org.opentripplanner.routing.core.RoutingRequest

        Graph graph = ConstantsForTests.getInstance().getPortlandGraph();
        Vertex start = graph.getVertex("TriMet:8371");
        Vertex end = graph.getVertex("TriMet:8374");

        RoutingRequest options = new RoutingRequest();
        long startTime = TestUtils.dateInSeconds("America/Los_Angeles", 2009, 11, 1, 12, 34, 25);
        options.dateTime = startTime;
        // one hour is more than enough time
        options.worstTime = startTime + 60 * 60;
        options.setRoutingContext(graph, start, end);

        ShortestPathTree spt = aStar.getShortestPathTree(options);
        GraphPath path = spt.getPath(end, true);
        assertNotNull(path);
       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.