Changeset 4869 in josm for trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java
- Timestamp:
- 2012-01-24T21:52:43+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java
r4806 r4869 29 29 */ 30 30 public class CrossingWays extends Test { 31 protected static int CROSSING_WAYS = 601;31 protected static final int CROSSING_WAYS = 601; 32 32 33 33 /** All way segments, grouped by cells */ … … 43 43 public CrossingWays() { 44 44 super(tr("Crossing ways"), 45 tr("This test checks if two roads, railways, waterways or buildings crosses in the same layer, but are not connected by a node."));45 tr("This test checks if two roads, railways, waterways or buildings crosses in the same layer, but are not connected by a node.")); 46 46 } 47 47 … … 82 82 83 83 String layer1 = w.get("layer"); 84 if ("0".equals(layer1)) layer1 = null; //0 is default value 84 if ("0".equals(layer1)) { 85 layer1 = null; //0 is default value 86 } 85 87 86 88 int nodesSize = w.getNodesCount(); … … 94 96 List<WaySegment> highlight; 95 97 96 if (errorSegments.contains(ws) && errorSegments.contains(es2.ws)) 97 continue; 98 if (errorSegments.contains(ws) && errorSegments.contains(es2.ws)) { 99 continue; 100 } 98 101 99 102 String layer2 = es2.layer; 100 103 String railway2 = es2.railway; 101 104 boolean isCoastline2 = es2.coastline; 102 if (layer1 == null ? layer2 != null : !layer1.equals(layer2)) 103 continue; 104 105 if (!es1.intersects(es2) ) continue; 106 if (isSubway1 && "subway".equals(railway2)) continue; 107 if (isTram1 && "tram".equals(railway2)) continue; 108 109 if (isCoastline1 != isCoastline2) continue; 105 if (layer1 == null ? layer2 != null : !layer1.equals(layer2)) { 106 continue; 107 } 108 109 if (!es1.intersects(es2) ) { 110 continue; 111 } 112 if (isSubway1 && "subway".equals(railway2)) { 113 continue; 114 } 115 if (isTram1 && "tram".equals(railway2)) { 116 continue; 117 } 118 119 if (isCoastline1 != isCoastline2) { 120 continue; 121 } 110 122 if (("river".equals(waterway1) && "riverbank".equals(es2.waterway)) 111 || ("riverbank".equals(waterway1) && "river".equals(es2.waterway))) continue; 123 || ("riverbank".equals(waterway1) && "river".equals(es2.waterway))) { 124 continue; 125 } 112 126 113 127 if ((es1.railway != null && es1.railway.equals("abandoned")) 114 || (railway2 != null && railway2.equals("abandoned"))) continue; 128 || (railway2 != null && railway2.equals("abandoned"))) { 129 continue; 130 } 115 131 116 132 prims = Arrays.asList(es1.ws.way, es2.ws.way); … … 131 147 132 148 errors.add(new TestError(this, Severity.WARNING, 133 message,134 CROSSING_WAYS,135 prims,136 highlight));149 message, 150 CROSSING_WAYS, 151 prims, 152 highlight)); 137 153 ways_seen.put(prims, highlight); 138 154 } else { … … 147 163 148 164 /** 149 * Returns all the cells this segment crosses. Each cell contains the list150 * of segments already processed151 *152 * @param n1 The first node153 * @param n2 The second node154 * @return A list with all the cells the segment crosses155 */165 * Returns all the cells this segment crosses. Each cell contains the list 166 * of segments already processed 167 * 168 * @param n1 The first node 169 * @param n2 The second node 170 * @return A list with all the cells the segment crosses 171 */ 156 172 public List<List<ExtendedSegment>> getSegments(Node n1, Node n2) { 157 173 … … 218 234 219 235 return Line2D.linesIntersect( 220 n1.getEastNorth().east(), n1.getEastNorth().north(),221 n2.getEastNorth().east(), n2.getEastNorth().north(),222 s2.n1.getEastNorth().east(), s2.n1.getEastNorth().north(),223 s2.n2.getEastNorth().east(), s2.n2.getEastNorth().north());236 n1.getEastNorth().east(), n1.getEastNorth().north(), 237 n2.getEastNorth().east(), n2.getEastNorth().north(), 238 s2.n1.getEastNorth().east(), s2.n1.getEastNorth().north(), 239 s2.n2.getEastNorth().east(), s2.n2.getEastNorth().north()); 224 240 } 225 241 }
Note:
See TracChangeset
for help on using the changeset viewer.