diff --git a/gradle.properties b/gradle.properties
index 28d74150..5c5f4494 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,9 +1,9 @@
# The minimum JOSM version this plugin is compatible with (can be any numeric version
-plugin.main.version = 18877
+plugin.main.version = 19067
# The JOSM version this plugin is currently compiled against
# Please make sure this version is available at https://josm.openstreetmap.de/download
# The special values "latest" and "tested" are also possible here, but not recommended.
-plugin.compile.version = 18877
+plugin.compile.version = 19067
plugin.canloadatruntime = true
plugin.author = Taylor Smock
plugin.class = org.openstreetmap.josm.plugins.mapwithai.MapWithAIPlugin
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 00000000..1e4f2652
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,143 @@
+
+ 4.0.0
+ org.openstreetmap.josm.plugins
+ MapWithAI
+ SNAPSHOT
+
+ 1.49.a
+ 7.5.0
+ 0.8.12
+ 10.18.1
+ 4.8.6
+
+
+
+ JOSM-releases
+ https://josm.openstreetmap.de/nexus/content/repositories/releases/
+
+
+ JOSM-snapshots
+ https://josm.openstreetmap.de/nexus/content/repositories/snapshots/
+
+
+
+
+
+ org.junit
+ junit-bom
+ 5.11.1
+ pom
+ import
+
+
+
+
+
+ org.openstreetmap.josm
+ josm
+ 19067
+ provided
+
+
+ org.openstreetmap.josm.plugins
+ pmtiles
+ SNAPSHOT
+ provided
+
+
+ org.openstreetmap.josm.plugins
+ utilsplugin2
+ SNAPSHOT
+ provided
+
+
+ org.openstreetmap.josm
+ josm-unittest
+ SNAPSHOT
+ test
+
+
+ org.wiremock
+ wiremock
+ 3.9.1
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+ test
+
+
+ org.junit.jupiter
+ junit-jupiter-params
+ test
+
+
+ org.jmockit
+ jmockit
+ 1.49.a
+ test
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.13.0
+
+ 17
+
+
+
+ com.diffplug.spotless
+ spotless-maven-plugin
+ 2.43.0
+
+
+
+ 4.21
+ ${project.basedir}/../00_core_tools/eclipse/formatter.xml
+
+
+
+ // License: GPL. For details, see LICENSE file.
+
+
+ src/main/java/**/*.java
+ src/test/unit/**/*.java
+ src/test/integration/**/*.java
+
+
+
+
+
+
+ check
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-enforcer-plugin
+ 3.5.0
+
+
+ enforce-maven
+
+ enforce
+
+
+
+
+
+
+ 3.6.3
+
+
+
+
+
+
+
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 b547839d..3a7c3cf1 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
@@ -44,8 +44,8 @@ public class StreetAddressTest extends Test {
public static final double BBOX_EXPANSION = 0.002;
private static final String ADDR_STREET = "addr:street";
private final Set namePrimitiveMap = new HashSet<>();
- private final Map> nameMap = new HashMap<>();
- private final Map> primitiveCellMap = new HashMap<>();
+ private final Map> nameMap = new HashMap<>();
+ private final Map> primitiveCellMap = new HashMap<>();
/**
* Classified highways. This uses a {@link Set} instead of a {@link List} since
* the MapWithAI code doesn't care about order.
@@ -146,7 +146,8 @@ private void realVisit(OsmPrimitive primitive) {
final var n1 = nodes.get(i);
final var n2 = nodes.get(i + 1);
for (Point2D cell : ValUtil.getSegmentCells(n1, n2, gridDetail)) {
- this.nameMap.computeIfAbsent(cell, k -> new HashSet<>()).addAll(names);
+ this.nameMap.computeIfAbsent(new Point(cell.getX(), cell.getY()), k -> new HashSet<>())
+ .addAll(names);
}
}
} else if (hasStreetAddressTags(primitive) && !primitive.isOutsideDownloadArea()) {
@@ -159,7 +160,7 @@ private void realVisit(OsmPrimitive primitive) {
if (en != null) {
long x = (long) Math.floor(en.getX() * gridDetail);
long y = (long) Math.floor(en.getY() * gridDetail);
- final var point = new Point2D.Double(x, y);
+ final var point = new Point(x, y);
primitiveCellMap.computeIfAbsent(point, p -> new ArrayList<>()).add(primitive);
}
}
@@ -174,7 +175,7 @@ private static Collection getWayNames(IPrimitive way) {
.filter(s -> !s.isEmpty()).collect(Collectors.toSet());
}
- private Collection getSurroundingHighwayNames(Point2D point2D) {
+ private Collection getSurroundingHighwayNames(Point point2D) {
if (this.nameMap.isEmpty()) {
return Collections.emptySet();
}
@@ -183,8 +184,9 @@ private Collection getSurroundingHighwayNames(Point2D point2D) {
while (surroundingWays.isEmpty()) {
for (int x = -surrounding; x <= surrounding; x++) {
for (int y = -surrounding; y <= surrounding; y++) {
- final var key = new Point2D.Double((long) Math.floor(point2D.getX() + x),
- (long) Math.floor(point2D.getY() + y));
+ final var xPoint = (long) Math.floor(point2D.x() + x);
+ final var yPoint = (long) Math.floor(point2D.y() + y);
+ final var key = new Point(xPoint, yPoint);
if (this.nameMap.containsKey(key)) {
surroundingWays.addAll(this.nameMap.get(key));
}
@@ -303,4 +305,20 @@ public static BBox expandBBox(BBox bbox, double degree) {
bbox.add(bbox.getTopLeftLon() - degree, bbox.getTopLeftLat() + degree);
return bbox;
}
-}
+
+ private record Point(double x, double y) implements Comparable {
+
+ @Override
+ public int compareTo(Point other) {
+ if (other.x == this.x && other.y == this.y) {
+ return 0;
+ }
+ if (other.x < this.x) {
+ return -1;
+ }
+ if (other.x > this.x) {
+ return 1;
+ }
+ return Double.compare(other.y, this.y);
+ }
+}}
diff --git a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/annotations/Wiremock.java b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/annotations/Wiremock.java
index 88459e16..3510fb77 100644
--- a/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/annotations/Wiremock.java
+++ b/src/test/unit/org/openstreetmap/josm/plugins/mapwithai/testutils/annotations/Wiremock.java
@@ -29,11 +29,9 @@
import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.client.WireMock;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
+import com.github.tomakehurst.wiremock.extension.ResponseTransformerV2;
import com.github.tomakehurst.wiremock.http.Response;
+import com.github.tomakehurst.wiremock.stubbing.ServeEvent;
/**
* Test annotation to ensure that wiremock is used
@@ -59,7 +57,7 @@
*
* @author Taylor Smock
*/
- class WireMockUrlTransformer extends ResponseTransformer {
+ class WireMockUrlTransformer implements ResponseTransformerV2 {
private final ExtensionContext context;
public WireMockUrlTransformer(ExtensionContext context) {
@@ -72,8 +70,8 @@ public String getName() {
}
@Override
- public Response transform(Request request, Response response, FileSource files, Parameters parameters) {
- if (!request.getUrl().endsWith("/capabilities")
+ public Response transform(Response response, ServeEvent serveEvent) {
+ if (!serveEvent.getRequest().getUrl().endsWith("/capabilities")
&& response.getHeaders().getContentTypeHeader().mimeTypePart() != null
&& !response.getHeaders().getContentTypeHeader().mimeTypePart().contains("application/zip")) {
String origBody = response.getBodyAsString();