kopia lustrzana https://github.com/JOSM/MapWithAI
See #23220: Use jakarta.annotation instead of javax.annotation (JSR305)
Some lint issues were also fixed. Signed-off-by: Taylor Smock <tsmock@meta.com>pull/43/head
rodzic
4af7ac225f
commit
e796f49d8e
|
@ -18,12 +18,12 @@ jobs:
|
|||
call-workflow:
|
||||
strategy:
|
||||
matrix:
|
||||
josm-revision: ["", "r18723"]
|
||||
josm-revision: ["", "r18877"]
|
||||
uses: JOSM/JOSMPluginAction/.github/workflows/ant.yml@v1
|
||||
with:
|
||||
java-version: 17
|
||||
josm-revision: ${{ matrix.josm-revision }}
|
||||
plugin-jar-name: 'mapwithai'
|
||||
perform-revision-tagging: ${{ github.repository == 'JOSM/MapWithAI' && github.ref_type == 'branch' && github.ref_name == 'master' && github.event_name != 'schedule' && github.event_name != 'pull_request' && matrix.josm-revision == 'r18723' }}
|
||||
perform-revision-tagging: ${{ matrix.josm-revision == 'r18877' && github.repository == 'JOSM/MapWithAI' && github.ref_type == 'branch' && github.ref_name == 'master' && github.event_name != 'schedule' && github.event_name != 'pull_request' }}
|
||||
secrets: inherit
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# The minimum JOSM version this plugin is compatible with (can be any numeric version
|
||||
plugin.main.version = 18723
|
||||
plugin.main.version = 18877
|
||||
# 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 = 18724
|
||||
plugin.compile.version = 18877
|
||||
plugin.canloadatruntime = true
|
||||
plugin.author = Taylor Smock
|
||||
plugin.class = org.openstreetmap.josm.plugins.mapwithai.MapWithAIPlugin
|
||||
|
|
|
@ -36,7 +36,6 @@ public class DataAvailability {
|
|||
static final Map<String, String> POSSIBLE_DATA_POINTS = new TreeMap<>();
|
||||
|
||||
private static final String PROVIDES = "provides";
|
||||
private static final String EMPTY_STRING = "";
|
||||
private static final int SEVEN_DAYS_IN_SECONDS = 604_800;
|
||||
|
||||
/**
|
||||
|
@ -150,7 +149,7 @@ public class DataAvailability {
|
|||
* @return A string that doesn't have quotes at the beginning or end
|
||||
*/
|
||||
public static String stripQuotes(String string) {
|
||||
return string.replaceAll("((^\")|(\"$))", EMPTY_STRING);
|
||||
return string.replaceAll("((^\")|(\"$))", "");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -224,7 +223,7 @@ public class DataAvailability {
|
|||
* @return The url or ""
|
||||
*/
|
||||
public String getTermsOfUseUrl() {
|
||||
return EMPTY_STRING;
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -247,11 +246,10 @@ public class DataAvailability {
|
|||
DATA_SOURCES.stream().map(clazz -> {
|
||||
try {
|
||||
return clazz.getConstructor().newInstance().getTermsOfUseUrl();
|
||||
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException
|
||||
| InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
||||
} catch (ReflectiveOperationException e) {
|
||||
Logging.debug(e);
|
||||
}
|
||||
return EMPTY_STRING;
|
||||
return "";
|
||||
})).filter(Objects::nonNull).filter(str -> !Utils.removeWhiteSpaces(str).isEmpty())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
@ -267,11 +265,10 @@ public class DataAvailability {
|
|||
DATA_SOURCES.stream().map(clazz -> {
|
||||
try {
|
||||
return clazz.getConstructor().newInstance().getPrivacyPolicyUrl();
|
||||
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException
|
||||
| InvocationTargetException | NoSuchMethodException | SecurityException e) {
|
||||
} catch (ReflectiveOperationException e) {
|
||||
Logging.debug(e);
|
||||
}
|
||||
return EMPTY_STRING;
|
||||
return "";
|
||||
}))
|
||||
.filter(Objects::nonNull).filter(str -> !Utils.removeWhiteSpaces(str).isEmpty()).distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
|
|
@ -3,12 +3,9 @@ package org.openstreetmap.josm.plugins.mapwithai.commands;
|
|||
|
||||
import static org.openstreetmap.josm.tools.I18n.tr;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.openstreetmap.josm.command.Command;
|
||||
|
@ -17,6 +14,8 @@ import org.openstreetmap.josm.data.osm.OsmPrimitive;
|
|||
import org.openstreetmap.josm.data.osm.Relation;
|
||||
import org.openstreetmap.josm.data.osm.Way;
|
||||
|
||||
import jakarta.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* This is similar to the ReplaceGeometryUtils.buildUpgradeNodeCommand method
|
||||
*
|
||||
|
@ -46,19 +45,19 @@ public final class MergeBuildingNodeCommand {
|
|||
|
||||
private static Node getNewOrNoTagNode(OsmPrimitive referenceObject) {
|
||||
List<Node> nodes;
|
||||
if (referenceObject instanceof Way) {
|
||||
nodes = ((Way) referenceObject).getNodes();
|
||||
} else if (referenceObject instanceof Relation) {
|
||||
nodes = ((Relation) referenceObject).getMemberPrimitives().stream().flatMap(o -> {
|
||||
if (o instanceof Way) {
|
||||
return ((Way) o).getNodes().stream();
|
||||
} else if (o instanceof Node) {
|
||||
return Stream.of((Node) o);
|
||||
if (referenceObject instanceof Way way) {
|
||||
nodes = way.getNodes();
|
||||
} else if (referenceObject instanceof Relation relation) {
|
||||
nodes = relation.getMemberPrimitives().stream().flatMap(o -> {
|
||||
if (o instanceof Way way) {
|
||||
return way.getNodes().stream();
|
||||
} else if (o instanceof Node node) {
|
||||
return Stream.of(node);
|
||||
}
|
||||
return null;
|
||||
}).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
} else if (referenceObject instanceof Node) {
|
||||
nodes = Collections.singletonList((Node) referenceObject);
|
||||
}).filter(Objects::nonNull).toList();
|
||||
} else if (referenceObject instanceof Node node) {
|
||||
nodes = Collections.singletonList(node);
|
||||
} else {
|
||||
throw new IllegalArgumentException(tr("Unknown OsmPrimitive type"));
|
||||
}
|
||||
|
|
|
@ -3,15 +3,11 @@ package org.openstreetmap.josm.plugins.mapwithai.commands;
|
|||
|
||||
import static org.openstreetmap.josm.tools.I18n.tr;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
|
@ -34,6 +30,9 @@ import org.openstreetmap.josm.plugins.mapwithai.backend.MapWithAIPreferenceHelpe
|
|||
import org.openstreetmap.josm.tools.Logging;
|
||||
import org.openstreetmap.josm.tools.Pair;
|
||||
|
||||
import jakarta.annotation.Nonnull;
|
||||
import jakarta.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Merge duplicate ways
|
||||
*/
|
||||
|
@ -83,7 +82,7 @@ public class MergeDuplicateWays extends Command {
|
|||
* @param way2 The second way
|
||||
*/
|
||||
public MergeDuplicateWays(DataSet data, Way way1, Way way2) {
|
||||
this(data, Stream.of(way1, way2).filter(Objects::nonNull).collect(Collectors.toList()));
|
||||
this(data, Stream.of(way1, way2).filter(Objects::nonNull).toList());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,7 +93,7 @@ public class MergeDuplicateWays extends Command {
|
|||
*/
|
||||
public MergeDuplicateWays(DataSet data, List<Way> ways) {
|
||||
super(data);
|
||||
this.ways = ways.stream().filter(MergeDuplicateWays::nonDeletedWay).collect(Collectors.toList());
|
||||
this.ways = ways.stream().filter(MergeDuplicateWays::nonDeletedWay).toList();
|
||||
this.commands = new ArrayList<>();
|
||||
}
|
||||
|
||||
|
@ -110,11 +109,11 @@ public class MergeDuplicateWays extends Command {
|
|||
} else if (ways.size() == 1) {
|
||||
checkForDuplicateWays(ways.get(0), commands);
|
||||
} else {
|
||||
Iterator<Way> it = ways.iterator();
|
||||
Way way1 = it.next();
|
||||
final var it = ways.iterator();
|
||||
var way1 = it.next();
|
||||
while (it.hasNext()) {
|
||||
Way way2 = it.next();
|
||||
final Command tCommand = checkForDuplicateWays(way1, way2);
|
||||
final var way2 = it.next();
|
||||
final var tCommand = checkForDuplicateWays(way1, way2);
|
||||
if (tCommand != null) {
|
||||
commands.add(tCommand);
|
||||
tCommand.executeCommand();
|
||||
|
@ -122,8 +121,7 @@ public class MergeDuplicateWays extends Command {
|
|||
way1 = way2;
|
||||
}
|
||||
}
|
||||
final List<Command> realCommands = commands.stream().filter(Objects::nonNull).distinct()
|
||||
.collect(Collectors.toList());
|
||||
final List<Command> realCommands = commands.stream().filter(Objects::nonNull).distinct().toList();
|
||||
commands.clear();
|
||||
commands.addAll(realCommands);
|
||||
if (!commands.isEmpty() && (commands.size() != 1)) {
|
||||
|
@ -165,14 +163,13 @@ public class MergeDuplicateWays extends Command {
|
|||
final List<Way> ways = (bound == null ? dataSet.getWays() : dataSet.searchWays(bound.toBBox())).stream()
|
||||
.filter(prim -> !prim.isIncomplete() && !prim.isDeleted())
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
for (int i = 0; i < ways.size(); i++) {
|
||||
final Way way1 = ways.get(i);
|
||||
final Collection<Way> nearbyWays = dataSet.searchWays(way1.getBBox()).stream()
|
||||
.filter(MergeDuplicateWays::nonDeletedWay).collect(Collectors.toList());
|
||||
nearbyWays.remove(way1);
|
||||
for (var i = 0; i < ways.size(); i++) {
|
||||
final var way1 = ways.get(i);
|
||||
final var nearbyWays = dataSet.searchWays(way1.getBBox()).stream()
|
||||
.filter(MergeDuplicateWays::nonDeletedWay).filter(w -> !Objects.equals(w, way1)).toList();
|
||||
for (final Way way2 : nearbyWays) {
|
||||
final Command command = checkForDuplicateWays(way1, way2);
|
||||
final Collection<OsmPrimitive> deletedWays = new ArrayList<>();
|
||||
final var command = checkForDuplicateWays(way1, way2);
|
||||
final var deletedWays = new ArrayList<OsmPrimitive>();
|
||||
if (command != null) {
|
||||
commands.add(command);
|
||||
command.executeCommand();
|
||||
|
@ -194,11 +191,10 @@ public class MergeDuplicateWays extends Command {
|
|||
*/
|
||||
public static void checkForDuplicateWays(Way way, List<Command> commands) {
|
||||
final Collection<Way> nearbyWays = way.getDataSet().searchWays(way.getBBox()).stream()
|
||||
.filter(MergeDuplicateWays::nonDeletedWay).collect(Collectors.toList());
|
||||
nearbyWays.remove(way);
|
||||
.filter(MergeDuplicateWays::nonDeletedWay).filter(w -> !Objects.equals(w, way)).toList();
|
||||
for (final Way way2 : nearbyWays) {
|
||||
if (!way2.isDeleted()) {
|
||||
final Command tCommand = checkForDuplicateWays(way, way2);
|
||||
final var tCommand = checkForDuplicateWays(way, way2);
|
||||
if (tCommand != null) {
|
||||
commands.add(tCommand);
|
||||
tCommand.executeCommand();
|
||||
|
@ -230,10 +226,8 @@ public class MergeDuplicateWays extends Command {
|
|||
Logging.error("{0}", way2);
|
||||
}
|
||||
if ((compressed.size() > 1) && duplicateEntrySet.stream().noneMatch(entry -> entry.getValue().size() > 1)) {
|
||||
final List<Integer> initial = compressed.stream().map(entry -> entry.a.a).sorted()
|
||||
.collect(Collectors.toList());
|
||||
final List<Integer> after = compressed.stream().map(entry -> entry.b.a).sorted()
|
||||
.collect(Collectors.toList());
|
||||
final var initial = compressed.stream().map(entry -> entry.a.a).sorted().toList();
|
||||
final var after = compressed.stream().map(entry -> entry.b.a).sorted().toList();
|
||||
if (sorted(initial) && sorted(after)) {
|
||||
returnCommand = mergeWays(way1, way2, compressed);
|
||||
}
|
||||
|
@ -278,12 +272,12 @@ public class MergeDuplicateWays extends Command {
|
|||
}
|
||||
}
|
||||
Collections.reverse(before);
|
||||
final Way newWay = new Way(way1);
|
||||
final var newWay = new Way(way1);
|
||||
List<Command> commands = new ArrayList<>();
|
||||
before.forEach(node -> newWay.addNode(0, node));
|
||||
after.forEach(newWay::addNode);
|
||||
if (newWay.getNodesCount() > 0) {
|
||||
final ChangeCommand changeCommand = new ChangeCommand(way1, newWay);
|
||||
final var changeCommand = new ChangeCommand(way1, newWay);
|
||||
commands.add(changeCommand);
|
||||
/*
|
||||
* This must be executed, otherwise the delete command will believe that way2
|
||||
|
@ -315,8 +309,8 @@ public class MergeDuplicateWays extends Command {
|
|||
* @return The node that the param {@code node} duplicates
|
||||
*/
|
||||
public static Node nodeInCompressed(Node node, Set<Pair<Pair<Integer, Node>, Pair<Integer, Node>>> compressed) {
|
||||
Node returnNode = node;
|
||||
for (final Pair<Pair<Integer, Node>, Pair<Integer, Node>> pair : compressed) {
|
||||
var returnNode = node;
|
||||
for (final var pair : compressed) {
|
||||
if (node.equals(pair.a.b)) {
|
||||
returnNode = pair.b.b;
|
||||
} else if (node.equals(pair.b.b)) {
|
||||
|
@ -326,26 +320,26 @@ public class MergeDuplicateWays extends Command {
|
|||
break;
|
||||
}
|
||||
}
|
||||
final Node tReturnNode = returnNode;
|
||||
final var tReturnNode = returnNode;
|
||||
node.getKeys().forEach(tReturnNode::put);
|
||||
return returnNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the node pairs increment in the same direction (only checks first
|
||||
* two pairs), ensure that they are sorted with {@link sorted}
|
||||
* two pairs), ensure that they are sorted with {@link #sorted}
|
||||
*
|
||||
* @param compressed The set of duplicate node/placement pairs
|
||||
* @return true if the node pairs increment in the same direction
|
||||
*/
|
||||
public static boolean checkDirection(Set<Pair<Pair<Integer, Node>, Pair<Integer, Node>>> compressed) {
|
||||
final Iterator<Pair<Pair<Integer, Node>, Pair<Integer, Node>>> iterator = compressed.iterator();
|
||||
boolean returnValue = false;
|
||||
final var iterator = compressed.iterator();
|
||||
var returnValue = false;
|
||||
if (compressed.size() > 1) {
|
||||
final Pair<Pair<Integer, Node>, Pair<Integer, Node>> first = iterator.next();
|
||||
final Pair<Pair<Integer, Node>, Pair<Integer, Node>> second = iterator.next();
|
||||
final boolean way1Forward = first.a.a < second.a.a;
|
||||
final boolean way2Forward = first.b.a < second.b.a;
|
||||
final var first = iterator.next();
|
||||
final var second = iterator.next();
|
||||
final var way1Forward = first.a.a < second.a.a;
|
||||
final var way2Forward = first.b.a < second.b.a;
|
||||
returnValue = way1Forward == way2Forward;
|
||||
}
|
||||
return returnValue;
|
||||
|
@ -358,10 +352,10 @@ public class MergeDuplicateWays extends Command {
|
|||
* @return true if there are no gaps and it increases
|
||||
*/
|
||||
public static boolean sorted(List<Integer> collection) {
|
||||
boolean returnValue = true;
|
||||
var returnValue = true;
|
||||
if (collection.size() > 1) {
|
||||
Integer last = collection.get(0);
|
||||
for (int i = 1; i < collection.size(); i++) {
|
||||
for (var i = 1; i < collection.size(); i++) {
|
||||
final Integer next = collection.get(i);
|
||||
if ((next - last) != 1) {
|
||||
returnValue = false;
|
||||
|
@ -381,17 +375,16 @@ public class MergeDuplicateWays extends Command {
|
|||
* @return A map of node -> node(s) duplicates
|
||||
*/
|
||||
public static Map<Pair<Integer, Node>, Map<Integer, Node>> getDuplicateNodes(Way way1, Way way2) {
|
||||
final Map<Pair<Integer, Node>, Map<Integer, Node>> duplicateNodes = new LinkedHashMap<>();
|
||||
for (int j = 0; j < way1.getNodesCount(); j++) {
|
||||
final Node origNode = way1.getNode(j);
|
||||
for (int k = 0; k < way2.getNodesCount(); k++) {
|
||||
final Node possDupeNode = way2.getNode(k);
|
||||
final var duplicateNodes = new LinkedHashMap<Pair<Integer, Node>, Map<Integer, Node>>();
|
||||
for (var j = 0; j < way1.getNodesCount(); j++) {
|
||||
final var origNode = way1.getNode(j);
|
||||
for (var k = 0; k < way2.getNodesCount(); k++) {
|
||||
final var possDupeNode = way2.getNode(k);
|
||||
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<>());
|
||||
final var origNodePair = new Pair<>(j, origNode);
|
||||
final var dupeNodeMap = duplicateNodes.computeIfAbsent(origNodePair, ignored -> new HashMap<>());
|
||||
dupeNodeMap.put(k, possDupeNode);
|
||||
duplicateNodes.put(origNodePair, dupeNodeMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,7 @@ package org.openstreetmap.josm.plugins.mapwithai.data.mapwithai;
|
|||
|
||||
import static org.openstreetmap.josm.tools.I18n.marktr;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
@ -13,11 +11,15 @@ import java.util.EnumMap;
|
|||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import org.openstreetmap.josm.data.sources.ISourceCategory;
|
||||
import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets;
|
||||
import org.openstreetmap.josm.tools.ImageProvider;
|
||||
import org.openstreetmap.josm.tools.ImageProvider.ImageSizes;
|
||||
|
||||
import jakarta.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* The category for a MapWithAI source (i.e., buildings/highways/addresses/etc.)
|
||||
*
|
||||
|
@ -98,6 +100,7 @@ public enum MapWithAICategory implements ISourceCategory<MapWithAICategory> {
|
|||
*/
|
||||
public static class DescriptionComparator implements Comparator<MapWithAICategory>, Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 9131636715279880580L;
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,9 +3,6 @@ package org.openstreetmap.josm.plugins.mapwithai.data.mapwithai;
|
|||
|
||||
import static org.openstreetmap.josm.tools.I18n.tr;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serial;
|
||||
import java.time.Instant;
|
||||
|
@ -25,6 +22,8 @@ import java.util.concurrent.ForkJoinTask;
|
|||
import java.util.concurrent.RecursiveTask;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import org.openstreetmap.gui.jmapviewer.tilesources.TileSourceInfo;
|
||||
import org.openstreetmap.josm.actions.ExpertToggleAction;
|
||||
import org.openstreetmap.josm.data.Preferences;
|
||||
|
@ -48,6 +47,8 @@ import org.openstreetmap.josm.tools.ListenerList;
|
|||
import org.openstreetmap.josm.tools.Logging;
|
||||
import org.openstreetmap.josm.tools.Utils;
|
||||
|
||||
import jakarta.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Manages the list of imagery entries that are shown in the imagery menu.
|
||||
*/
|
||||
|
@ -280,8 +281,8 @@ public class MapWithAILayerInfo {
|
|||
}
|
||||
// This is literally to avoid allocations on startup
|
||||
final Preferences preferences;
|
||||
if (Config.getPref() instanceof Preferences) {
|
||||
preferences = (Preferences) Config.getPref();
|
||||
if (Config.getPref() instanceof Preferences pref) {
|
||||
preferences = pref;
|
||||
} else {
|
||||
preferences = null;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
// License: GPL. For details, see LICENSE file.
|
||||
package org.openstreetmap.josm.plugins.mapwithai.data.mapwithai;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.openstreetmap.josm.data.sources.ISourceType;
|
||||
|
||||
import jakarta.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Type of MapWithAI entry
|
||||
*
|
||||
|
|
|
@ -4,9 +4,6 @@ package org.openstreetmap.josm.plugins.mapwithai.data.validation.tests;
|
|||
import static org.openstreetmap.josm.tools.I18n.marktr;
|
||||
import static org.openstreetmap.josm.tools.I18n.tr;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
@ -33,6 +30,9 @@ import org.openstreetmap.josm.plugins.mapwithai.tools.Access;
|
|||
import org.openstreetmap.josm.spi.preferences.Config;
|
||||
import org.openstreetmap.josm.tools.Pair;
|
||||
|
||||
import jakarta.annotation.Nonnull;
|
||||
import jakarta.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A test for routing islands
|
||||
*
|
||||
|
@ -181,7 +181,7 @@ public class RoutingIslandsTest extends Test {
|
|||
getDefaultAccessTags(way).getOrDefault(currentTransportMode, Access.AccessTags.NO.getKey())))
|
||||
.collect(Collectors.toSet())).stream()
|
||||
.map(way -> new Pair<>((incomingWays.containsAll(way) ? marktr("outgoing") : marktr("incoming")), way))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
createErrors(problematic, currentTransportMode);
|
||||
}
|
||||
|
||||
|
@ -198,9 +198,9 @@ public class RoutingIslandsTest extends Test {
|
|||
private static void findConnectedWays(String currentTransportMode, Collection<Way> potentialWays,
|
||||
Collection<Way> incomingWays, Collection<Way> outgoingWays) {
|
||||
potentialWays.stream().filter(Way::isUsable).filter(Way::isOutsideDownloadArea).forEach(way -> {
|
||||
Node firstNode = firstNode(way, currentTransportMode);
|
||||
Node lastNode = lastNode(way, currentTransportMode);
|
||||
Integer isOneway = isOneway(way, currentTransportMode);
|
||||
final var firstNode = firstNode(way, currentTransportMode);
|
||||
final var lastNode = lastNode(way, currentTransportMode);
|
||||
final var isOneway = isOneway(way, currentTransportMode);
|
||||
if (firstNode != null && firstNode.isOutsideDownloadArea()) {
|
||||
incomingWays.add(way);
|
||||
}
|
||||
|
@ -223,14 +223,14 @@ public class RoutingIslandsTest extends Test {
|
|||
* @return a list of sets of ways that are connected
|
||||
*/
|
||||
private static List<Set<Way>> collectConnected(Collection<Way> ways) {
|
||||
ArrayList<Set<Way>> collected = new ArrayList<>();
|
||||
ArrayList<Way> listOfWays = new ArrayList<>(ways);
|
||||
final int maxLoop = Config.getPref().getInt("validator.routingislands.maxrecursion", MAX_LOOPS);
|
||||
for (int i = 0; i < listOfWays.size(); i++) {
|
||||
Way initial = listOfWays.get(i);
|
||||
final var collected = new ArrayList<Set<Way>>();
|
||||
final var listOfWays = new ArrayList<>(ways);
|
||||
final var maxLoop = Config.getPref().getInt("validator.routingislands.maxrecursion", MAX_LOOPS);
|
||||
for (var i = 0; i < listOfWays.size(); i++) {
|
||||
final var initial = listOfWays.get(i);
|
||||
Set<Way> connected = new HashSet<>();
|
||||
connected.add(initial);
|
||||
int loopCounter = 0;
|
||||
var loopCounter = 0;
|
||||
while (!getConnected(connected) && loopCounter < maxLoop) {
|
||||
loopCounter++;
|
||||
}
|
||||
|
@ -281,8 +281,8 @@ public class RoutingIslandsTest extends Test {
|
|||
*/
|
||||
public static void checkForUnconnectedWays(Collection<Way> incoming, Collection<Way> outgoing,
|
||||
String currentTransportMode) {
|
||||
int loopCount = 0;
|
||||
int maxLoops = Config.getPref().getInt("validator.routingislands.maxrecursion", MAX_LOOPS);
|
||||
var loopCount = 0;
|
||||
var maxLoops = Config.getPref().getInt("validator.routingislands.maxrecursion", MAX_LOOPS);
|
||||
do {
|
||||
loopCount++;
|
||||
} while (loopCount <= maxLoops && getWaysFor(incoming, currentTransportMode,
|
||||
|
@ -325,11 +325,11 @@ public class RoutingIslandsTest extends Test {
|
|||
* clean up and work with via ways
|
||||
*/
|
||||
public static boolean checkAccessibility(Way from, Way to, String currentTransportMode) {
|
||||
boolean isAccessible = true;
|
||||
var isAccessible = true;
|
||||
|
||||
List<Relation> relations = from.getReferrers().stream().distinct().filter(Relation.class::isInstance)
|
||||
.map(Relation.class::cast).filter(relation -> "restriction".equals(relation.get("type")))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
for (Relation relation : relations) {
|
||||
if (((relation.hasKey("except") && relation.get("except").contains(currentTransportMode))
|
||||
|| (currentTransportMode == null || currentTransportMode.trim().isEmpty()))
|
||||
|
@ -432,7 +432,7 @@ public class RoutingIslandsTest extends Test {
|
|||
* @return The map of access tags to access
|
||||
*/
|
||||
public static TagMap getDefaultAccessTags(OsmPrimitive primitive) {
|
||||
TagMap access = new TagMap();
|
||||
final var access = new TagMap();
|
||||
final TagMap tags;
|
||||
if (primitive.hasKey(HIGHWAY)) {
|
||||
tags = getDefaultHighwayAccessTags(primitive.getKeys());
|
||||
|
@ -451,13 +451,9 @@ public class RoutingIslandsTest extends Test {
|
|||
}
|
||||
|
||||
private static String getCachedDirectionMode(String direction, String mode) {
|
||||
if (!DIRECTION_MAP.containsKey(direction)) {
|
||||
DIRECTION_MAP.put(direction, new HashMap<>(Access.getTransportModes().size()));
|
||||
}
|
||||
DIRECTION_MAP.computeIfAbsent(direction, d -> new HashMap<>(Access.getTransportModes().size()));
|
||||
final var directionMap = DIRECTION_MAP.get(direction);
|
||||
if (!directionMap.containsKey(mode)) {
|
||||
directionMap.put(mode, direction.concat(mode));
|
||||
}
|
||||
directionMap.computeIfAbsent(mode, direction::concat);
|
||||
return directionMap.get(mode);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,22 +4,6 @@ package org.openstreetmap.josm.plugins.mapwithai.gui.preferences.mapwithai;
|
|||
import static org.openstreetmap.josm.tools.I18n.marktr;
|
||||
import static org.openstreetmap.josm.tools.I18n.tr;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JToolBar;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
|
@ -43,6 +27,22 @@ import java.util.function.Function;
|
|||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JToolBar;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
|
||||
import org.openstreetmap.gui.jmapviewer.Coordinate;
|
||||
import org.openstreetmap.gui.jmapviewer.MapPolygonImpl;
|
||||
import org.openstreetmap.gui.jmapviewer.MapRectangleImpl;
|
||||
|
@ -52,6 +52,7 @@ import org.openstreetmap.josm.data.Bounds;
|
|||
import org.openstreetmap.josm.data.coor.LatLon;
|
||||
import org.openstreetmap.josm.data.preferences.NamedColorProperty;
|
||||
import org.openstreetmap.josm.gui.MainApplication;
|
||||
import org.openstreetmap.josm.gui.bbox.JosmMapViewer;
|
||||
import org.openstreetmap.josm.gui.bbox.SlippyMapBBoxChooser;
|
||||
import org.openstreetmap.josm.gui.preferences.imagery.ImageryProvidersPanel;
|
||||
import org.openstreetmap.josm.gui.util.GuiHelper;
|
||||
|
@ -72,6 +73,8 @@ import org.openstreetmap.josm.tools.ListenerList;
|
|||
import org.openstreetmap.josm.tools.Logging;
|
||||
import org.openstreetmap.josm.tools.OpenBrowser;
|
||||
|
||||
import jakarta.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* A panel displaying imagery providers. Largely duplicates
|
||||
* {@link ImageryProvidersPanel}.
|
||||
|
@ -376,7 +379,7 @@ public class MapWithAIProvidersPanel extends JPanel {
|
|||
|
||||
// Add default item map
|
||||
defaultMap = new SlippyMapBBoxChooser();
|
||||
defaultMap.setTileSource(SlippyMapBBoxChooser.DefaultOsmTileSourceProvider.get()); // for attribution
|
||||
defaultMap.setTileSource(JosmMapViewer.DefaultOsmTileSourceProvider.get()); // for attribution
|
||||
defaultMap.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
|
@ -408,36 +411,36 @@ public class MapWithAIProvidersPanel extends JPanel {
|
|||
defaultTableListener = new DefListSelectionListener();
|
||||
defaultTable.getSelectionModel().addListSelectionListener(defaultTableListener);
|
||||
|
||||
defaultToolbar = new JToolBar(JToolBar.VERTICAL);
|
||||
defaultToolbar = new JToolBar(SwingConstants.VERTICAL);
|
||||
defaultToolbar.setFloatable(false);
|
||||
defaultToolbar.setBorderPainted(false);
|
||||
defaultToolbar.setOpaque(false);
|
||||
defaultToolbar.add(new ReloadAction());
|
||||
add(defaultToolbar, GBC.eol().anchor(GBC.SOUTH).insets(0, 0, 5, 0));
|
||||
add(defaultToolbar, GBC.eol().anchor(GridBagConstraints.SOUTH).insets(0, 0, 5, 0));
|
||||
|
||||
final var help = new HtmlPanel(
|
||||
tr("New default entries can be added in the <a href=\"{0}\">GitHub Repository</a>.",
|
||||
"https://github.com/JOSM/MapWithAI/blob/pages/json/sources.json"));
|
||||
help.enableClickableHyperlinks();
|
||||
add(help, GBC.eol().insets(10, 0, 0, 0).fill(GBC.HORIZONTAL));
|
||||
add(help, GBC.eol().insets(10, 0, 0, 0).fill(GridBagConstraints.HORIZONTAL));
|
||||
|
||||
final var activate = new ActivateAction();
|
||||
defaultTable.getSelectionModel().addListSelectionListener(activate);
|
||||
final var btnActivate = new JButton(activate);
|
||||
|
||||
middleToolbar = new JToolBar(JToolBar.HORIZONTAL);
|
||||
middleToolbar = new JToolBar(SwingConstants.HORIZONTAL);
|
||||
middleToolbar.setFloatable(false);
|
||||
middleToolbar.setBorderPainted(false);
|
||||
middleToolbar.setOpaque(false);
|
||||
middleToolbar.add(btnActivate);
|
||||
add(middleToolbar, GBC.eol().anchor(GBC.CENTER).insets(5, 5, 5, 0));
|
||||
add(middleToolbar, GBC.eol().anchor(GridBagConstraints.CENTER).insets(5, 5, 5, 0));
|
||||
|
||||
add(Box.createHorizontalGlue(), GBC.eol().fill(GridBagConstraints.HORIZONTAL));
|
||||
|
||||
final var scroll = new JScrollPane(activeTable);
|
||||
scroll.setPreferredSize(new Dimension(200, 200));
|
||||
|
||||
activeToolbar = new JToolBar(JToolBar.VERTICAL);
|
||||
activeToolbar = new JToolBar(SwingConstants.VERTICAL);
|
||||
activeToolbar.setFloatable(false);
|
||||
activeToolbar.setBorderPainted(false);
|
||||
activeToolbar.setOpaque(false);
|
||||
|
@ -448,7 +451,7 @@ public class MapWithAIProvidersPanel extends JPanel {
|
|||
add(new JLabel(tr("Selected entries:")), GBC.eol().insets(5, 0, 0, 0));
|
||||
add(scroll, GBC.std().fill(GridBagConstraints.BOTH).span(GridBagConstraints.RELATIVE).weight(1.0, 0.4)
|
||||
.insets(5, 0, 0, 5));
|
||||
add(activeToolbar, GBC.eol().anchor(GBC.NORTH).insets(0, 0, 5, 5));
|
||||
add(activeToolbar, GBC.eol().anchor(GridBagConstraints.NORTH).insets(0, 0, 5, 5));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
// License: GPL. For details, see LICENSE file.
|
||||
package org.openstreetmap.josm.plugins.mapwithai.io.mapwithai;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
@ -36,6 +33,8 @@ import org.openstreetmap.josm.spi.preferences.Config;
|
|||
import org.openstreetmap.josm.tools.HttpClient;
|
||||
import org.openstreetmap.josm.tools.Logging;
|
||||
|
||||
import jakarta.annotation.Nonnull;
|
||||
import jakarta.annotation.Nullable;
|
||||
import jakarta.json.Json;
|
||||
import jakarta.json.JsonArray;
|
||||
import jakarta.json.JsonNumber;
|
||||
|
@ -55,6 +54,7 @@ public class ESRISourceReader {
|
|||
/** The cache storing ESRI source information (json) */
|
||||
public static final CacheAccess<String, String> SOURCE_CACHE = JCSCacheManager.getCache("mapwithai:esrisources", 5,
|
||||
50_000, new File(Config.getDirs().getCacheDirectory(true), "mapwithai").getPath());
|
||||
private static final String ACCESS_INFORMATION = "accessInformation";
|
||||
private final MapWithAIInfo source;
|
||||
private boolean fastFail;
|
||||
private final List<MapWithAICategory> ignoreConflationCategories;
|
||||
|
@ -187,9 +187,9 @@ public class ESRISourceReader {
|
|||
if (this.ignoreConflationCategories.contains(newInfo.getCategory())) {
|
||||
newInfo.setConflation(false);
|
||||
}
|
||||
if (feature.containsKey("accessInformation")
|
||||
&& feature.get("accessInformation").getValueType() != JsonValue.ValueType.NULL) {
|
||||
newInfo.setAttributionText(feature.getString("accessInformation"));
|
||||
if (feature.containsKey(ACCESS_INFORMATION)
|
||||
&& feature.get(ACCESS_INFORMATION).getValueType() != JsonValue.ValueType.NULL) {
|
||||
newInfo.setAttributionText(feature.getString(ACCESS_INFORMATION));
|
||||
}
|
||||
newInfo.setDescription(feature.getString("snippet"));
|
||||
if (newInfo.getSource() != null) {
|
||||
|
|
|
@ -8,7 +8,6 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
import org.openstreetmap.josm.data.Bounds;
|
||||
import org.openstreetmap.josm.data.osm.DataSet;
|
||||
import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
|
||||
|
@ -17,10 +16,10 @@ import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo;
|
|||
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIType;
|
||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAIConfig;
|
||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
|
||||
import org.openstreetmap.josm.testutils.JOSMTestRules;
|
||||
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
||||
import org.openstreetmap.josm.testutils.annotations.BasicWiremock;
|
||||
import org.openstreetmap.josm.testutils.annotations.HTTP;
|
||||
import org.openstreetmap.josm.testutils.annotations.OsmApi;
|
||||
|
||||
import com.github.tomakehurst.wiremock.WireMockServer;
|
||||
import com.github.tomakehurst.wiremock.admin.model.GetServeEventsResult;
|
||||
|
@ -41,12 +40,11 @@ import com.github.tomakehurst.wiremock.verification.LoggedRequest;
|
|||
*/
|
||||
@BasicPreferences
|
||||
@HTTP
|
||||
@Wiremock
|
||||
@MapWithAIConfig
|
||||
@OsmApi(OsmApi.APIType.FAKE)
|
||||
@Wiremock
|
||||
class BoundingBoxMapWithAIDownloaderTest {
|
||||
private static final String TEST_DATA = "<osm version=\"0.6\"><node id=\"1\" lat=\"0\" lon=\"0\" version=\"1\"/><node id=\"2\" lat=\"1\" lon=\"1\" version=\"1\"/></osm>";
|
||||
@RegisterExtension
|
||||
JOSMTestRules josmTestRules = new JOSMTestRules().fakeAPI();
|
||||
|
||||
@BasicWiremock
|
||||
public WireMockServer wireMockServer;
|
||||
|
|
|
@ -11,31 +11,25 @@ import java.util.concurrent.ExecutionException;
|
|||
import java.util.concurrent.Future;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
import org.openstreetmap.josm.actions.downloadtasks.DownloadParams;
|
||||
import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
|
||||
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAILayerInfo;
|
||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAITestRules;
|
||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources;
|
||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.NoExceptions;
|
||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
|
||||
import org.openstreetmap.josm.testutils.JOSMTestRules;
|
||||
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
||||
import org.openstreetmap.josm.testutils.annotations.OsmApi;
|
||||
import org.openstreetmap.josm.testutils.annotations.Projection;
|
||||
import org.openstreetmap.josm.testutils.annotations.Territories;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
|
||||
@BasicPreferences
|
||||
@MapWithAISources
|
||||
@NoExceptions
|
||||
@Wiremock
|
||||
@Territories
|
||||
@OsmApi(OsmApi.APIType.FAKE)
|
||||
@Projection
|
||||
@Territories
|
||||
@Wiremock
|
||||
class DownloadMapWithAITaskTest {
|
||||
@RegisterExtension
|
||||
@SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
||||
JOSMTestRules rule = new MapWithAITestRules().fakeAPI();
|
||||
|
||||
@Test
|
||||
void testDownloadOsmServerReaderDownloadParamsBoundsProgressMonitor()
|
||||
|
|
|
@ -17,7 +17,6 @@ import java.util.Map;
|
|||
import java.util.Objects;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
import org.openstreetmap.josm.TestUtils;
|
||||
import org.openstreetmap.josm.data.Bounds;
|
||||
import org.openstreetmap.josm.data.coor.LatLon;
|
||||
|
@ -28,30 +27,24 @@ import org.openstreetmap.josm.data.osm.Way;
|
|||
import org.openstreetmap.josm.data.projection.ProjectionRegistry;
|
||||
import org.openstreetmap.josm.gui.MainApplication;
|
||||
import org.openstreetmap.josm.gui.layer.OsmDataLayer;
|
||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAITestRules;
|
||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources;
|
||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.NoExceptions;
|
||||
import org.openstreetmap.josm.testutils.JOSMTestRules;
|
||||
import org.openstreetmap.josm.testutils.annotations.OsmApi;
|
||||
import org.openstreetmap.josm.testutils.annotations.Projection;
|
||||
import org.openstreetmap.josm.testutils.annotations.Territories;
|
||||
import org.openstreetmap.josm.tools.Geometry;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
|
||||
/**
|
||||
* Test class for {@link GetDataRunnable}
|
||||
*
|
||||
* @author Taylor Smock
|
||||
*/
|
||||
@NoExceptions
|
||||
@MapWithAISources
|
||||
@NoExceptions
|
||||
@OsmApi(OsmApi.APIType.FAKE)
|
||||
@Projection
|
||||
@Territories
|
||||
class GetDataRunnableTest {
|
||||
@RegisterExtension
|
||||
@SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
||||
static JOSMTestRules rule = new MapWithAITestRules().fakeAPI();
|
||||
|
||||
@Test
|
||||
void testAddMissingElement() {
|
||||
Way way1 = TestUtils.newWay("", new Node(new LatLon(-5.7117803, 34.5011898)),
|
||||
|
|
|
@ -17,7 +17,6 @@ import java.util.stream.Collectors;
|
|||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
import org.openstreetmap.josm.TestUtils;
|
||||
import org.openstreetmap.josm.data.Bounds;
|
||||
import org.openstreetmap.josm.data.coor.ILatLon;
|
||||
|
@ -32,19 +31,16 @@ import org.openstreetmap.josm.data.osm.Way;
|
|||
import org.openstreetmap.josm.gui.MainApplication;
|
||||
import org.openstreetmap.josm.gui.layer.GpxLayer;
|
||||
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo;
|
||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.MapWithAITestRules;
|
||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.MapWithAISources;
|
||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.NoExceptions;
|
||||
import org.openstreetmap.josm.plugins.mapwithai.testutils.annotations.Wiremock;
|
||||
import org.openstreetmap.josm.testutils.JOSMTestRules;
|
||||
import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
|
||||
import org.openstreetmap.josm.testutils.annotations.Main;
|
||||
import org.openstreetmap.josm.testutils.annotations.OsmApi;
|
||||
import org.openstreetmap.josm.testutils.annotations.Projection;
|
||||
import org.openstreetmap.josm.testutils.annotations.Territories;
|
||||
import org.openstreetmap.josm.tools.Logging;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
|
||||
/**
|
||||
* Test class for {@link MapWithAIDataUtils}
|
||||
*
|
||||
|
@ -54,6 +50,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
|||
@Main
|
||||
@MapWithAISources
|
||||
@NoExceptions
|
||||
@OsmApi(OsmApi.APIType.FAKE)
|
||||
@Projection
|
||||
@Territories
|
||||
@Wiremock
|
||||
|
@ -61,10 +58,6 @@ public class MapWithAIDataUtilsTest {
|
|||
/** This is the default MapWithAI URL */
|
||||
private static final String DEFAULT_MAPWITHAI_API = "https://www.mapwith.ai/maps/ml_roads?conflate_with_osm=true&theme=ml_road_vector&collaborator=josm&token=ASb3N5o9HbX8QWn8G_NtHIRQaYv3nuG2r7_f3vnGld3KhZNCxg57IsaQyssIaEw5rfRNsPpMwg4TsnrSJtIJms5m&hash=ASawRla3rBcwEjY4HIY&bbox={bbox}";
|
||||
|
||||
@RegisterExtension
|
||||
@SuppressFBWarnings("URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
||||
static JOSMTestRules test = new MapWithAITestRules().fakeAPI();
|
||||
|
||||
/**
|
||||
* This gets data from MapWithAI. This test may fail if someone adds the data to
|
||||
* OSM.
|
||||
|
|
|
@ -62,7 +62,7 @@ import mockit.Mock;
|
|||
@MapWithAISources
|
||||
@Projection
|
||||
@Wiremock
|
||||
class MapWithAIAddComandTest {
|
||||
class MapWithAIAddCommandTest {
|
||||
private final static String HIGHWAY_RESIDENTIAL = "highway=residential";
|
||||
|
||||
@BeforeEach
|
||||
|
@ -70,7 +70,7 @@ class MapWithAIAddComandTest {
|
|||
// Required to avoid an NPE with AutoZoomHandler
|
||||
new WindowMocker() {
|
||||
@Mock
|
||||
void pack() {
|
||||
public void pack() {
|
||||
// Do nothing
|
||||
}
|
||||
};
|
Ładowanie…
Reference in New Issue