diff options
author | Samuel Tardieu <sam@rfc1149.net> | 2011-11-09 16:58:36 +0100 |
---|---|---|
committer | Samuel Tardieu <sam@rfc1149.net> | 2011-11-09 17:59:05 +0100 |
commit | bcbb6f97db2bc560305283c2291b828b2e372bb9 (patch) | |
tree | 40ae84a08c64c6db524155ed719479757e68ff9c /main/src/cgeo/geocaching/geopoint | |
parent | ae1fd0ffc874998e3e2bf45e4e345d5702c0faf4 (diff) | |
download | cgeo-bcbb6f97db2bc560305283c2291b828b2e372bb9.zip cgeo-bcbb6f97db2bc560305283c2291b828b2e372bb9.tar.gz cgeo-bcbb6f97db2bc560305283c2291b828b2e372bb9.tar.bz2 |
Use GeopointFormatter instead of String.format when coordinates are around
Some predefined formats have been added to fill the needs.
This closes issue #769.
Diffstat (limited to 'main/src/cgeo/geocaching/geopoint')
-rw-r--r-- | main/src/cgeo/geocaching/geopoint/GeopointFormatter.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/geopoint/GeopointFormatter.java b/main/src/cgeo/geocaching/geopoint/GeopointFormatter.java index 2c0dd3b..052dfb2 100644 --- a/main/src/cgeo/geocaching/geopoint/GeopointFormatter.java +++ b/main/src/cgeo/geocaching/geopoint/GeopointFormatter.java @@ -19,10 +19,14 @@ public class GeopointFormatter LAT_LON_DECMINUTE, /** Example: "W 5° 12,345 | N 10° 12,345" */ LAT_LON_DECMINUTE_PIPE, + /** Example: "-0.123456" (unlocalized latitude) */ + LAT_DECDEGREE_RAW, /** Example: "W 5° 12,345" */ LAT_DECMINUTE, /** Example: "W 5 12,345" */ LAT_DECMINUTE_RAW, + /** Example: "-0.123456" (unlocalized longitude) */ + LON_DECDEGREE_RAW, /** Example: "N 10° 12,345" */ LON_DECMINUTE, /** Example: "N 10 12,345" */ @@ -66,12 +70,18 @@ public class GeopointFormatter return String.format("%c %02.0f° %.3f | %c %03.0f° %.3f", latDir, latFloor, latMin, lonDir, lonFloor, lonMin); + case LAT_DECDEGREE_RAW: + return String.format((Locale) null, "%.6f", latSigned); + case LAT_DECMINUTE: return String.format("%c %02.0f° %.3f", latDir, latFloor, latMin); case LAT_DECMINUTE_RAW: return String.format("%c %02.0f %.3f", latDir, latFloor, latMin); + case LON_DECDEGREE_RAW: + return String.format((Locale) null, "%.6f", lonSigned); + case LON_DECMINUTE: return String.format("%c %03.0f° %.3f", lonDir, lonFloor, lonMin); |