- Timestamp:
- 2024-01-30T10:53:13+01:00 (10 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java
r18961 r18962 310 310 @Override 311 311 public void endTest() { 312 final Collection<Way> selection; 313 if (this instanceof SelfCrossing || !partialSelection) { 314 selection = waysToTest; 315 } else { 316 selection = new HashSet<>(); 317 DataSet ds = OsmDataManager.getInstance().getActiveDataSet(); 318 if (ds != null) { 319 for (Way wt : waysToTest) { 320 selection.addAll(ds.searchWays(wt.getBBox()).stream() 321 .filter(w -> !w.isDeleted() && isPrimitiveUsable(w)).collect(Collectors.toList())); 322 if (this instanceof CrossingWays.Boundaries) { 323 List<Relation> relations = ds.searchRelations(wt.getBBox()).stream() 324 .filter(p -> isPrimitiveUsable(p)).collect(Collectors.toList()); 325 for (Relation r: relations) { 326 for (Way w : r.getMemberPrimitives(Way.class)) { 327 if (!w.isIncomplete()) 328 selection.add(w); 329 } 330 } 331 } 332 } 333 } 334 } 335 for (Way w : selection) { 336 testWay(w); 337 } 312 runTest(); 338 313 // free storage 339 314 cellSegments.clear(); … … 345 320 } 346 321 322 protected void runTest() { 323 final Collection<Way> selection; 324 if (this instanceof SelfCrossing || !partialSelection) { 325 selection = waysToTest; 326 } else { 327 selection = addNearbyObjects(); 328 } 329 for (Way w : selection) { 330 testWay(w); 331 } 332 333 } 334 335 private Collection<Way> addNearbyObjects() { 336 final Collection<Way> selection = new HashSet<>(); 337 DataSet ds = OsmDataManager.getInstance().getActiveDataSet(); 338 if (ds != null) { 339 for (Way wt : waysToTest) { 340 selection.addAll(ds.searchWays(wt.getBBox()).stream() 341 .filter(w -> !w.isDeleted() && isPrimitiveUsable(w)).collect(Collectors.toList())); 342 if (this instanceof CrossingWays.Boundaries) { 343 List<Relation> relations = ds.searchRelations(wt.getBBox()).stream() 344 .filter(p -> isPrimitiveUsable(p)).collect(Collectors.toList()); 345 for (Relation r: relations) { 346 for (Way w : r.getMemberPrimitives(Way.class)) { 347 if (!w.isIncomplete()) 348 selection.add(w); 349 } 350 } 351 } 352 } 353 } 354 return selection; 355 } 347 356 static boolean isCoastline(OsmPrimitive w) { 348 357 return w.hasTag("natural", "water", "coastline") || w.hasTag(LANDUSE, "reservoir"); … … 521 530 SelfCrossing test = new SelfCrossing(); 522 531 test.visit(way); 523 test. endTest();532 test.runTest(); 524 533 return !test.getErrors().isEmpty(); 525 534 }
Note:
See TracChangeset
for help on using the changeset viewer.