Search in sources :

Example 36 with StopBean

use of org.onebusaway.transit_data.model.StopBean in project onebusaway-application-modules by camsys.

the class StopSelectionServiceImpl method getStopsForRouteAsStopSelectionTree.

/**
 **
 * Private Methods
 ***
 */
private StopSelectionTreeBean getStopsForRouteAsStopSelectionTree(StopsForRouteBean stopsForRoute) {
    StopSelectionTreeBean tree = new StopSelectionTreeBean();
    StopGroupingBean byDirection = getGroupingByType(stopsForRoute, TransitDataConstants.STOP_GROUPING_TYPE_DIRECTION);
    Map<String, StopBean> stopsById = getStopsById(stopsForRoute);
    if (byDirection != null) {
        groupByDirection(tree, stopsForRoute, byDirection, stopsById);
    } else {
        groupByStop(tree, stopsForRoute.getStops());
    }
    return tree;
}
Also used : StopSelectionTreeBean(org.onebusaway.presentation.model.StopSelectionTreeBean) StopGroupingBean(org.onebusaway.transit_data.model.StopGroupingBean) StopBean(org.onebusaway.transit_data.model.StopBean)

Example 37 with StopBean

use of org.onebusaway.transit_data.model.StopBean in project onebusaway-application-modules by camsys.

the class ArrivalsAndDeparturesForRouteAction method getRouteIdsForMatchingRoutes.

private Set<String> getRouteIdsForMatchingRoutes() {
    StopsWithArrivalsAndDeparturesBean result = _model.getResult();
    Set<String> ids = new HashSet<String>();
    for (StopBean stop : result.getStops()) {
        for (RouteBean route : stop.getRoutes()) {
            if (route.getShortName().equals(_route))
                ids.add(route.getId());
        }
    }
    return ids;
}
Also used : RouteBean(org.onebusaway.transit_data.model.RouteBean) StopsWithArrivalsAndDeparturesBean(org.onebusaway.transit_data.model.StopsWithArrivalsAndDeparturesBean) StopBean(org.onebusaway.transit_data.model.StopBean) HashSet(java.util.HashSet)

Example 38 with StopBean

use of org.onebusaway.transit_data.model.StopBean in project onebusaway-application-modules by camsys.

the class MultipleStopsFoundTemplate method buildTemplate.

@SuppressWarnings("unchecked")
@Override
public void buildTemplate(ActionContext context) {
    ValueStack vs = context.getValueStack();
    List<StopBean> stops = (List<StopBean>) vs.findValue("stops");
    int index = 1;
    addMessage(Messages.MULTIPLE_STOPS_WERE_FOUND);
    for (StopBean stop : stops) {
        addMessage(Messages.FOR);
        addText(_destinationPronunciation.modify(stop.getName()));
        addMessage(Messages.PLEASE_PRESS);
        String key = Integer.toString(index++);
        addText(key);
        AgiActionName action = addAction(key, "/stop/arrivalsAndDeparturesForStopId");
        action.putParam("stopIds", Arrays.asList(stop.getId()));
    }
    addMessage(Messages.HOW_TO_GO_BACK);
    addAction("\\*", "/back");
    addMessage(Messages.TO_REPEAT);
}
Also used : ValueStack(com.opensymphony.xwork2.util.ValueStack) StopBean(org.onebusaway.transit_data.model.StopBean) List(java.util.List) AgiActionName(org.onebusaway.probablecalls.AgiActionName)

Example 39 with StopBean

use of org.onebusaway.transit_data.model.StopBean in project onebusaway-application-modules by camsys.

the class StopFoundTemplate method buildTemplate.

@Override
public void buildTemplate(ActionContext context) {
    ValueStack vs = context.getValueStack();
    StopBean stop = (StopBean) vs.findValue("stop");
    addMessage(Messages.THE_STOP_NUMBER_FOR);
    addText(_destinationPronunciation.modify(stop.getName()));
    String direction = _directionPronunciation.modify(stop.getDirection());
    addMessage(Messages.DIRECTION_BOUND, direction);
    addText(Messages.IS);
    addText(stop.getCode());
    addMessage(Messages.STOP_FOUND_ARRIVAL_INFO);
    AgiActionName arrivalInfoAction = addAction("1", "/stop/arrivalsAndDeparturesForStopId");
    arrivalInfoAction.putParam("stopIds", Arrays.asList(stop.getId()));
    addMessage(Messages.STOP_FOUND_BOOKMARK_THIS_LOCATION);
    AgiActionName bookmarkAction = addAction("2", "/stop/bookmark");
    bookmarkAction.putParam("stop", stop);
    addMessage(Messages.STOP_FOUND_RETURN_TO_MAIN_MENU);
    addAction("3", "/index");
    addAction("[04-9]", "/repeat");
    addMessage(Messages.HOW_TO_GO_BACK);
    addAction("\\*", "/back");
    addMessage(Messages.TO_REPEAT);
}
Also used : ValueStack(com.opensymphony.xwork2.util.ValueStack) StopBean(org.onebusaway.transit_data.model.StopBean) AgiActionName(org.onebusaway.probablecalls.AgiActionName)

Example 40 with StopBean

use of org.onebusaway.transit_data.model.StopBean in project onebusaway-application-modules by camsys.

the class RouteBeanServiceImplTest method getStopBean.

private StopBean getStopBean(StopEntryImpl stopEntry) {
    StopBean stop = new StopBean();
    stop.setId(AgencyAndIdLibrary.convertToString(stopEntry.getId()));
    return stop;
}
Also used : StopBean(org.onebusaway.transit_data.model.StopBean)

Aggregations

StopBean (org.onebusaway.transit_data.model.StopBean)69 ArrayList (java.util.ArrayList)34 AgencyAndId (org.onebusaway.gtfs.model.AgencyAndId)23 RouteBean (org.onebusaway.transit_data.model.RouteBean)22 StopsForRouteBean (org.onebusaway.transit_data.model.StopsForRouteBean)17 StopGroupBean (org.onebusaway.transit_data.model.StopGroupBean)15 StopGroupingBean (org.onebusaway.transit_data.model.StopGroupingBean)15 HashMap (java.util.HashMap)12 CoordinateBounds (org.onebusaway.geospatial.model.CoordinateBounds)9 ArrivalAndDepartureBean (org.onebusaway.transit_data.model.ArrivalAndDepartureBean)9 NameBean (org.onebusaway.transit_data.model.NameBean)9 ServiceAlertBean (org.onebusaway.transit_data.model.service_alerts.ServiceAlertBean)8 TripBean (org.onebusaway.transit_data.model.trips.TripBean)8 HashSet (java.util.HashSet)7 StopsBean (org.onebusaway.transit_data.model.StopsBean)7 List (java.util.List)6 BlockTripBean (org.onebusaway.transit_data.model.blocks.BlockTripBean)6 Test (org.junit.Test)5 SearchQueryBean (org.onebusaway.transit_data.model.SearchQueryBean)5 TripStatusBean (org.onebusaway.transit_data.model.trips.TripStatusBean)5