kopia lustrzana https://github.com/JOSM/MapWithAI
Fix some compile warnings
Signed-off-by: Taylor Smock <taylor.smock@kaart.com>pull/1/head
rodzic
88ab3ea863
commit
5d81c2906f
|
@ -11,7 +11,6 @@ import java.util.Arrays;
|
|||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
|
@ -63,9 +62,9 @@ public final class MapWithAIPlugin extends Plugin implements Destroyable {
|
|||
|
||||
private final List<Destroyable> destroyables;
|
||||
|
||||
private PreferencesAction preferenceAction;
|
||||
private final PreferencesAction preferenceAction;
|
||||
|
||||
private MapWithAIMenu mapwithaiMenu;
|
||||
private final MapWithAIMenu mapwithaiMenu;
|
||||
|
||||
private static final Map<Class<? extends JosmAction>, Boolean> MENU_ENTRIES = new LinkedHashMap<>();
|
||||
static {
|
||||
|
@ -86,7 +85,7 @@ public final class MapWithAIPlugin extends Plugin implements Destroyable {
|
|||
mapwithaiMenu = new MapWithAIMenu();
|
||||
MainApplication.getMenu().addMenu(mapwithaiMenu, "mapwithai:menu", KeyEvent.VK_M, 9, ht("/Plugin/MapWithAI"));
|
||||
|
||||
for (final Entry<Class<? extends JosmAction>, Boolean> entry : MENU_ENTRIES.entrySet()) {
|
||||
for (final Map.Entry<Class<? extends JosmAction>, Boolean> entry : MENU_ENTRIES.entrySet()) {
|
||||
if (Arrays.asList(mapwithaiMenu.getMenuComponents()).parallelStream().filter(JMenuItem.class::isInstance)
|
||||
.map(JMenuItem.class::cast)
|
||||
.noneMatch(component -> entry.getKey().equals(component.getAction().getClass()))) {
|
||||
|
@ -154,6 +153,8 @@ public final class MapWithAIPlugin extends Plugin implements Destroyable {
|
|||
}
|
||||
|
||||
/**
|
||||
* The current version for the plugin
|
||||
*
|
||||
* @return The version information of the plugin
|
||||
*/
|
||||
public static String getVersionInfo() {
|
||||
|
|
|
@ -4,6 +4,8 @@ package org.openstreetmap.josm.plugins.mapwithai.actions;
|
|||
import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import org.openstreetmap.josm.actions.AdaptableAction;
|
||||
import org.openstreetmap.josm.actions.AddImageryLayerAction;
|
||||
|
@ -50,11 +52,19 @@ public class AddMapWithAILayerAction extends JosmAction implements AdaptableActi
|
|||
// change toolbar icon from if specified
|
||||
String icon = info.getIcon();
|
||||
if (icon != null) {
|
||||
new ImageProvider(icon).setOptional(true).getResourceAsync(result -> {
|
||||
Future<?> future = new ImageProvider(icon).setOptional(true).getResourceAsync(result -> {
|
||||
if (result != null) {
|
||||
GuiHelper.runInEDT(() -> result.attachImageIcon(this));
|
||||
}
|
||||
});
|
||||
try {
|
||||
future.get();
|
||||
} catch (InterruptedException e) {
|
||||
Logging.error(e);
|
||||
Thread.currentThread().interrupt();
|
||||
} catch (ExecutionException e) {
|
||||
Logging.error(e);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
ImageResource resource = new ImageResource(
|
||||
|
@ -104,7 +114,7 @@ public class AddMapWithAILayerAction extends JosmAction implements AdaptableActi
|
|||
}
|
||||
}
|
||||
|
||||
private OsmDataLayer getDataLayer() {
|
||||
private static OsmDataLayer getDataLayer() {
|
||||
return MainApplication.getLayerManager().getLayersOfType(OsmDataLayer.class).stream()
|
||||
.filter(i -> !(i instanceof MapWithAILayer)).findFirst().orElse(null);
|
||||
}
|
||||
|
|
|
@ -40,9 +40,9 @@ import org.openstreetmap.josm.tools.Logging;
|
|||
public class DataConflationSender implements RunnableFuture<DataSet> {
|
||||
|
||||
private static final int MAX_POLLS = 100;
|
||||
private DataSet external;
|
||||
private DataSet osm;
|
||||
private MapWithAICategory category;
|
||||
private final DataSet external;
|
||||
private final DataSet osm;
|
||||
private final MapWithAICategory category;
|
||||
private DataSet conflatedData;
|
||||
private CloseableHttpClient client;
|
||||
private boolean done;
|
||||
|
|
|
@ -303,8 +303,8 @@ public class GetDataRunnable extends RecursiveTask<DataSet> {
|
|||
/**
|
||||
* Replace tags in a dataset with a set of replacement tags
|
||||
*
|
||||
* @param dataSet The dataset with primitives to change
|
||||
* @param map The tags to replace
|
||||
* @param dataSet The dataset with primitives to change
|
||||
* @param replaceTags The tags to replace
|
||||
*/
|
||||
public static void replaceTags(DataSet dataSet, Map<Tag, Tag> replaceTags) {
|
||||
replaceTags.forEach((orig, replace) -> dataSet.allNonDeletedPrimitives().parallelStream()
|
||||
|
|
|
@ -60,7 +60,7 @@ public final class MapWithAIDataUtils {
|
|||
public static final String DEFAULT_PAINT_STYLE_RESOURCE_URL = "https://josm.openstreetmap.de/josmfile?page=Styles/MapWithAI&zip=1";
|
||||
|
||||
private static String paintStyleResourceUrl = DEFAULT_PAINT_STYLE_RESOURCE_URL;
|
||||
private static Pattern TEST_PATTERN = Pattern
|
||||
private static final Pattern TEST_PATTERN = Pattern
|
||||
.compile("^https?:\\/\\/(www\\.)?localhost[:0-9]*\\/josmfile\\?page=Styles\\/MapWithAI&zip=1$");
|
||||
|
||||
private MapWithAIDataUtils() {
|
||||
|
|
|
@ -11,8 +11,9 @@ import org.openstreetmap.josm.plugins.PluginInformation;
|
|||
import org.openstreetmap.josm.tools.Destroyable;
|
||||
|
||||
/**
|
||||
* @author Taylor Smock
|
||||
* Add information that is useful for QC/debugging to OSM changesets.
|
||||
*
|
||||
* @author Taylor Smock
|
||||
*/
|
||||
public class MapWithAIUploadHook implements UploadHook, Destroyable {
|
||||
private final String version;
|
||||
|
|
|
@ -39,7 +39,13 @@ import org.openstreetmap.josm.tools.Pair;
|
|||
public abstract class AbstractConflationCommand extends Command {
|
||||
protected Collection<OsmPrimitive> possiblyAffectedPrimitives;
|
||||
|
||||
public AbstractConflationCommand(DataSet data) {
|
||||
/**
|
||||
* Creates a new command in the context of a specific data set, without data
|
||||
* layer
|
||||
*
|
||||
* @param data the data set. Must not be null.
|
||||
*/
|
||||
protected AbstractConflationCommand(DataSet data) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
// License: GPL. For details, see LICENSE file.
|
||||
package org.openstreetmap.josm.plugins.mapwithai.backend.commands.conflation;
|
||||
|
||||
import static org.openstreetmap.josm.tools.I18n.tr;
|
||||
|
||||
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;
|
||||
import org.openstreetmap.josm.data.osm.Node;
|
||||
import org.openstreetmap.josm.data.osm.OsmPrimitive;
|
||||
import org.openstreetmap.josm.data.osm.Relation;
|
||||
import org.openstreetmap.josm.data.osm.Way;
|
||||
|
||||
/**
|
||||
* This is similar to the ReplaceGeometryUtils.buildUpgradeNodeCommand method
|
||||
*
|
||||
* @author Taylor Smock
|
||||
*
|
||||
*/
|
||||
public class MergeBuildingNodeCommand {
|
||||
/**
|
||||
* Upgrade a node to a way or multipolygon
|
||||
*
|
||||
* @param subjectNode node to be replaced
|
||||
* @param referenceObject object with greater spatial quality
|
||||
*/
|
||||
public static Command buildUpgradeNodeCommand(Node subjectNode, OsmPrimitive referenceObject) {
|
||||
boolean keepNode = !subjectNode.isNew();
|
||||
if (keepNode) {
|
||||
getNewOrNoTagNode(referenceObject);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
return null;
|
||||
}).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
} else if (referenceObject instanceof Node) {
|
||||
nodes = Collections.singletonList((Node) referenceObject);
|
||||
} else {
|
||||
throw new IllegalArgumentException(tr("Unknown OsmPrimitive type"));
|
||||
}
|
||||
return nodes.stream().filter(OsmPrimitive::isNew).findAny()
|
||||
.orElse(nodes.stream().filter(p -> !p.isTagged()).findAny().orElse(nodes.get(0)));
|
||||
}
|
||||
}
|
|
@ -93,6 +93,8 @@ public class AddNodeToWayCommand extends Command {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the node that will be added to a way
|
||||
*
|
||||
* @return {@link Node} to add to {@link Way}
|
||||
*/
|
||||
public Node getToAddNode() {
|
||||
|
@ -100,6 +102,8 @@ public class AddNodeToWayCommand extends Command {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the way that we are modifying
|
||||
*
|
||||
* @return {@link Way} that we are adding a {@link Node} to
|
||||
*/
|
||||
public Way getWay() {
|
||||
|
@ -107,6 +111,8 @@ public class AddNodeToWayCommand extends Command {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the node that we are adding our node after
|
||||
*
|
||||
* @return {@link Node} that we are adding another {@link Node} after.
|
||||
*/
|
||||
public Node getFirstNode() {
|
||||
|
@ -114,6 +120,8 @@ public class AddNodeToWayCommand extends Command {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the node that we are adding our node before
|
||||
*
|
||||
* @return {@link Node} that we are adding another {@link Node} before.
|
||||
*/
|
||||
public Node getSecondNode() {
|
||||
|
|
|
@ -148,6 +148,8 @@ public class CreateConnectionsCommand extends Command {
|
|||
}
|
||||
|
||||
/**
|
||||
* Add third-party commands that are run when conflating data.
|
||||
*
|
||||
* @param command A command to run when copying data from the MapWithAI layer
|
||||
*/
|
||||
public static void addConflationCommand(Class<? extends AbstractConflationCommand> command) {
|
||||
|
@ -155,6 +157,8 @@ public class CreateConnectionsCommand extends Command {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the commands to run when conflating data.
|
||||
*
|
||||
* @return A set of commands to run when copying data from the MapWithAI layer
|
||||
*/
|
||||
public static Set<Class<? extends AbstractConflationCommand>> getConflationCommands() {
|
||||
|
@ -162,6 +166,8 @@ public class CreateConnectionsCommand extends Command {
|
|||
}
|
||||
|
||||
/**
|
||||
* Remove a command that runs when conflating data.
|
||||
*
|
||||
* @param command The command class to remove
|
||||
* @return {@code true} if the conflation command was removed and was present
|
||||
* @see List#remove
|
||||
|
|
|
@ -8,7 +8,6 @@ import java.util.Collection;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -154,6 +153,9 @@ public class MapWithAIAddCommand extends Command implements Runnable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Calculate the number of objects added in this command that are not deleted
|
||||
* (may not count significantly modified objects as well).
|
||||
*
|
||||
* @return The number of MapWithAI objects added in this command that are not
|
||||
* deleted
|
||||
*/
|
||||
|
@ -170,7 +172,7 @@ public class MapWithAIAddCommand extends Command implements Runnable {
|
|||
|
||||
public Collection<String> getSourceTags() {
|
||||
return sources.entrySet().parallelStream()
|
||||
.filter(entry -> validPrimitive(editable.getPrimitiveById(entry.getKey()))).map(Entry::getValue)
|
||||
.filter(entry -> validPrimitive(editable.getPrimitiveById(entry.getKey()))).map(Map.Entry::getValue)
|
||||
.filter(Objects::nonNull).distinct().sorted().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ import java.util.LinkedHashMap;
|
|||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -179,7 +178,7 @@ public class MergeDuplicateWays extends Command {
|
|||
public static Command checkForDuplicateWays(Way way1, Way way2) {
|
||||
Command returnCommand = null;
|
||||
final Map<Pair<Integer, Node>, Map<Integer, Node>> duplicateNodes = getDuplicateNodes(way1, way2);
|
||||
final Set<Entry<Pair<Integer, Node>, Map<Integer, Node>>> duplicateEntrySet = duplicateNodes.entrySet();
|
||||
final Set<Map.Entry<Pair<Integer, Node>, Map<Integer, Node>>> duplicateEntrySet = duplicateNodes.entrySet();
|
||||
final Set<Pair<Pair<Integer, Node>, Pair<Integer, Node>>> compressed = duplicateNodes.entrySet().stream()
|
||||
.map(entry -> new Pair<Pair<Integer, Node>, Pair<Integer, Node>>(entry.getKey(),
|
||||
new Pair<Integer, Node>(entry.getValue().entrySet().iterator().next().getKey(),
|
||||
|
|
|
@ -30,6 +30,10 @@ public class MapWithAIConflationCategory {
|
|||
}
|
||||
}
|
||||
|
||||
private MapWithAIConflationCategory() {
|
||||
// Hide the constructor
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a conflation URL for a specific category
|
||||
*
|
||||
|
|
|
@ -51,7 +51,7 @@ public class MapWithAILayerInfo {
|
|||
private final List<MapWithAIInfo> layers = Collections.synchronizedList(new ArrayList<>());
|
||||
/** List of layer ids of all usable layers */
|
||||
private final Map<String, MapWithAIInfo> layerIds = new HashMap<>();
|
||||
private ListenerList<LayerChangeListener> listeners = ListenerList.create();
|
||||
private final ListenerList<LayerChangeListener> listeners = ListenerList.create();
|
||||
/** List of all available default layers */
|
||||
static final List<MapWithAIInfo> defaultLayers = new ArrayList<>();
|
||||
/** List of all available default layers (including mirrors) */
|
||||
|
|
|
@ -16,7 +16,6 @@ import java.util.EnumMap;
|
|||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.swing.Action;
|
||||
|
@ -147,7 +146,7 @@ public class MapWithAIMenu extends JMenu {
|
|||
}
|
||||
if (!dynamicNonPhotoItems.isEmpty()) {
|
||||
addDynamicSeparator();
|
||||
for (Entry<MapWithAICategory, List<JMenuItem>> e : dynamicNonPhotoItems.entrySet()) {
|
||||
for (Map.Entry<MapWithAICategory, List<JMenuItem>> e : dynamicNonPhotoItems.entrySet()) {
|
||||
MapWithAICategory cat = e.getKey();
|
||||
List<JMenuItem> list = e.getValue();
|
||||
if (list.size() > 1) {
|
||||
|
|
|
@ -66,7 +66,7 @@ public class MapWithAIDownloadOptions extends JPanel implements DownloadSelectio
|
|||
}
|
||||
}
|
||||
|
||||
private JComponent[] getJComponents(Component[] components) {
|
||||
private static JComponent[] getJComponents(Component[] components) {
|
||||
return Stream.of(components).filter(JComponent.class::isInstance).map(JComponent.class::cast)
|
||||
.toArray(JComponent[]::new);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAILayerInf
|
|||
public class MapWithAIDownloadSourceType implements IDownloadSourceType, LayerChangeListener {
|
||||
static final BooleanProperty IS_ENABLED = new BooleanProperty("download.mapwithai.data", false);
|
||||
JCheckBox cbDownloadMapWithAIData;
|
||||
private static MapWithAIDownloadSourceType INSTANCE;
|
||||
|
||||
@Override
|
||||
public JCheckBox getCheckBox(ChangeListener checkboxChangeListener) {
|
||||
|
|
|
@ -15,7 +15,6 @@ import java.util.Arrays;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import javax.swing.Box;
|
||||
|
@ -64,7 +63,7 @@ public class MapWithAIPreferences extends DefaultTabPreferenceSetting {
|
|||
|
||||
private static void fillReplacementTagDisplayData(List<PrefEntry> list) {
|
||||
final Map<String, String> current = new TreeMap<>(MapWithAIPreferenceHelper.getReplacementTags());
|
||||
for (final Entry<String, String> entry : current.entrySet()) {
|
||||
for (final Map.Entry<String, String> entry : current.entrySet()) {
|
||||
list.add(
|
||||
new PrefEntry(entry.getKey(), new StringSetting(entry.getValue()), new StringSetting(null), false));
|
||||
}
|
||||
|
@ -81,7 +80,7 @@ public class MapWithAIPreferences extends DefaultTabPreferenceSetting {
|
|||
p.add(panel, GBC.std().fill(GBC.BOTH));
|
||||
}
|
||||
|
||||
private Component getServerList(PreferenceTabbedPane gui) {
|
||||
private static Component getServerList(PreferenceTabbedPane gui) {
|
||||
return new MapWithAIProvidersPanel(gui, MapWithAIProvidersPanel.Options.SHOW_ACTIVE);
|
||||
}
|
||||
|
||||
|
@ -235,17 +234,28 @@ public class MapWithAIPreferences extends DefaultTabPreferenceSetting {
|
|||
}
|
||||
|
||||
/**
|
||||
* This method returns the checkbox used for deciding if layers should be
|
||||
* switched.
|
||||
*
|
||||
* @return The {@code JCheckBox} for whether or not we are switching layers.
|
||||
*/
|
||||
public JCheckBox getSwitchLayerCheckBox() {
|
||||
return switchLayerCheckBox;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the checkbox for merging buildings/addresses
|
||||
*
|
||||
* @return The checkbox
|
||||
*/
|
||||
public JCheckBox getMergeBuildingAddressCheckBox() {
|
||||
return mergeBuildingAddressCheckBox;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the spinner used to determine maximum additions (and maximum
|
||||
* selections).
|
||||
*
|
||||
* @return {@code JSpinner} for the maximum additions
|
||||
*/
|
||||
public JSpinner getMaximumAdditionSpinner() {
|
||||
|
|
|
@ -148,7 +148,9 @@ class MapWithAIParametersPanel extends JPanel {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return headers provided by user
|
||||
* HTTP parameters (so {@code ?param1=value1¶m2=value2})
|
||||
*
|
||||
* @return parameters provided by user
|
||||
*/
|
||||
public Map<String, Pair<String, Boolean>> getParameters() {
|
||||
return headers.stream().distinct()
|
||||
|
@ -156,6 +158,8 @@ class MapWithAIParametersPanel extends JPanel {
|
|||
}
|
||||
|
||||
/**
|
||||
* These are the current parameters for the info object.
|
||||
*
|
||||
* @param parameters The initial parameters to show in the dialog
|
||||
*/
|
||||
public void setParameters(JsonArray parameters) {
|
||||
|
@ -175,6 +179,8 @@ class MapWithAIParametersPanel extends JPanel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Add a listener to the model ({@code model.addTableModelListener})
|
||||
*
|
||||
* @param l A TableModelListener for the backing model
|
||||
*/
|
||||
public void addListener(TableModelListener l) {
|
||||
|
@ -182,6 +188,8 @@ class MapWithAIParametersPanel extends JPanel {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the model that is displayed in the panel.
|
||||
*
|
||||
* @return The table model used to display parameters
|
||||
*/
|
||||
public TableModel getModel() {
|
||||
|
|
|
@ -331,7 +331,7 @@ public class MapWithAIProvidersPanel extends JPanel {
|
|||
defaultModel.addTableModelListener(e -> activeTable.repaint());
|
||||
activeModel.addTableModelListener(e -> defaultTable.repaint());
|
||||
|
||||
setupDefaultTable(this, defaultTable, options, areaListeners);
|
||||
setupDefaultTable(defaultTable, options, areaListeners);
|
||||
|
||||
TableColumnModel mod = activeTable.getColumnModel();
|
||||
mod.getColumn(1).setPreferredWidth(800);
|
||||
|
@ -436,7 +436,7 @@ public class MapWithAIProvidersPanel extends JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
private static void setupDefaultTable(MapWithAIProvidersPanel panel, JTable defaultTable, Options[] options,
|
||||
private static void setupDefaultTable(JTable defaultTable, Options[] options,
|
||||
ListenerList<AreaListener> areaListeners) {
|
||||
boolean showActive = Stream.of(options).anyMatch(Options.SHOW_ACTIVE::equals);
|
||||
int tenXWidth = defaultTable.getFontMetrics(defaultTable.getFont()).stringWidth("XXXXXXXXXX");
|
||||
|
@ -507,7 +507,9 @@ public class MapWithAIProvidersPanel extends JPanel {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param The current area to highlight data from
|
||||
* Set the current bounds of the map and the area to select
|
||||
*
|
||||
* @param area The current area to highlight data from
|
||||
*/
|
||||
public void setCurrentBounds(Bounds area) {
|
||||
this.defaultMap.setBoundingBox(area);
|
||||
|
@ -613,12 +615,14 @@ public class MapWithAIProvidersPanel extends JPanel {
|
|||
}
|
||||
|
||||
private <T> void doCleanupResidualBounds(Map<Integer, T> map, Consumer<T> removalEffect) {
|
||||
List<Integer> toRemove = new ArrayList<>();
|
||||
for (Integer i : map.keySet()) {
|
||||
int viewIndex = defaultTable.convertRowIndexToView(i);
|
||||
if (!defaultTable.getSelectionModel().isSelectedIndex(viewIndex)) {
|
||||
removalEffect.accept(map.remove(i));
|
||||
toRemove.add(i);
|
||||
}
|
||||
}
|
||||
toRemove.forEach(i -> removalEffect.accept(map.remove(i)));
|
||||
}
|
||||
|
||||
private void cleanupResidualBounds() {
|
||||
|
|
|
@ -37,7 +37,7 @@ public class ESRISourceReader implements Closeable {
|
|||
private final MapWithAIInfo source;
|
||||
private CachedFile cachedFile;
|
||||
private boolean fastFail;
|
||||
private List<MapWithAICategory> ignoreConflationCategories;
|
||||
private final List<MapWithAICategory> ignoreConflationCategories;
|
||||
private static final String JSON_QUERY_PARAM = "?f=json";
|
||||
|
||||
/**
|
||||
|
|
|
@ -184,7 +184,7 @@ public class MapWithAISourceReader implements Closeable {
|
|||
}
|
||||
|
||||
}
|
||||
return Collections.emptyList();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
private static Collection<Shape> areaToShapes(java.awt.Shape shape) {
|
||||
|
|
|
@ -45,7 +45,9 @@ public class MapWithAIPluginTest {
|
|||
private static final String VERSION = "no-such-version";
|
||||
|
||||
/**
|
||||
* @throws java.lang.Exception
|
||||
* Set up the tests
|
||||
*
|
||||
* @throws java.lang.Exception if something goes wrong
|
||||
*/
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
|
|
|
@ -77,8 +77,6 @@ public class MapWithAIUploadHookTest {
|
|||
|
||||
/**
|
||||
* Test method for {@link MapWithAIUploadHook#modifyChangesetTags(Map)}.
|
||||
*
|
||||
* @throws PluginException
|
||||
*/
|
||||
@Test
|
||||
public void testModifyChangesetTags() {
|
||||
|
|
|
@ -216,8 +216,8 @@ public class MapWithAIAddComandTest {
|
|||
/**
|
||||
* https://josm.openstreetmap.de/ticket/18351
|
||||
*
|
||||
* @throws InterruptedException
|
||||
* @throws InvocationTargetException
|
||||
* @throws InterruptedException if the thread is interrupted
|
||||
* @throws InvocationTargetException if some checked exception occurs
|
||||
*/
|
||||
@Test
|
||||
public void testRegression18351() throws InvocationTargetException, InterruptedException {
|
||||
|
|
|
@ -32,7 +32,9 @@ public class MapWithAIPreferencesTest {
|
|||
private MapWithAIPreferences preferences;
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
* Set up the test
|
||||
*
|
||||
* @throws Exception if something goes wrong with set up
|
||||
*/
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
|
@ -42,10 +44,10 @@ public class MapWithAIPreferencesTest {
|
|||
/**
|
||||
* Test method for {@link MapWithAIPreferences#addGui(PreferenceTabbedPane)}.
|
||||
*
|
||||
* @throws SecurityException
|
||||
* @throws NoSuchFieldException
|
||||
* @throws IllegalAccessException
|
||||
* @throws IllegalArgumentException
|
||||
* @throws SecurityException see {@link java.lang.Class#getDeclaredField}
|
||||
* @throws NoSuchFieldException see {@link java.lang.Class#getDeclaredField}
|
||||
* @throws IllegalAccessException see {@link java.lang.reflect.Field#get}
|
||||
* @throws IllegalArgumentException see {@link java.lang.reflect.Field#get}
|
||||
*/
|
||||
@Test
|
||||
public void testAddGui()
|
||||
|
|
|
@ -31,10 +31,12 @@ public class ReplacementPreferenceTableTest {
|
|||
public JOSMTestRules rule = new JOSMTestRules().preferences();
|
||||
ReplacementPreferenceTable test;
|
||||
|
||||
protected static final class ReplacementPreferenceTableMock extends MockUp<ReplacementPreferenceTable> {
|
||||
static class ReplacementPreferenceTableMock extends MockUp<ReplacementPreferenceTable> {
|
||||
private boolean set;
|
||||
|
||||
/**
|
||||
* Initialize the mock with a preset return value
|
||||
*
|
||||
* @param set the return value for
|
||||
* {@link ReplacementPreferenceTableMock#askAddSetting}
|
||||
*/
|
||||
|
@ -48,7 +50,9 @@ public class ReplacementPreferenceTableTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param set the return value for
|
||||
* Set the return value
|
||||
*
|
||||
* @param set the new return value for
|
||||
* {@link ReplacementPreferenceTableMock#askAddSetting}
|
||||
*/
|
||||
public void setAskAddSetting(boolean set) {
|
||||
|
|
|
@ -194,14 +194,14 @@ public class MapWithAITestRules extends JOSMTestRules {
|
|||
/**
|
||||
* Replace URL servers with wiremock
|
||||
*
|
||||
* @param wireMock The wiremock to point to
|
||||
* @param url The URL to fix
|
||||
* @param wireMockServer The wiremock to point to
|
||||
* @param url The URL to fix
|
||||
* @return A url that points at the wiremock server
|
||||
*/
|
||||
private static String replaceUrl(WireMockServer wireMock, String url) {
|
||||
private static String replaceUrl(WireMockServer wireMockServer, String url) {
|
||||
try {
|
||||
URL temp = new URL(url);
|
||||
return wireMock.baseUrl() + temp.getFile();
|
||||
return wireMockServer.baseUrl() + temp.getFile();
|
||||
} catch (MalformedURLException error) {
|
||||
Logging.error(error);
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue