Example usage for com.google.gwt.geolocation.client Position getTimestamp

List of usage examples for com.google.gwt.geolocation.client Position getTimestamp

Introduction

In this page you can find the example usage for com.google.gwt.geolocation.client Position getTimestamp.

Prototype

public double getTimestamp();

Source Link

Document

Returns the time this position was reported by the browser.

Usage

From source file:com.googlecode.gwtphonegap.client.geolocation.browser.GeolocationBrowserEmptyImpl.java

License:Apache License

/**
 * @param result/* w  w  w  . j a  v a  2 s .  c  o m*/
 * @return
 */
private PositionBrowserImpl createPosition(com.google.gwt.geolocation.client.Position result) {
    CoordinatesBrowserImpl co = new CoordinatesBrowserImpl();
    co.setAltitude(result.getCoordinates().getAltitude() != null ? result.getCoordinates().getAltitude() : 0);
    co.setAltitudeAccuracy(result.getCoordinates().getAltitudeAccuracy() != null
            ? result.getCoordinates().getAltitudeAccuracy()
            : 0);
    co.setHeading(result.getCoordinates().getHeading() != null ? result.getCoordinates().getHeading() : 0);
    co.setAccuracy(result.getCoordinates().getAccuracy());
    co.setLatitude(result.getCoordinates().getLatitude());
    co.setLongitude(result.getCoordinates().getLongitude());
    co.setSpeed(result.getCoordinates().getSpeed() != null ? result.getCoordinates().getSpeed() : 0);
    PositionBrowserImpl positionBrowserImpl = new PositionBrowserImpl(co, Math.round(result.getTimestamp()));
    return positionBrowserImpl;
}