Example usage for com.google.gwt.search.client LocalSearch setAddressLookupMode

List of usage examples for com.google.gwt.search.client LocalSearch setAddressLookupMode

Introduction

In this page you can find the example usage for com.google.gwt.search.client LocalSearch setAddressLookupMode.

Prototype

public void setAddressLookupMode(AddressLookupMode mode) 

Source Link

Document

The default behavior of this searcher is to co-mingle address lookup results (e.g., NY, NY) with local search results.

Usage

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);//  ww  w . ja  v a  2  s  .c  o  m

    // 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;/*w w w . j  a  v a  2 s  .c o  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());
}