Compare commits
2 Commits
master
...
betterGpxA
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6de4d996da | ||
|
|
46edf48e3f |
@ -425,8 +425,8 @@ public class RoutePlannerFrontEnd {
|
||||
while (st != end) {
|
||||
LatLon point = r.getPoint(st);
|
||||
boolean pointIsClosed = false;
|
||||
int delta = 0, startInd = Math.max(0, start.ind - delta),
|
||||
nextInd = Math.min(gpxPoints.size(), next.ind + delta);
|
||||
int delta = 3, startInd = Math.max(0, start.ind - delta),
|
||||
nextInd = Math.min(gpxPoints.size() - 1, next.ind + delta);
|
||||
for (int k = startInd; !pointIsClosed && k < nextInd; k++) {
|
||||
pointIsClosed = pointCloseEnough(minPointApproximation, point, gpxPoints.get(k),
|
||||
gpxPoints.get(k + 1));
|
||||
@ -773,11 +773,14 @@ public class RoutePlannerFrontEnd {
|
||||
|
||||
private boolean pointCloseEnough(float minPointApproximation, LatLon point, GpxPoint gpxPoint,
|
||||
GpxPoint gpxPointNext) {
|
||||
// LatLon gpxPointLL = gpxPoint.loc; // more correct version
|
||||
// LatLon gpxPointNextLL = gpxPointNext.loc;
|
||||
LatLon gpxPointLL = gpxPoint.pnt != null ? gpxPoint.pnt.getPreciseLatLon() : gpxPoint.loc;
|
||||
LatLon gpxPointNextLL = gpxPointNext.pnt != null ? gpxPointNext.pnt.getPreciseLatLon() : gpxPointNext.loc;
|
||||
double orthogonalDistance = MapUtils.getOrthogonalDistance(point.getLatitude(), point.getLongitude(),
|
||||
gpxPointLL.getLatitude(), gpxPointLL.getLongitude(), gpxPointNextLL.getLatitude(),
|
||||
gpxPointNextLL.getLongitude());
|
||||
// System.out.printf("%.1f %s ( ntNext.ind, gpxPointLL, gpxPointNextLL);
|
||||
return orthogonalDistance <= minPointApproximation;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user