Changeset 8693 in osm for applications/editors/josm/plugins
- Timestamp:
- 2008-07-03T18:04:00+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
r8043 r8693 52 52 for (List<WaySegment> duplicated : nodePairs.values()) 53 53 { 54 int highway = 0; 55 int railway = 0; 54 int ways = duplicated.size(); 56 55 57 if ( duplicated.size()> 1)56 if (ways > 1) 58 57 { 59 58 List<OsmPrimitive> prims = new ArrayList<OsmPrimitive>(); 60 59 List<Way> current_ways = new ArrayList<Way>(); 61 60 List<WaySegment> highlight; 61 int highway = 0; 62 int railway = 0; 63 int area = 0; 62 64 63 65 for (WaySegment ws : duplicated) 64 66 { 67 String ar; 68 65 69 if (ws.way.get("highway") != null) 66 70 highway++; 67 71 else if (ws.way.get("railway") != null) 68 72 railway++; 73 ar = ws.way.get("area"); 74 if (ar != null && ("true".equalsIgnoreCase(ar) || "yes".equalsIgnoreCase(ar) || "1".equals(ar))) 75 area++; 76 if (ws.way.get("landuse") != null) 77 { 78 area++; ways--; 79 } 69 80 70 81 prims.add(ws.way); 71 82 current_ways.add(ws.way); 72 83 } 73 /* These ways not seen before 84 /* These ways not seen before 74 85 * If two or more of the overlapping ways are 75 * highways or railways mark a seperate error 86 * highways or railways mark a seperate error 76 87 */ 77 88 if ((highlight = ways_seen.get(current_ways)) == null) 78 89 { 79 String errortype = tr("Overlapping ways");90 String errortype; 80 91 81 if (highway >1) 82 errortype = tr("Overlapping highways"); 83 else if (railway >1) 84 errortype = tr("Overlapping railways"); 92 if(area > 0) 93 { 94 if (highway == ways) 95 errortype = tr("Overlapping highways (with area)"); 96 else if (railway == ways) 97 errortype = tr("Overlapping railways (with area)"); 98 else 99 errortype = tr("Overlapping ways (with area)"); 100 } 101 else if (highway == ways) 102 errortype = tr("Overlapping highways"); 103 else if (railway == ways) 104 errortype = tr("Overlapping railways"); 105 else 106 errortype = tr("Overlapping ways"); 85 107 86 errors.add(new TestError(this, Severity.OTHER, 87 tr(errortype), prims, duplicated)); 88 ways_seen.put(current_ways, duplicated); 108 errors.add(new TestError(this, Severity.OTHER, tr(errortype), prims, duplicated)); 109 ways_seen.put(current_ways, duplicated); 89 110 } 90 111 else /* way seen, mark highlight layer only */ 91 112 { 92 for (WaySegment ws : duplicated) 93 113 for (WaySegment ws : duplicated) 114 highlight.add(ws); 94 115 } 95 116 }
Note:
See TracChangeset
for help on using the changeset viewer.