Changeset 1302 in josm for trunk/src/org


Ignore:
Timestamp:
2009-01-19T14:07:58+01:00 (15 years ago)
Author:
stoecker
Message:

applied #2046. patch by Detlef Reichl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java

    r1169 r1302  
    1212
    1313import org.openstreetmap.josm.Main;
     14import org.openstreetmap.josm.data.coor.LatLon;
    1415import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1516import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
     
    2324public class AutoScaleAction extends JosmAction {
    2425
    25     public static final String[] modes = { marktr("data"), marktr("layer"), marktr("selection"), marktr("conflict") };
     26    public static final String[] modes = { marktr("data"), marktr("layer"), marktr("selection"), marktr("conflict"), marktr("download") };
    2627    private final String mode;
    2728
     
    4041        if (mode.equals("conflict")) {
    4142            shortcut = KeyEvent.VK_4;
     43        }
     44        if (mode.equals("download")) {
     45            shortcut = KeyEvent.VK_5;
    4246        }
    4347
     
    8589            v.enlargeBoundingBox();
    8690        }
     91        else if (mode.equals("download")) {
     92            if (Main.pref.hasKey("osm-download.bounds")) {
     93                try {
     94                    String bounds[] = Main.pref.get("osm-download.bounds").split(";");
     95                    double minlat = Double.parseDouble(bounds[0]);
     96                    double minlon = Double.parseDouble(bounds[1]);
     97                    double maxlat = Double.parseDouble(bounds[2]);
     98                    double maxlon = Double.parseDouble(bounds[3]);
     99                   
     100                    v.visit(Main.proj.latlon2eastNorth(new LatLon(minlat, minlon)));
     101                    v.visit(Main.proj.latlon2eastNorth(new LatLon(maxlat, maxlon)));
     102                }
     103                catch (Exception e) {
     104                    e.printStackTrace();
     105                }
     106            }
     107        }
    87108        return v;
    88109    }
Note: See TracChangeset for help on using the changeset viewer.