Example usage for com.google.gwt.maps.client.geom LatLng toUrlValue

List of usage examples for com.google.gwt.maps.client.geom LatLng toUrlValue

Introduction

In this page you can find the example usage for com.google.gwt.maps.client.geom LatLng toUrlValue.

Prototype

public final native String toUrlValue() ;

Source Link

Document

Returns a string that represents this point in a format suitable for use as a URL parameter value.

Usage

From source file:net.sylvek.sharemyposition.client.Client.java

License:Open Source License

private void requestPosition() {
    geo.getCurrentPosition(new PositionCallback() {
        public void onFailure(PositionError error) {
            String message = "";
            switch (error.getCode()) {
            case PositionError.UNKNOWN_ERROR:
                message = "Unknown Error";
                break;
            case PositionError.PERMISSION_DENIED:
                message = "Permission Denied";
                break;
            case PositionError.POSITION_UNAVAILABLE:
                message = "Position Unavailable";
                break;
            case PositionError.TIMEOUT:
                message = "Time-out";
                break;
            default:
                message = "Unknown error code.";
            }// ww w. ja va  2s. c  o  m
            RootPanel.get("error").add(new Label(
                    "Message: '" + error.getMessage() + "', code: " + error.getCode() + " (" + message + ")"));
        }

        public void onSuccess(Position position) {
            Coordinates c = position.getCoords();

            final LatLng point = LatLng.newInstance(c.getLatitude(), c.getLongitude());
            final String url = URL_STATIC + "?pos=" + point.toUrlValue();
            addLinks(url, "");
        }
    }, PositionOptions.getPositionOptions(true /* GPS if possible */, 60000 /* timeout 1min */,
            0 /* new position */));
}