Java Code Examples for org.onebusaway.gtfs.model.Trip.getShapeId()

The following are Jave code examples for showing how to use getShapeId() of the org.onebusaway.gtfs.model.Trip class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: gtfsview   File: GtfsViewController.java   View Source Code Vote up 5 votes
public Collection<AgencyAndId> getShapesForAgency(Agency agency) {
    Set<AgencyAndId> agencyShapes = new HashSet<>();

    for (Route r : dao.getRoutesForAgency(agency)) {
        for (Trip t : dao.getTripsForRoute(r)) {
            AgencyAndId shapeId = t.getShapeId();
            if (shapeId != null) {
                agencyShapes.add(shapeId);
            }
        }
    }
    return agencyShapes;
}
 
Example 2
Project: gtfsview   File: GtfsViewController.java   View Source Code Vote up 5 votes
public Collection<AgencyAndId> getShapesForRoute(Route route) {
    Set<AgencyAndId> shapesForRoute = new HashSet<>();
    for (Trip t : dao.getTripsForRoute(route)) {
        if (t.getShapeId() != null) {
            shapesForRoute.add(t.getShapeId());
        }
    }
    return shapesForRoute;
}
 
Example 3
Project: gtfsview   File: GtfsViewController.java   View Source Code Vote up 5 votes
public Collection<AgencyAndId> getShapeForTrip(Trip trip) {
    AgencyAndId shapeId = trip.getShapeId();
    if (shapeId != null) {
        return Collections.singleton(shapeId);
    } else {
        return Collections.EMPTY_LIST;
    }

}
 
Example 4
Project: gtfsview   File: GtfsViewController.java   View Source Code Vote up 5 votes
public Collection<Trip> getTripsForRouteAndShape(Route route, AgencyAndId shape) {
    Collection<Trip> tripsForRoute = dao.getTripsForRoute(route);
    List<Trip> tripsForRouteAndShape = new ArrayList<>(tripsForRoute.size());

    for (Trip t : tripsForRoute) {
        if (t.getShapeId() != null && t.getShapeId().equals(shape)) {
            tripsForRouteAndShape.add(t);
        }
    }

    return tripsForRouteAndShape;
}