diff options
Diffstat (limited to 'main/src/cgeo/geocaching/geopoint/GeopointFormatter.java')
| -rw-r--r-- | main/src/cgeo/geocaching/geopoint/GeopointFormatter.java | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/main/src/cgeo/geocaching/geopoint/GeopointFormatter.java b/main/src/cgeo/geocaching/geopoint/GeopointFormatter.java index ba0a4d5..67f5ebb 100644 --- a/main/src/cgeo/geocaching/geopoint/GeopointFormatter.java +++ b/main/src/cgeo/geocaching/geopoint/GeopointFormatter.java @@ -64,36 +64,51 @@ public class GeopointFormatter { case LAT_LON_DECDEGREE_COMMA: return String.format((Locale) null, "%.6f,%.6f", latSigned, lonSigned); - case LAT_LON_DECMINUTE: + case LAT_LON_DECMINUTE: { + final Geopoint rgp = gp.roundedAt(60 * 1000); return String.format(Locale.getDefault(), "%c %02d° %06.3f · %c %03d° %06.3f", - gp.getLatDir(), gp.getLatDeg(), gp.getLatMinRaw(), gp.getLonDir(), gp.getLonDeg(), gp.getLonMinRaw()); + rgp.getLatDir(), rgp.getLatDeg(), rgp.getLatMinRaw(), rgp.getLonDir(), rgp.getLonDeg(), rgp.getLonMinRaw()); + } - case LAT_LON_DECMINUTE_RAW: + case LAT_LON_DECMINUTE_RAW: { + final Geopoint rgp = gp.roundedAt(60 * 1000); return String.format((Locale) null, "%c %02d° %06.3f %c %03d° %06.3f", - gp.getLatDir(), gp.getLatDeg(), gp.getLatMinRaw(), gp.getLonDir(), gp.getLonDeg(), gp.getLonMinRaw()); + rgp.getLatDir(), rgp.getLatDeg(), rgp.getLatMinRaw(), rgp.getLonDir(), rgp.getLonDeg(), rgp.getLonMinRaw()); + } - case LAT_LON_DECSECOND: + case LAT_LON_DECSECOND: { + final Geopoint rgp = gp.roundedAt(3600 * 1000); return String.format(Locale.getDefault(), "%c %02d° %02d' %06.3f\" · %c %03d° %02d' %06.3f\"", - gp.getLatDir(), gp.getLatDeg(), gp.getLatMin(), gp.getLatSecRaw(), - gp.getLonDir(), gp.getLonDeg(), gp.getLonMin(), gp.getLonSecRaw()); + rgp.getLatDir(), rgp.getLatDeg(), rgp.getLatMin(), rgp.getLatSecRaw(), + rgp.getLonDir(), rgp.getLonDeg(), rgp.getLonMin(), rgp.getLonSecRaw()); + } case LAT_DECDEGREE_RAW: return String.format((Locale) null, "%.6f", latSigned); - case LAT_DECMINUTE: - return String.format(Locale.getDefault(), "%c %02d° %06.3f", gp.getLatDir(), gp.getLatDeg(), gp.getLatMinRaw()); + case LAT_DECMINUTE: { + final Geopoint rgp = gp.roundedAt(60 * 1000); + return String.format(Locale.getDefault(), "%c %02d° %06.3f", rgp.getLatDir(), rgp.getLatDeg(), rgp.getLatMinRaw()); + } - case LAT_DECMINUTE_RAW: - return String.format(Locale.getDefault(), "%c %02d %06.3f", gp.getLatDir(), gp.getLatDeg(), gp.getLatMinRaw()); + case LAT_DECMINUTE_RAW: { + final Geopoint rgp = gp.roundedAt(60 * 1000); + return String.format(Locale.getDefault(), "%c %02d %06.3f", rgp.getLatDir(), rgp.getLatDeg(), rgp.getLatMinRaw()); + } case LON_DECDEGREE_RAW: return String.format((Locale) null, "%.6f", lonSigned); - case LON_DECMINUTE: - return String.format(Locale.getDefault(), "%c %03d° %06.3f", gp.getLonDir(), gp.getLonDeg(), gp.getLonMinRaw()); + case LON_DECMINUTE: { + final Geopoint rgp = gp.roundedAt(60 * 1000); + return String.format(Locale.getDefault(), "%c %03d° %06.3f", rgp.getLonDir(), rgp.getLonDeg(), rgp.getLonMinRaw()); + } + + case LON_DECMINUTE_RAW: { + final Geopoint rgp = gp.roundedAt(60 * 1000); + return String.format(Locale.getDefault(), "%c %03d %06.3f", rgp.getLonDir(), rgp.getLonDeg(), rgp.getLonMinRaw()); + } - case LON_DECMINUTE_RAW: - return String.format(Locale.getDefault(), "%c %03d %06.3f", gp.getLonDir(), gp.getLonDeg(), gp.getLonMinRaw()); default: throw new IllegalArgumentException(); } |
