Search in sources :

Example 1 with RouteInRegionResult

use of org.onebusaway.enterprise.webapp.actions.api.model.RouteInRegionResult in project onebusaway-application-modules by camsys.

the class SearchResultFactoryImpl method getRouteResultForRegion.

@Override
public SearchResult getRouteResultForRegion(RouteBean routeBean) {
    List<String> polylines = new ArrayList<String>();
    StopsForRouteBean stopsForRoute = _transitDataService.getStopsForRoute(routeBean.getId());
    List<StopGroupingBean> stopGroupings = stopsForRoute.getStopGroupings();
    for (StopGroupingBean stopGroupingBean : stopGroupings) {
        for (StopGroupBean stopGroupBean : stopGroupingBean.getStopGroups()) {
            NameBean name = stopGroupBean.getName();
            String type = name.getType();
            if (!type.equals("destination"))
                continue;
            for (EncodedPolylineBean polyline : stopGroupBean.getPolylines()) {
                polylines.add(polyline.getPoints());
            }
        }
    }
    return new RouteInRegionResult(routeBean, polylines);
}
Also used : RouteInRegionResult(org.onebusaway.enterprise.webapp.actions.api.model.RouteInRegionResult) StopGroupingBean(org.onebusaway.transit_data.model.StopGroupingBean) StopGroupBean(org.onebusaway.transit_data.model.StopGroupBean) ArrayList(java.util.ArrayList) StopsForRouteBean(org.onebusaway.transit_data.model.StopsForRouteBean) NameBean(org.onebusaway.transit_data.model.NameBean) EncodedPolylineBean(org.onebusaway.geospatial.model.EncodedPolylineBean)

Aggregations

ArrayList (java.util.ArrayList)1 RouteInRegionResult (org.onebusaway.enterprise.webapp.actions.api.model.RouteInRegionResult)1 EncodedPolylineBean (org.onebusaway.geospatial.model.EncodedPolylineBean)1 NameBean (org.onebusaway.transit_data.model.NameBean)1 StopGroupBean (org.onebusaway.transit_data.model.StopGroupBean)1 StopGroupingBean (org.onebusaway.transit_data.model.StopGroupingBean)1 StopsForRouteBean (org.onebusaway.transit_data.model.StopsForRouteBean)1