Ignore:
Timestamp:
2009-02-10T17:42:52+01:00 (16 years ago)
Author:
stoecker
Message:

apply patches from xeen: #1954 and #1906

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/wmsplugin/src/wmsplugin/YAHOOGrabber.java

    r13497 r13645  
    2121public class YAHOOGrabber extends WMSGrabber{
    2222    protected String browserCmd;
     23    protected Cache cache = new wmsplugin.Cache();
    2324
    2425    YAHOOGrabber(String baseURL, Bounds b, Projection proj,
    2526            double pixelPerDegree, GeorefImage image, MapView mv, WMSLayer layer) {
    26         super("file:///" + Main.pref.getPreferencesDir() + "plugins/wmsplugin/ymap.html?"
    27 //                + "request=getmap&format=image/jpeg"
     27        super("file:///" + WMSPlugin.getPrefsPath() + "ymap.html?"
    2828        , b, proj, pixelPerDegree, image, mv, layer);
    2929        this.browserCmd = baseURL.replaceFirst("yahoo://", "");
     
    3131
    3232    protected BufferedImage grab(URL url) throws IOException {
    33         ArrayList<String> cmdParams = new ArrayList<String>();
    3433        String urlstring = url.toExternalForm();
    3534        // work around a problem in URL removing 2 slashes
    3635        if(!urlstring.startsWith("file:///"))
    3736            urlstring = urlstring.replaceFirst("file:", "file://");
     37
     38        BufferedImage cached = cache.getImg(urlstring);
     39        if(cached != null) return cached;
     40
     41        ArrayList<String> cmdParams = new ArrayList<String>();
    3842        StringTokenizer st = new StringTokenizer(MessageFormat.format(browserCmd, urlstring));
    3943        while( st.hasMoreTokens() )
     
    5054        }
    5155
    52         return ImageIO.read(browser.getInputStream());
     56        return cache.saveImg(urlstring, ImageIO.read(browser.getInputStream()), true);
    5357    }
    5458}
Note: See TracChangeset for help on using the changeset viewer.