Merge changes.

This commit is contained in:
Sandor Dornbush
2010-09-23 14:30:44 -07:00
parent 21b0a517a9
commit 35182a1483
2 changed files with 4 additions and 18 deletions
@@ -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++;
@@ -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;