- Timestamp:
- 2011-04-23T19:57:10+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java
r4034 r4058 43 43 44 44 Set<MyWaySegment> ways; 45 Set<Node> endnodes; // nodes at end of way46 Set<Node> endnodes_highway; // nodes at end of way47 Set<Node> middlenodes; // nodes in middle of way45 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 48 48 Set<Node> othernodes; // nodes appearing at least twice 49 49 //NodeSearchCache nodecache; … … 67 67 super.startTest(monitor); 68 68 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>(); 72 72 othernodes = new HashSet<Node>(); 73 73 mindist = Main.pref.getDouble(PREFIX + ".node_way_distance", 10.0); … … 94 94 last_print = now; 95 95 } 96 for (Node en : s.nearbyNodes(mindist)) { 96 Collection<Node> nearbyNodes = s.nearbyNodes(mindist); 97 for (Node en : nearbyNodes) { 97 98 if (en == null || !s.highway || !endnodes_highway.contains(en)) { 98 99 continue; … … 271 272 // area, but keep the old larger cache. 272 273 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) { 274 276 if (!nearby(n, dist)) { 275 277 trimmed.remove(n); … … 290 292 nearbyNodeCache = null; 291 293 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 293 297 if (found_nodes == null) 294 298 return Collections.emptySet(); … … 348 352 public void visit(Way w) { 349 353 ways.addAll(getWaySegments(w)); 350 Set<Node> set = endnodes;354 QuadBuckets<Node> set = endnodes; 351 355 if (w.hasKey("highway") || w.hasKey("railway")) { 352 356 set = endnodes_highway; … … 360 364 } 361 365 362 private void addNode(Node n, Set<Node> s) {366 private void addNode(Node n, QuadBuckets<Node> s) { 363 367 boolean m = middlenodes.contains(n); 364 368 boolean e = endnodes.contains(n);
Note:
See TracChangeset
for help on using the changeset viewer.