Changeset 15185 in osm for applications
- Timestamp:
- 2009-05-23T11:58:07+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/wmsplugin
- Files:
-
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wmsplugin/build.xml
r14120 r15185 29 29 <attribute name="Plugin-Description" value="Display georeferenced images as background in JOSM (WMS servers, Yahoo, ...)."/> 30 30 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/WMSPlugin"/> 31 <attribute name="Plugin-Mainversion" value="1 498"/>31 <attribute name="Plugin-Mainversion" value="1610"/> 32 32 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/> 33 33 <attribute name="de_Plugin-Link" value="http://wiki.openstreetmap.org/wiki/DE:JOSM/Plugins/WMSPlugin"/> -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/Grabber.java
r15091 r15185 2 2 3 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 5 import java.awt.image.BufferedImage; 6 import java.awt.Graphics; 7 import java.awt.Color; 8 import java.awt.Font; 4 9 5 10 import org.openstreetmap.josm.data.Bounds; … … 7 12 import org.openstreetmap.josm.gui.MapView; 8 13 import org.openstreetmap.josm.Main; 9 import java.awt.image.BufferedImage;10 import java.awt.Graphics;11 import java.awt.Color;12 import java.awt.Font;13 import javax.swing.JOptionPane;14 14 import org.openstreetmap.josm.data.coor.LatLon; 15 import org.openstreetmap.josm.io.CacheFiles; 15 16 16 17 abstract public class Grabber implements Runnable { … … 21 22 protected WMSLayer layer; 22 23 protected GeorefImage image; 24 protected CacheFiles cache; 23 25 24 26 Grabber(Bounds b, Projection proj, double pixelPerDegree, GeorefImage image, 25 MapView mv, WMSLayer layer )27 MapView mv, WMSLayer layer, CacheFiles cache) 26 28 { 27 29 if (b.min != null && b.max != null && WMSPlugin.doOverlap) … … 49 51 this.mv = mv; 50 52 this.layer = layer; 53 this.cache = cache; 51 54 } 52 55 -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSGrabber.java
r14110 r15185 28 28 import org.openstreetmap.josm.data.projection.Projection; 29 29 import org.openstreetmap.josm.gui.MapView; 30 import org.openstreetmap.josm.io.CacheFiles; 30 31 import org.openstreetmap.josm.io.ProgressInputStream; 31 32 … … 33 34 public class WMSGrabber extends Grabber { 34 35 protected String baseURL; 35 protected Cache cache = new wmsplugin.Cache();36 36 private static Boolean shownWarning = false; 37 37 private boolean urlWithPatterns; 38 38 39 39 WMSGrabber(String baseURL, Bounds b, Projection proj, 40 double pixelPerDegree, GeorefImage image, MapView mv, WMSLayer layer ) {41 super(b, proj, pixelPerDegree, image, mv, layer );40 double pixelPerDegree, GeorefImage image, MapView mv, WMSLayer layer, CacheFiles cache) { 41 super(b, proj, pixelPerDegree, image, mv, layer, cache); 42 42 this.baseURL = baseURL; 43 43 /* URL containing placeholders? */ … … 147 147 is.close(); 148 148 149 return cache.saveImg(url.toString(), img, true); 149 cache.saveImg(url.toString(), img); 150 return img; 150 151 } 151 152 -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSLayer.java
r15091 r15185 255 255 // Delete small files, because they're probably blank tiles. 256 256 // See https://josm.openstreetmap.de/ticket/2307 257 new wmsplugin.Cache().deleteSmallFiles(2048);257 WMSPlugin.cache.customCleanUp(WMSPlugin.cache.CLEAN_SMALL_FILES, 2048); 258 258 259 259 for (int x = 0; x < dax; ++x) { -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSPlugin.java
r15091 r15185 24 24 import org.openstreetmap.josm.gui.IconToggleButton; 25 25 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 26 import org.openstreetmap.josm.io.CacheFiles; 26 27 import org.openstreetmap.josm.io.MirroredInputStream; 27 28 import org.openstreetmap.josm.actions.JosmAction; … … 31 32 32 33 public class WMSPlugin extends Plugin { 34 static CacheFiles cache = new CacheFiles("wmsplugin"); 33 35 34 36 WMSLayer wmsLayer; … … 54 56 } 55 57 refreshMenu(); 58 cache.setExpire(cache.EXPIRE_MONTHLY, false); 59 cache.setMaxSize(70, false); 56 60 } 57 61 … … 199 203 double _pixelPerDegree, GeorefImage _image, MapView _mv, WMSLayer _layer){ 200 204 if(_baseURL.startsWith("yahoo://")) 201 return new YAHOOGrabber(_baseURL, _b, _proj, _pixelPerDegree, _image, _mv, _layer );205 return new YAHOOGrabber(_baseURL, _b, _proj, _pixelPerDegree, _image, _mv, _layer, cache); 202 206 else 203 return new WMSGrabber(_baseURL, _b, _proj, _pixelPerDegree, _image, _mv, _layer );207 return new WMSGrabber(_baseURL, _b, _proj, _pixelPerDegree, _image, _mv, _layer, cache); 204 208 // OSBGrabber should be rewrite for thread support first 205 209 //if (wmsurl.matches("(?i).*layers=npeoocmap.*") || wmsurl.matches("(?i).*layers=npe.*") ){ -
applications/editors/josm/plugins/wmsplugin/src/wmsplugin/YAHOOGrabber.java
r13645 r15185 16 16 import org.openstreetmap.josm.data.Bounds; 17 17 import org.openstreetmap.josm.data.projection.Projection; 18 import org.openstreetmap.josm.io.CacheFiles; 18 19 import org.openstreetmap.josm.gui.MapView; 19 20 20 21 21 public class YAHOOGrabber extends WMSGrabber {22 public class YAHOOGrabber extends WMSGrabber { 22 23 protected String browserCmd; 23 protected Cache cache = new wmsplugin.Cache();24 24 25 25 YAHOOGrabber(String baseURL, Bounds b, Projection proj, 26 double pixelPerDegree, GeorefImage image, MapView mv, WMSLayer layer ) {26 double pixelPerDegree, GeorefImage image, MapView mv, WMSLayer layer, CacheFiles cache) { 27 27 super("file:///" + WMSPlugin.getPrefsPath() + "ymap.html?" 28 , b, proj, pixelPerDegree, image, mv, layer );28 , b, proj, pixelPerDegree, image, mv, layer, cache); 29 29 this.browserCmd = baseURL.replaceFirst("yahoo://", ""); 30 30 } … … 53 53 throw new IOException( "Could not start browser. Please check that the executable path is correct.\n" + ioe.getMessage() ); 54 54 } 55 56 return cache.saveImg(urlstring, ImageIO.read(browser.getInputStream()), true); 55 56 BufferedImage img = ImageIO.read(browser.getInputStream()); 57 cache.saveImg(urlstring, img); 58 return img; 57 59 } 58 60 }
Note:
See TracChangeset
for help on using the changeset viewer.