use of org.onebusaway.geospatial.model.CoordinateBounds in project onebusaway-application-modules by camsys.
the class ShapeGeospatialIndexTask method run.
@Override
public void run() {
try {
Map<CoordinateBounds, List<AgencyAndId>> shapeIdsByGridCell = buildShapeSpatialIndex();
File path = _bundle.getShapeGeospatialIndexDataPath();
ObjectSerializationLibrary.writeObject(path, shapeIdsByGridCell);
_refreshService.refresh(RefreshableResources.SHAPE_GEOSPATIAL_INDEX);
} catch (Exception ex) {
throw new IllegalStateException("error creating shape geospatial index data", ex);
}
}
use of org.onebusaway.geospatial.model.CoordinateBounds in project onebusaway-application-modules by camsys.
the class StopForCodeAction method execute.
public String execute() throws Exception {
_log.info("in stop for code");
CoordinateBounds bounds = getDefaultSearchArea();
if (bounds == null)
return NEEDS_DEFAULT_SEARCH_LOCATION;
if (_stopCode == null || _stopCode.length() == 0)
return INPUT;
if (_stop != null) {
_stops = Arrays.asList(_stop);
} else {
_log.info("searching on stopCode=" + _stopCode);
SearchQueryBean searchQuery = new SearchQueryBean();
searchQuery.setBounds(bounds);
searchQuery.setMaxCount(5);
searchQuery.setType(EQueryType.BOUNDS_OR_CLOSEST);
searchQuery.setQuery(_stopCode);
StopsBean stopsBean = _transitDataService.getStops(searchQuery);
_stops = stopsBean.getStops();
}
logUserInteraction("query", _stopCode);
if (_stops.size() == 0) {
sessionMap.put("messageFromAction", getText(Messages.NO_STOPS_WERE_FOUND));
sessionMap.put("backAction", "stops-index");
return "noStopsFound";
} else if (_stops.size() == 1) {
StopBean stop = _stops.get(0);
_stopIds = Arrays.asList(stop.getId());
return SUCCESS;
} else {
sessionMap.put("stops", _stops);
return "multipleStopsFound";
}
}
use of org.onebusaway.geospatial.model.CoordinateBounds in project onebusaway-application-modules by camsys.
the class RoutesAction method execute.
@Override
@Actions({ @Action(value = "/where/iphone/routes") })
public String execute() throws ServiceException {
if (_query == null || _query.length() == 0)
return INPUT;
CoordinateBounds bounds = getServiceArea();
if (bounds == null) {
pushNextAction("routes", "query", _query);
return "query-default-search-location";
}
SearchQueryBean query = new SearchQueryBean();
query.setBounds(bounds);
query.setMaxCount(5);
query.setQuery(_query);
query.setType(EQueryType.BOUNDS_OR_CLOSEST);
RoutesBean routesResult = _transitDataService.getRoutes(query);
_routes = routesResult.getRoutes();
if (_routes.size() == 0) {
return "noRoutesFound";
} else if (_routes.size() > 1) {
return "multipleRoutesFound";
} else {
_route = _routes.get(0);
return "singleRouteFound";
}
}
use of org.onebusaway.geospatial.model.CoordinateBounds in project onebusaway-application-modules by camsys.
the class StopsAction method execute.
@Override
@Actions({ @Action(value = "/where/iphone/stops") })
public String execute() throws ServiceException {
CoordinateBounds bounds = getServiceArea();
if (bounds == null) {
pushNextAction("stops", "code", _code);
return "query-default-search-location";
}
SearchQueryBean searchQuery = new SearchQueryBean();
searchQuery.setBounds(bounds);
searchQuery.setMaxCount(5);
searchQuery.setType(EQueryType.BOUNDS_OR_CLOSEST);
searchQuery.setQuery(_code);
StopsBean stopsResult = _transitDataService.getStops(searchQuery);
_stops = stopsResult.getStops();
if (_stops.size() == 0) {
return "noStopsFound";
} else if (_stops.size() > 1) {
return "multipleStopsFound";
} else {
_stop = _stops.get(0);
return "singleStopFound";
}
}
use of org.onebusaway.geospatial.model.CoordinateBounds in project onebusaway-application-modules by camsys.
the class FederatedByCoordinateBoundsMethodInvocationHandlerImpl method invoke.
public Object invoke(FederatedServiceCollection collection, Method method, Object[] args) throws ServiceAreaServiceException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
Object value = args[_argumentIndex];
if (_expression != null)
value = _expression.invoke(value);
CoordinateBounds bounds = (CoordinateBounds) value;
FederatedService service = collection.getServiceForBounds(bounds);
return method.invoke(service, args);
}
Aggregations