From 35182a1483c10c8e314872ff6773836d9f1302e2 Mon Sep 17 00:00:00 2001 From: Sandor Dornbush Date: Thu, 23 Sep 2010 14:30:44 -0700 Subject: [PATCH] Merge changes. --- .../android/apps/mytracks/MyTracksMap.java | 6 ++++-- .../android/apps/mytracks/MyTracksOverlay.java | 16 ---------------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/MyTracks/src/com/google/android/apps/mytracks/MyTracksMap.java b/MyTracks/src/com/google/android/apps/mytracks/MyTracksMap.java index db12a49cd..c32edc066 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/MyTracksMap.java +++ b/MyTracks/src/com/google/android/apps/mytracks/MyTracksMap.java @@ -1020,6 +1020,7 @@ public class MyTracksMap extends MapActivity long lastStoredLocationId = providerUtils.getLastLocationId(selectedTrackId); int samplingFrequency = -1; + Location location = new Location(""); for (;;) { Cursor cursor = null; try { @@ -1047,7 +1048,7 @@ public class MyTracksMap extends MapActivity numTotalPoints / MyTracksConstants.TARGET_DISPLAYED_TRACK_POINTS); } - Location location = providerUtils.createLocation(cursor); + providerUtils.fillLocation(cursor, location); // Include a point if it fits one of the following criteria: // - Has the mod for the sampling frequency (includes first point). @@ -1056,7 +1057,8 @@ public class MyTracksMap extends MapActivity if (numPoints % samplingFrequency == 0 || (!isRecordingSelected() && locationId == lastStoredLocationId) || !MyTracksUtils.isValidLocation(location)) { - mapOverlay.addLocation(location); + // Only allocate a new location if it is going to be kept around. + mapOverlay.addLocation(new Location(location)); } numPoints++; diff --git a/MyTracks/src/com/google/android/apps/mytracks/MyTracksOverlay.java b/MyTracks/src/com/google/android/apps/mytracks/MyTracksOverlay.java index 4f776802b..e7579e848 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/MyTracksOverlay.java +++ b/MyTracks/src/com/google/android/apps/mytracks/MyTracksOverlay.java @@ -231,23 +231,7 @@ public class MyTracksOverlay extends Overlay { int cx = mapView.getMapCenter().getLongitudeE6(); int cy = mapView.getMapCenter().getLatitudeE6(); Rect rect = new Rect(cx - w, cy - h, cx + w, cy + h); - Log.i(MyTracksConstants.TAG, - "Found bounding box: " + rect); - Point pt = new Point(); - GeoPoint upperLeft = new GeoPoint(rect.top, rect.left); - Point pUpperLeft = new Point(); - mapView.getProjection().toPixels(upperLeft, pUpperLeft); - GeoPoint bottomRight = new GeoPoint(rect.bottom, rect.right); - Point pBottomRight = new Point(); - mapView.getProjection().toPixels(upperLeft, pBottomRight); - Rect dispRect = new Rect(pUpperLeft.x, pUpperLeft.y, - pBottomRight.x, pBottomRight.y); - Log.i(MyTracksConstants.TAG, - "Found display box: " + rect); - canvas.drawRect(dispRect, selectedTrackPaint); - - Rect displayRect; GeoPoint geoPoint;