Examples of Itinerary


Examples of org.opentripplanner.api.model.Itinerary

        to.orig = request.to.name;

        TripPlan plan = new TripPlan(from, to, request.getDateTime());

        for (GraphPath path : paths) {
            Itinerary itinerary = generateItinerary(path, request.showIntermediateStops);
            itinerary = adjustItinerary(request, itinerary);
            plan.addItinerary(itinerary);
        }
        return plan;
    }
View Full Code Here

Examples of org.opentripplanner.api.model.Itinerary

    public Itinerary generateItinerary(GraphPath path, boolean showIntermediateStops) {
        if (path.states.size() < 2) {
            throw new TrivialPathException();
        }

        Itinerary itinerary = new Itinerary();

        State[] states = new State[path.states.size()];
        State lastState = path.states.getLast();
        states = path.states.toArray(states);

        Edge[] edges = new Edge[path.edges.size()];
        edges = path.edges.toArray(edges);

        Graph graph = path.getRoutingContext().graph;

        FareService fareService = graph.getService(FareService.class);

        State[][] legsStates = sliceStates(states);

        if (fareService != null) {
            itinerary.fare = fareService.getCost(path);
        }

        for (State[] legStates : legsStates) {
            itinerary.addLeg(generateLeg(graph, legStates, showIntermediateStops));
        }

        addWalkSteps(graph, itinerary.legs, legsStates);

        fixupLegs(itinerary.legs, legsStates);
View Full Code Here

Examples of org.opentripplanner.api.model.Itinerary

    public void testPlanner() throws Exception {
        TestPlanner planner = new TestPlanner(
                "portland", "From::NE 43RD AVE at NE GLISAN ST", "To::NE 43RD AVE at NE ROYAL CT");

        Response response = planner.getItineraries();
        Itinerary itinerary = response.getPlan().itinerary.get(0);
        Leg leg = itinerary.legs.get(0);
        List<WalkStep> steps = leg.walkSteps;
        assertEquals(3, steps.size());
        WalkStep step0 = steps.get(0);
        WalkStep step2 = steps.get(2);
View Full Code Here

Examples of org.opentripplanner.api.model.Itinerary

        // SE 47th and Ash, NE 47th and Davis (note that we cross Burnside, this goes from SE to NE)
        TestPlanner planner = new TestPlanner(
                "portland", "SE 47TH AVE at SE ASH ST", "NE 47TH AVE at NE COUCH ST");
        Response response = planner.getItineraries();

        Itinerary itinerary = response.getPlan().itinerary.get(0);
        Leg leg = itinerary.legs.get(0);
        List<WalkStep> steps = leg.walkSteps;
        assertEquals(2, steps.size());
        WalkStep step0 = steps.get(0);
        WalkStep step1 = steps.get(1);
View Full Code Here

Examples of org.opentripplanner.api.model.Itinerary

                "portland", "NE 57TH AVE at NE GLISAN ST #2", "NE 30TH AVE at NE GLISAN ST");
        // Ban trips with ids 190W1280 and 190W1260 from agency with id TriMet
        planner.setBannedTrips(Arrays.asList("TriMet:190W1280,TriMet:190W1260"));
        // Do the planning
        Response response = planner.getItineraries();
        Itinerary itinerary = response.getPlan().itinerary.get(0);
        Leg leg = itinerary.legs.get(1);
        // Without bannedTrips this leg would contain a trip with id 190W1280
        assertFalse(leg.tripId.equals("190W1280"));
        // Instead a trip is now expected with id 190W1290
        assertTrue(leg.tripId.equals("190W1290"));
View Full Code Here

Examples of org.opentripplanner.api.model.Itinerary

        // These are the two stops near NE 30TH AVE at NE GLISAN ST
        planner.setBannedStops(Arrays.asList("TriMet:2106,TriMet:2107"));
        // Do the planning
        Response response = planner.getItineraries();
        // First check the request
        Itinerary itinerary = response.getPlan().itinerary.get(0);
        Leg leg = itinerary.legs.get(1);
        // Without bannedStops this leg would stop at the stop with id 2107
        assertFalse(leg.to.stopId.getId().equals("2107"));
        // Instead a stop is now expected with id 2109
        assertTrue(leg.to.stopId.getId().equals("2109"));
View Full Code Here

Examples of org.opentripplanner.api.model.Itinerary

                "portland", "NE 57TH AVE at NE GLISAN ST #2", "NE 30TH AVE at NE GLISAN ST");

        // Do the planning
        Response response = planner.getItineraries();
        // First check the request
        Itinerary itinerary = response.getPlan().itinerary.get(0);
        Leg leg = itinerary.legs.get(1);
        // Validate that this leg uses trip 190W1280
        assertTrue(leg.tripId.equals("190W1280"));

        // Ban stop hard with id 2009 from agency with id TriMet
View Full Code Here

Examples of org.opentripplanner.api.model.Itinerary

        TestPlanner planner = new TestPlanner(
                "portland", "45.501115,-122.738214", "45.469487,-122.500343");
        // Do the planning
        Response response = planner.getItineraries();
        // Check itinerary for walkLimitExceeded
        Itinerary itinerary = response.getPlan().itinerary.get(0);
        assertTrue(itinerary.walkDistance > planner.getMaxWalkDistance().get(0));
        assertTrue(itinerary.walkLimitExceeded);

        planner = new TestPlanner("portland", "45.445631,-122.845388", "45.459961,-122.752347");
        // Do the planning with high walk reluctance
View Full Code Here

Examples of org.opentripplanner.api.model.Itinerary

            int expectedLegs, boolean smaller) {
        // Set transfer penalty
        planner.setTransferPenalty(Arrays.asList(transferPenalty));
        // Do the planning
        Response response = planner.getItineraries();
        Itinerary itinerary = response.getPlan().itinerary.get(0);
        // Check the number of legs
        if (smaller) {
            assertTrue(itinerary.legs.size() < expectedLegs);
        } else {
            assertEquals(expectedLegs, itinerary.legs.size());
View Full Code Here

Examples of org.opentripplanner.api.model.Itinerary

        Graph graph = Context.getInstance().graph;
        when(graph.getTransferTable()).thenReturn(table);

        // Do the planning
        Response response = planner.getItineraries();
        Itinerary itinerary = response.getPlan().itinerary.get(0);
        // Check the ids of the first two busses
        assertEquals("190W1280", itinerary.legs.get(1).tripId);
        assertEquals("751W1330", itinerary.legs.get(3).tripId);

        // Now add a transfer between the two busses of minimal 126 seconds
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.