From 680b1433bc60a24f3b157e60c028c56b571bb200 Mon Sep 17 00:00:00 2001 From: Taylor Smock Date: Thu, 2 Apr 2020 11:21:46 -0600 Subject: [PATCH] Don't update prod when JOSM version is unknown. Also, modify address test to not consider items outside of the download area, and expand the bbox Signed-off-by: Taylor Smock --- .../josm/plugins/mapwithai/UpdateProd.java | 3 ++- .../mapwithai/data/mapwithai/MapWithAIInfo.java | 1 - .../data/validation/tests/StreetAddressTest.java | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/UpdateProd.java b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/UpdateProd.java index d956b60..73a6fd5 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/UpdateProd.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/UpdateProd.java @@ -28,7 +28,8 @@ public final class UpdateProd { * @return {@code true} if an update is needed */ public static boolean doProd(int nextMinVersion) { - if (nextMinVersion > Version.getInstance().getVersion()) { + if (nextMinVersion > Version.getInstance().getVersion() + && Version.getInstance().getVersion() != Version.JOSM_UNKNOWN_VERSION) { int doUpdate = ConditionalOptionPaneUtil.showOptionDialog( MapWithAIPlugin.NAME.concat(".ignore_next_version"), MainApplication.getMainFrame(), tr("Please update JOSM -- {0} {1} is the last {0} version to support JOSM {2}", diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/mapwithai/MapWithAIInfo.java b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/mapwithai/MapWithAIInfo.java index fcaa64b..549f4dd 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/mapwithai/MapWithAIInfo.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/mapwithai/MapWithAIInfo.java @@ -31,7 +31,6 @@ import org.openstreetmap.josm.data.StructUtils.StructEntry; import org.openstreetmap.josm.data.imagery.ImageryInfo; import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryBounds; import org.openstreetmap.josm.data.imagery.Shape; -import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo.MapWithAIPreferenceEntry; import org.openstreetmap.josm.spi.preferences.Config; import org.openstreetmap.josm.tools.CheckParameterUtil; import org.openstreetmap.josm.tools.ImageProvider; diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/validation/tests/StreetAddressTest.java b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/validation/tests/StreetAddressTest.java index 410ff62..784a2da 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/validation/tests/StreetAddressTest.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapwithai/data/validation/tests/StreetAddressTest.java @@ -32,7 +32,7 @@ import org.openstreetmap.josm.tools.Pair; public class StreetAddressTest extends Test { /** Standard bbox expansion */ - public static final double BBOX_EXPANSION = 0.001; + public static final double BBOX_EXPANSION = 0.002; private static final String ADDR_STREET = "addr:street"; private final Set namePrimitiveMap = new HashSet<>(); /** @@ -80,7 +80,7 @@ public class StreetAddressTest extends Test { } public void realVisit(OsmPrimitive primitive) { - if (primitive.isUsable() && hasStreetAddressTags(primitive)) { + if (primitive.isUsable() && hasStreetAddressTags(primitive) && !primitive.isOutsideDownloadArea()) { Collection surroundingWays = getSurroundingHighways(primitive); Collection names = getWayNames(surroundingWays); if (!names.contains(primitive.get(ADDR_STREET))) { @@ -90,9 +90,9 @@ public class StreetAddressTest extends Test { } public static Collection getWayNames(Collection ways) { - return ways.parallelStream().flatMap(w -> w.getInterestingTags().entrySet().parallelStream()) - .filter(e -> e.getKey().contains("name") && !e.getKey().contains("tiger")).map(Map.Entry::getValue) - .collect(Collectors.toSet()); + return ways.parallelStream().flatMap(w -> w.getInterestingTags().entrySet().parallelStream()).filter( + e -> (e.getKey().contains("name") || e.getKey().contains("ref")) && !e.getKey().contains("tiger")) + .map(Map.Entry::getValue).collect(Collectors.toSet()); } public static Collection getSurroundingHighways(OsmPrimitive address) {