Changeset 8433 in josm for trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java
- Timestamp:
- 2015-05-28T22:00:41+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java
r8425 r8433 137 137 138 138 @Override 139 protected boolean cacheAsEmpty(Map<String, List<String>> headers, int statusCode, byte[] content) { 140 // cacheAsEmpty is called for every successful download, so we can put 141 // metadata handling here 139 protected boolean isResponseLoadable(Map<String, List<String>> headers, int statusCode, byte[] content) { 142 140 attributes.setMetadata(tile.getTileSource().getMetadata(headers)); 143 141 if (tile.getTileSource().isNoTileAtZoom(headers, statusCode, content)) { 144 142 attributes.setNoTileAtZoom(true); 145 return true; 146 } 147 return false; 143 return false; // do no try to load data from no-tile at zoom, cache empty object instead 144 } 145 return super.isResponseLoadable(headers, statusCode, content); 146 } 147 148 @Override 149 protected boolean cacheAsEmpty() { 150 return isNoTileAtZoom() || super.cacheAsEmpty(); 148 151 } 149 152 … … 171 174 listeners = inProgress.remove(getCacheKey()); 172 175 } 176 boolean status = result.equals(LoadResult.SUCCESS); 173 177 174 178 try { … … 194 198 if (!isNoTileAtZoom() && httpStatusCode >= 400) { 195 199 tile.setError(tr("HTTP error {0} when loading tiles", httpStatusCode)); 200 status = false; 196 201 } 197 202 break; … … 207 212 if (listeners != null) { // listeners might be null, if some other thread notified already about success 208 213 for(TileLoaderListener l: listeners) { 209 l.tileLoadingFinished(tile, result.equals(LoadResult.SUCCESS));214 l.tileLoadingFinished(tile, status); 210 215 } 211 216 } … … 259 264 } 260 265 261 @Override262 protected boolean handleNotFound() {263 if (tile.getSource().isNoTileAtZoom(null, 404, null)) {264 tile.setError("No tile at this zoom level");265 tile.putValue("tile-info", "no-tile");266 return true;267 }268 return false;269 }270 271 266 /** 272 267 * For TMS use BaseURL as settings discovery, so for different paths, we will have different settings (useful for developer servers)
Note:
See TracChangeset
for help on using the changeset viewer.