diff options
Diffstat (limited to 'src/org/traccar/helper/Parser.java')
-rw-r--r-- | src/org/traccar/helper/Parser.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/org/traccar/helper/Parser.java b/src/org/traccar/helper/Parser.java index bda7d6366..c5f5d2e37 100644 --- a/src/org/traccar/helper/Parser.java +++ b/src/org/traccar/helper/Parser.java @@ -87,9 +87,11 @@ public class Parser { } public enum CoordinateFormat { + DEG_DEG, DEG_HEM, DEG_MIN_HEM, DEG_MIN_MIN_HEM, + HEM_DEG_MIN_MIN, HEM_DEG, HEM_DEG_MIN, HEM_DEG_MIN_HEM @@ -97,9 +99,12 @@ public class Parser { public double nextCoordinate(CoordinateFormat format) { double coordinate; - String hemisphere; + String hemisphere = null; switch (format) { + case DEG_DEG: + coordinate = Double.parseDouble(next() + '.' + next()); + break; case DEG_HEM: coordinate = nextDouble(); hemisphere = next(); @@ -126,6 +131,12 @@ public class Parser { hemisphere = next(); } break; + case HEM_DEG_MIN_MIN: + hemisphere = next(); + coordinate = nextInt(); + coordinate += Double.parseDouble(next() + '.' + next()) / 60; + break; + case DEG_MIN_HEM: default: coordinate = nextInt(); coordinate += nextDouble() / 60; |