js/position.js
changeset 0 54063d8b0412
equal deleted inserted replaced
-1:000000000000 0:54063d8b0412
       
     1 /**
       
     2  * This class contains position information.
       
     3  * @param {Object} lat
       
     4  * @param {Object} lng
       
     5  * @param {Object} acc
       
     6  * @param {Object} alt
       
     7  * @param {Object} altacc
       
     8  * @param {Object} head
       
     9  * @param {Object} vel
       
    10  * @constructor
       
    11  */
       
    12 function Position(coords, timestamp) {
       
    13 	this.coords = coords;
       
    14         this.timestamp = new Date().getTime();
       
    15 }
       
    16 
       
    17 function Coordinates(lat, lng, alt, acc, head, vel) {
       
    18 	/**
       
    19 	 * The latitude of the position.
       
    20 	 */
       
    21 	this.latitude = lat;
       
    22 	/**
       
    23 	 * The longitude of the position,
       
    24 	 */
       
    25 	this.longitude = lng;
       
    26 	/**
       
    27 	 * The accuracy of the position.
       
    28 	 */
       
    29 	this.accuracy = acc;
       
    30 	/**
       
    31 	 * The altitude of the position.
       
    32 	 */
       
    33 	this.altitude = alt;
       
    34 	/**
       
    35 	 * The direction the device is moving at the position.
       
    36 	 */
       
    37 	this.heading = head;
       
    38 	/**
       
    39 	 * The velocity with which the device is moving at the position.
       
    40 	 */
       
    41 	this.speed = vel;
       
    42 }
       
    43 
       
    44 /**
       
    45  * This class specifies the options for requesting position data.
       
    46  * @constructor
       
    47  */
       
    48 function PositionOptions() {
       
    49 	/**
       
    50 	 * Specifies the desired position accuracy.
       
    51 	 */
       
    52 	this.enableHighAccuracy = true;
       
    53 	/**
       
    54 	 * The timeout after which if position data cannot be obtained the errorCallback
       
    55 	 * is called.
       
    56 	 */
       
    57 	this.timeout = 10000;
       
    58 }
       
    59 
       
    60 /**
       
    61  * This class contains information about any GSP errors.
       
    62  * @constructor
       
    63  */
       
    64 function PositionError() {
       
    65 	this.code = null;
       
    66 	this.message = "";
       
    67 }
       
    68 
       
    69 PositionError.UNKNOWN_ERROR = 0;
       
    70 PositionError.PERMISSION_DENIED = 1;
       
    71 PositionError.POSITION_UNAVAILABLE = 2;
       
    72 PositionError.TIMEOUT = 3;