diff options
Diffstat (limited to 'main/src/cgeo/geocaching/geopoint/GeopointFormatter.java')
| -rw-r--r-- | main/src/cgeo/geocaching/geopoint/GeopointFormatter.java | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/main/src/cgeo/geocaching/geopoint/GeopointFormatter.java b/main/src/cgeo/geocaching/geopoint/GeopointFormatter.java index c706e77..0e676ce 100644 --- a/main/src/cgeo/geocaching/geopoint/GeopointFormatter.java +++ b/main/src/cgeo/geocaching/geopoint/GeopointFormatter.java @@ -10,7 +10,7 @@ public class GeopointFormatter /** * Predefined formats. */ - public static enum Format { + public enum Format { /** Example: "10,123456 -0,123456" */ LAT_LON_DECDEGREE, @@ -61,13 +61,13 @@ public class GeopointFormatter switch (format) { case LAT_LON_DECDEGREE: - return String.format("%.6f %.6f", latSigned, lonSigned); + return String.format(Locale.getDefault(), "%.6f %.6f", latSigned, lonSigned); case LAT_LON_DECDEGREE_COMMA: return String.format((Locale) null, "%.6f,%.6f", latSigned, lonSigned); case LAT_LON_DECMINUTE: - return String.format("%c %02d° %06.3f · %c %03d° %06.3f", + 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()); case LAT_LON_DECMINUTE_RAW: @@ -75,7 +75,7 @@ public class GeopointFormatter gp.getLatDir(), gp.getLatDeg(), gp.getLatMinRaw(), gp.getLonDir(), gp.getLonDeg(), gp.getLonMinRaw()); case LAT_LON_DECSECOND: - return String.format("%c %02d° %02d' %06.3f\" · %c %03d° %02d' %06.3f\"", + 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()); @@ -83,23 +83,22 @@ public class GeopointFormatter return String.format((Locale) null, "%.6f", latSigned); case LAT_DECMINUTE: - return String.format("%c %02d° %06.3f", gp.getLatDir(), gp.getLatDeg(), gp.getLatMinRaw()); + return String.format(Locale.getDefault(), "%c %02d° %06.3f", gp.getLatDir(), gp.getLatDeg(), gp.getLatMinRaw()); case LAT_DECMINUTE_RAW: - return String.format("%c %02d %06.3f", gp.getLatDir(), gp.getLatDeg(), gp.getLatMinRaw()); + return String.format(Locale.getDefault(), "%c %02d %06.3f", gp.getLatDir(), gp.getLatDeg(), gp.getLatMinRaw()); case LON_DECDEGREE_RAW: return String.format((Locale) null, "%.6f", lonSigned); case LON_DECMINUTE: - return String.format("%c %03d° %06.3f", gp.getLonDir(), gp.getLonDeg(), gp.getLonMinRaw()); + return String.format(Locale.getDefault(), "%c %03d° %06.3f", gp.getLonDir(), gp.getLonDeg(), gp.getLonMinRaw()); case LON_DECMINUTE_RAW: - return String.format("%c %03d %06.3f", gp.getLonDir(), gp.getLonDeg(), gp.getLonMinRaw()); + return String.format(Locale.getDefault(), "%c %03d %06.3f", gp.getLonDir(), gp.getLonDeg(), gp.getLonMinRaw()); + default: + throw new IllegalArgumentException(); } - - // Keep the compiler happy even though it cannot happen - return null; } } |
