- Timestamp:
- 2013-06-15T11:06:38+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/DistributeAction.java
r4982 r6006 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; 8 8 import java.awt.event.KeyEvent; 9 9 import java.util.Collection; 10 import java.util.HashSet; 11 import java.util.Iterator; 10 12 import java.util.LinkedList; 13 import java.util.Set; 11 14 12 15 import javax.swing.JOptionPane; … … 28 31 public final class DistributeAction extends JosmAction { 29 32 33 /** 34 * Constructs a new {@code DistributeAction}. 35 */ 30 36 public DistributeAction() { 31 37 super(tr("Distribute Nodes"), "distribute", tr("Distribute the selected nodes to equal distances along a line."), … … 34 40 putValue("help", ht("/Action/DistributeNodes")); 35 41 } 36 42 37 43 /** 38 44 * The general algorithm here is to find the two selected nodes … … 59 65 itnodes.addAll(((Way)osm).getNodes()); 60 66 } 67 } 68 69 Set<Node> ignoredNodes = removeNodesWithoutCoordinates(nodes); 70 ignoredNodes.addAll(removeNodesWithoutCoordinates(itnodes)); 71 if (!ignoredNodes.isEmpty()) { 72 Main.warn(tr("Ignoring {0} nodes with null coordinates", ignoredNodes.size())); 73 ignoredNodes.clear(); 61 74 } 62 75 … … 136 149 Main.map.repaint(); 137 150 } 151 152 private Set<Node> removeNodesWithoutCoordinates(Collection<Node> col) { 153 Set<Node> result = new HashSet<Node>(); 154 for (Iterator<Node> it = col.iterator(); it.hasNext();) { 155 Node n = it.next(); 156 if (n.getCoor() == null) { 157 it.remove(); 158 result.add(n); 159 } 160 } 161 return result; 162 } 138 163 139 164 @Override
Note:
See TracChangeset
for help on using the changeset viewer.