mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 23:42:53 +08:00
73 lines
1.4 KiB
JavaScript
73 lines
1.4 KiB
JavaScript
/**
|
|
* This class contains position information.
|
|
* @param {Object} lat
|
|
* @param {Object} lng
|
|
* @param {Object} acc
|
|
* @param {Object} alt
|
|
* @param {Object} altacc
|
|
* @param {Object} head
|
|
* @param {Object} vel
|
|
* @constructor
|
|
*/
|
|
function Position(coords, timestamp) {
|
|
this.coords = coords;
|
|
this.timestamp = new Date().getTime();
|
|
}
|
|
|
|
function Coordinates(lat, lng, alt, acc, head, vel) {
|
|
/**
|
|
* The latitude of the position.
|
|
*/
|
|
this.latitude = lat;
|
|
/**
|
|
* The longitude of the position,
|
|
*/
|
|
this.longitude = lng;
|
|
/**
|
|
* The accuracy of the position.
|
|
*/
|
|
this.accuracy = acc;
|
|
/**
|
|
* The altitude of the position.
|
|
*/
|
|
this.altitude = alt;
|
|
/**
|
|
* The direction the device is moving at the position.
|
|
*/
|
|
this.heading = head;
|
|
/**
|
|
* The velocity with which the device is moving at the position.
|
|
*/
|
|
this.speed = vel;
|
|
}
|
|
|
|
/**
|
|
* This class specifies the options for requesting position data.
|
|
* @constructor
|
|
*/
|
|
function PositionOptions() {
|
|
/**
|
|
* Specifies the desired position accuracy.
|
|
*/
|
|
this.enableHighAccuracy = true;
|
|
/**
|
|
* The timeout after which if position data cannot be obtained the errorCallback
|
|
* is called.
|
|
*/
|
|
this.timeout = 10000;
|
|
}
|
|
|
|
/**
|
|
* This class contains information about any GSP errors.
|
|
* @constructor
|
|
*/
|
|
function PositionError() {
|
|
this.code = null;
|
|
this.message = "";
|
|
}
|
|
|
|
PositionError.UNKNOWN_ERROR = 0;
|
|
PositionError.PERMISSION_DENIED = 1;
|
|
PositionError.POSITION_UNAVAILABLE = 2;
|
|
PositionError.TIMEOUT = 3;
|