List of usage examples for com.google.gwt.search.client LocalSearch setCenterPoint
public void setCenterPoint(String point)
From source file:org.onebusaway.webapp.gwt.common.control.PlaceSearch.java
License:Apache License
public void query(String query, PlaceSearchListener listener, LatLngBounds view) { final LocationHandler handler = new LocationHandler(listener, view); // Google Local Search LocalSearch search = new LocalSearch(); search.setAddressLookupMode(AddressLookupMode.ENABLED); if (view != null) search.setCenterPoint(view.getCenter()); search.addSearchCompleteHandler(handler); search.execute(query);/*from ww w . j a va 2s.c om*/ // Google Maps Geocoder Search Geocoder geocoder = new Geocoder(); if (view != null) geocoder.setViewport(view); geocoder.getLocations(query, handler); handler.scheduleRepeating(1000); }
From source file:org.onebusaway.webapp.gwt.where_library.impl.CombinedSearchServiceImpl.java
License:Apache License
@Override public void search(SearchQueryBean query, int placeTimeoutMillis, AsyncCallback<CombinedSearchResult> callback) { LatLngBounds originalBounds = getBounds(query.getBounds()); System.out.println(query.getBounds()); System.out.println(originalBounds); LatLngBounds smallerBounds = null;//from w w w .j a v a2s. co m if (originalBounds != null) { LatLng center = originalBounds.getCenter(); CoordinateBounds cb2 = SphericalGeometryLibrary.bounds(center.getLatitude(), center.getLongitude(), 4000); smallerBounds = getBounds(cb2); System.out.println(cb2); System.out.println(smallerBounds); } CombinedSearchHandlerImpl handler = new CombinedSearchHandlerImpl(originalBounds, placeTimeoutMillis, callback); // Start the route and stop search _service.getRoutesAndStops(query, handler); // Google Maps Geocoder Search Geocoder geocoder = new Geocoder(); if (smallerBounds != null) geocoder.setViewport(smallerBounds); geocoder.getLocations(query.getQuery(), handler); // Google Local Search LocalSearch search = new LocalSearch(); search.setAddressLookupMode(AddressLookupMode.ENABLED); if (!smallerBounds.isEmpty()) search.setCenterPoint(smallerBounds.getCenter()); search.addSearchCompleteHandler(handler); search.execute(query.getQuery()); }