コード例 #1
0
  public DefaultHttpHeaders index() throws IOException, ServiceException {

    int maxCount = _maxCount.getMaxCount();

    if (maxCount <= 0) addFieldError("maxCount", "must be greater than zero");

    if (hasErrors()) return setValidationErrorsResponse();

    CoordinateBounds bounds = getSearchBounds();

    SearchQueryBean searchQuery = new SearchQueryBean();
    searchQuery.setBounds(bounds);
    searchQuery.setMaxCount(maxCount);
    searchQuery.setType(EQueryType.BOUNDS);
    if (_query != null) {
      searchQuery.setQuery(_query);
      searchQuery.setType(EQueryType.BOUNDS_OR_CLOSEST);
    }

    try {
      StopsBean result = _service.getStops(searchQuery);
      return transformResult(result);
    } catch (OutOfServiceAreaServiceException ex) {
      return transformOutOfRangeResult();
    }
  }
コード例 #2
0
  public static void searchForRoute(String route) {

    switchToMapView();

    CoordinateBounds bounds = getSearchBounds(20 * 1000);

    SearchQueryBean query = new SearchQueryBean();
    query.setQuery(route);
    query.setMaxCount(10);
    query.setBounds(bounds);
    query.setType(EQueryType.BOUNDS_OR_CLOSEST);

    _service.getRoutes(query, new RoutesHandler());
  }