Changeset 8043 in osm for applications/editors/josm/plugins
- Timestamp:
- 2008-06-02T11:27:13+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/OverlappingWays.java
r6302 r8043 3 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 4 5 import java.util.List; 6 import java.util.ArrayList; 5 import java.util.*; 7 6 8 7 import org.openstreetmap.josm.data.coor.LatLon; … … 48 47 public void endTest() 49 48 { 49 Map<List<Way>, List<WaySegment>> ways_seen = 50 new HashMap<List<Way>, List<WaySegment>>(500); 51 50 52 for (List<WaySegment> duplicated : nodePairs.values()) 51 53 { 54 int highway = 0; 55 int railway = 0; 56 52 57 if (duplicated.size() > 1) 53 58 { 54 59 List<OsmPrimitive> prims = new ArrayList<OsmPrimitive>(); 55 for (WaySegment ws : duplicated) prims.add(ws.way); 56 errors.add(new TestError(this, Severity.OTHER, 57 tr("Overlapping ways"), prims, duplicated)); 60 List<Way> current_ways = new ArrayList<Way>(); 61 List<WaySegment> highlight; 62 63 for (WaySegment ws : duplicated) 64 { 65 if (ws.way.get("highway") != null) 66 highway++; 67 else if (ws.way.get("railway") != null) 68 railway++; 69 70 prims.add(ws.way); 71 current_ways.add(ws.way); 72 } 73 /* These ways not seen before 74 * If two or more of the overlapping ways are 75 * highways or railways mark a seperate error 76 */ 77 if ((highlight = ways_seen.get(current_ways)) == null) 78 { 79 String errortype = tr("Overlapping ways"); 80 81 if (highway >1) 82 errortype = tr("Overlapping highways"); 83 else if (railway >1) 84 errortype = tr("Overlapping railways"); 85 86 errors.add(new TestError(this, Severity.OTHER, 87 tr(errortype), prims, duplicated)); 88 ways_seen.put(current_ways, duplicated); 89 } 90 else /* way seen, mark highlight layer only */ 91 { 92 for (WaySegment ws : duplicated) 93 highlight.add(ws); 94 } 58 95 } 59 96 }
Note:
See TracChangeset
for help on using the changeset viewer.