Changeset 2941 in josm for trunk/src/org


Ignore:
Timestamp:
2010-02-05T15:37:09+01:00 (15 years ago)
Author:
bastiK
Message:

fix gpx drawing ("intersects" is to strict on horizontal/vertical segments) (close #4478)

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/Bounds.java

    r2845 r2941  
    172172        return true;
    173173    }
     174   
     175    /**
     176     * The two bounds intersect? Compared to java Shape.intersects, if does not use
     177     * the interior but the closure. (">=" instead of ">")
     178     */
     179    public boolean intersects(Bounds b) {
     180            return b.getMax().lat() >= minLat &&
     181                    b.getMax().lon() >= minLon &&
     182                    b.getMin().lat() <= maxLat &&
     183                    b.getMin().lon() <= maxLon;
     184    }
     185   
    174186
    175187    /**
  • trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java

    r2907 r2941  
    613613        for (GpxTrack trk: data.tracks) {
    614614            for (GpxTrackSegment trkSeg: trk.getSegments()) {
    615                 if (trkSeg.getBounds().asRect().intersects(box.asRect())) {
     615                if (trkSeg.getBounds().intersects(box)) {
    616616                    visibleSegments.add(trkSeg.getWayPoints());
    617617                }
Note: See TracChangeset for help on using the changeset viewer.