List of usage examples for com.google.gwt.maps.client.base HasLatLngBounds getCenter
public HasLatLng getCenter();
From source file:com.google.mobile.trippy.web.client.presenter.CreateNewTripPresenter.java
License:Apache License
/** * Create Trip and Add Trip to the Db.// w w w .ja v a2s . c om */ void addTripToDb(final String location, final String address, final HasLatLngBounds latlngBound) { final Trip trip = new Trip(); trip.setLocation(location); trip.setDuration(Constants.DEFAULT_TRIP_DURATION); trip.setLatitude(latlngBound.getCenter().getLatitude()); trip.setLongitude(latlngBound.getCenter().getLongitude()); // LP place details. trip.setPlaceId(0L); trip.setNorthLatitude(latlngBound.getNorthEast().getLatitude()); trip.setSouthLatitude(latlngBound.getSouthWest().getLatitude()); trip.setEastLongitude(latlngBound.getNorthEast().getLongitude()); trip.setWestLongitude(latlngBound.getSouthWest().getLongitude()); trip.setStartDate(Constants.UNSCHEDULED_DATE); trip.setLastModified(new Date()); trip.setAddedOn(new Date()); trip.setName(location); trip.setDescription(""); trip.setThumbsUp(0); trip.setThumbsDown(0); final Toast toast = singletonComponents.getToast(); toast.showLoading(singletonComponents.getMessage().toastMsgCreatingTrip()); singletonComponents.getTripService().addTrip(trip, new AsyncCallback<Trip>() { @Override public void onSuccess(final Trip result) { toast.hideLoading(); toast.showToast(singletonComponents.getMessage().tripCreated()); singletonComponents.getEventBus().fireEvent(new ShowTripScheduleEvent(result, true)); } @Override public void onFailure(final Throwable caught) { toast.hideLoading(); toast.showToast(singletonComponents.getMessage().tripSaveFailed()); singletonComponents.getEventBus().fireEvent(new ShowHomePageEvent()); } }); }