* calculate area for single, given way point and return new LatLon if the
* way point has been used to modify the area.
*/
private LatLon calcAreaForWayPoint(WayPoint p, LatLon previous) {
tick();
LatLon c = p.getCoor();
if (previous == null || c.greatCircleDistance(previous) > buffer_dist) {
// we add a buffer around the point.
r.setRect(c.lon() - buffer_x, c.lat() - buffer_y, 2 * buffer_x, 2 * buffer_y);
a.add(new Area(r));
return c;
}
return previous;
}
@Override
protected void realRun() {
progressMonitor.setTicksCount(totalTicks);
/*
* Collect the combined area of all gpx points plus buffer zones around them. We ignore
* points that lie closer to the previous point than the given buffer size because
* otherwise this operation takes ages.
*/
LatLon previous = null;
if (near == NEAR_TRACK || near == NEAR_BOTH) {
for (GpxTrack trk : data.tracks) {
for (GpxTrackSegment segment : trk.getSegments()) {
for (WayPoint p : segment.getWayPoints()) {
if (cancel) {