- Timestamp:
- 2020-12-10T17:38:18+01:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java
r17393 r17400 114 114 boolean ignoreWaySegmentCombination(Way w1, Way w2) { 115 115 if (w1 == w2) 116 return false;117 if (areLayerOrLevelDifferent(w1, w2)) {118 116 return true; 119 } 117 if (areLayerOrLevelDifferent(w1, w2)) 118 return true; 120 119 if (isBuilding(w1) && isBuilding(w2)) 121 return true; 122 if (w1.hasKey(HIGHWAY) && w2.hasKey(HIGHWAY) && !Objects.equals(w1.get("level"), w2.get("level"))) { 123 return true; 124 } 120 return true; // handled by mapcss tests 125 121 if (((isResidentialArea(w1) || w1.hasKey(BARRIER, HIGHWAY, RAILWAY, WATERWAY)) && isResidentialArea(w2)) 126 122 || ((isResidentialArea(w2) || w2.hasKey(BARRIER, HIGHWAY, RAILWAY, WATERWAY)) && isResidentialArea(w1))) 127 123 return true; 128 if (isSubwayOrTramOrRazed(w2)) { 129 return true; 130 } 124 if (isWaterArea(w1) && isWaterArea(w2)) 125 return true; // handled by mapcss tests 131 126 if (w1.hasKey(RAILWAY) && w2.hasKey(RAILWAY) && w1.hasTag(RAILWAY, "yard") != w2.hasTag(RAILWAY, "yard")) { 132 127 return true; // see #20089 133 128 } 134 if (isCoastline(w1) != isCoastline(w2)) { 135 return true; 136 } 137 if ((w1.hasTag(WATERWAY, "river", "stream", "canal", "drain", "ditch") && w2.hasTag(WATERWAY, "riverbank")) 138 || (w2.hasTag(WATERWAY, "river", "stream", "canal", "drain", "ditch") && w1.hasTag(WATERWAY, "riverbank"))) { 139 return true; 140 } 141 return isProposedOrAbandoned(w2); 129 return (w1.hasTag(WATERWAY, "river", "stream", "canal", "drain", "ditch") && w2.hasTag(WATERWAY, "riverbank")) 130 || (w2.hasTag(WATERWAY, "river", "stream", "canal", "drain", "ditch") && w1.hasTag(WATERWAY, "riverbank")); 142 131 } 143 132 … … 274 263 275 264 /** 276 * Self crossing ways test (for all the rest)265 * Self crossing ways test (for all ways) 277 266 */ 278 267 public static class SelfCrossing extends CrossingWays { 279 268 280 269 protected static final int CROSSING_SELF = 604; 281 282 CrossingWays.Ways normalTest = new Ways();283 CrossingWays.Boundaries boundariesTest = new Boundaries();284 270 285 271 /** … … 291 277 292 278 @Override 293 public boolean isPrimitiveUsable(OsmPrimitive p) {294 return super.isPrimitiveUsable(p) && !(normalTest.isPrimitiveUsable(p)295 || boundariesTest.isPrimitiveUsable(p));296 }297 298 @Override299 279 boolean ignoreWaySegmentCombination(Way w1, Way w2) { 300 return w1 != w2; //should nothappen280 return false; // we should not get here 301 281 } 302 282 } … … 332 312 } 333 313 314 static boolean isWaterArea(OsmPrimitive w) { 315 return w.hasTag("natural", "water") || w.hasTag(LANDUSE, "reservoir"); 316 } 317 334 318 static boolean isHighway(OsmPrimitive w) { 335 319 return w.hasTagDifferent(HIGHWAY, "rest_area", "services", "bus_stop", "platform"); … … 358 342 @Override 359 343 public void visit(Way w) { 360 if (this instanceof SelfCrossing) { 344 boolean findSelfCrossingOnly = this instanceof SelfCrossing; 345 if (findSelfCrossingOnly) { 361 346 // free memory, we are not interested in previous ways 362 347 cellSegments.clear(); … … 378 363 List<WaySegment> highlight; 379 364 380 if (!es1.intersects(es2) || ignoreWaySegmentCombination(es1.way, es2.way)) { 365 if (!es1.intersects(es2) 366 || (!findSelfCrossingOnly && ignoreWaySegmentCombination(es1.way, es2.way))) { 381 367 continue; 382 368 } … … 475 461 * @return {@code true} if one or more segments of the way are crossing 476 462 * @see SelfIntersectingWay 477 * @since xxx463 * @since 17393 478 464 */ 479 465 public static boolean isSelfCrossing(Way way) {
Note:
See TracChangeset
for help on using the changeset viewer.