#23841 closed enhancement (fixed)
[PATCH] Bing: Automatically reload all tiles with `Error: Attribution is not loaded yet` after successfully loading the attribution
Reported by: | skyper | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | 24.08 |
Component: | Core imagery | Version: | |
Keywords: | template_report bing attribution reload tiles | Cc: | stoecker |
Description
Follow-up of #23721
Copied from 23721#comment:14:
There is still an annoying glitch as the tiles are not automatically reloaded once the attribution was successfully loaded. Right now,
Error: Attribution is not loaded yet
remains on the screen and I have to manually reload the tiles on every zoom level.
Copied from 23721#comment:16:
Don't we have a "reload error tiles" function. Would simply calling it when attribution is loaded help?
Relative:URL: ^/trunk Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b Last:Changed Date: 2024-08-06 23:58:07 +0200 (Tue, 06 Aug 2024) Revision:19171 Build-Date:2024-08-07 01:30:30 URL:https://josm.openstreetmap.de/svn/trunk
Attachments (2)
Change History (10)
comment:1 by , 8 months ago
comment:2 by , 8 months ago
Milestone: | → 24.08 |
---|
comment:3 by , 8 months ago
Cc: | added |
---|
It turns out we already have some code in place for this. It just doesn't work fully; it only loads error tiles in view.
comment:4 by , 8 months ago
For those who want to test the following patches:
-
src/org/openstreetmap/josm/data/imagery/CachedAttributionBingAerialTileSource.java
diff --git a/src/org/openstreetmap/josm/data/imagery/CachedAttributionBingAerialTileSource.java b/src/org/openstreetmap/josm/data/imagery/CachedAttributionBingAerialTileSource.java
a b 136 136 public void run() { 137 137 BingAttributionData attributionLoader = new BingAttributionData(); 138 138 try { 139 if (true) throw new IOException("Temp exception"); // I change `true` to `false` and hot reload the class. 139 140 String xml = attributionLoader.updateIfRequiredString(); 140 141 List<Attribution> ret; 141 142 try (StringReader sr = new StringReader(xml)) {
What we do is the following:
- In JMapViewer, we add a new method
clearAllErrorTiles
that does what it says. By default, it just callsclear()
, but the cache implementation we use implements something a bit smarter than that. - In
AbstractTileSource
we add a method that will clear the error tiles - In
TMSLayer
we modify the listener to clear all error tiles
by , 8 months ago
Attachment: | 23841.jmapviewer.patch added |
---|
by , 8 months ago
Attachment: | 23841.core.patch added |
---|
comment:5 by , 8 months ago
Summary: | Bing: Automatically reload all tiles with `Error: Attribution is not loaded yet` after successfully loading the attribution → [PATCH] Bing: Automatically reload all tiles with `Error: Attribution is not loaded yet` after successfully loading the attribution |
---|
Replying to stoecker:
Yes. The problem is calling it from a location where we know that the attribution has been loaded.
We can do one of several different things (semi-psuedocode):
MainApplication.getLayerManager().getLayersOfType(TMSLayer.class).stream().filter(l -> l.getInfo() == 'Bing').forEach(TMSLayer::reloadTiles)
Runnable
that will be called when the attribution is loaded.(1) is easier, (2) is better IMO.