Changeset 15183 in josm for trunk/src/org
- Timestamp:
- 2019-06-18T11:52:25+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java
r15160 r15183 81 81 /** set when used to build a multipolygon relation */ 82 82 private Relation createdRelation; 83 /** might be set when creating a relation and touching rings were found. */ 84 private boolean repeatCheck; 83 85 84 86 /** … … 250 252 // we found no intersection or crossing between the polygons and they are closed 251 253 // now we can calculate the nesting level to verify the roles with some simple node checks 252 checkRoles(r, allPolygons, wayMap, sharedNodes); 254 checkOrSetRoles(r, allPolygons, wayMap, sharedNodes); 253 255 } 254 256 } … … 461 463 * @param sharedNodes all nodes shared by multiple ways of this multipolygon 462 464 */ 463 private void checkRoles(Relation r, List<PolyData> allPolygons, Map<Long, RelationMember> wayMap, Set<Node> sharedNodes) { 465 private void checkOrSetRoles(Relation r, List<PolyData> allPolygons, Map<Long, RelationMember> wayMap, Set<Node> sharedNodes) { 464 466 PolygonLevelFinder levelFinder = new PolygonLevelFinder(sharedNodes); 465 467 List<PolygonLevel> list = levelFinder.findOuterWays(allPolygons); … … 577 579 } 578 580 } 579 if (loop == 0 || samePoly || (loop == 1 && !allInner)) { 581 if (r == createdRelation && loop == 1 && !allInner) { 582 repeatCheck = true; 583 } else if (loop == 0 || samePoly || (loop == 1 && !allInner)) { 580 584 String msg = loop == 0 ? tr("Intersection between multipolygon ways") 581 585 : samePoly ? tr("Multipolygon ring contains segments twice") … … 922 926 r.addMember(new RelationMember("", w)); 923 927 } 924 errors.clear(); 925 Multipolygon polygon = null; 926 boolean hasRepeatedMembers = checkRepeatedWayMembers(r); 927 if (!hasRepeatedMembers) { 928 polygon = new Multipolygon(r); 929 // don't check style consistency here 930 checkGeometryAndRoles(r, polygon); 931 } 932 createdRelation = null; 928 do { 929 repeatCheck = false; 930 errors.clear(); 931 Multipolygon polygon = null; 932 boolean hasRepeatedMembers = checkRepeatedWayMembers(r); 933 if (!hasRepeatedMembers) { 934 polygon = new Multipolygon(r); 935 // don't check style consistency here 936 checkGeometryAndRoles(r, polygon); 937 } 938 createdRelation = null; // makes sure that repeatCheck is only set once 939 } while (repeatCheck); 933 940 errors.removeIf(e->e.getSeverity() == Severity.OTHER); 934 941 return r;
Note:
See TracChangeset
for help on using the changeset viewer.