Example usage for com.google.gwt.maps.client.geocode Placemark getPoint

List of usage examples for com.google.gwt.maps.client.geocode Placemark getPoint

Introduction

In this page you can find the example usage for com.google.gwt.maps.client.geocode Placemark getPoint.

Prototype

public final LatLng getPoint() 

Source Link

Document

Returns the point corresponding to the decoded address.

Usage

From source file:com.google.gwt.maps.sample.hellomaps.client.Geocoder2Demo.java

License:Apache License

private void showAddress(final String address) {
    final InfoWindow info = map.getInfoWindow();
    geocoder.getLocations(address, new LocationCallback() {
        public void onFailure(int statusCode) {
            Window.alert("Sorry, we were unable to geocode that address");
        }// w  w  w . j  a va2s  .  co  m

        public void onSuccess(JsArray<Placemark> locations) {
            Placemark place = locations.get(0);
            Marker marker = new Marker(place.getPoint());
            map.addOverlay(marker);
            String message = place.getAddress() + "<br>" + "<b>Country code:</b> " + place.getCountry();
            info.open(marker, new InfoWindowContent(message));
        }
    });
}

From source file:org.maps.client.Maps.java

License:Apache License

private void performSearch(final String address) {
    if (address != null && !address.isEmpty()) {
        LocationCallback callback = new LocationCallback() {
            public void onFailure(int statusCode) {
                String message = "We could not find " + address + " due to: " + getMessage(statusCode);
                handleFailure(message);//from ww w. j av a2s .c o  m
            }

            public void onSuccess(JsArray<Placemark> locations) {
                map.clearOverlays();
                Placemark location = locations.get(0);
                map.setCenter(location.getPoint(), getZoom(location.getAccuracy()));
                refreshLayers();
            }
        };

        geocoder.getLocations(address, callback);
    }
}

From source file:org.onebusaway.webapp.gwt.where_library.impl.CombinedSearchHandlerImpl.java

License:Apache License

private Place getPlacemarkAsPlace(Placemark mark) {

    String name = null;//from   w w w .j  a va  2s.c  o m
    List<String> description = new ArrayList<String>();

    if (mark.getStreet() != null) {
        name = mark.getStreet();
        if (mark.getCity() != null)
            description.add(mark.getCity());
        if (mark.getState() != null)
            description.add(mark.getState());
        if (mark.getPostalCode() != null)
            description.add(mark.getPostalCode());
    } else if (mark.getCity() != null) {
        name = mark.getCity();
        if (mark.getState() != null)
            name += ", " + mark.getState();
    } else if (mark.getState() != null) {
        name = mark.getState();
        if (mark.getCounty() != null)
            description.add(mark.getCountry());
    }

    return new PlaceImpl(name, description, mark.getPoint(), mark.getAccuracy());
}