Fix #23390: Progress Monitor needs to send child monitors to avoid being in the finished state

Signed-off-by: Taylor Smock <smocktaylor@gmail.com>
pull/45/head v823
Taylor Smock 2024-01-05 06:16:54 -07:00
rodzic eff911c300
commit d56513358d
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: A755BFD7C10867F2
1 zmienionych plików z 5 dodań i 2 usunięć

Wyświetl plik

@ -330,19 +330,22 @@ public class BoundingBoxMapWithAIDownloader extends BoundingBoxDownloader {
} }
ds = new DataSet(); ds = new DataSet();
final var currentBounds = new Bounds(this.downloadArea); final var currentBounds = new Bounds(this.downloadArea);
progressMonitor.beginTask(tr("Downloading data"), 2 * tiles.size());
for (TileXYZ tileXYZ : tiles) { for (TileXYZ tileXYZ : tiles) {
try { try {
final var hilbert = PMTiles.convertToHilbert(tileXYZ.z(), tileXYZ.x(), tileXYZ.y()); final var hilbert = PMTiles.convertToHilbert(tileXYZ.z(), tileXYZ.x(), tileXYZ.y());
final var data = this.info.getSourceType() == MapWithAIType.PMTILES final var data = this.info.getSourceType() == MapWithAIType.PMTILES
? new ByteArrayInputStream(PMTiles.readData(header, hilbert, cachedDirectories)) ? new ByteArrayInputStream(PMTiles.readData(header, hilbert, cachedDirectories))
: getInputStream(getRequestForTile(tileXYZ), progressMonitor); : getInputStream(getRequestForTile(tileXYZ), progressMonitor.createSubTaskMonitor(1, true));
final var dataSet = loadTile(tileSource, tileXYZ, data); final var dataSet = loadTile(tileSource, tileXYZ, data);
ds.mergeFrom(dataSet, progressMonitor); ds.mergeFrom(dataSet, progressMonitor.createSubTaskMonitor(1, true));
tileXYZ.expandBounds(currentBounds); tileXYZ.expandBounds(currentBounds);
} catch (OsmTransferException | IOException e) { } catch (OsmTransferException | IOException e) {
progressMonitor.finishTask();
throw new IllegalDataException(e); throw new IllegalDataException(e);
} }
} }
progressMonitor.finishTask();
ds.addDataSource(new DataSource(currentBounds, this.url)); ds.addDataSource(new DataSource(currentBounds, this.url));
return ds; return ds;
} }