Changeset 3713 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2010-12-11T17:59:16+01:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/JoinNodeWayAction.java
r3643 r3713 2 2 package org.openstreetmap.josm.actions; 3 3 4 import static org.openstreetmap.josm.gui.help.HelpUtil.ht; 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.gui.help.HelpUtil.ht;6 6 7 7 import java.awt.event.ActionEvent; … … 12 12 import java.util.HashMap; 13 13 import java.util.HashSet; 14 import java.util.Iterator;15 14 import java.util.LinkedList; 16 15 import java.util.List; … … 43 42 44 43 for (OsmPrimitive osm : sel) { 45 if (!(osm instanceof Node)) continue; 44 if (!(osm instanceof Node)) { 45 continue; 46 } 46 47 Node node = (Node) osm; 47 48 … … 66 67 for (Map.Entry<Way, List<Integer>> insertPoint : insertPoints.entrySet()) { 67 68 List<Integer> is = insertPoint.getValue(); 68 if (is.size() == 0) 69 if (is.size() == 0) { 69 70 continue; 71 } 70 72 71 73 Way w = insertPoint.getKey(); -
trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java
r3596 r3713 13 13 import java.util.Collection; 14 14 import java.util.HashSet; 15 import java.util.LinkedHashSet;16 15 import java.util.LinkedList; 17 16 import java.util.List; … … 62 61 return; 63 62 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); 64 LinkedHashSet<Node> selectedNodes = OsmPrimitive.getFilteredSet(selection, Node.class); 65 if (selectedNodes.size() < 2) { 66 JOptionPane.showMessageDialog( 67 Main.parent, 68 tr("Please select at least two nodes to merge."), 69 tr("Warning"), 70 JOptionPane.WARNING_MESSAGE 71 ); 72 return; 63 List<Node> selectedNodes = OsmPrimitive.getFilteredList(selection, Node.class); 64 65 if (selectedNodes.size() == 1) { 66 List<Node> nearestNodes = Main.map.mapView.getNearestNodes(Main.map.mapView.getPoint(selectedNodes.get(0)), selectedNodes, OsmPrimitive.isUsablePredicate); 67 if (nearestNodes.isEmpty()) { 68 JOptionPane.showMessageDialog( 69 Main.parent, 70 tr("Please select at least two nodes to merge or node that is close to another node."), 71 tr("Warning"), 72 JOptionPane.WARNING_MESSAGE 73 ); 74 75 return; 76 } 77 selectedNodes.addAll(nearestNodes); 73 78 } 74 79 … … 88 93 * @return the coordinates of this node are later used for the target node 89 94 */ 90 public static Node selectTargetLocationNode(Li nkedHashSet<Node> candidates) {95 public static Node selectTargetLocationNode(List<Node> candidates) { 91 96 if (! Main.pref.getBoolean("merge-nodes.average-location", false)) { 92 97 Node targetNode = null; … … 112 117 * @return the selected target node 113 118 */ 114 public static Node selectTargetNode(Li nkedHashSet<Node> candidates) {119 public static Node selectTargetNode(List<Node> candidates) { 115 120 Node targetNode = null; 116 121 Node lastNode = null; … … 298 303 } 299 304 boolean ok = true; 300 if (selection.size() < 2) {301 setEnabled(false);302 return;303 }304 305 for (OsmPrimitive osm : selection) { 305 306 if (!(osm instanceof Node)) {
Note:
See TracChangeset
for help on using the changeset viewer.