Changeset 9277 in josm
- Timestamp:
- 2016-01-03T14:37:56+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/layer/geoimage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageEntry.java
r9270 r9277 7 7 import java.text.ParseException; 8 8 import java.util.Calendar; 9 import java.util.Collections; 9 10 import java.util.Date; 10 11 import java.util.GregorianCalendar; … … 220 221 public void setThumbnail(Image thumbnail) { 221 222 this.thumbnail = thumbnail; 223 } 224 225 /** 226 * Loads the thumbnail if it was not loaded yet. 227 * @see ThumbsLoader 228 */ 229 public void loadThumbnail() { 230 if (thumbnail == null) { 231 new ThumbsLoader(Collections.singleton(this)).run(); 232 } 222 233 } 223 234 -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ThumbsLoader.java
r9270 r9277 13 13 import java.io.IOException; 14 14 import java.util.ArrayList; 15 import java.util. List;15 import java.util.Collection; 16 16 17 17 import javax.imageio.ImageIO; … … 27 27 public static final int minSize = 22; 28 28 public volatile boolean stop; 29 private final List<ImageEntry> data;29 private final Collection<ImageEntry> data; 30 30 private final GeoImageLayer layer; 31 31 private MediaTracker tracker; 32 32 private ICacheAccess<String, BufferedImageCacheEntry> cache; 33 33 private final boolean cacheOff = Main.pref.getBoolean("geoimage.noThumbnailCache", false); 34 35 private ThumbsLoader(Collection<ImageEntry> data, GeoImageLayer layer) { 36 this.data = data; 37 this.layer = layer; 38 initCache(); 39 } 34 40 35 41 /** … … 38 44 */ 39 45 public ThumbsLoader(GeoImageLayer layer) { 40 this.layer = layer; 41 this.data = new ArrayList<>(layer.data); 42 initCache(); 46 this(new ArrayList<>(layer.data), layer); 47 } 48 49 /** 50 * Constructs a new thumbnail loader that operates on the image entries 51 * @param entries image entries 52 */ 53 public ThumbsLoader(Collection<ImageEntry> entries) { 54 this(entries, null); 43 55 } 44 56 … … 69 81 entry.setThumbnail(loadThumb(entry)); 70 82 71 if ( Main.isDisplayingMapView()) {83 if (layer != null && Main.isDisplayingMapView()) { 72 84 layer.updateOffscreenBuffer = true; 73 85 Main.map.mapView.repaint(); … … 75 87 } 76 88 } 77 layer.thumbsLoaded(); 78 layer.updateOffscreenBuffer = true; 79 Main.map.mapView.repaint(); 89 if (layer != null) { 90 layer.thumbsLoaded(); 91 layer.updateOffscreenBuffer = true; 92 Main.map.mapView.repaint(); 93 } 80 94 } 81 95
Note:
See TracChangeset
for help on using the changeset viewer.