Changeset 5352 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2012-07-19T21:54:10+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/UntaggedWay.java
r5287 r5352 5 5 6 6 import java.util.HashSet; 7 import java.util.LinkedList;8 7 import java.util.Map; 9 8 import java.util.Set; … … 11 10 import org.openstreetmap.josm.Main; 12 11 import org.openstreetmap.josm.command.Command; 12 import org.openstreetmap.josm.data.osm.OsmPrimitive; 13 13 import org.openstreetmap.josm.data.osm.Relation; 14 14 import org.openstreetmap.josm.data.osm.RelationMember; … … 39 39 protected static final int COMMENTED_WAY = 306; 40 40 41 private LinkedList<Way> multipolygonways;41 private Set<Way> waysUsedInRelations; 42 42 43 43 /** Ways that must have a name */ … … 51 51 NAMED_WAYS.add( "residential" ); 52 52 NAMED_WAYS.add( "pedestrian" ); ; 53 } 54 55 /** Whitelist of roles allowed to reference an untagged way */ 56 public static final Set<String> WHITELIST = new HashSet<String>(); 57 static { 58 WHITELIST.add( "outer" ); 59 WHITELIST.add( "inner" ); 60 WHITELIST.add( "perimeter" ); 61 WHITELIST.add( "edge" ); 62 WHITELIST.add( "outline" ); 53 63 } 54 64 … … 93 103 } 94 104 95 if (!w.isTagged() && ! multipolygonways.contains(w)) {105 if (!w.isTagged() && !waysUsedInRelations.contains(w)) { 96 106 if (w.hasKeys()) { 97 107 errors.add(new TestError(this, Severity.WARNING, tr("Untagged ways (commented)"), COMMENTED_WAY, w)); … … 111 121 public void startTest(ProgressMonitor monitor) { 112 122 super.startTest(monitor); 113 multipolygonways = new LinkedList<Way>();123 waysUsedInRelations = new HashSet<Way>(); 114 124 for (Relation r : Main.main.getCurrentDataSet().getRelations()) { 115 if (r.isUsable() && r.isMultipolygon()) {125 if (r.isUsable()) { 116 126 for (RelationMember m : r.getMembers()) { 117 if (m.getMember() != null && m.getMember() instanceof Way && 118 m.getMember().isUsable() && !m.getMember().isTagged()) { 119 multipolygonways.add((Way)m.getMember()); 127 if (r.isMultipolygon() || WHITELIST.contains(m.getRole())) { 128 OsmPrimitive member = m.getMember(); 129 if (member != null && member instanceof Way && member.isUsable() && !member.isTagged()) { 130 waysUsedInRelations.add((Way)member); 131 } 120 132 } 121 133 } … … 126 138 @Override 127 139 public void endTest() { 128 multipolygonways = null;140 waysUsedInRelations = null; 129 141 super.endTest(); 130 142 }
Note:
See TracChangeset
for help on using the changeset viewer.