Package org.onebusaway.gtfs.model

Examples of org.onebusaway.gtfs.model.Route


    }

    @Test
    public void testPreferencesPenaltyForRoute() {
        AgencyAndId agencyAndId = new AgencyAndId();
        Route route = new Route();
        Trip trip = new Trip();
        RoutingRequest routingRequest = new RoutingRequest();

        trip.setRoute(route);
        route.setId(agencyAndId);
        assertEquals(0, routingRequest.preferencesPenaltyForRoute(trip.getRoute()));
    }
View Full Code Here


     */
    private void addTripFields(Leg leg, State[] states) {
        Trip trip = states[states.length - 1].getBackTrip();

        if (trip != null) {
            Route route = trip.getRoute();
            Agency agency = route.getAgency();
            ServiceDay serviceDay = states[states.length - 1].getServiceDay();

            leg.agencyId = agency.getId();
            leg.agencyName = agency.getName();
            leg.agencyUrl = agency.getUrl();
            leg.headsign = states[states.length - 1].getBackDirection();
            leg.route = states[states.length - 1].getBackEdge().getName();
            leg.routeColor = route.getColor();
            leg.routeId = route.getId().getId();
            leg.routeLongName = route.getLongName();
            leg.routeShortName = route.getShortName();
            leg.routeTextColor = route.getTextColor();
            leg.routeType = route.getType();
            leg.tripId = trip.getId().getId();
            leg.tripShortName = trip.getTripShortName();
            leg.tripBlockId = trip.getBlockId();

            if (serviceDay != null) {
View Full Code Here

class RoutesHandler implements OTPHandler {
    @Override
    public Object handle (OTPRequest oreq) {
        Map<String, Route> routes = Maps.newHashMap();
        for (TransitBoardAlight ba : Iterables.filter(oreq.graph.getEdges(), TransitBoardAlight.class)) {
            Route route = ba.getPattern().route;
            routes.put(route.getId().toString(), route);
        }
        if (oreq.id != null) {
            return routes.get(oreq.id);
        } else {
            return routes;
View Full Code Here

        ferryAgency.setId("Ferry");
        ferryAgency.setName("Brian Ferry");
        ferryAgency.setUrl("http://www.ferry.org/");

        // Routes for legs 1, 2 and 4, plus initialization
        Route firstRoute = new Route();
        Route secondRoute = new Route();
        Route thirdRoute = new Route();

        firstRoute.setId(new AgencyAndId("Train", "A"));
        firstRoute.setAgency(trainAgency);
        firstRoute.setShortName("A");
        firstRoute.setLongName("'A' Train");
        firstRoute.setType(2);
        firstRoute.setColor("White");
        firstRoute.setTextColor("Black");
        secondRoute.setId(new AgencyAndId("Train", "B"));
        secondRoute.setAgency(trainAgency);
        secondRoute.setShortName("B");
        secondRoute.setLongName("Another Train");
        secondRoute.setType(2);
        secondRoute.setColor("Cyan");
        secondRoute.setTextColor("Yellow");
        thirdRoute.setId(new AgencyAndId("Ferry", "C"));
        thirdRoute.setAgency(ferryAgency);
        thirdRoute.setShortName("C");
        thirdRoute.setLongName("Ferry Cross the Mersey");
        thirdRoute.setType(4);
        thirdRoute.setColor("Black");
        thirdRoute.setTextColor("White");

        // Trips for legs 1, 2 and 4, plus initialization
        Trip firstTrip = new Trip();
        Trip secondTrip = new Trip();
        Trip thirdTrip = new Trip();
View Full Code Here

        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();
        StopTime stopArriveTime = new StopTime();
        Stop stopDepart = new Stop();
        Stop stopDwell = new Stop();
        Stop stopArrive = new Stop();
        Trip trip = new Trip();

        routingContext.serviceDays =
                new ArrayList<ServiceDay>(Collections.singletonList(serviceDay));
        route.setId(agencyAndId);
        stopDepart.setId(agencyAndId);
        stopDwell.setId(agencyAndId);
        stopArrive.setId(agencyAndId);
        stopDepartTime.setStop(stopDepart);
        stopDepartTime.setDepartureTime(0);
View Full Code Here

        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();
        Stop stopDepart = new Stop();
        Stop stopArrive = new Stop();
        Trip trip = new Trip();

        routingContext.serviceDays =
                new ArrayList<ServiceDay>(Collections.singletonList(serviceDay));
        route.setId(agencyAndId);
        stopDepart.setId(new AgencyAndId("Station", "0"));
        stopArrive.setId(new AgencyAndId("Station", "1"));
        stopDepartTime.setStop(stopDepart);
        stopDepartTime.setDepartureTime(0);
        stopArriveTime.setArrivalTime(10);
View Full Code Here

        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();
        StopTime stopArriveTime = new StopTime();
        Stop stopDepart = new Stop();
        Stop stopDwell = new Stop();
        Stop stopArrive = new Stop();
        Trip trip = new Trip();

        routingContext.serviceDays =
                new ArrayList<ServiceDay>(Collections.singletonList(serviceDay));
        route.setId(agencyAndId);
        stopDepart.setId(new AgencyAndId("Station", "0"));
        stopDwell.setId(new AgencyAndId("Station", "1"));
        stopArrive.setId(new AgencyAndId("Station", "2"));
        stopDepartTime.setStop(stopDepart);
        stopDepartTime.setDepartureTime(0);
View Full Code Here

            spt = aStar.getShortestPathTree(options);
            GraphPath path = spt.getPath(end, true);
            for (State s : path.states) {
                if (s.getBackEdge() instanceof PatternHop) {
                    PatternHop e = (PatternHop) s.getBackEdge();
                    Route route = e.getPattern().route;
                    assertFalse(options.bannedRoutes.matches(route));
                    boolean foundMaxLine = false;
                    for (int j = 0; j < maxLines.length; ++j) {
                        if (j != i) {
                            if (e.getName().equals(maxLines[j][0])) {
View Full Code Here

            String toTripId, int transferTime) {
        Stop fromStop = new Stop();
        fromStop.setId(new AgencyAndId("TriMet", fromStopId));
        Stop toStop = new Stop();
        toStop.setId(new AgencyAndId("TriMet", toStopId));
        Route fromRoute = new Route();
        fromRoute.setId(new AgencyAndId("TriMet", fromRouteId));
        Route toRoute = new Route();
        toRoute.setId(new AgencyAndId("TriMet", toRouteId));
        Trip fromTrip = new Trip();
        fromTrip.setId(new AgencyAndId("TriMet", fromTripId));
        fromTrip.setRoute(fromRoute);
        Trip toTrip = new Trip();
        toTrip.setId(new AgencyAndId("TriMet", toTripId));
View Full Code Here

            String toStopId, int transferTime) {
        Stop fromStop = new Stop();
        fromStop.setId(new AgencyAndId("TriMet", fromStopId));
        Stop toStop = new Stop();
        toStop.setId(new AgencyAndId("TriMet", toStopId));
        Route fromRoute = new Route();
        fromRoute.setId(new AgencyAndId("TriMet", "dummy"));
        Route toRoute = new Route();
        toRoute.setId(new AgencyAndId("TriMet", "dummy"));
        Trip fromTrip = new Trip();
        fromTrip.setId(new AgencyAndId("TriMet", "dummy"));
        fromTrip.setRoute(fromRoute);
        Trip toTrip = new Trip();
        toTrip.setId(new AgencyAndId("TriMet", "dummy"));
View Full Code Here

TOP

Related Classes of org.onebusaway.gtfs.model.Route

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.