Changeset 16761 in josm
- Timestamp:
- 2020-07-14T11:41:24+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java
r16630 r16761 562 562 563 563 /** 564 * Determine multipolygon ways which are intersecting (crossing without a common node) .564 * Determine multipolygon ways which are intersecting (crossing without a common node) or sharing one or more way segments. 565 565 * This should only be used for relations with incomplete members. 566 566 * See also {@link CrossingWays} … … 568 568 */ 569 569 private void findIntersectingWaysIncomplete(Relation r) { 570 for (Entry<List<Way>, List<WaySegment>> entry : findIntersectingWays(r, false).entrySet()) { 571 List<Way> ways = entry.getKey(); 572 if (ways.size() != 2) 573 continue; 574 575 errors.add(TestError.builder(this, Severity.ERROR, CROSSING_WAYS) 576 .message(tr("Intersection between multipolygon ways")) 577 .primitives(Arrays.asList(r, ways.get(0), ways.get(1))) 578 .highlightWaySegments(entry.getValue()) 579 .build()); 570 Set<OsmPrimitive> outerWays = r.getMembers().stream() 571 .filter(m -> m.getRole().isEmpty() || "outer".equals(m.getRole())) 572 .map(RelationMember::getMember) 573 .collect(Collectors.toSet()); 574 for (int loop = 0; loop < 2; loop++) { 575 for (Entry<List<Way>, List<WaySegment>> entry : findIntersectingWays(r, loop == 1).entrySet()) { 576 List<Way> ways = entry.getKey(); 577 if (ways.size() != 2) 578 continue; 579 if (loop == 0) { 580 errors.add(TestError.builder(this, Severity.ERROR, CROSSING_WAYS) 581 .message(tr("Intersection between multipolygon ways")) 582 .primitives(Arrays.asList(r, ways.get(0), ways.get(1))) 583 .highlightWaySegments(entry.getValue()) 584 .build()); 585 } else if (outerWays.contains(ways.get(0)) || outerWays.contains(ways.get(1))) { 586 errors.add(TestError.builder(this, Severity.ERROR, CROSSING_WAYS) 587 .message(tr("Multipolygon outer way shares segment with other ring")) 588 .primitives(Arrays.asList(r, ways.get(0), ways.get(1))) 589 .highlightWaySegments(entry.getValue()).build()); 590 } 591 592 } 580 593 } 581 594 }
Note:
See TracChangeset
for help on using the changeset viewer.