You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by he...@apache.org on 2013/05/15 20:34:45 UTC

[2/2] git commit: added Coordinates class & updated require path to Coordinates class

added Coordinates class & updated require path to Coordinates class


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/commit/317b2353
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/tree/317b2353
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/diff/317b2353

Branch: refs/heads/master
Commit: 317b235367661f78e2bfc1362d401b5fabf493a2
Parents: 5a901e1
Author: hermwong <he...@gmail.com>
Authored: Wed May 15 11:34:32 2013 -0700
Committer: hermwong <he...@gmail.com>
Committed: Wed May 15 11:34:32 2013 -0700

----------------------------------------------------------------------
 www/Coordinates.js |   69 +++++++++++++++++++++++++++++++++++++++++++++++
 www/Position.js    |    2 +-
 2 files changed, 70 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/blob/317b2353/www/Coordinates.js
----------------------------------------------------------------------
diff --git a/www/Coordinates.js b/www/Coordinates.js
new file mode 100644
index 0000000..84fdd5b
--- /dev/null
+++ b/www/Coordinates.js
@@ -0,0 +1,69 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+/**
+ * This class contains position information.
+ * @param {Object} lat
+ * @param {Object} lng
+ * @param {Object} alt
+ * @param {Object} acc
+ * @param {Object} head
+ * @param {Object} vel
+ * @param {Object} altacc
+ * @constructor
+ */
+var Coordinates = function(lat, lng, alt, acc, head, vel, altacc) {
+    /**
+     * 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 !== undefined ? alt : null);
+    /**
+     * The direction the device is moving at the position.
+     */
+    this.heading = (head !== undefined ? head : null);
+    /**
+     * The velocity with which the device is moving at the position.
+     */
+    this.speed = (vel !== undefined ? vel : null);
+
+    if (this.speed === 0 || this.speed === null) {
+        this.heading = NaN;
+    }
+
+    /**
+     * The altitude accuracy of the position.
+     */
+    this.altitudeAccuracy = (altacc !== undefined) ? altacc : null;
+};
+
+module.exports = Coordinates;

http://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation/blob/317b2353/www/Position.js
----------------------------------------------------------------------
diff --git a/www/Position.js b/www/Position.js
index 0f21ba3..dec18f6 100644
--- a/www/Position.js
+++ b/www/Position.js
@@ -19,7 +19,7 @@
  *
 */
 
-var Coordinates = require('cordova/plugin/Coordinates');
+var Coordinates = require('org.apache.cordova.core.GeoBroker.PositionError.Coordinates');
 
 var Position = function(coords, timestamp) {
     if (coords) {