Changeset 19240 in osm for applications/editors/josm/plugins/wmsplugin/src
- Timestamp:
- 2009-12-30T16:59:35+01:00 (16 years ago)
- Location:
- applications/editors/josm/plugins/wmsplugin/src/wmsplugin
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified applications/editors/josm/plugins/wmsplugin/src/wmsplugin/Grabber.java ¶
r19239 r19240 113 113 return (int)(Math.random() * ((max+1)-min) ) + min; 114 114 } 115 116 abstract public boolean loadFromCache(); 115 117 } -
TabularUnified applications/editors/josm/plugins/wmsplugin/src/wmsplugin/HTMLGrabber.java ¶
r17334 r19240 27 27 System.out.println("Grabbing HTML " + url); 28 28 29 BufferedImage cached = cache.getImg(urlstring);30 if(cached != null) return cached;31 32 29 ArrayList<String> cmdParams = new ArrayList<String>(); 33 30 StringTokenizer st = new StringTokenizer(MessageFormat.format( -
TabularUnified applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSGrabber.java ¶
r19239 r19240 66 66 67 67 if(image.isVisible(mv, layer.getDx(), layer.getDy())) { //don't download, if the image isn't visible already 68 BufferedImage img = grab(url); 69 if(img == null)return; 70 image.image = img; 68 image.image = grab(url); 71 69 image.flushedResizedCachedInstance(); 72 70 } … … 154 152 } 155 153 156 protected BufferedImage grab(URL url) throws IOException, OsmTransferException { 154 public boolean loadFromCache(){ 155 URL url = null; 156 try{ 157 url = getURL( 158 b.min.east(), b.min.north(), 159 b.max.east(), b.max.north(), 160 width(), height()); 161 } catch(Exception e) { 162 return false; 163 } 157 164 BufferedImage cached = cache.getImg(url.toString()); 158 165 if(!layer.hasAutoDownload() || cached != null){ 159 if(cached == null) grabNotInCache(); 160 return cached; 161 } 162 166 image.min = b.min; 167 image.max = b.max; 168 if(cached == null){ 169 grabNotInCache(); 170 return true; 171 } 172 image.image = cached; 173 image.flushedResizedCachedInstance(); 174 image.downloadingStarted = false; 175 return true; 176 } 177 return false; 178 } 179 180 protected BufferedImage grab(URL url) throws IOException, OsmTransferException { 163 181 System.out.println("Grabbing WMS " + url); 164 182 -
TabularUnified applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSLayer.java ¶
r19239 r19240 252 252 img.flushedResizedCachedInstance(); 253 253 Grabber gr = WMSPlugin.getGrabber(XYtoBounds(x,y), img, mv, this); 254 gr.setPriority(1); 255 executor.submit(gr); 254 if(!gr.loadFromCache()){ 255 gr.setPriority(1); 256 executor.submit(gr); 257 } 256 258 } 257 259 }
Note:
See TracChangeset
for help on using the changeset viewer.