Ignore:
Timestamp:
2010-12-03T14:17:09+01:00 (14 years ago)
Author:
upliner
Message:

Make per-layer maxzoom to override global settings(includes some refactoring)

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

Legend:

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

    r24541 r24555  
    1717    protected static final Icon icon =
    1818        new ImageIcon(Toolkit.getDefaultToolkit().createImage(ImageryPlugin.class.getResource("/images/imagery_small.png")));
     19
     20    protected ImageryInfo info;
    1921    protected MapView mv;
    2022
     
    2224    protected double dy = 0.0;
    2325
    24     public ImageryLayer(String name) {
    25         super(name);
    26         mv = Main.map.mapView;
     26    public ImageryLayer(ImageryInfo info) {
     27        super(info.getName());
     28        this.info = info;
     29        this.mv = Main.map.mapView;
    2730    }
    2831
     
    4447    public double getDy() {
    4548        return dy;
     49    }
     50
     51    public ImageryInfo getInfo() {
     52        return info;
    4653    }
    4754
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/tms/TMSLayer.java

    r24548 r24555  
    178178    @SuppressWarnings("serial")
    179179    public TMSLayer(ImageryInfo info) {
    180         super(info.getName());
     180        super(info);
    181181
    182182        setBackgroundLayer(true);
     
    191191        } else if (info.getImageryType() == ImageryType.BING) {
    192192            initTileSource(new BingAerialTileSource());
    193         } else throw new AssertionError();
     193        } else throw new IllegalStateException("cannot create TMSLayer with non-TMS ImageryInfo");
    194194
    195195        tileOptionMenu = new JPopupMenu();
     
    380380    int getMaxZoomLvl()
    381381    {
    382         return TMSPreferences.getMaxZoomLvl(tileSource);
     382        if (info.getMaxZoom() != 0) {
     383            return TMSPreferences.checkMaxZoomLvl(info.getMaxZoom(), tileSource);
     384        } else {
     385            return TMSPreferences.getMaxZoomLvl(tileSource);
     386        }
    383387    }
    384388
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/WMSAdapter.java

    r24501 r24555  
    3131
    3232    public Grabber getGrabber(MapView mv, WMSLayer layer){
    33         if(layer.info.getImageryType() == ImageryType.HTML)
     33        if(layer.getInfo().getImageryType() == ImageryType.HTML)
    3434            return new HTMLGrabber(mv, layer, cache);
    35         else if(layer.info.getImageryType() == ImageryType.WMS)
     35        else if(layer.getInfo().getImageryType() == ImageryType.WMS)
    3636            return new WMSGrabber(mv, layer, cache);
    37         else throw new AssertionError();
     37        else throw new IllegalStateException("WMSAdapter.getGrabber() called for non-WMS layer type");
    3838    }
    3939
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/WMSGrabber.java

    r24501 r24555  
    4444    WMSGrabber(MapView mv, WMSLayer layer, CacheFiles cache) {
    4545        super(mv, layer, cache);
    46         this.baseURL = layer.info.getURL();
     46        this.baseURL = layer.getInfo().getURL();
    4747        /* URL containing placeholders? */
    4848        urlWithPatterns = isUrlWithPatterns(baseURL);
     
    168168
    169169        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
    170         if(layer.info.getCookies() != null && !layer.info.getCookies().equals(""))
    171             conn.setRequestProperty("Cookie", layer.info.getCookies());
     170        if(layer.getInfo().getCookies() != null && !layer.getInfo().getCookies().equals(""))
     171            conn.setRequestProperty("Cookie", layer.getInfo().getCookies());
    172172        conn.setRequestProperty("User-Agent", Main.pref.get("wmsplugin.user_agent", Version.getInstance().getAgentString()));
    173173        conn.setConnectTimeout(Main.pref.getInteger("wmsplugin.timeout.connect", 30) * 1000);
  • applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/WMSLayer.java

    r24541 r24555  
    6969    protected boolean autoDownloadEnabled = true;
    7070    protected boolean settingsChanged;
    71     protected ImageryInfo info;
    7271
    7372    // Image index boundary for current view
     
    101100
    102101    public WMSLayer(ImageryInfo info) {
    103         super(info.getName());
     102        super(info);
    104103        setBackgroundLayer(true); /* set global background variable */
    105104        initializeImages();
Note: See TracChangeset for help on using the changeset viewer.