kopia lustrzana https://github.com/JOSM/MapWithAI
Fix an issue where multiple bbox downloads would case an exception
Signed-off-by: Taylor Smock <taylor.smock@kaart.com>pull/1/head
rodzic
46308c62b9
commit
3632380cf8
|
@ -171,6 +171,7 @@ public final class MapWithAIDataUtils {
|
|||
realBBoxes.size()),
|
||||
null, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, JOptionPane.YES_OPTION)) {
|
||||
final PleaseWaitProgressMonitor monitor = new PleaseWaitProgressMonitor();
|
||||
monitor.beginTask(tr("Downloading {0} Data", MapWithAIPlugin.NAME), realBounds.size());
|
||||
realBounds.parallelStream()
|
||||
.forEach(bound -> MapWithAIPreferenceHelper.getMapWithAIUrl().parallelStream()
|
||||
.filter(map -> map.containsKey("url")).map(MapWithAIDataUtils::getUrl)
|
||||
|
@ -178,7 +179,7 @@ public final class MapWithAIDataUtils {
|
|||
BoundingBoxMapWithAIDownloader downloader = new BoundingBoxMapWithAIDownloader(
|
||||
bound, url, DetectTaskingManagerUtils.hasTaskingManagerLayer());
|
||||
try {
|
||||
DataSet ds = downloader.parseOsm(monitor);
|
||||
DataSet ds = downloader.parseOsm(monitor.createSubTaskMonitor(1, false));
|
||||
synchronized (MapWithAIDataUtils.class) {
|
||||
dataSet.mergeFrom(ds);
|
||||
}
|
||||
|
|
|
@ -85,6 +85,17 @@ public class MapWithAIDataUtilsTest {
|
|||
assertEquals(1, ds.getWays().size(), "There should only be one way in the testBBox");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that getting multiple bboxes does not create an exception
|
||||
*/
|
||||
@Test
|
||||
public void testGetDataMultiple() {
|
||||
final BBox testBBox = getTestBBox();
|
||||
final BBox testBBox2 = new BBox(-108.4495519, 39.095376, -108.4422314, 39.0987811);
|
||||
final DataSet ds = new DataSet(MapWithAIDataUtils.getData(Arrays.asList(testBBox, testBBox2)));
|
||||
assertEquals(2, ds.getDataSourceBounds().size());
|
||||
}
|
||||
|
||||
/**
|
||||
* This gets data from MapWithAI. This test may fail if someone adds the data to
|
||||
* OSM.
|
||||
|
|
Ładowanie…
Reference in New Issue