aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/helper
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-04-26 17:06:43 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-04-26 17:07:00 +1200
commit1f3185d8a06f5d8cd3c05c15cbb7abbbfa81af37 (patch)
treef45f77fc14943215dd6112bf10decd7e5cb90ee9 /src/org/traccar/helper
parent1669e9c453f6bf2add655bbb2cf48b68bbbfb503 (diff)
downloadtraccar-server-1f3185d8a06f5d8cd3c05c15cbb7abbbfa81af37.tar.gz
traccar-server-1f3185d8a06f5d8cd3c05c15cbb7abbbfa81af37.tar.bz2
traccar-server-1f3185d8a06f5d8cd3c05c15cbb7abbbfa81af37.zip
Implement additional Xirgo attributes
Diffstat (limited to 'src/org/traccar/helper')
-rw-r--r--src/org/traccar/helper/Parser.java8
-rw-r--r--src/org/traccar/helper/UnitsConverter.java9
2 files changed, 17 insertions, 0 deletions
diff --git a/src/org/traccar/helper/Parser.java b/src/org/traccar/helper/Parser.java
index 69c80adb2..582b497cf 100644
--- a/src/org/traccar/helper/Parser.java
+++ b/src/org/traccar/helper/Parser.java
@@ -121,6 +121,14 @@ public class Parser {
}
}
+ public Double nextDouble() {
+ if (hasNext()) {
+ return Double.parseDouble(next());
+ } else {
+ return null;
+ }
+ }
+
public double nextDouble(double defaultValue) {
if (hasNext()) {
return Double.parseDouble(next());
diff --git a/src/org/traccar/helper/UnitsConverter.java b/src/org/traccar/helper/UnitsConverter.java
index e0d94c6dc..56d15e4e7 100644
--- a/src/org/traccar/helper/UnitsConverter.java
+++ b/src/org/traccar/helper/UnitsConverter.java
@@ -22,6 +22,7 @@ public final class UnitsConverter {
private static final double KNOTS_TO_MPS_RATIO = 1.94384;
private static final double KNOTS_TO_CPS_RATIO = 0.0194384449;
private static final double METERS_TO_FEET_RATIO = 0.3048;
+ private static final double METERS_TO_MILE_RATIO = 1609.34;
private UnitsConverter() {
}
@@ -62,4 +63,12 @@ public final class UnitsConverter {
return value * METERS_TO_FEET_RATIO;
}
+ public static double milesFromMeters(double value) {
+ return value / METERS_TO_MILE_RATIO;
+ }
+
+ public static double metersFromMiles(double value) {
+ return value * METERS_TO_MILE_RATIO;
+ }
+
}