Changeset 18961 in josm for trunk/src


Ignore:
Timestamp:
2024-01-30T10:28:35+01:00 (10 months ago)
Author:
GerdP
Message:

see #23397: Improve the results of partial validations

  • correct last minute change so that it doesn't use empty collection to filter irrelevant warnings
  • correct usage of isPrimitiveUsable() so that CrossingWays.Boundaries works again (old unit test failed)
  • add unit tests to check partial validation of DuplicateWay and CrossingWays gives expected results
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java

    r18960 r18961  
    317317            DataSet ds = OsmDataManager.getInstance().getActiveDataSet();
    318318            if (ds != null) {
    319                 for (Way w: waysToTest) {
    320                     selection.addAll(ds.searchWays(w.getBBox()));
     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                    }
    321332                }
    322333            }
    323334        }
    324335        for (Way w : selection) {
    325             if (!w.isDeleted() && isPrimitiveUsable(w)) {
    326                 testWay(w);
    327             }
     336            testWay(w);
    328337        }
    329338        // free storage
    330339        cellSegments.clear();
    331340        seenWays.clear();
    332         waysToTest.clear();
    333341        if (partialSelection)
    334342            removeIrrelevantErrors(waysToTest);
     343        waysToTest.clear();
    335344        super.endTest();
    336345    }
Note: See TracChangeset for help on using the changeset viewer.