diff options
Diffstat (limited to 'src/cgeo/geocaching/StaticMapsProvider.java')
| -rw-r--r-- | src/cgeo/geocaching/StaticMapsProvider.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/cgeo/geocaching/StaticMapsProvider.java b/src/cgeo/geocaching/StaticMapsProvider.java index b649f7b..927a99c 100644 --- a/src/cgeo/geocaching/StaticMapsProvider.java +++ b/src/cgeo/geocaching/StaticMapsProvider.java @@ -28,7 +28,7 @@ public class StaticMapsProvider { private static void downloadMapsInThread(final cgCache cache, String latlonMap, int edge, String waypoints) { createStorageDirectory(cache); - + downloadMap(cache, 20, "satellite", 1, latlonMap, edge, waypoints); downloadMap(cache, 18, "satellite", 2, latlonMap, edge, waypoints); downloadMap(cache, 16, "roadmap", 3, latlonMap, edge, waypoints); @@ -54,7 +54,7 @@ public class StaticMapsProvider { private static void downloadMap(cgCache cache, int zoom, String mapType, int level, String latlonMap, int edge, String waypoints) { String mapUrl = "http://maps.google.com/maps/api/staticmap?center=" + latlonMap; String markerUrl = getMarkerUrl(cache); - + String url = mapUrl + "&zoom=" + zoom + "&size=" + edge + "x" + edge + "&maptype=" + mapType + "&markers=icon%3A" + markerUrl + "%7C" + latlonMap + waypoints + "&sensor=false"; final String fileName = getStaticMapsDirectory(cache) + "/map_" + level; @@ -125,7 +125,7 @@ public class StaticMapsProvider { || cache.longitude == null || cache.geocode == null || cache.geocode.length() == 0) { return; } - + final String latlonMap = String.format((Locale) null, "%.6f", cache.latitude) + "," + String.format((Locale) null, "%.6f", cache.longitude); final Display display = ((WindowManager) activity.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); final int maxWidth = display.getWidth() - 25; @@ -144,11 +144,13 @@ public class StaticMapsProvider { continue; } - waypoints.append("&markers=icon%3A" + MARKERS_URL + "marker_waypoint_"); + waypoints.append("&markers=icon%3A"); + waypoints.append(MARKERS_URL); + waypoints.append("marker_waypoint_"); waypoints.append(waypoint.type); waypoints.append(".png%7C"); waypoints.append(String.format((Locale) null, "%.6f", waypoint.latitude)); - waypoints.append(","); + waypoints.append(','); waypoints.append(String.format((Locale) null, "%.6f", waypoint.longitude)); } } @@ -156,7 +158,7 @@ public class StaticMapsProvider { // download map images in separate background thread for higher performance downloadMaps(cache, latlonMap, edge, waypoints.toString()); } - + private static void downloadMaps(final cgCache cache, final String latlonMap, final int edge, final String waypoints) { Thread staticMapsThread = new Thread("getting static map") {@Override |
