Subject: [PATCH] #23841: Bing: Automatically reload all tiles with `Error: Attribution is not loaded yet` after su...
---
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/gui/jmapviewer/interfaces/TileCache.java b/src/org/openstreetmap/gui/jmapviewer/interfaces/TileCache.java
a
|
b
|
|
48 | 48 | */ |
49 | 49 | void clear(); |
50 | 50 | |
| 51 | /** |
| 52 | * Removes error tiles from memory. |
| 53 | * This is implementation specific; the default calls {@link #clear()}. |
| 54 | */ |
| 55 | default void clearErrorTiles() { |
| 56 | this.clear(); |
| 57 | } |
| 58 | |
51 | 59 | /** |
52 | 60 | * Size of the cache. |
53 | 61 | * @return maximum number of tiles in cache |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/gui/jmapviewer/MemoryTileCache.java b/src/org/openstreetmap/gui/jmapviewer/MemoryTileCache.java
a
|
b
|
|
1 | 1 | // License: GPL. For details, see Readme.txt file. |
2 | 2 | package org.openstreetmap.gui.jmapviewer; |
3 | 3 | |
| 4 | import java.util.Collection; |
4 | 5 | import java.util.HashMap; |
5 | 6 | import java.util.Map; |
6 | 7 | import java.util.logging.Level; |
7 | 8 | import java.util.logging.Logger; |
| 9 | import java.util.stream.Collectors; |
8 | 10 | |
9 | 11 | import org.openstreetmap.gui.jmapviewer.interfaces.TileCache; |
10 | 12 | import org.openstreetmap.gui.jmapviewer.interfaces.TileSource; |
… |
… |
|
103 | 105 | lruTiles.clear(); |
104 | 106 | } |
105 | 107 | |
| 108 | @Override |
| 109 | public synchronized void clearErrorTiles() { |
| 110 | Collection<CacheEntry> toRemove = hash.values().stream().filter(cacheEntry -> cacheEntry.tile.hasError()).collect(Collectors.toList()); |
| 111 | hash.values().removeAll(toRemove); |
| 112 | toRemove.forEach(lruTiles::removeEntry); |
| 113 | } |
| 114 | |
106 | 115 | @Override |
107 | 116 | public synchronized int getTileCount() { |
108 | 117 | return hash.size(); |