Ignore:
Timestamp:
2011-04-23T19:57:10+02:00 (13 years ago)
Author:
stoecker
Message:

see #6241 - patch by akks - improve long lasting validator check

File:
1 edited

Legend:

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

    r4034 r4058  
    4343
    4444    Set<MyWaySegment> ways;
    45     Set<Node> endnodes; // nodes at end of way
    46     Set<Node> endnodes_highway; // nodes at end of way
    47     Set<Node> middlenodes; // nodes in middle of way
     45    QuadBuckets<Node> endnodes; // nodes at end of way
     46    QuadBuckets<Node> endnodes_highway; // nodes at end of way
     47    QuadBuckets<Node> middlenodes; // nodes in middle of way
    4848    Set<Node> othernodes; // nodes appearing at least twice
    4949    //NodeSearchCache nodecache;
     
    6767        super.startTest(monitor);
    6868        ways = new HashSet<MyWaySegment>();
    69         endnodes = new HashSet<Node>();
    70         endnodes_highway = new HashSet<Node>();
    71         middlenodes = new HashSet<Node>();
     69        endnodes = new QuadBuckets<Node>();
     70        endnodes_highway = new QuadBuckets<Node>();
     71        middlenodes = new QuadBuckets<Node>();
    7272        othernodes = new HashSet<Node>();
    7373        mindist = Main.pref.getDouble(PREFIX + ".node_way_distance", 10.0);
     
    9494                    last_print = now;
    9595                }
    96                 for (Node en : s.nearbyNodes(mindist)) {
     96                Collection<Node> nearbyNodes = s.nearbyNodes(mindist);
     97                for (Node en : nearbyNodes) {
    9798                    if (en == null || !s.highway || !endnodes_highway.contains(en)) {
    9899                        continue;
     
    271272                    // area, but keep the old larger cache.
    272273                    Set<Node> trimmed = new HashSet<Node>(nearbyNodeCache);
    273                     for (Node n : new HashSet<Node>(nearbyNodeCache)) {
     274                    Set<Node> initial = new HashSet<Node>(nearbyNodeCache);
     275                    for (Node n : initial) {
    274276                        if (!nearby(n, dist)) {
    275277                            trimmed.remove(n);
     
    290292            nearbyNodeCache = null;
    291293            List<LatLon> bounds = this.getBounds(dist);
    292             List<Node> found_nodes = ds.searchNodes(new BBox(bounds.get(0), bounds.get(1)));
     294            List<Node> found_nodes = endnodes_highway.search(new BBox(bounds.get(0), bounds.get(1)));
     295            found_nodes.addAll(endnodes.search(new BBox(bounds.get(0), bounds.get(1))));
     296
    293297            if (found_nodes == null)
    294298                return Collections.emptySet();
     
    348352    public void visit(Way w) {
    349353        ways.addAll(getWaySegments(w));
    350         Set<Node> set = endnodes;
     354        QuadBuckets<Node> set = endnodes;
    351355        if (w.hasKey("highway") || w.hasKey("railway")) {
    352356            set = endnodes_highway;
     
    360364    }
    361365
    362     private void addNode(Node n, Set<Node> s) {
     366    private void addNode(Node n, QuadBuckets<Node> s) {
    363367        boolean m = middlenodes.contains(n);
    364368        boolean e = endnodes.contains(n);
Note: See TracChangeset for help on using the changeset viewer.