Changeset 1797 in josm


Ignore:
Timestamp:
2009-07-16T00:41:38+02:00 (12 years ago)
Author:
framm
Message:
  • minor changes in conjunction with the Walking Papers plugin.
Location:
trunk/src/org/openstreetmap/josm
Files:
4 edited

Legend:

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

    r1750 r1797  
    6161        if (Main.map != null) {
    6262            BoundingXYVisitor bbox = getBoundingBox();
    63             if (bbox != null) {
     63            if (bbox != null && bbox.getBounds() != null) {
    6464                Main.map.mapView.recalculateCenterScale(bbox);
    6565            }
  • trunk/src/org/openstreetmap/josm/gui/MapView.java

    r1764 r1797  
    321321     */
    322322    public void recalculateCenterScale(BoundingXYVisitor box) {
    323         if(box == null) {
     323        if (box == null) {
    324324            box = new BoundingXYVisitor();
    325325        }
    326         if(box.getBounds() == null) {
     326        if (box.getBounds() == null) {
    327327            box.visit(getProjection().getWorldBounds());
    328328        }
    329         if(!box.hasExtend()) {
     329        if (!box.hasExtend()) {
    330330            box.enlargeBoundingBox();
    331331        }
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r1728 r1797  
    138138     */
    139139    public Point getPoint(EastNorth p) {
    140         if(null == p)
     140        if (null == p)
    141141            return new Point();
    142142        double x = (p.east()-center.east())/scale + getWidth()/2;
     
    146146
    147147    public Point getPoint(LatLon latlon) {
    148         if(latlon == null)
     148        if (latlon == null)
    149149            return new Point();
    150         else if(latlon instanceof CachedLatLon)
     150        else if (latlon instanceof CachedLatLon)
    151151            return getPoint(((CachedLatLon)latlon).getEastNorth());
    152152        else
     
    165165/* TODO: check that newCenter is really inside visible world and that scale is correct, don't allow zooming out to much */
    166166        boolean rep = false;
    167         if(!newCenter.equals(center))
    168         {
     167        if (!newCenter.equals(center)) {
    169168            EastNorth oldCenter = center;
    170169            center = newCenter;
     
    172171            firePropertyChange("center", oldCenter, newCenter);
    173172        }
    174         if(scale != newScale)
    175         {
     173        if (scale != newScale) {
    176174            double oldScale = scale;
    177175            scale = newScale;
     
    188186
    189187    public void zoomTo(LatLon newCenter) {
    190         if(newCenter instanceof CachedLatLon)
     188        if (newCenter instanceof CachedLatLon)
    191189            zoomTo(((CachedLatLon)newCenter).getEastNorth(), scale);
    192190        else
  • trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java

    r1740 r1797  
    88
    99public class OsmUrlToBounds {
     10   
    1011    public static Bounds parse(String url) {
    1112        int i = url.indexOf('?');
     
    5657    }
    5758
    58     static public int getZoom(Bounds b)
    59     {
     59    static public int getZoom(Bounds b) {
    6060        // convert to mercator (for calculation of zoom only)
    6161        double latMin = Math.log(Math.tan(Math.PI/4.0+b.min.lat()/180.0*Math.PI/2.0))*180.0/Math.PI;
     
    7272    }
    7373
    74     static public String getURL(Bounds b)
    75     {
     74    static public String getURL(Bounds b) {
    7675        return getURL(b.getCenter(), getZoom(b));
    7776    }
    7877
    79     static public String getURL(LatLon pos, int zoom)
    80     {
     78    static public String getURL(LatLon pos, int zoom) {
    8179        // Truncate lat and lon to something more sensible
    8280        int decimals = (int) Math.pow(10, (zoom / 3));
Note: See TracChangeset for help on using the changeset viewer.