forked from upstream-mirrors/OpenTracks
Minor updates.
This commit is contained in:
@@ -295,11 +295,14 @@ public class MyTracksOverlay extends Overlay {
|
|||||||
} else {
|
} else {
|
||||||
int numPoints = points.size();
|
int numPoints = points.size();
|
||||||
if (numPoints < 2) {
|
if (numPoints < 2) {
|
||||||
|
// Not enough points to draw a path.
|
||||||
path = null;
|
path = null;
|
||||||
} else if (lastPath != null && !newProjection) {
|
} else if (lastPath != null && !newProjection) {
|
||||||
|
// Incremental update of the path, without repositioning the view.
|
||||||
path = lastPath;
|
path = lastPath;
|
||||||
updatePath(projection, viewRect, path, numPoints - newPoints);
|
updatePath(projection, viewRect, path, numPoints - newPoints);
|
||||||
} else {
|
} else {
|
||||||
|
// The view has changed so we have to start from scratch.
|
||||||
path = newPath();
|
path = newPath();
|
||||||
path.incReserve(numPoints);
|
path.incReserve(numPoints);
|
||||||
updatePath(projection, viewRect, path, 0);
|
updatePath(projection, viewRect, path, 0);
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ public class MyTracksOverlayTest extends AndroidTestCase {
|
|||||||
/**
|
/**
|
||||||
* A mock {@code Projection} that acts as the identity matrix.
|
* A mock {@code Projection} that acts as the identity matrix.
|
||||||
*/
|
*/
|
||||||
private static class MockProjection implements Projection {
|
private static class MockProjection implements Projection {
|
||||||
@Override
|
@Override
|
||||||
public Point toPixels(GeoPoint in, Point out) {
|
public Point toPixels(GeoPoint in, Point out) {
|
||||||
return out;
|
return out;
|
||||||
|
|||||||
Reference in New Issue
Block a user