MapWithAIDataUtils: Add minimum dimensions (effectively 1 km).

Signed-off-by: Taylor Smock <tsmock@fb.com>
pull/1/head v1.7.1
Taylor Smock 2020-11-12 09:02:39 -07:00
rodzic b77508554a
commit 7d64a84062
1 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -48,7 +48,7 @@ import org.openstreetmap.josm.tools.Utils;
* *
*/ */
public final class MapWithAIDataUtils { public final class MapWithAIDataUtils {
/** THe maximum dimensions for MapWithAI data (in kilometers) */ /** The maximum dimensions for MapWithAI data (in kilometers) */
public static final int MAXIMUM_SIDE_DIMENSIONS = 10_000; // RapiD is about 1km, max is 10km, but 10km causes public static final int MAXIMUM_SIDE_DIMENSIONS = 10_000; // RapiD is about 1km, max is 10km, but 10km causes
// timeouts // timeouts
private static final int TOO_MANY_BBOXES = 4; private static final int TOO_MANY_BBOXES = 4;
@ -158,7 +158,8 @@ public final class MapWithAIDataUtils {
} }
} catch (OsmTransferException e) { } catch (OsmTransferException e) {
if (e.getCause() instanceof SocketTimeoutException if (e.getCause() instanceof SocketTimeoutException
&& maximumDimensions > MAXIMUM_SIDE_DIMENSIONS / 10) { && maximumDimensions > MAXIMUM_SIDE_DIMENSIONS / 10
&& maximumDimensions / 2f > 0.5) {
dataSet.mergeFrom(getData(bound, maximumDimensions / 2)); dataSet.mergeFrom(getData(bound, maximumDimensions / 2));
} else if (e.getCause() instanceof IllegalDataException) { } else if (e.getCause() instanceof IllegalDataException) {
Logging.error(e); Logging.error(e);