use of org.onebusaway.transit_data.model.RoutesBean 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;
}
use of org.onebusaway.transit_data.model.RoutesBean in project onebusaway-application-modules by camsys.
the class RouteForNameAction method execute.
public String execute() throws Exception {
_log.debug("in RouteForName with routeName " + _routeName);
CoordinateBounds bounds = getDefaultSearchArea();
if (bounds == null) {
return NEEDS_DEFAULT_SEARCH_LOCATION;
}
if (_routeName == null || _routeName.length() == 0) {
return INPUT;
}
SearchQueryBean routesQuery = new SearchQueryBean();
routesQuery.setBounds(bounds);
routesQuery.setMaxCount(10);
routesQuery.setQuery(_routeName);
routesQuery.setType(EQueryType.BOUNDS_OR_CLOSEST);
RoutesBean routesBean = _transitDataService.getRoutes(routesQuery);
List<RouteBean> routes = routesBean.getRoutes();
sessionMap.put("navState", new Integer(DISPLAY_DATA));
logUserInteraction("route", _routeName);
if (routes.size() == 0) {
sessionMap.put("messageFromAction", getText(Messages.NO_ROUTES_WERE_FOUND));
sessionMap.put("backAction", "search-index");
return "noRoutesFound";
} else if (routes.size() == 1) {
_route = routes.get(0);
return SUCCESS;
} else {
_routes = routes;
return "multipleRoutesFound";
}
}
use of org.onebusaway.transit_data.model.RoutesBean in project onebusaway-application-modules by camsys.
the class RealtimeServiceV2Impl method getRoutesForBounds.
private List<RouteBean> getRoutesForBounds(CoordinateBounds bounds) {
if (bounds != null) {
SearchQueryBean queryBean = new SearchQueryBean();
queryBean.setType(SearchQueryBean.EQueryType.BOUNDS_OR_CLOSEST);
queryBean.setBounds(bounds);
queryBean.setMaxCount(Integer.MAX_VALUE);
RoutesBean routes = _transitDataService.getRoutes(queryBean);
return routes.getRoutes();
}
return new ArrayList<RouteBean>();
}
Aggregations