diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2011-09-08 00:00:58 +0200 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2011-09-08 11:32:14 +0200 |
| commit | 39ec7accd759fd60706523b366977ba371efd168 (patch) | |
| tree | 401ba08d9ec58e49d02ce614e12db5cf7b2b57bd /src/cgeo/geocaching/StaticMapsProvider.java | |
| parent | 668472ec735f827a4741a971614596df02618689 (diff) | |
| download | cgeo-39ec7accd759fd60706523b366977ba371efd168.zip cgeo-39ec7accd759fd60706523b366977ba371efd168.tar.gz cgeo-39ec7accd759fd60706523b366977ba371efd168.tar.bz2 | |
Refactoring to use Geopoint for coordinates
This uses the new Geopoint immutable class discussed in #58. No more
independent longitude or latitude fields -- they are now treated
and defined as a consistent pair.
Diffstat (limited to 'src/cgeo/geocaching/StaticMapsProvider.java')
| -rw-r--r-- | src/cgeo/geocaching/StaticMapsProvider.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cgeo/geocaching/StaticMapsProvider.java b/src/cgeo/geocaching/StaticMapsProvider.java index 5962460..97e9bd1 100644 --- a/src/cgeo/geocaching/StaticMapsProvider.java +++ b/src/cgeo/geocaching/StaticMapsProvider.java @@ -123,12 +123,12 @@ public class StaticMapsProvider { } public static void downloadMaps(cgCache cache, cgSettings settings, Activity activity) { - if (settings.storeOfflineMaps != 1 || cache.latitude == null - || cache.longitude == null || StringUtils.isNotBlank(cache.geocode)) { + if (settings.storeOfflineMaps != 1 || cache.coords == null || StringUtils.isNotBlank(cache.geocode)) { return; } - final String latlonMap = String.format((Locale) null, "%.6f", cache.latitude) + "," + String.format((Locale) null, "%.6f", cache.longitude); + final String latlonMap = String.format((Locale) null, "%.6f", cache.coords.getLatitude()) + "," + + String.format((Locale) null, "%.6f", cache.coords.getLongitude()); final Display display = ((WindowManager) activity.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); final int maxWidth = display.getWidth() - 25; final int maxHeight = display.getHeight() - 25; @@ -142,7 +142,7 @@ public class StaticMapsProvider { final StringBuilder waypoints = new StringBuilder(); if (CollectionUtils.isNotEmpty(cache.waypoints)) { for (cgWaypoint waypoint : cache.waypoints) { - if (waypoint.latitude == null && waypoint.longitude == null) { + if (waypoint.coords == null) { continue; } @@ -151,9 +151,9 @@ public class StaticMapsProvider { waypoints.append("marker_waypoint_"); waypoints.append(waypoint.type); waypoints.append(".png%7C"); - waypoints.append(String.format((Locale) null, "%.6f", waypoint.latitude)); + waypoints.append(String.format((Locale) null, "%.6f", waypoint.coords.getLatitude())); waypoints.append(','); - waypoints.append(String.format((Locale) null, "%.6f", waypoint.longitude)); + waypoints.append(String.format((Locale) null, "%.6f", waypoint.coords.getLongitude())); } } |
