aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-11-06 09:06:33 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-11-06 09:06:33 +1300
commit395249ddf82bafec4ec1bf879a6d7282cbdc2ea9 (patch)
tree72b82e95bb5d5a9c5b5c6002be7907298b36521c /src
parent850734d2f1bef8aba5761f540caa40c23608acc6 (diff)
downloadtrackermap-server-395249ddf82bafec4ec1bf879a6d7282cbdc2ea9.tar.gz
trackermap-server-395249ddf82bafec4ec1bf879a6d7282cbdc2ea9.tar.bz2
trackermap-server-395249ddf82bafec4ec1bf879a6d7282cbdc2ea9.zip
Simplify formatting code
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/WebDataHandler.java21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/org/traccar/WebDataHandler.java b/src/org/traccar/WebDataHandler.java
index b9de37ed2..f99d7c97a 100644
--- a/src/org/traccar/WebDataHandler.java
+++ b/src/org/traccar/WebDataHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2016 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,23 +51,8 @@ public class WebDataHandler extends BaseDataHandler {
double lat = position.getLatitude();
double lon = position.getLongitude();
- char hemisphere;
-
- if (lat < 0) {
- hemisphere = 'S';
- } else {
- hemisphere = 'N';
- }
-
- f.format("%02d%07.4f,%c,", (int) Math.abs(lat), Math.abs(lat) % 1 * 60, hemisphere);
-
- if (lon < 0) {
- hemisphere = 'W';
- } else {
- hemisphere = 'E';
- }
-
- f.format("%03d%07.4f,%c,", (int) Math.abs(lon), Math.abs(lon) % 1 * 60, hemisphere);
+ f.format("%02d%07.4f,%c,", (int) Math.abs(lat), Math.abs(lat) % 1 * 60, lat < 0 ? 'S' : 'N');
+ f.format("%03d%07.4f,%c,", (int) Math.abs(lon), Math.abs(lon) % 1 * 60, lon < 0 ? 'W' : 'E');
f.format("%.2f,%.2f,", position.getSpeed(), position.getCourse());
f.format("%1$td%1$tm%1$ty,,", calendar);