Changeset 6873 in josm for trunk/src


Ignore:
Timestamp:
2014-02-19T00:30:40+01:00 (6 years ago)
Author:
Don-vip
Message:

fix #9692 - IllegalStateException with print and pdfimport plugins (regression from r6509)

File:
1 edited

Legend:

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

    r6509 r6873  
    416416        int width = getWidth()/2;
    417417        int height = getHeight()/2;
    418         if (width == 0 || height == 0) {
    419             throw new IllegalStateException("Cannot zoom into undimensioned NavigatableComponent");
    420         }
    421418        LatLon l1 = new LatLon(b.getMinLat(), lon);
    422419        LatLon l2 = new LatLon(b.getMaxLat(), lon);
     
    424421        EastNorth e2 = getProjection().latlon2eastNorth(l2);
    425422        double d = e2.north() - e1.north();
    426         if(d < height*newScale)
    427         {
     423        if (height > 0 && d < height*newScale) {
    428424            double newScaleH = d/height;
    429425            e1 = getProjection().latlon2eastNorth(new LatLon(lat, b.getMinLon()));
    430426            e2 = getProjection().latlon2eastNorth(new LatLon(lat, b.getMaxLon()));
    431427            d = e2.east() - e1.east();
    432             if(d < width*newScale) {
     428            if (width > 0 && d < width*newScale) {
    433429                newScale = Math.max(newScaleH, d/width);
    434430            }
    435         }
    436         else
    437         {
     431        } else if (height > 0) {
    438432            d = d/(l1.greatCircleDistance(l2)*height*10);
    439             if(newScale < d) {
     433            if (newScale < d) {
    440434                newScale = d;
    441435            }
Note: See TracChangeset for help on using the changeset viewer.