Changeset 24567 in osm for applications/editors/josm


Ignore:
Timestamp:
2010-12-03T23:13:57+01:00 (14 years ago)
Author:
upliner
Message:

catch NumberFormatException, fix zoomlevel restriction

Location:
applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/ImageryPreferenceEditor.java

    r24550 r24567  
    454454                info.setURL((String)o);
    455455            case 2:
    456                 if(info.imageryType == ImageryType.WMS)
    457                     info.pixelPerDegree = Double.parseDouble((String) o);
    458                 else
    459                     info.maxZoom = Integer.parseInt((String) o);
     456                info.pixelPerDegree = 0;
     457                info.maxZoom = 0;
     458                try {
     459                    if(info.imageryType == ImageryType.WMS)
     460                        info.pixelPerDegree = Double.parseDouble((String) o);
     461                    else
     462                        info.maxZoom = Integer.parseInt((String) o);
     463                } catch (NumberFormatException e) {
     464                }
    460465            }
    461466        }
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/tms/TMSLayer.java

    r24555 r24567  
    5353import org.openstreetmap.josm.gui.layer.Layer;
    5454import org.openstreetmap.josm.plugins.imagery.ImageryInfo;
    55 import org.openstreetmap.josm.plugins.imagery.ImageryInfo.ImageryType;
    5655import org.openstreetmap.josm.plugins.imagery.ImageryLayer;
    5756import org.openstreetmap.josm.plugins.imagery.ImageryPreferences;
     57import org.openstreetmap.josm.plugins.imagery.ImageryInfo.ImageryType;
    5858
    5959/**
     
    151151
    152152        currentZoomLevel = getBestZoom();
    153         if (tileSource.getMaxZoom() < currentZoomLevel)
    154             currentZoomLevel = tileSource.getMaxZoom();
    155         if (tileSource.getMinZoom() > currentZoomLevel)
    156             currentZoomLevel = tileSource.getMinZoom();
     153        if (currentZoomLevel > getMaxZoomLvl())
     154            currentZoomLevel = getMaxZoomLvl();
     155        if (currentZoomLevel < getMinZoomLvl())
     156            currentZoomLevel = getMinZoomLvl();
    157157        clearTileCache();
    158158        //tileloader = new OsmTileLoader(this);
Note: See TracChangeset for help on using the changeset viewer.