Changeset 334 in josm for branch/0.5


Ignore:
Timestamp:
2007-09-27T02:23:27+02:00 (17 years ago)
Author:
framm
Message:
  • fixed bug in getNearestWaySegment that led to strange results when ignore list was populated
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branch/0.5/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r329 r334  
    168168                                        continue;
    169169                                }
    170                                 if (ignore != null && ignore.contains(new WaySegment(w, i))) {
    171                                         continue;
    172                                 }
    173                                 Point A = getPoint(lastN.eastNorth);
    174                                 Point B = getPoint(n.eastNorth);
    175                                 double c = A.distanceSq(B);
    176                                 double a = p.distanceSq(B);
    177                                 double b = p.distanceSq(A);
    178                                 double perDist = a-(a-b+c)*(a-b+c)/4/c; // perpendicular distance squared
    179                                 if (perDist < 100 && minDistanceSq > perDist && a < c+100 && b < c+100) {
    180                                         minDistanceSq = perDist;
    181                                         minPrimitive = w;
    182                                         minI = i;
     170                                if (ignore == null || !ignore.contains(new WaySegment(w, i))) {
     171                                        Point A = getPoint(lastN.eastNorth);
     172                                        Point B = getPoint(n.eastNorth);
     173                                        double c = A.distanceSq(B);
     174                                        double a = p.distanceSq(B);
     175                                        double b = p.distanceSq(A);
     176                                        double perDist = a-(a-b+c)*(a-b+c)/4/c; // perpendicular distance squared
     177                                        if (perDist < 100 && minDistanceSq > perDist && a < c+100 && b < c+100) {
     178                                                minDistanceSq = perDist;
     179                                                minPrimitive = w;
     180                                                minI = i;
     181                                        }
    183182                                }
    184183                                lastN = n;
Note: See TracChangeset for help on using the changeset viewer.