Ignore:
Timestamp:
2009-07-03T22:19:22+02:00 (15 years ago)
Author:
stoecker
Message:

some more changes and bug fixes related to new projection stuff - GPX should now work also

File:
1 edited

Legend:

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

    r1722 r1724  
    2525        this.max = max;
    2626    }
     27    public ProjectionBounds(EastNorth p) {
     28        this.min = p;
     29        this.max = p;
     30    }
    2731    public ProjectionBounds(EastNorth center, double east, double north) {
    2832        this.min = new EastNorth(center.east()-east/2.0, center.north()-north/2.0);
     
    3236    {
    3337        if (e.east() < min.east() || e.north() < min.north())
    34             min = e;
    35         else if (e.east() > max.east() || e.north() > max.north())
    36             max = e;
     38            min = new EastNorth(Math.min(e.east(), min.east()), Math.min(e.north(), min.north()));
     39        if (e.east() > max.east() || e.north() > max.north())
     40            max = new EastNorth(Math.max(e.east(), max.east()), Math.max(e.north(), max.north()));
    3741    }
    3842    public EastNorth getCenter()
    3943    {
    40         return  new EastNorth(min.east()/2+max.east()/2, min.north()/2+max.north()/2);
     44        return min.getCenter(max);
     45    }
     46
     47    @Override public String toString() {
     48        return "ProjectionBounds["+min.east()+","+min.north()+","+max.east()+","+max.north()+"]";
    4149    }
    4250}
Note: See TracChangeset for help on using the changeset viewer.