Modify

Opened 8 months ago

Closed 8 months ago

Last modified 8 months ago

#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)

23841.jmapviewer.patch (2.4 KB ) - added by taylor.smock 8 months ago.
23841.core.patch (3.3 KB ) - added by taylor.smock 8 months ago.

Download all attachments as: .zip

Change History (10)

comment:1 by taylor.smock, 8 months ago

Replying to stoecker:

Don't we have a "reload error tiles" function. Would simply calling it when attribution is loaded help?

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):

  1. Call MainApplication.getLayerManager().getLayersOfType(TMSLayer.class).stream().filter(l -> l.getInfo() == 'Bing').forEach(TMSLayer::reloadTiles)
  2. Add an overload with a Runnable that will be called when the attribution is loaded.

(1) is easier, (2) is better IMO.

comment:2 by taylor.smock, 8 months ago

Milestone: 24.08

comment:3 by taylor.smock, 8 months ago

Cc: stoecker 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 taylor.smock, 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  
    136136        public void run() {
    137137            BingAttributionData attributionLoader = new BingAttributionData();
    138138            try {
     139                if (true) throw new IOException("Temp exception"); // I change `true` to `false` and hot reload the class.
    139140                String xml = attributionLoader.updateIfRequiredString();
    140141                List<Attribution> ret;
    141142                try (StringReader sr = new StringReader(xml)) {

What we do is the following:

  1. In JMapViewer, we add a new method clearAllErrorTiles that does what it says. By default, it just calls clear(), but the cache implementation we use implements something a bit smarter than that.
  2. In AbstractTileSource we add a method that will clear the error tiles
  3. In TMSLayer we modify the listener to clear all error tiles

by taylor.smock, 8 months ago

Attachment: 23841.jmapviewer.patch added

by taylor.smock, 8 months ago

Attachment: 23841.core.patch added

comment:5 by taylor.smock, 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

comment:6 by taylor.smock, 8 months ago

Resolution: fixed
Status: newclosed

In 36306/osm:

Fix #23841: Bing: Automatically reload all tiles with Error: Attribution is not loaded yet after successfully loading the attribution

comment:7 by taylor.smock, 8 months ago

In 19191/josm:

Dependency updates

ivy.xml

  • org.openstreetmap.jmapviewer:jmapviewer: 2.20 -> 2.21 (see #23841)
  • org.eclipse.parsson:parsson: 1.1.6 -> 1.1.7
  • org.apache.commons:commons-compress: 1.26.2 -> 1.27.0
  • org.tukaani:xz: 1.9 -> 1.10 (PD -> 0BSD)
  • org.webjars.npm:tag2link: 2024.7.8 -> 2024.8.12

tools/ivy.xml

  • net.sourceforge.pmd:pmd: 7.3.0 -> 7.4.0
  • com.google.errorprone:error_prone: 2.29.2 -> 2.30.0

comment:8 by taylor.smock, 8 months ago

In 19192/josm:

Fix #23841: Bing: Automatically reload all tiles with Error: Attribution is not loaded yet after successfully loading the attribution

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.