Changeset 20579 in osm for applications/editors/josm/plugins/validator
- Timestamp:
- 2010-03-21T13:19:55+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UntaggedNode.java
r18425 r20579 3 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 4 5 import java.util.ArrayList; 5 6 import java.util.Collection; 6 import java.util.HashSet; 7 import java.util.Set; 7 import java.util.List; 8 8 9 9 import org.openstreetmap.josm.Main; … … 12 12 import org.openstreetmap.josm.data.osm.Node; 13 13 import org.openstreetmap.josm.data.osm.OsmPrimitive; 14 import org.openstreetmap.josm.data.osm.Way;15 14 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 16 15 import org.openstreetmap.josm.plugins.validator.Severity; … … 28 27 29 28 /** Bag of all nodes */ 30 Set<Node> emptyNodes;29 List<Node> emptyNodes; 31 30 32 31 /** … … 36 35 { 37 36 super(tr("Untagged and unconnected nodes")+".", 38 tr("This test checks for untagged nodes that are not part of any way."));37 tr("This test checks for untagged nodes that are not part of any way.")); 39 38 } 40 39 … … 42 41 public void startTest(ProgressMonitor monitor) 43 42 { 44 45 emptyNodes = new HashSet<Node>(100);43 super.startTest(monitor); 44 emptyNodes = new ArrayList<Node>(); 46 45 } 47 46 … … 49 48 public void visit(Collection<OsmPrimitive> selection) 50 49 { 51 // If there is a partial selection, it may be false positives if a 52 // node is selected, but not the container way. So, in this 53 // case, we must visit all ways, selected or not. 54 if (partialSelection) { 55 for (OsmPrimitive p : selection) { 56 if (p.isUsable() && p instanceof Node) { 57 p.visit(this); 58 } 59 } 60 for (Way w : Main.main.getCurrentDataSet().getWays()) { 61 visit(w); 62 } 63 } else { 64 for (OsmPrimitive p : selection) { 65 if (p.isUsable()) { 66 p.visit(this); 67 } 50 for (OsmPrimitive p : selection) { 51 if (p.isUsable() && p instanceof Node) { 52 p.visit(this); 68 53 } 69 54 } … … 73 58 public void visit(Node n) 74 59 { 75 if(n.isUsable() && !n.isTagged() )60 if(n.isUsable() && !n.isTagged() && n.getReferrers().isEmpty()) 76 61 emptyNodes.add(n); 77 }78 79 @Override80 public void visit(Way w)81 {82 for (Node n : w.getNodes()) {83 emptyNodes.remove(n);84 }85 62 } 86 63
Note:
See TracChangeset
for help on using the changeset viewer.