Changeset 12620 in josm for trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ThumbsLoader.java
- Timestamp:
- 2017-08-22T22:26:32+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ThumbsLoader.java
r12460 r12620 22 22 import org.openstreetmap.josm.data.cache.JCSCacheManager; 23 23 import org.openstreetmap.josm.tools.ExifReader; 24 import org.openstreetmap.josm.tools.Logging; 24 25 25 26 /** 26 27 * Loads thumbnail previews for a list of images from a {@link GeoImageLayer}. 27 * 28 * 28 29 * Thumbnails are loaded in the background and cached on disk for the next session. 29 30 */ … … 69 70 Main.pref.getCacheDirectory().getPath() + File.separator + "geoimage-thumbnails"); 70 71 } catch (IOException e) { 71 Main.warn("Failed to initialize cache for geoimage-thumbnails");72 Main.warn(e);72 Logging.warn("Failed to initialize cache for geoimage-thumbnails"); 73 Logging.warn(e); 73 74 } 74 75 } … … 77 78 @Override 78 79 public void run() { 79 Main.debug("Load Thumbnails");80 Logging.debug("Load Thumbnails"); 80 81 tracker = new MediaTracker(Main.map.mapView); 81 82 for (ImageEntry entry : data) { … … 104 105 BufferedImageCacheEntry cacheEntry = cache.get(cacheIdent); 105 106 if (cacheEntry != null && cacheEntry.getImage() != null) { 106 Main.debug(" from cache");107 Logging.debug(" from cache"); 107 108 return cacheEntry.getImage(); 108 109 } 109 110 } catch (IOException e) { 110 Main.warn(e);111 Logging.warn(e); 111 112 } 112 113 } … … 117 118 tracker.waitForID(0); 118 119 } catch (InterruptedException e) { 119 Main.error(" InterruptedException while loading thumb");120 Logging.error(" InterruptedException while loading thumb"); 120 121 Thread.currentThread().interrupt(); 121 122 return null; 122 123 } 123 124 if (tracker.isErrorID(1) || img.getWidth(null) <= 0 || img.getHeight(null) <= 0) { 124 Main.error(" Invalid image");125 Logging.error(" Invalid image"); 125 126 return null; 126 127 } … … 154 155 Thread.sleep(10); 155 156 } catch (InterruptedException e) { 156 Main.warn("InterruptedException while drawing thumb");157 Logging.warn("InterruptedException while drawing thumb"); 157 158 Thread.currentThread().interrupt(); 158 159 } … … 162 163 163 164 if (scaledBI.getWidth() <= 0 || scaledBI.getHeight() <= 0) { 164 Main.error(" Invalid image");165 Logging.error(" Invalid image"); 165 166 return null; 166 167 } … … 171 172 cache.put(cacheIdent, new BufferedImageCacheEntry(output.toByteArray())); 172 173 } catch (IOException e) { 173 Main.warn("Failed to save geoimage thumb to cache");174 Main.warn(e);174 Logging.warn("Failed to save geoimage thumb to cache"); 175 Logging.warn(e); 175 176 } 176 177 }
Note:
See TracChangeset
for help on using the changeset viewer.