use of org.onebusaway.presentation.impl.RouteComparator in project onebusaway-application-modules by camsys.
the class RouteListServiceImpl method getRoutes.
@Override
public List<RouteBean> getRoutes() {
List<RouteBean> allRoutes = new ArrayList<RouteBean>();
List<AgencyWithCoverageBean> agencies = _transitDataService.getAgenciesWithCoverage();
for (AgencyWithCoverageBean agency : agencies) {
allRoutes.addAll(_transitDataService.getRoutesForAgencyId(agency.getAgency().getId()).getList());
}
Collections.sort(allRoutes, (getShowAgencyNames() ? new AgencyAndRouteComparator() : new RouteComparator()));
return allRoutes;
}
use of org.onebusaway.presentation.impl.RouteComparator in project onebusaway-application-modules by camsys.
the class SearchServiceImpl method findRoutesStoppingWithinRegion.
@Override
public SearchResultCollection findRoutesStoppingWithinRegion(CoordinateBounds bounds, SearchResultFactory resultFactory) {
SearchResultCollection results = new SearchResultCollection();
SearchQueryBean queryBean = new SearchQueryBean();
queryBean.setType(SearchQueryBean.EQueryType.BOUNDS_OR_CLOSEST);
queryBean.setBounds(bounds);
queryBean.setMaxCount(100);
RoutesBean routes = null;
try {
routes = _transitDataService.getRoutes(queryBean);
} catch (OutOfServiceAreaServiceException e) {
return results;
}
Collections.sort(routes.getRoutes(), new RouteComparator());
for (RouteBean route : routes.getRoutes()) {
results.addMatch(resultFactory.getRouteResultForRegion(route));
}
return results;
}
Aggregations