List of usage examples for com.google.gwt.maps.client.geocoder HasGeocoderGeometry getBounds
public HasLatLngBounds getBounds();
From source file:com.google.mobile.trippy.web.client.presenter.CreateNewTripPresenter.java
License:Apache License
/** * Creates the trip by providing the location trip using service. */// www . j av a2 s . c om void createTrip(final String location) { final HasGeocoderRequest geocoderRequest = geocoderRequestProvider.get(); geocoderRequest.setAddress(location); singletonComponents.getToast().showLoading(singletonComponents.getMessage().toastMsgResolvingName()); geocoder.geocode(geocoderRequest, new GeocoderCallback() { @Override public void callback(final List<HasGeocoderResult> responses, final String status) { singletonComponents.getToast().hideLoading(); switch (responses.size()) { case 0: // no locations found singletonComponents.getToast().showToast(singletonComponents.getMessage().noTripLocations(), STATUS_TIME_MILLIS); break; case 1: // one location found create trip directly final HasGeocoderGeometry geometry = responses.get(0).getGeometry(); if (geometry.getBounds() != null) { final String address = responses.get(0).getAddressComponents().get(0).getLongName(); addTripToDb(location, address, geometry.getBounds()); } else { singletonComponents.getToast().showToast(singletonComponents.getMessage().noTripLocations(), STATUS_TIME_MILLIS); } break; default: // more than one location found, allow user to choose one if (registerSuggestedHandlers(responses)) { display.showPopup(); } else { singletonComponents.getToast().showToast(singletonComponents.getMessage().noTripLocations(), STATUS_TIME_MILLIS); } break; } } }); }