Changeset 8714 in josm for trunk/src/org
- Timestamp:
- 2015-09-01T22:57:30+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/CachedAttributionBingAerialTileSource.java
r8624 r8714 10 10 11 11 import org.openstreetmap.gui.jmapviewer.tilesources.BingAerialTileSource; 12 import org.openstreetmap.gui.jmapviewer.tilesources.TileSourceInfo; 12 13 import org.openstreetmap.josm.Main; 14 import org.openstreetmap.josm.gui.util.GuiHelper; 13 15 import org.openstreetmap.josm.io.CacheCustomContent; 14 16 import org.openstreetmap.josm.io.UTFInputStreamReader; … … 23 25 */ 24 26 public class CachedAttributionBingAerialTileSource extends BingAerialTileSource { 27 private Runnable attributionDownloadedTask; 28 25 29 /** 26 30 * Creates tile source … … 30 34 super(info); 31 35 } 36 37 /** 38 * Creates tile source 39 * @param info ImageryInfo description of this tile source 40 * @param attributionDownloadedTask runnable to be executed once attribution is loaded 41 */ 42 43 public CachedAttributionBingAerialTileSource(TileSourceInfo info, Runnable attributionDownloadedTask) { 44 super(info); 45 this.attributionDownloadedTask = attributionDownloadedTask; 46 } 47 32 48 33 49 class BingAttributionData extends CacheCustomContent<IOException> { … … 59 75 try { 60 76 String xml = attributionLoader.updateIfRequiredString(); 61 return parseAttributionText(new InputSource(new StringReader((xml)))); 77 List<Attribution> ret = parseAttributionText(new InputSource(new StringReader((xml)))); 78 if (attributionDownloadedTask != null) { 79 GuiHelper.runInEDT(attributionDownloadedTask); 80 attributionDownloadedTask = null; 81 } 82 return ret; 62 83 } catch (IOException ex) { 63 84 Main.warn("Could not connect to Bing API. Will retry in " + waitTimeSec + " seconds."); -
trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
r8673 r8714 879 879 } 880 880 881 pr ivatevoid loadAllTiles(boolean force) {881 protected void loadAllTiles(boolean force) { 882 882 TileSet ts = getVisibleTileSet(); 883 883 … … 890 890 } 891 891 892 pr ivatevoid loadAllErrorTiles(boolean force) {892 protected void loadAllErrorTiles(boolean force) { 893 893 TileSet ts = getVisibleTileSet(); 894 894 ts.loadAllErrorTiles(force); -
trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java
r8602 r8714 10 10 import org.openstreetmap.gui.jmapviewer.tilesources.TMSTileSource; 11 11 import org.openstreetmap.gui.jmapviewer.tilesources.TemplatedTMSTileSource; 12 import org.openstreetmap.josm.Main; 12 13 import org.openstreetmap.josm.data.cache.BufferedImageCacheEntry; 13 14 import org.openstreetmap.josm.data.imagery.CachedAttributionBingAerialTileSource; … … 67 68 @Override 68 69 protected AbstractTMSTileSource getTileSource(ImageryInfo info) throws IllegalArgumentException { 69 return getTileSourceStatic(info); 70 return getTileSourceStatic(info, new Runnable() { 71 @Override 72 public void run() { 73 Main.debug("Attribution loaded, running loadAllErrorTiles"); 74 TMSLayer.this.loadAllErrorTiles(true); 75 } 76 }); 70 77 } 71 78 … … 97 104 */ 98 105 public static AbstractTMSTileSource getTileSourceStatic(ImageryInfo info) throws IllegalArgumentException { 106 return getTileSourceStatic(info, null); 107 } 108 109 /** 110 * Creates and returns a new TileSource instance depending on the {@link ImageryType} 111 * of the passed ImageryInfo object. 112 * 113 * If no appropriate TileSource is found, null is returned. 114 * Currently supported ImageryType are {@link ImageryType#TMS}, 115 * {@link ImageryType#BING}, {@link ImageryType#SCANEX}. 116 * 117 * @param info imagery info 118 * @param attributionLoadedTask task to be run once attribution is loaded, might be null, if nothing special shall happen 119 * @return a new TileSource instance or null if no TileSource for the ImageryInfo/ImageryType could be found. 120 * @throws IllegalArgumentException if url from imagery info is null or invalid 121 */ 122 public static AbstractTMSTileSource getTileSourceStatic(ImageryInfo info, Runnable attributionLoadedTask) throws IllegalArgumentException { 99 123 if (info.getImageryType() == ImageryType.TMS) { 100 124 TemplatedTMSTileSource.checkUrl(info.getUrl()); … … 103 127 return t; 104 128 } else if (info.getImageryType() == ImageryType.BING) 105 return new CachedAttributionBingAerialTileSource(info );129 return new CachedAttributionBingAerialTileSource(info, attributionLoadedTask); 106 130 else if (info.getImageryType() == ImageryType.SCANEX) { 107 131 return new ScanexTileSource(info);
Note:
See TracChangeset
for help on using the changeset viewer.