Changeset 8174 in josm for trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java
- Timestamp:
- 2015-04-07T09:00:22+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java
r8168 r8174 125 125 byte[] content = cacheData.getContent(); 126 126 try { 127 return (content != null && content.length > 0)|| cacheData.getImage() != null || cacheAsEmpty();127 return content != null || cacheData.getImage() != null || cacheAsEmpty(); 128 128 } catch (IOException e) { 129 129 log.log(Level.WARNING, "JCS TMS - error loading from cache for tile {0}: {1}", new Object[] {tile.getKey(), e.getMessage()}); … … 143 143 return true; 144 144 } 145 return false; 145 return false; // as there is no other cache to cache the Tile, also cache other empty requests 146 146 } 147 147 … … 159 159 public void loadingFinished(CacheEntry object, boolean success) { 160 160 try { 161 loadTile(object );161 loadTile(object, success); 162 162 if (listener != null) { 163 163 listener.tileLoadingFinished(tile, success); … … 178 178 */ 179 179 public Tile getCachedTile() { 180 BufferedImageCacheEntry data = super.get();180 BufferedImageCacheEntry data = get(); 181 181 if (isObjectLoadable()) { 182 182 try { … … 193 193 } 194 194 195 private void loadTile(CacheEntry object) throws IOException { 195 // loads tile when calling back from cache 196 private void loadTile(CacheEntry object, boolean success) throws IOException { 196 197 tile.finishLoading(); 197 198 if (object != null) { … … 201 202 } 202 203 } 203 } 204 204 if (!success) { 205 tile.setError("Problem loading tile"); 206 } 207 } 208 209 // loads tile when geting stright from cache 205 210 private void loadTile(BufferedImageCacheEntry object) throws IOException { 206 211 tile.finishLoading(); 207 if ( object != null) {212 if (cacheAsEmpty() || object != null) { // if cache as empty object, do not try to load image 208 213 if (object.getImage() != null) { 209 214 tile.setImage(object.getImage()); … … 213 218 214 219 @Override 215 protected voidhandleNotFound() {220 protected boolean handleNotFound() { 216 221 tile.setError("No tile at this zoom level"); 217 222 tile.putValue("tile-info", "no-tile"); 218 } 219 223 return true; 224 } 225 226 /** 227 * For TMS use BaseURL as settings discovery, so for different paths, we will have different settings (useful for developer servers) 228 * 229 * @return base URL of TMS or server url as defined in super class 230 */ 220 231 @Override 221 232 protected String getServerKey() {
Note:
See TracChangeset
for help on using the changeset viewer.