Package org.opentripplanner.routing.core

Examples of org.opentripplanner.routing.core.RoutingContext


        return itinerary;
    }

    private Calendar makeCalendar(State state) {
        RoutingContext rctx = state.getContext();
        TimeZone timeZone = rctx.graph.getTimeZone();
        Calendar calendar = Calendar.getInstance(timeZone);
        calendar.setTimeInMillis(state.getTimeInMillis());
        return calendar;
    }
View Full Code Here


     * not created for pick/drop type 1 (no pick/drop).
     *
     * @param arrivalTimeAtStop TODO: clarify what this is.
     */
    public State traverse(State s0, long arrivalTimeAtStop) {
        RoutingContext rctx    = s0.getContext();
        RoutingRequest options = s0.getOptions();

        /* If the user requested a wheelchair accessible trip, check whether and this stop is not accessible. */
        if (options.wheelchairAccessible && ! getPattern().wheelchairAccessible(stopIndex)) {
            return null;
View Full Code Here

        OnBoardDepartPatternHop onBoardDepartPatternHop = new OnBoardDepartPatternHop(
                onboardDepartVertex, v12, firstTripPattern.scheduledTimetable.getTripTimes(0), serviceDay, 0, 0.5);

        // Traverse the path forward first
        RoutingRequest forwardOptions = options.clone();
        RoutingContext forwardContext = new RoutingContext(forwardOptions, graph, v0, v60);

        forwardContext.serviceDays = new ArrayList<ServiceDay>(1);
        forwardContext.serviceDays.add(serviceDay);

        forwardOptions.rctx = forwardContext;
        forwardOptions.dateTime = 0L;
        forwardOptions.bikeRentalPickupTime = 4;
        forwardOptions.bikeRentalDropoffTime = 2;
        e53.visibleTo = forwardContext;

        // Forward traversal of all edges
        State s0Forward = new State(forwardOptions);
        State s2Forward = e1.traverse(s0Forward);
        State s4Forward = e3.traverse(s2Forward);
        State s6Forward = e5.traverse(s4Forward);
        State s8Forward = e7.traverse(s6Forward);
        State s10Forward = e9.traverse(s8Forward);
        State s12Forward = e11.traverse(s10Forward);
        State s14Forward = e13.traverse(s12Forward);
        State s16Forward = e15.traverse(s14Forward);
        State s18Forward = e17.traverse(s16Forward);
        State s20Forward = e19.traverse(s18Forward);
        State s22Forward = e21.traverse(s20Forward);
        State s24Forward = e23.traverse(s22Forward);
        State s26Forward = e25.traverse(s24Forward);
        State s28Forward = e27.traverse(s26Forward);
        State s30Forward = e29.traverse(s28Forward);
        State s32Forward = e31.traverse(s30Forward);
        State s34Forward = e33.traverse(s32Forward);
        State s36Forward = e35.traverse(s34Forward);
        State s38Forward = e37.traverse(s36Forward);
        State s40Forward = e39.traverse(s38Forward);
        State s42Forward = e41.traverse(s40Forward);
        State s44Forward = e43.traverse(s42Forward);
        State s46Forward = e45.traverse(s44Forward);
        State s48Forward = e47.traverse(s46Forward);
        State s50Forward = e49.traverse(s48Forward);
        State s52Forward = e51.traverse(s50Forward);
        State s54Forward = e53.traverse(s52Forward);
        State s56Forward = e55.traverse(s54Forward);
        State s58Forward = e57.traverse(s56Forward);
        State s60Forward = e59.traverse(s58Forward);

        // Also traverse the path backward
        RoutingRequest backwardOptions = options.clone();
        RoutingContext backwardContext = new RoutingContext(backwardOptions, graph, v60, v0);

        backwardContext.serviceDays = new ArrayList<ServiceDay>(1);
        backwardContext.serviceDays.add(serviceDay);

        backwardOptions.rctx = backwardContext;
        backwardOptions.dateTime = 60L;
        backwardOptions.bikeRentalPickupTime = 4;
        backwardOptions.bikeRentalDropoffTime = 2;
        backwardOptions.setArriveBy(true);
        e53.visibleTo = backwardContext;

        // Backward traversal of all edges
        State s60Backward = new State(backwardOptions);
        State s58Backward = e59.traverse(s60Backward);
        State s56Backward = e57.traverse(s58Backward);
        State s54Backward = e55.traverse(s56Backward);
        State s52Backward = e53.traverse(s54Backward);
        State s50Backward = e51.traverse(s52Backward);
        State s48Backward = e49.traverse(s50Backward);
        State s46Backward = e47.traverse(s48Backward);
        State s44Backward = e45.traverse(s46Backward);
        State s42Backward = e43.traverse(s44Backward);
        State s40Backward = e41.traverse(s42Backward);
        State s38Backward = e39.traverse(s40Backward);
        State s36Backward = e37.traverse(s38Backward);
        State s34Backward = e35.traverse(s36Backward);
        State s32Backward = e33.traverse(s34Backward);
        State s30Backward = e31.traverse(s32Backward);
        State s28Backward = e29.traverse(s30Backward);
        State s26Backward = e27.traverse(s28Backward);
        State s24Backward = e25.traverse(s26Backward);
        State s22Backward = e23.traverse(s24Backward);
        State s20Backward = e21.traverse(s22Backward);
        State s18Backward = e19.traverse(s20Backward);
        State s16Backward = e17.traverse(s18Backward);
        State s14Backward = e15.traverse(s16Backward);
        State s12Backward = e13.traverse(s14Backward);
        State s10Backward = e11.traverse(s12Backward);
        State s8Backward = e9.traverse(s10Backward);
        State s6Backward = e7.traverse(s8Backward);
        State s4Backward = e5.traverse(s6Backward);
        State s2Backward = e3.traverse(s4Backward);
        State s0Backward = e1.traverse(s2Backward);

        // Perform a forward traversal starting onboard
        RoutingRequest onboardOptions = options.clone();
        RoutingContext onboardContext = new RoutingContext(onboardOptions, graph,
                onboardDepartVertex, v60);

        onboardContext.serviceDays = new ArrayList<ServiceDay>(1);
        onboardContext.serviceDays.add(serviceDay);
View Full Code Here

        CoordinateSequenceFactory coordinateSequenceFactory =
                geometryFactory.getCoordinateSequenceFactory();
        CoordinateSequence coordinateSequence = coordinateSequenceFactory.create(coordinates);
        LineString geometry = new LineString(coordinateSequence, geometryFactory);
        ArrayList<Edge> hops = new ArrayList<Edge>(2);
        RoutingContext routingContext = new RoutingContext(routingRequest, graph, null, arrive);
        AgencyAndId agencyAndId = new AgencyAndId("Agency", "ID");
        Route route = new Route();
        ArrayList<StopTime> stopTimes = new ArrayList<StopTime>(3);
        StopTime stopDepartTime = new StopTime();
        StopTime stopDwellTime = new StopTime();
View Full Code Here

        when(station0.getX()).thenReturn(coordinates[0].x);
        when(station0.getY()).thenReturn(coordinates[0].y);
        when(station1.getX()).thenReturn(coordinates[1].x);
        when(station1.getY()).thenReturn(coordinates[1].y);

        RoutingContext routingContext = new RoutingContext(routingRequest, graph, null, arrive);
        AgencyAndId agencyAndId = new AgencyAndId("Agency", "ID");
        Route route = new Route();
        ArrayList<StopTime> stopTimes = new ArrayList<StopTime>(2);
        StopTime stopDepartTime = new StopTime();
        StopTime stopArriveTime = new StopTime();
View Full Code Here

        ServiceDay serviceDay = mock(ServiceDay.class);

        when(graph.getTimeZone()).thenReturn(TimeZone.getTimeZone("GMT"));

        ArrayList<Edge> hops = new ArrayList<Edge>(2);
        RoutingContext routingContext = new RoutingContext(routingRequest, graph, null, arrive);
        AgencyAndId agencyAndId = new AgencyAndId("Agency", "ID");
        Route route = new Route();
        ArrayList<StopTime> stopTimes = new ArrayList<StopTime>(2);
        StopTime stopDepartTime = new StopTime();
        StopTime stopDwellTime = new StopTime();
View Full Code Here

TOP

Related Classes of org.opentripplanner.routing.core.RoutingContext

Copyright © 2018 www.massapicom. 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.