Update to non-deprecated methods

Signed-off-by: Taylor Smock <tsmock@meta.com>
pull/9/head
Taylor Smock 2022-12-07 07:23:42 -07:00
rodzic 61d5b62689
commit 01ce992d24
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 233BB2E466604E27
13 zmienionych plików z 31 dodań i 30 usunięć

Wyświetl plik

@ -8,7 +8,7 @@ jobs:
call-workflow:
uses: JOSM/JOSMPluginAction/.github/workflows/ant.yml@v1
with:
josm-revision: "r18218"
josm-revision: "r18464"
update-pluginssource: true
plugin-jar-name: 'mapwithai'
secrets:

Wyświetl plik

@ -18,7 +18,7 @@ jobs:
call-workflow:
strategy:
matrix:
josm-revision: ["", "r18218"]
josm-revision: ["", "r18464"]
uses: JOSM/JOSMPluginAction/.github/workflows/ant.yml@v1
with:
josm-revision: ${{ matrix.josm-revision }}

Wyświetl plik

@ -212,6 +212,7 @@ spotless {
josm {
debugPort = 7055
manifest {
oldVersionDownloadLink 18218, "v1.9.20", new URL("https://github.com/JOSM/MapWithAI/releases/download/v1.9.20/mapwithai.jar")
oldVersionDownloadLink 17903, "v1.8.7", new URL("https://github.com/JOSM/MapWithAI/releases/download/v1.8.7/mapwithai.jar")
oldVersionDownloadLink 17084, "v1.7.1.6", new URL("https://github.com/JOSM/MapWithAI/releases/download/v1.7.1.6/mapwithai.jar")
oldVersionDownloadLink 16645, "v1.6.8", new URL("https://github.com/JOSM/MapWithAI/releases/download/v1.6.8/mapwithai.jar")

Wyświetl plik

@ -31,6 +31,7 @@
<target name="additional-manifest">
<manifest file="MANIFEST" mode="update">
<attribute name="18218_Plugin-Url" value="v1.9.20;https://github.com/JOSM/MapWithAI/releases/download/v1.9.20/mapwithai.jar" />
<attribute name="17903_Plugin-Url" value="v1.8.7;https://github.com/JOSM/MapWithAI/releases/download/v1.8.7/mapwithai.jar" />
<attribute name="17084_Plugin-Url" value="v1.7.1.6;https://github.com/JOSM/MapWithAI/releases/download/v1.7.1.6/mapwithai.jar" />
<attribute name="16645_Plugin-Url" value="v1.6.8;https://github.com/JOSM/MapWithAI/releases/download/v1.6.8/mapwithai.jar" />

Wyświetl plik

@ -1,9 +1,9 @@
# The minimum JOSM version this plugin is compatible with (can be any numeric version
plugin.main.version = 18218
plugin.main.version = 18464
# 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 = 18218
plugin.compile.version = 18468
plugin.canloadatruntime = true
plugin.author = Taylor Smock
plugin.class = org.openstreetmap.josm.plugins.mapwithai.MapWithAIPlugin

Wyświetl plik

@ -359,14 +359,15 @@ public class GetDataRunnable extends RecursiveTask<DataSet> {
twoMap.remove(MAPWITHAI_SOURCE_TAG_KEY);
if (one.getClass().equals(two.getClass()) && oneMap.equals(twoMap)) {
if (one instanceof Node) {
final LatLon coor1 = ((Node) one).getCoor();
final LatLon coor2 = ((Node) two).getCoor();
if (one.hasSameInterestingTags(two) && coor1 != null && coor2 != null && coor1.equalsEpsilon(coor2)) {
final ILatLon coor1 = ((Node) one);
final ILatLon coor2 = ((Node) two);
if (one.hasSameInterestingTags(two) && coor1.isLatLonKnown() && coor2.isLatLonKnown()
&& coor1.equalsEpsilon(coor2)) {
equivalent = true;
}
} else if (one instanceof Way) {
equivalent = ((Way) one).getNodes().stream().map(INode::getCoor).filter(Objects::nonNull).allMatch(
node1 -> ((Way) two).getNodes().stream().map(INode::getCoor).anyMatch(node1::equalsEpsilon));
equivalent = ((Way) one).getNodes().stream().filter(Objects::nonNull)
.allMatch(node1 -> ((Way) two).getNodes().stream().anyMatch(node1::equalsEpsilon));
} else if (one instanceof Relation) {
equivalent = ((Relation) one).getMembers().stream()
.allMatch(member1 -> ((Relation) two).getMembers().stream()

Wyświetl plik

@ -23,6 +23,7 @@ import java.util.stream.Collectors;
import org.openstreetmap.josm.data.Bounds;
import org.openstreetmap.josm.data.UndoRedoHandler;
import org.openstreetmap.josm.data.coor.ILatLon;
import org.openstreetmap.josm.data.coor.LatLon;
import org.openstreetmap.josm.data.osm.DataSet;
import org.openstreetmap.josm.data.osm.Node;
@ -264,7 +265,7 @@ public final class MapWithAIDataUtils {
final double minx = bottomLeft.getX();
final double maxY = topRight.getY();
final LatLon topLeft = new LatLon(maxY, minx);
return bottomLeft.greatCircleDistance(topLeft);
return bottomLeft.greatCircleDistance((ILatLon) topLeft);
}
/**
@ -380,7 +381,8 @@ public final class MapWithAIDataUtils {
final double maxY = topRight.getY();
final LatLon bottomRight = new LatLon(minY, maxX);
final LatLon topLeft = new LatLon(maxY, minX);
return Math.max(bottomLeft.greatCircleDistance(bottomRight), topLeft.greatCircleDistance(topRight));
return Math.max(bottomLeft.greatCircleDistance((ILatLon) bottomRight),
topLeft.greatCircleDistance((ILatLon) topRight));
}
/**

Wyświetl plik

@ -69,7 +69,7 @@ public class DuplicateCommand extends AbstractConflationCommand {
*/
public static Command replaceNode(Node original, Node newNode) {
Command tCommand = null;
if (original.getCoor().equalsEpsilon(newNode.getCoor())) {
if (original.equalsEpsilon(newNode)) {
tCommand = MergeNodesAction.mergeNodes(Collections.singletonList(original), newNode, newNode);
}
return tCommand;

Wyświetl plik

@ -386,9 +386,8 @@ public class MergeDuplicateWays extends Command {
final Node origNode = way1.getNode(j);
for (int k = 0; k < way2.getNodesCount(); k++) {
final Node possDupeNode = way2.getNode(k);
if (origNode.equals(possDupeNode)
|| (origNode.getCoor().greatCircleDistance(possDupeNode.getCoor()) < MapWithAIPreferenceHelper
.getMaxNodeDistance())) {
if (origNode.equals(possDupeNode) || (origNode
.greatCircleDistance(possDupeNode) < MapWithAIPreferenceHelper.getMaxNodeDistance())) {
final Pair<Integer, Node> origNodePair = new Pair<>(j, origNode);
final Map<Integer, Node> dupeNodeMap = duplicateNodes.getOrDefault(origNodePair, new HashMap<>());
dupeNodeMap.put(k, possDupeNode);

Wyświetl plik

@ -22,7 +22,6 @@ import org.openstreetmap.josm.command.Command;
import org.openstreetmap.josm.command.SequenceCommand;
import org.openstreetmap.josm.data.osm.BBox;
import org.openstreetmap.josm.data.osm.DataSet;
import org.openstreetmap.josm.data.osm.INode;
import org.openstreetmap.josm.data.osm.IPrimitive;
import org.openstreetmap.josm.data.osm.IWaySegment;
import org.openstreetmap.josm.data.osm.Node;
@ -212,10 +211,9 @@ public class MissingConnectionTags extends AbstractConflationCommand {
Collection<Node> nodes = Geometry.addIntersections(error.getPrimitives().stream().filter(Way.class::isInstance)
.map(Way.class::cast).filter(w -> w.hasKey(HIGHWAY)).collect(Collectors.toList()), false,
new ArrayList<>());
if (nodes.stream().filter(MissingConnectionTags::noConflationKey).map(INode::getCoor).filter(Objects::nonNull)
.anyMatch(
n -> way.getNodes().stream().filter(MissingConnectionTags::noConflationKey).map(INode::getCoor)
.filter(Objects::nonNull).anyMatch(wn -> n.greatCircleDistance(wn) < precision))) {
if (nodes.stream().filter(MissingConnectionTags::noConflationKey).filter(Objects::nonNull)
.anyMatch(n -> way.getNodes().stream().filter(MissingConnectionTags::noConflationKey)
.filter(Objects::nonNull).anyMatch(wn -> n.greatCircleDistance(wn) < precision))) {
return () -> createIntersectionCommand(way,
way.getNodes().stream().filter(MissingConnectionTags::noConflationKey)
.filter(n1 -> nodes.stream().anyMatch(n2 -> Geometry.getDistance(n1, n2) < precision))

Wyświetl plik

@ -14,7 +14,6 @@ import java.util.stream.Collectors;
import org.openstreetmap.josm.command.ChangeCommand;
import org.openstreetmap.josm.command.DeleteCommand;
import org.openstreetmap.josm.command.SequenceCommand;
import org.openstreetmap.josm.data.coor.LatLon;
import org.openstreetmap.josm.data.osm.Node;
import org.openstreetmap.josm.data.osm.Way;
import org.openstreetmap.josm.data.validation.Severity;
@ -123,10 +122,8 @@ public class StubEndsTest extends Test {
List<Way> connectingWays = getConnectingWays(previous, way);
if (!node.equals(previous) && connectingWays.isEmpty()) {
nodesToConnection.add(previous);
final LatLon nodeCoor = node.getCoor();
final LatLon prevCoor = previous.getCoor();
if (nodeCoor != null && prevCoor != null) {
distance += nodeCoor.greatCircleDistance(prevCoor);
if (node.isLatLonKnown() && previous.isLatLonKnown()) {
distance += node.greatCircleDistance(previous);
}
previous = node;
}

Wyświetl plik

@ -10,6 +10,7 @@ import java.util.stream.Stream;
import org.openstreetmap.josm.actions.downloadtasks.AbstractDownloadTask;
import org.openstreetmap.josm.data.Bounds;
import org.openstreetmap.josm.data.coor.ILatLon;
import org.openstreetmap.josm.data.coor.LatLon;
import org.openstreetmap.josm.data.preferences.BooleanProperty;
import org.openstreetmap.josm.gui.download.IDownloadSourceType;
@ -64,10 +65,12 @@ public class MapWithAIDownloadSourceType implements IDownloadSourceType, LayerCh
* @return {@code true} if the area is too large
*/
public static boolean isDownloadAreaTooLargeStatic(Bounds bound) {
double width = Math.max(bound.getMin().greatCircleDistance(new LatLon(bound.getMinLat(), bound.getMaxLon())),
bound.getMax().greatCircleDistance(new LatLon(bound.getMaxLat(), bound.getMinLon())));
double height = Math.max(bound.getMin().greatCircleDistance(new LatLon(bound.getMaxLat(), bound.getMinLon())),
bound.getMax().greatCircleDistance(new LatLon(bound.getMinLat(), bound.getMaxLon())));
double width = Math.max(
bound.getMin().greatCircleDistance((ILatLon) new LatLon(bound.getMinLat(), bound.getMaxLon())),
bound.getMax().greatCircleDistance((ILatLon) new LatLon(bound.getMaxLat(), bound.getMinLon())));
double height = Math.max(
bound.getMin().greatCircleDistance((ILatLon) new LatLon(bound.getMaxLat(), bound.getMinLon())),
bound.getMax().greatCircleDistance((ILatLon) new LatLon(bound.getMinLat(), bound.getMaxLon())));
return height > MapWithAIDataUtils.MAXIMUM_SIDE_DIMENSIONS
|| width > MapWithAIDataUtils.MAXIMUM_SIDE_DIMENSIONS;
}

Wyświetl plik

@ -8,7 +8,6 @@ import javax.json.JsonValue;
import java.io.Closeable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;